random-weighted-pick 1.0.12 → 2.0.1

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.
Files changed (43) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/.eslintrc.json +7 -0
  3. package/.local-tests/esm-smoke/package-lock.json +25 -0
  4. package/.local-tests/esm-smoke/package.json +16 -0
  5. package/.local-tests/esm-smoke/test.mjs +52 -0
  6. package/.local-tests/npm-smoke/package-lock.json +25 -0
  7. package/.local-tests/npm-smoke/package.json +15 -0
  8. package/.local-tests/npm-smoke/test.js +61 -0
  9. package/.prettierrc +4 -0
  10. package/CONTRIBUTING.md +9 -0
  11. package/README.md +144 -45
  12. package/dist/cjs/index.js +45 -0
  13. package/dist/cjs/package.json +1 -0
  14. package/dist/cjs/weightList.js +166 -0
  15. package/dist/esm/index.d.ts +4 -0
  16. package/dist/esm/index.js +7 -0
  17. package/dist/esm/weightList.d.ts +36 -0
  18. package/dist/esm/weightList.js +161 -0
  19. package/jest.config.cjs +5 -0
  20. package/package.json +22 -32
  21. package/random-weighted-pick-2.0.0.tgz +0 -0
  22. package/random-weighted-pick-2.0.1.tgz +0 -0
  23. package/tsconfig.cjs.json +8 -0
  24. package/tsconfig.esm.json +9 -0
  25. package/tsconfig.json +20 -0
  26. package/.eslintrc +0 -27
  27. package/coverage/clover.xml +0 -54
  28. package/coverage/coverage-final.json +0 -3
  29. package/coverage/lcov-report/base.css +0 -212
  30. package/coverage/lcov-report/index.html +0 -106
  31. package/coverage/lcov-report/prettify.css +0 -1
  32. package/coverage/lcov-report/prettify.js +0 -1
  33. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  34. package/coverage/lcov-report/sorter.js +0 -158
  35. package/coverage/lcov-report/src/index.html +0 -93
  36. package/coverage/lcov-report/src/utils/index.html +0 -93
  37. package/coverage/lcov-report/src/utils/tests.utils.js.html +0 -128
  38. package/coverage/lcov-report/src/weightList.js.html +0 -194
  39. package/coverage/lcov.info +0 -106
  40. package/dist/index.js +0 -1
  41. package/scripts/emptyFolder.js +0 -18
  42. package/webpack.config.js +0 -46
  43. package/webpack.prod.config.js +0 -31
