@simcups/swiss-tools 1.0.20 → 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 CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './array-utils.js';
2
- export * from './chunk-pots.js';
2
+ export * from './pot-distributor.js';
3
3
  export * from './delay.js';
4
4
  export * from './errors.js';
5
5
  export * from './format-signed-number.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,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"}
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
@@ -1,5 +1,5 @@
1
1
  export * from './array-utils.js';
2
- export * from './chunk-pots.js';
2
+ export * from './pot-distributor.js';
3
3
  export * from './delay.js';
4
4
  export * from './errors.js';
5
5
  export * from './format-signed-number.js';
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,iBAAiB,CAAC;AAChC,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"}
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"}
package/dist/number.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export declare const isNumber: (value: unknown) => value is number;
2
2
  export declare function convertNumberToLetter(index: number): string;
3
+ export declare function roundUpToNearestInterval(minutes: number, roundTo?: number): number;
3
4
  //# sourceMappingURL=number.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../src/number.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAElD,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,UAElD"}
1
+ {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../src/number.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAElD,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,UAElD;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAK,GAAG,MAAM,CAE9E"}
package/dist/number.js CHANGED
@@ -4,7 +4,7 @@ export const isNumber = (value) => {
4
4
  export function convertNumberToLetter(index) {
5
5
  return String.fromCharCode(index + "A".charCodeAt(0)).toUpperCase();
6
6
  }
7
- function roundUpToNearestInterval(minutes, roundTo = 15) {
7
+ export function roundUpToNearestInterval(minutes, roundTo = 15) {
8
8
  return Math.ceil(minutes / roundTo) * roundTo;
9
9
  }
10
10
  //# sourceMappingURL=number.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"number.js","sourceRoot":"","sources":["../src/number.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAmB,EAAE;IACxD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,KAAa;IAC/C,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AACxE,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAe,EAAE,OAAO,GAAG,EAAE;IAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"number.js","sourceRoot":"","sources":["../src/number.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAmB,EAAE;IACxD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,KAAa;IAC/C,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAe,EAAE,OAAO,GAAG,EAAE;IAClE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC;AAClD,CAAC"}
@@ -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,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,KAAK,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACvE,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAI,IAAS,EAAE,MAAc;QAC7C,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC;QACxC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC3C,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC5D,CAAC;IACJ,CAAC;CAGF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simcups/swiss-tools",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "Slim utility.",
5
5
  "type": "module",
6
6
  "sideEffects": false,