@simcups/swiss-tools 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pot-distributor.d.ts +13 -0
- package/dist/pot-distributor.d.ts.map +1 -0
- package/dist/pot-distributor.js +23 -0
- package/dist/pot-distributor.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class PotDistributor {
|
|
2
|
+
/**
|
|
3
|
+
* Chunks items into fixed-capacity pots, dumping any excess/remainder
|
|
4
|
+
* items into the last pot (e.g., EURO Qualifiers format).
|
|
5
|
+
*/
|
|
6
|
+
static fillLastPot<T>(list: T[], minSize: number): T[][];
|
|
7
|
+
/**
|
|
8
|
+
* This function takes an array of ranked teams and splits them into a specific number of groups (groups, or "pots"),
|
|
9
|
+
* distributing any remaining items as evenly as possible starting from the last groups.
|
|
10
|
+
*/
|
|
11
|
+
static balancePots<T>(list: T[], groups: number): T[][];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=pot-distributor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pot-distributor.d.ts","sourceRoot":"","sources":["../src/pot-distributor.ts"],"names":[],"mappings":"AAGA,qBAAa,cAAc;IAEzB;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE;IAUxD;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE;CAUxD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class PotDistributor {
|
|
2
|
+
/**
|
|
3
|
+
* Chunks items into fixed-capacity pots, dumping any excess/remainder
|
|
4
|
+
* items into the last pot (e.g., EURO Qualifiers format).
|
|
5
|
+
*/
|
|
6
|
+
static fillLastPot(list, minSize) {
|
|
7
|
+
const clonedList = structuredClone(list);
|
|
8
|
+
const remainder = clonedList.length % minSize;
|
|
9
|
+
const potCount = Math.floor(clonedList.length / minSize);
|
|
10
|
+
return Array.from({ length: potCount }, (_, i) => clonedList.splice(0, minSize + (i === potCount - 1 ? remainder : 0)));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* This function takes an array of ranked teams and splits them into a specific number of groups (groups, or "pots"),
|
|
14
|
+
* distributing any remaining items as evenly as possible starting from the last groups.
|
|
15
|
+
*/
|
|
16
|
+
static balancePots(list, groups) {
|
|
17
|
+
const clonedList = structuredClone(list);
|
|
18
|
+
const size = Math.floor(clonedList.length / groups);
|
|
19
|
+
const rest = clonedList.length % groups;
|
|
20
|
+
return Array.from({ length: groups }, (_, i) => clonedList.splice(0, size + (rest >= groups - i ? 1 : 0)));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=pot-distributor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pot-distributor.js","sourceRoot":"","sources":["../src/pot-distributor.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,cAAc;IAEzB;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAI,IAAS,EAAE,OAAe;QAC9C,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC;QAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;QAEzD,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC7C,UAAU,CA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