@@ -0,0 +1,4 @@
1
+ import weightedPick, { pickMany, createWeightedPicker, RNG, PickConfig, Method, WeightedInput, WeightedResult } from './weightList.js';
2
+ export type { RNG, PickConfig, Method, WeightedInput, WeightedResult };
3
+ export { weightedPick, pickMany, createWeightedPicker };
4
+ export default weightedPick;
@@ -0,0 +1,7 @@
1
+ import weightedPick, { pickMany, createWeightedPicker, } from './weightList.js';
2
+ export { weightedPick, pickMany, createWeightedPicker };
3
+ export default weightedPick;
4
+ if (typeof module !== 'undefined' && module?.exports) {
5
+ module.exports = Object.assign(weightedPick, { weightedPick, pickMany, createWeightedPicker });
6
+ module.exports.default = weightedPick;
7
+ }
@@ -0,0 +1,36 @@
1
+ /** RNG function returning a float x where 0 <= x < 1 */
2
+ export type RNG = () => number;
3
+ /** Configuration shared by all pickers */
4
+ export interface PickConfig {
5
+ /** Normalize weights so that they sum 1. Defaults to `true` */
6
+ normalize?: boolean;
7
+ /** Tolerance when checking weight sums. Defaults to `1e-12` */
8
+ epsilon?: number;
9
+ /** Random number generator. Defaults to crypto or `Math.random` */
10
+ rng?: RNG;
11
+ }
12
+ export interface WeightedInput<T> {
13
+ id?: number;
14
+ weight: number;
15
+ item: T;
16
+ }
17
+ export interface WeightedResult<T> {
18
+ id: number;
19
+ item: T;
20
+ }
21
+ /** Pick a single item based on its weight */
22
+ export declare function weightedPick<T>(options: ReadonlyArray<WeightedInput<T>>, cfg?: PickConfig): WeightedResult<T>;
23
+ /** Pick `k` items. When `replacement` is false sampling is without replacement */
24
+ export declare function pickMany<T>(options: ReadonlyArray<WeightedInput<T>>, k: number, cfg?: PickConfig & {
25
+ replacement?: boolean;
26
+ }): Array<WeightedResult<T>>;
27
+ export type Method = 'cdf' | 'alias';
28
+ /** Create a weighted picker for many fast selections */
29
+ export declare function createWeightedPicker<T>(options: ReadonlyArray<WeightedInput<T>>, cfg?: PickConfig & {
30
+ method?: Method;
31
+ }): {
32
+ pick: () => WeightedResult<T>;
33
+ pickMany: (k: number) => WeightedResult<T>[];
34
+ updateWeight: (id: number, weight: number) => void;
35
+ };
36
+ export default weightedPick;
@@ -0,0 +1,161 @@
1
+ const throwTypeError = (msg) => {
2
+ throw new TypeError(msg);
3
+ };
4
+ const defaultRNG = () => {
5
+ if (typeof globalThis !== 'undefined' && globalThis.crypto?.getRandomValues) {
6
+ const arr = new Uint32Array(1);
7
+ globalThis.crypto.getRandomValues(arr);
8
+ return arr[0] / 0x100000000;
9
+ }
10
+ return Math.random();
11
+ };
12
+ const validateOptions = (options) => {
13
+ if (!Array.isArray(options)) {
14
+ return throwTypeError('Weighted List expect Array of Objects as argument');
15
+ }
16
+ return options.map((opt, i) => {
17
+ if (!('weight' in opt))
18
+ throwTypeError('Every list item should have [weight] property');
19
+ if (!('item' in opt))
20
+ throwTypeError('Every list item should have [item] property');
21
+ const w = opt.weight;
22
+ if (typeof w !== 'number' || Number.isNaN(w) || !Number.isFinite(w) || w < 0) {
23
+ throwTypeError('Weights should be finite numbers >= 0');
24
+ }
25
+ return { id: opt.id ?? i, item: opt.item, weight: w };
26
+ });
27
+ };
28
+ const normalize = (weights, { normalize, epsilon }) => {
29
+ const total = weights.reduce((a, b) => a + b, 0);
30
+ if (normalize) {
31
+ if (total <= epsilon)
32
+ throwTypeError("Sum of 'weights' should be greater than 0");
33
+ return weights.map((w) => w / total);
34
+ }
35
+ if (Math.abs(total - 1) > epsilon)
36
+ throwTypeError("Sum of 'weights' should be equal 1");
37
+ return weights;
38
+ };
39
+ /** Pick a single item based on its weight */
40
+ export function weightedPick(options, cfg = {}) {
41
+ const config = { normalize: true, epsilon: 1e-12, rng: defaultRNG, ...cfg };
42
+ const opts = validateOptions(options);
43
+ const weights = opts.map(o => o.weight);
44
+ const normalized = normalize(weights, config);
45
+ const num = config.rng();
46
+ if (typeof num !== 'number' || Number.isNaN(num) || num < 0 || num >= 1) {
47
+ throwTypeError('RNG should return a number x where 0 <= x < 1');
48
+ }
49
+ let acc = 0;
50
+ for (let i = 0; i < normalized.length; i++) {
51
+ acc += normalized[i];
52
+ if (num < acc) {
53
+ return { id: opts[i].id, item: opts[i].item };
54
+ }
55
+ }
56
+ return { id: opts[opts.length - 1].id, item: opts[opts.length - 1].item };
57
+ }
58
+ /** Pick `k` items. When `replacement` is false sampling is without replacement */
59
+ export function pickMany(options, k, cfg = {}) {
60
+ const { replacement = true, ...rest } = cfg;
61
+ if (replacement) {
62
+ return Array.from({ length: k }, () => weightedPick(options, rest));
63
+ }
64
+ const config = { normalize: true, epsilon: 1e-12, rng: defaultRNG, ...rest };
65
+ const opts = validateOptions(options);
66
+ const res = [];
67
+ opts.forEach((o) => {
68
+ const r = config.rng();
69
+ if (typeof r !== 'number' || Number.isNaN(r) || r <= 0 || r >= 1) {
70
+ throwTypeError('RNG should return a number x where 0 < x < 1');
71
+ }
72
+ if (o.weight > 0) {
73
+ const key = Math.pow(r, 1 / o.weight);
74
+ res.push({ key, option: o });
75
+ }
76
+ });
77
+ res.sort((a, b) => b.key - a.key);
78
+ return res.slice(0, k).map(r => ({ id: r.option.id, item: r.option.item }));
79
+ }
80
+ /** Create a weighted picker for many fast selections */
81
+ export function createWeightedPicker(options, cfg = {}) {
82
+ const { method = 'alias', ...rest } = cfg;
83
+ const config = { normalize: true, epsilon: 1e-12, rng: defaultRNG, ...rest };
84
+ let opts = validateOptions(options);
85
+ let probs = [];
86
+ let alias = [];
87
+ let cdf = [];
88
+ const build = () => {
89
+ const weights = opts.map(o => o.weight);
90
+ const normalized = normalize(weights, config);
91
+ if (method === 'alias') {
92
+ const n = normalized.length;
93
+ const scaled = normalized.map(w => w * n);
94
+ const small = [];
95
+ const large = [];
96
+ probs = new Array(n).fill(0);
97
+ alias = new Array(n).fill(0);
98
+ scaled.forEach((w, i) => (w < 1 ? small : large).push(i));
99
+ while (small.length && large.length) {
100
+ const l = small.pop();
101
+ const g = large.pop();
102
+ probs[l] = scaled[l];
103
+ alias[l] = g;
104
+ scaled[g] = scaled[g] + scaled[l] - 1;
105
+ if (scaled[g] < 1)
106
+ small.push(g);
107
+ else
108
+ large.push(g);
109
+ }
110
+ ;
111
+ [...large, ...small].forEach(i => (probs[i] = 1));
112
+ }
113
+ else {
114
+ cdf = [];
115
+ let sum = 0;
116
+ normalized.forEach((w) => {
117
+ sum += w;
118
+ cdf.push(sum);
119
+ });
120
+ }
121
+ };
122
+ build();
123
+ const pick = () => {
124
+ if (method === 'alias') {
125
+ const n = opts.length;
126
+ const i = Math.floor(config.rng() * n);
127
+ const r = config.rng();
128
+ const idx = r < probs[i] ? i : alias[i];
129
+ return { id: opts[idx].id, item: opts[idx].item };
130
+ }
131
+ const r = config.rng();
132
+ if (typeof r !== 'number' || Number.isNaN(r) || r < 0 || r >= 1) {
133
+ throwTypeError('RNG should return a number x where 0 <= x < 1');
134
+ }
135
+ let low = 0;
136
+ let high = cdf.length - 1;
137
+ while (low < high) {
138
+ const mid = Math.floor((low + high) / 2);
139
+ if (r < cdf[mid])
140
+ high = mid;
141
+ else
142
+ low = mid + 1;
143
+ }
144
+ return { id: opts[low].id, item: opts[low].item };
145
+ };
146
+ return {
147
+ pick,
148
+ pickMany: (k) => Array.from({ length: k }, () => pick()),
149
+ updateWeight: (id, weight) => {
150
+ const idx = opts.findIndex(o => o.id === id);
151
+ if (idx === -1)
152
+ throwTypeError('ID not found');
153
+ if (typeof weight !== 'number' || Number.isNaN(weight) || !Number.isFinite(weight) || weight < 0) {
154
+ throwTypeError('Weights should be finite numbers >= 0');
155
+ }
156
+ opts[idx].weight = weight;
157
+ build();
158
+ },
159
+ };
160
+ }
161
+ export default weightedPick;
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ preset: 'ts-jest',
3
+ testEnvironment: 'node',
4
+ testMatch: ['**/*.test.ts']
5
+ }
package/package.json CHANGED
@@ -1,46 +1,36 @@
1
1
  {
2
2
  "name": "random-weighted-pick",
3
- "version": "1.0.12",
4
- "main": "dist/index.js",
3
+ "version": "2.0.1",
4
+ "type": "module",
5
+ "main": "dist/cjs/index.js",
6
+ "types": "dist/esm/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/esm/index.d.ts",
10
+ "import": "./dist/esm/index.js",
11
+ "require": "./dist/cjs/index.js"
12
+ }
13
+ },
5
14
  "engines": {
6
- "node": ">=8.9.3"
15
+ "node": ">=16"
7
16
  },
