@simcups/chance-utils 1.0.54 → 1.0.55

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/clamp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare function clamp(value: number, min: number, max: number): number;
2
2
  export declare function clampLikelihood(likelihood: number): number;
3
- export declare function clampAttribute(attribute: number, min?: number, max?: number): number;
3
+ export declare function clampAndRound(attribute: number, min?: number, max?: number): number;
4
4
  //# sourceMappingURL=clamp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../src/clamp.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,UAEjD;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,SAAI,EAAE,GAAG,SAAM,UAEnE"}
1
+ {"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../src/clamp.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,UAEjD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,SAAI,EAAE,GAAG,SAAM,UAElE"}
package/dist/clamp.js CHANGED
@@ -4,7 +4,7 @@ export function clamp(value, min, max) {
4
4
  export function clampLikelihood(likelihood) {
5
5
  return clamp(Math.round(likelihood), 0, 100);
6
6
  }
7
- export function clampAttribute(attribute, min = 1, max = 100) {
7
+ export function clampAndRound(attribute, min = 1, max = 100) {
8
8
  return clamp(Math.round(attribute), min, max);
9
9
  }
10
10
  //# sourceMappingURL=clamp.js.map
package/dist/clamp.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"clamp.js","sourceRoot":"","sources":["../src/clamp.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IACzD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAkB;IAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,SAAiB,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG;IAChE,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"clamp.js","sourceRoot":"","sources":["../src/clamp.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IACzD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAkB;IAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,SAAiB,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG;IAC/D,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * - weightedSample(items, weights) in 80% of cases will return 'apple', in 20% of cases will return
7
7
  * 'orange' and it may return banana too even though the weight is 0
8
8
  *
9
- * Item with a -1 weight will nbe ignored.
9
+ * None of the weight functions supports negative numbers.
10
10
  * @param items
11
11
  * @param weights
12
12
  */
@@ -6,7 +6,7 @@
6
6
  * - weightedSample(items, weights) in 80% of cases will return 'apple', in 20% of cases will return
7
7
  * 'orange' and it may return banana too even though the weight is 0
8
8
  *
9
- * Item with a -1 weight will nbe ignored.
9
+ * None of the weight functions supports negative numbers.
10
10
  * @param items
11
11
  * @param weights
12
12
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simcups/chance-utils",
3
- "version": "1.0.54",
3
+ "version": "1.0.55",
4
4
  "description": "Slim utility for weighted sampling, chance logic, and math clamping.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",