8
17
  "scripts": {
9
- "build": "babel-node ./scripts/emptyFolder && webpack --config ./webpack.prod.config.js",
10
- "dev": "webpack-dashboard -- webpack-dev-server --content-base src/index --hot --host 0.0.0.0 --config ./webpack.config.js",
11
- "watch": "webpack-dashboard -- webpack --progress --colors --watch --config ./webpack.config.js",
18
+ "build": "tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
12
19
  "test": "jest",
13
20
  "coverage": "npm test -- --coverage"
14
21
  },
15
22
  "license": "MIT",
16
23
  "devDependencies": {
17
- "babel-cli": "^6.14.0",
18
- "babel-core": "^6.26.0",
19
- "babel-jest": "^22.2.2",
20
- "babel-loader": "^6.2.5",
21
- "babel-plugin-add-module-exports": "^0.2.1",
22
- "babel-polyfill": "^6.13.0",
23
- "babel-preset-env": "^1.6.1",
24
- "babel-preset-es2015": "^6.14.0",
25
- "chai": "^4.1.2",
26
- "eslint": "^3.6.0",
27
- "eslint-config-airbnb": "^11.2.0",
28
- "eslint-plugin-import": "^1.16.0",
29
- "eslint-plugin-jsx-a11y": "^2.2.2",
30
- "eslint-plugin-react": "^6.3.0",
31
- "fs-extra": "^0.30.0",
32
- "jest": "^22.3.0",
33
- "regenerator-runtime": "^0.11.1",
34
- "webpack": "^1.13.2",
35
- "webpack-bundle-analyzer": "^2.10.0",
36
- "webpack-dashboard": "^1.1.1",
37
- "webpack-dev-server": "^1.16.1",
38
- "webpack-node-externals": "^1.6.0"
39
- },
40
- "directories": {
41
- "test": "test"
24
+ "@types/jest": "^29.5.14",
25
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
26
+ "@typescript-eslint/parser": "^7.18.0",
27
+ "eslint": "^8.56.0",
28
+ "jest": "^29.7.0",
29
+ "prettier": "^3.3.3",
30
+ "ts-jest": "^29.4.1",
31
+ "typescript": "^5.9.2",
32
+ "undici-types": "^7.16.0"
42
33
  },
43
- "dependencies": {},
44
34
  "repository": {
45
35
  "type": "git",
46
36
  "url": "git+https://github.com/phellipeandrade/random-weighted-pick.git"
Binary file
Binary file
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "CommonJS",
5
+ "outDir": "dist/cjs",
6
+ "declaration": false
7
+ }
8
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "dist/esm",
7
+ "declaration": true
8
+ }
9
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "commonjs",
5
+ "declaration": true,
6
+ "outDir": "./dist",
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "types": ["node"],
11
+ "moduleResolution": "node"
12
+ },
13
+ "include": ["src/**/*"],
14
+ "exclude": [
15
+ "node_modules",
16
+ "dist",
17
+ "**/*.test.ts",
18
+ "src/utils/tests.utils.ts"
19
+ ]
20
+ }
package/.eslintrc DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "extends": "eslint-config-airbnb",
3
- "parserOptions": {
4
- "ecmaFeatures": {
5
- "experimentalObjectRestSpread": true
6
- }
7
- },
8
- "globals": {
9
- "document": true
10
- },
11
- "env":{
12
- "jest": true
13
- },
14
- "rules": {
15
- "func-names": "off",
16
- "no-param-reassign": "off",
17
- "arrow-body-style": "off",
18
- "max-len": "off",
19
- "new-cap": "off",
20
- "global-require": "off",
21
- "no-underscore-dangle": "off",
22
- "import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
23
- "no-trailing-spaces": 0,
24
- "padded-blocks": 0,
25
- "no-plusplus": 0
26
- }
27
- }
@@ -1,54 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1519039562480" clover="3.2.0">
3
- <project timestamp="1519039562480" name="All files">
4
- <metrics statements="35" coveredstatements="35" conditionals="13" coveredconditionals="13" methods="20" coveredmethods="19" elements="68" coveredelements="67" complexity="0" loc="35" ncloc="35" packages="2" files="2" classes="2">
5
- <package name="src">
6
- <metrics statements="24" coveredstatements="24" conditionals="6" coveredconditionals="6" methods="12" coveredmethods="12"/>
7
- <file name="weightList.js" path="/home/phellipe/Documents/GIT/personal/probabilities/src/weightList.js">
8
- <metrics statements="24" coveredstatements="24" conditionals="6" coveredconditionals="6" methods="12" coveredmethods="12"/>
9
- <line num="1" count="2140978" type="stmt"/>
10
- <line num="3" count="3700401" type="stmt"/>
11
- <line num="5" count="1" type="stmt"/>
12
- <line num="6" count="7400805" type="stmt"/>
13
- <line num="8" count="2" type="stmt"/>
14
- <line num="10" count="500203" type="stmt"/>
15
- <line num="11" count="1000405" type="cond" truecount="2" falsecount="0"/>
16
- <line num="12" count="2" type="stmt"/>
17
- <line num="14" count="1000403" type="stmt"/>
18
- <line num="17" count="2" type="stmt"/>
19
- <line num="19" count="1" type="stmt"/>
20
- <line num="21" count="500204" type="cond" truecount="2" falsecount="0"/>
21
- <line num="22" count="1" type="stmt"/>
22
- <line num="25" count="500203" type="stmt"/>
23
- <line num="27" count="500201" type="stmt"/>
24
- <line num="28" count="3700401" type="stmt"/>
25
- <line num="29" count="500201" type="stmt"/>
26
- <line num="30" count="500201" type="stmt"/>
27
- <line num="33" count="500201" type="cond" truecount="2" falsecount="0"/>
28
- <line num="35" count="500200" type="stmt"/>
29
- <line num="36" count="2140978" type="stmt"/>
30
- <line num="37" count="2140978" type="stmt"/>
31
- <line num="38" count="2140978" type="stmt"/>
32
- <line num="40" count="500200" type="stmt"/>
33
- </file>
34
- </package>
35
- <package name="src.utils">
36
- <metrics statements="11" coveredstatements="11" conditionals="7" coveredconditionals="7" methods="8" coveredmethods="7"/>
37
- <file name="tests.utils.js" path="/home/phellipe/Documents/GIT/personal/probabilities/src/utils/tests.utils.js">
38
- <metrics statements="11" coveredstatements="11" conditionals="7" coveredconditionals="7" methods="8" coveredmethods="7"/>
39
- <line num="3" count="1" type="stmt"/>
40
- <line num="5" count="6" type="cond" truecount="2" falsecount="0"/>
41
- <line num="7" count="1" type="stmt"/>
42
- <line num="9" count="5" type="stmt"/>
43
- <line num="10" count="500000" type="cond" truecount="2" falsecount="0"/>
44
- <line num="11" count="500000" type="stmt"/>
45
- <line num="14" count="5" type="cond" truecount="2" falsecount="0"/>
46
- <line num="16" count="1" type="stmt"/>
47
- <line num="18" count="1" type="cond" truecount="1" falsecount="0"/>
48
- <line num="19" count="5" type="stmt"/>
49
- <line num="21" count="500000" type="stmt"/>
50
- </file>
51
- </package>
52
- </metrics>
53
- </project>
54
- </coverage>
@@ -1,3 +0,0 @@
1
- {"/home/phellipe/Documents/GIT/personal/probabilities/src/weightList.js": {"path":"/home/phellipe/Documents/GIT/personal/probabilities/src/weightList.js","statementMap":{"0":{"start":{"line":1,"column":21},"end":{"line":1,"column":71}},"1":{"start":{"line":1,"column":34},"end":{"line":1,"column":70}},"2":{"start":{"line":3,"column":16},"end":{"line":3,"column":56}},"3":{"start":{"line":3,"column":31},"end":{"line":3,"column":56}},"4":{"start":{"line":3,"column":46},"end":{"line":3,"column":55}},"5":{"start":{"line":5,"column":22},"end":{"line":6,"column":69}},"6":{"start":{"line":6,"column":2},"end":{"line":6,"column":69}},"7":{"start":{"line":6,"column":20},"end":{"line":6,"column":68}},"8":{"start":{"line":8,"column":21},"end":{"line":8,"column":77}},"9":{"start":{"line":8,"column":29},"end":{"line":8,"column":77}},"10":{"start":{"line":10,"column":24},"end":{"line":15,"column":2}},"11":{"start":{"line":10,"column":44},"end":{"line":15,"column":2}},"12":{"start":{"line":11,"column":2},"end":{"line":13,"column":3}},"13":{"start":{"line":12,"column":4},"end":{"line":12,"column":44}},"14":{"start":{"line":14,"column":2},"end":{"line":14,"column":14}},"15":{"start":{"line":17,"column":23},"end":{"line":17,"column":61}},"16":{"start":{"line":17,"column":34},"end":{"line":17,"column":59}},"17":{"start":{"line":19,"column":21},"end":{"line":41,"column":1}},"18":{"start":{"line":21,"column":2},"end":{"line":23,"column":3}},"19":{"start":{"line":22,"column":4},"end":{"line":22,"column":79}},"20":{"start":{"line":25,"column":2},"end":{"line":25,"column":47}},"21":{"start":{"line":27,"column":18},"end":{"line":27,"column":44}},"22":{"start":{"line":28,"column":23},"end":{"line":28,"column":80}},"23":{"start":{"line":28,"column":55},"end":{"line":28,"column":60}},"24":{"start":{"line":29,"column":14},"end":{"line":29,"column":27}},"25":{"start":{"line":30,"column":12},"end":{"line":30,"column":13}},"26":{"start":{"line":33,"column":2},"end":{"line":33,"column":79}},"27":{"start":{"line":33,"column":26},"end":{"line":33,"column":79}},"28":{"start":{"line":35,"column":2},"end":{"line":39,"column":5}},"29":{"start":{"line":36,"column":4},"end":{"line":36,"column":18}},"30":{"start":{"line":37,"column":4},"end":{"line":37,"column":40}},"31":{"start":{"line":38,"column":4},"end":{"line":38,"column":21}},"32":{"start":{"line":40,"column":2},"end":{"line":40,"column":18}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}},"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":70}},"line":1},"1":{"name":"(anonymous_1)","decl":{"start":{"line":3,"column":16},"end":{"line":3,"column":17}},"loc":{"start":{"line":3,"column":31},"end":{"line":3,"column":56}},"line":3},"2":{"name":"(anonymous_2)","decl":{"start":{"line":3,"column":39},"end":{"line":3,"column":40}},"loc":{"start":{"line":3,"column":46},"end":{"line":3,"column":55}},"line":3},"3":{"name":"(anonymous_3)","decl":{"start":{"line":5,"column":22},"end":{"line":5,"column":23}},"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":69}},"line":6},"4":{"name":"(anonymous_4)","decl":{"start":{"line":6,"column":12},"end":{"line":6,"column":13}},"loc":{"start":{"line":6,"column":20},"end":{"line":6,"column":68}},"line":6},"5":{"name":"(anonymous_5)","decl":{"start":{"line":8,"column":21},"end":{"line":8,"column":22}},"loc":{"start":{"line":8,"column":29},"end":{"line":8,"column":77}},"line":8},"6":{"name":"(anonymous_6)","decl":{"start":{"line":10,"column":24},"end":{"line":10,"column":25}},"loc":{"start":{"line":10,"column":44},"end":{"line":15,"column":2}},"line":10},"7":{"name":"(anonymous_7)","decl":{"start":{"line":10,"column":54},"end":{"line":10,"column":55}},"loc":{"start":{"line":10,"column":64},"end":{"line":15,"column":1}},"line":10},"8":{"name":"(anonymous_8)","decl":{"start":{"line":17,"column":23},"end":{"line":17,"column":24}},"loc":{"start":{"line":17,"column":32},"end":{"line":17,"column":61}},"line":17},"9":{"name":"(anonymous_9)","decl":{"start":{"line":19,"column":21},"end":{"line":19,"column":22}},"loc":{"start":{"line":19,"column":34},"end":{"line":41,"column":1}},"line":19},"10":{"name":"(anonymous_10)","decl":{"start":{"line":28,"column":45},"end":{"line":28,"column":46}},"loc":{"start":{"line":28,"column":55},"end":{"line":28,"column":60}},"line":28},"11":{"name":"(anonymous_11)","decl":{"start":{"line":35,"column":15},"end":{"line":35,"column":16}},"loc":{"start":{"line":35,"column":30},"end":{"line":39,"column":3}},"line":35}},"branchMap":{"0":{"loc":{"start":{"line":11,"column":2},"end":{"line":13,"column":3}},"type":"if","locations":[{"start":{"line":11,"column":2},"end":{"line":13,"column":3}},{"start":{"line":11,"column":2},"end":{"line":13,"column":3}}],"line":11},"1":{"loc":{"start":{"line":21,"column":2},"end":{"line":23,"column":3}},"type":"if","locations":[{"start":{"line":21,"column":2},"end":{"line":23,"column":3}},{"start":{"line":21,"column":2},"end":{"line":23,"column":3}}],"line":21},"2":{"loc":{"start":{"line":33,"column":2},"end":{"line":33,"column":79}},"type":"if","locations":[{"start":{"line":33,"column":2},"end":{"line":33,"column":79}},{"start":{"line":33,"column":2},"end":{"line":33,"column":79}}],"line":33}},"s":{"0":1,"1":2140978,"2":1,"3":500201,"4":3700401,"5":1,"6":1000405,"7":7400805,"8":1,"9":2,"10":1,"11":500203,"12":1000405,"13":2,"14":1000403,"15":1,"16":2,"17":1,"18":500204,"19":1,"20":500203,"21":500201,"22":500201,"23":3700401,"24":500201,"25":500201,"26":500201,"27":1,"28":500200,"29":2140978,"30":2140978,"31":2140978,"32":500200},"f":{"0":2140978,"1":500201,"2":3700401,"3":1000405,"4":7400805,"5":2,"6":500203,"7":1000405,"8":2,"9":500204,"10":3700401,"11":2140978},"b":{"0":[2,1000403],"1":[1,500203],"2":[1,500200]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"de63f9a5672735a15d704945f20b1b9961a80947"}
2
- ,"/home/phellipe/Documents/GIT/personal/probabilities/src/utils/tests.utils.js": {"path":"/home/phellipe/Documents/GIT/personal/probabilities/src/utils/tests.utils.js","statementMap":{"0":{"start":{"line":3,"column":28},"end":{"line":3,"column":31}},"1":{"start":{"line":5,"column":23},"end":{"line":5,"column":69}},"2":{"start":{"line":5,"column":33},"end":{"line":5,"column":69}},"3":{"start":{"line":7,"column":27},"end":{"line":7,"column":36}},"4":{"start":{"line":9,"column":33},"end":{"line":12,"column":6}},"5":{"start":{"line":9,"column":40},"end":{"line":12,"column":6}},"6":{"start":{"line":10,"column":2},"end":{"line":10,"column":31}},"7":{"start":{"line":11,"column":2},"end":{"line":11,"column":13}},"8":{"start":{"line":14,"column":23},"end":{"line":14,"column":60}},"9":{"start":{"line":14,"column":40},"end":{"line":14,"column":60}},"10":{"start":{"line":16,"column":20},"end":{"line":16,"column":45}},"11":{"start":{"line":16,"column":30},"end":{"line":16,"column":45}},"12":{"start":{"line":18,"column":32},"end":{"line":19,"column":54}},"13":{"start":{"line":19,"column":2},"end":{"line":19,"column":54}},"14":{"start":{"line":21,"column":29},"end":{"line":21,"column":94}},"15":{"start":{"line":21,"column":49},"end":{"line":21,"column":94}},"16":{"start":{"line":21,"column":74},"end":{"line":21,"column":93}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":5,"column":23},"end":{"line":5,"column":24}},"loc":{"start":{"line":5,"column":33},"end":{"line":5,"column":69}},"line":5},"1":{"name":"(anonymous_1)","decl":{"start":{"line":9,"column":33},"end":{"line":9,"column":34}},"loc":{"start":{"line":9,"column":40},"end":{"line":12,"column":6}},"line":9},"2":{"name":"(anonymous_2)","decl":{"start":{"line":9,"column":51},"end":{"line":9,"column":52}},"loc":{"start":{"line":9,"column":63},"end":{"line":12,"column":1}},"line":9},"3":{"name":"(anonymous_3)","decl":{"start":{"line":14,"column":23},"end":{"line":14,"column":24}},"loc":{"start":{"line":14,"column":40},"end":{"line":14,"column":60}},"line":14},"4":{"name":"(anonymous_4)","decl":{"start":{"line":16,"column":20},"end":{"line":16,"column":21}},"loc":{"start":{"line":16,"column":30},"end":{"line":16,"column":45}},"line":16},"5":{"name":"(anonymous_5)","decl":{"start":{"line":18,"column":32},"end":{"line":18,"column":33}},"loc":{"start":{"line":19,"column":2},"end":{"line":19,"column":54}},"line":19},"6":{"name":"(anonymous_6)","decl":{"start":{"line":21,"column":29},"end":{"line":21,"column":30}},"loc":{"start":{"line":21,"column":49},"end":{"line":21,"column":94}},"line":21},"7":{"name":"(anonymous_7)","decl":{"start":{"line":21,"column":68},"end":{"line":21,"column":69}},"loc":{"start":{"line":21,"column":74},"end":{"line":21,"column":93}},"line":21}},"branchMap":{"0":{"loc":{"start":{"line":5,"column":39},"end":{"line":5,"column":61}},"type":"binary-expr","locations":[{"start":{"line":5,"column":39},"end":{"line":5,"column":45}},{"start":{"line":5,"column":49},"end":{"line":5,"column":61}}],"line":5},"1":{"loc":{"start":{"line":10,"column":14},"end":{"line":10,"column":30}},"type":"binary-expr","locations":[{"start":{"line":10,"column":14},"end":{"line":10,"column":25}},{"start":{"line":10,"column":29},"end":{"line":10,"column":30}}],"line":10},"2":{"loc":{"start":{"line":14,"column":40},"end":{"line":14,"column":60}},"type":"binary-expr","locations":[{"start":{"line":14,"column":40},"end":{"line":14,"column":48}},{"start":{"line":14,"column":52},"end":{"line":14,"column":60}}],"line":14},"3":{"loc":{"start":{"line":18,"column":49},"end":{"line":18,"column":62}},"type":"default-arg","locations":[{"start":{"line":18,"column":61},"end":{"line":18,"column":62}}],"line":18}},"s":{"0":1,"1":1,"2":6,"3":1,"4":1,"5":5,"6":500000,"7":500000,"8":1,"9":5,"10":1,"11":0,"12":1,"13":5,"14":1,"15":5,"16":500000},"f":{"0":6,"1":5,"2":500000,"3":5,"4":0,"5":5,"6":5,"7":500000},"b":{"0":[6,1],"1":[500000,36],"2":[5,5],"3":[5]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"d64d74ebb268f8055d0bf64e48838bc99171ccac"}
3
- }