@spscommerce/utils 5.0.2 → 5.2.2-ie
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/.pnpm-debug.log +20 -0
- package/dist/out-tsc/array/flatten.d.ts +1 -0
- package/dist/out-tsc/array/flatten.js +7 -0
- package/dist/out-tsc/array/flatten.js.map +1 -0
- package/dist/out-tsc/array/flatten.spec.d.ts +1 -0
- package/dist/out-tsc/array/flatten.spec.js +10 -0
- package/dist/out-tsc/array/flatten.spec.js.map +1 -0
- package/dist/out-tsc/array/index.d.ts +3 -0
- package/dist/out-tsc/array/index.js +4 -0
- package/dist/out-tsc/array/index.js.map +1 -0
- package/dist/out-tsc/array/is-subset.d.ts +4 -0
- package/dist/out-tsc/array/is-subset.js +41 -0
- package/dist/out-tsc/array/is-subset.js.map +1 -0
- package/dist/out-tsc/array/is-subset.spec.d.ts +1 -0
- package/dist/out-tsc/array/is-subset.spec.js +41 -0
- package/dist/out-tsc/array/is-subset.spec.js.map +1 -0
- package/dist/out-tsc/array/range.d.ts +5 -0
- package/dist/out-tsc/array/range.js +16 -0
- package/dist/out-tsc/array/range.js.map +1 -0
- package/dist/out-tsc/array/range.spec.d.ts +1 -0
- package/dist/out-tsc/array/range.spec.js +26 -0
- package/dist/out-tsc/array/range.spec.js.map +1 -0
- package/dist/out-tsc/classes/custom-event.d.ts +4 -0
- package/dist/out-tsc/classes/custom-event.js +87 -0
- package/dist/out-tsc/classes/custom-event.js.map +1 -0
- package/dist/out-tsc/classes/index.d.ts +1 -0
- package/dist/out-tsc/classes/index.js +2 -0
- package/dist/out-tsc/classes/index.js.map +1 -0
- package/dist/out-tsc/data/doctypes.d.ts +4 -0
- package/dist/out-tsc/data/doctypes.js +302 -0
- package/dist/out-tsc/data/doctypes.js.map +1 -0
- package/dist/out-tsc/data/index.d.ts +1 -0
- package/dist/out-tsc/data/index.js +2 -0
- package/dist/out-tsc/data/index.js.map +1 -0
- package/dist/out-tsc/decorators/cast-to-number.d.ts +5 -0
- package/dist/out-tsc/decorators/cast-to-number.js +29 -0
- package/dist/out-tsc/decorators/cast-to-number.js.map +1 -0
- package/dist/out-tsc/decorators/debounced.broken_spec.d.ts +0 -0
- package/dist/out-tsc/decorators/debounced.broken_spec.js +38 -0
- package/dist/out-tsc/decorators/debounced.broken_spec.js.map +1 -0
- package/dist/out-tsc/decorators/debounced.d.ts +11 -0
- package/dist/out-tsc/decorators/debounced.js +35 -0
- package/dist/out-tsc/decorators/debounced.js.map +1 -0
- package/dist/out-tsc/decorators/index.d.ts +5 -0
- package/dist/out-tsc/decorators/index.js +6 -0
- package/dist/out-tsc/decorators/index.js.map +1 -0
- package/dist/out-tsc/decorators/locked-to-animation-frames.d.ts +4 -0
- package/dist/out-tsc/decorators/locked-to-animation-frames.js +34 -0
- package/dist/out-tsc/decorators/locked-to-animation-frames.js.map +1 -0
- package/dist/out-tsc/decorators/locked-to-animation-frames.spec.d.ts +0 -0
- package/dist/out-tsc/decorators/locked-to-animation-frames.spec.js +63 -0
- package/dist/out-tsc/decorators/locked-to-animation-frames.spec.js.map +1 -0
- package/dist/out-tsc/decorators/simple-metadata-decorator-applicator.d.ts +11 -0
- package/dist/out-tsc/decorators/simple-metadata-decorator-applicator.js +80 -0
- package/dist/out-tsc/decorators/simple-metadata-decorator-applicator.js.map +1 -0
- package/dist/out-tsc/decorators/tick-delay.d.ts +6 -0
- package/dist/out-tsc/decorators/tick-delay.js +31 -0
- package/dist/out-tsc/decorators/tick-delay.js.map +1 -0
- package/dist/out-tsc/function/debounce.d.ts +9 -0
- package/dist/out-tsc/function/debounce.js +102 -0
- package/dist/out-tsc/function/debounce.js.map +1 -0
- package/dist/out-tsc/function/debounce.spec.d.ts +1 -0
- package/dist/out-tsc/function/debounce.spec.js +150 -0
- package/dist/out-tsc/function/debounce.spec.js.map +1 -0
- package/dist/out-tsc/function/debounced-function.interface.d.ts +10 -0
- package/dist/out-tsc/function/debounced-function.interface.js +2 -0
- package/dist/out-tsc/function/debounced-function.interface.js.map +1 -0
- package/dist/out-tsc/function/delayed-function.interface.d.ts +10 -0
- package/dist/out-tsc/function/delayed-function.interface.js +2 -0
- package/dist/out-tsc/function/delayed-function.interface.js.map +1 -0
- package/dist/out-tsc/function/index.d.ts +6 -0
- package/dist/out-tsc/function/index.js +7 -0
- package/dist/out-tsc/function/index.js.map +1 -0
- package/dist/out-tsc/function/lock-to-animation-frames.d.ts +7 -0
- package/dist/out-tsc/function/lock-to-animation-frames.js +43 -0
- package/dist/out-tsc/function/lock-to-animation-frames.js.map +1 -0
- package/dist/out-tsc/function/lock-to-animation-frames.spec.d.ts +0 -0
- package/dist/out-tsc/function/lock-to-animation-frames.spec.js +53 -0
- package/dist/out-tsc/function/lock-to-animation-frames.spec.js.map +1 -0
- package/dist/out-tsc/function/on-next-tick.d.ts +8 -0
- package/dist/out-tsc/function/on-next-tick.js +12 -0
- package/dist/out-tsc/function/on-next-tick.js.map +1 -0
- package/dist/out-tsc/function/on-next-tick.spec.d.ts +1 -0
- package/dist/out-tsc/function/on-next-tick.spec.js +13 -0
- package/dist/out-tsc/function/on-next-tick.spec.js.map +1 -0
- package/dist/out-tsc/function/op.d.ts +32 -0
- package/dist/out-tsc/function/op.js +34 -0
- package/dist/out-tsc/function/op.js.map +1 -0
- package/dist/out-tsc/function/op.spec.d.ts +1 -0
- package/dist/out-tsc/function/op.spec.js +94 -0
- package/dist/out-tsc/function/op.spec.js.map +1 -0
- package/dist/out-tsc/index.d.ts +9 -0
- package/dist/out-tsc/index.js +10 -0
- package/dist/out-tsc/index.js.map +1 -0
- package/dist/out-tsc/number/constrain.d.ts +7 -0
- package/dist/out-tsc/number/constrain.js +16 -0
- package/dist/out-tsc/number/constrain.js.map +1 -0
- package/dist/out-tsc/number/decimal-round.d.ts +7 -0
- package/dist/out-tsc/number/decimal-round.js +19 -0
- package/dist/out-tsc/number/decimal-round.js.map +1 -0
- package/dist/out-tsc/number/decimal-round.spec.d.ts +1 -0
- package/dist/out-tsc/number/decimal-round.spec.js +10 -0
- package/dist/out-tsc/number/decimal-round.spec.js.map +1 -0
- package/dist/out-tsc/number/index.d.ts +3 -0
- package/dist/out-tsc/number/index.js +4 -0
- package/dist/out-tsc/number/index.js.map +1 -0
- package/dist/out-tsc/number/to-file-size-string.d.ts +5 -0
- package/dist/out-tsc/number/to-file-size-string.js +24 -0
- package/dist/out-tsc/number/to-file-size-string.js.map +1 -0
- package/dist/out-tsc/object/copy-property.d.ts +6 -0
- package/dist/out-tsc/object/copy-property.js +9 -0
- package/dist/out-tsc/object/copy-property.js.map +1 -0
- package/dist/out-tsc/object/copy-property.spec.d.ts +1 -0
- package/dist/out-tsc/object/copy-property.spec.js +16 -0
- package/dist/out-tsc/object/copy-property.spec.js.map +1 -0
- package/dist/out-tsc/object/crumble-path.d.ts +6 -0
- package/dist/out-tsc/object/crumble-path.js +9 -0
- package/dist/out-tsc/object/crumble-path.js.map +1 -0
- package/dist/out-tsc/object/crumble-path.spec.d.ts +1 -0
- package/dist/out-tsc/object/crumble-path.spec.js +24 -0
- package/dist/out-tsc/object/crumble-path.spec.js.map +1 -0
- package/dist/out-tsc/object/deep-freeze.d.ts +1 -0
- package/dist/out-tsc/object/deep-freeze.js +36 -0
- package/dist/out-tsc/object/deep-freeze.js.map +1 -0
- package/dist/out-tsc/object/deep-freeze.spec.d.ts +1 -0
- package/dist/out-tsc/object/deep-freeze.spec.js +14 -0
- package/dist/out-tsc/object/deep-freeze.spec.js.map +1 -0
- package/dist/out-tsc/object/diff.d.ts +12 -0
- package/dist/out-tsc/object/diff.js +92 -0
- package/dist/out-tsc/object/diff.js.map +1 -0
- package/dist/out-tsc/object/diff.spec.d.ts +1 -0
- package/dist/out-tsc/object/diff.spec.js +40 -0
- package/dist/out-tsc/object/diff.spec.js.map +1 -0
- package/dist/out-tsc/object/for-each-entry-deep.d.ts +4 -0
- package/dist/out-tsc/object/for-each-entry-deep.js +38 -0
- package/dist/out-tsc/object/for-each-entry-deep.js.map +1 -0
- package/dist/out-tsc/object/for-each-entry-deep.spec.d.ts +1 -0
- package/dist/out-tsc/object/for-each-entry-deep.spec.js +24 -0
- package/dist/out-tsc/object/for-each-entry-deep.spec.js.map +1 -0
- package/dist/out-tsc/object/for-each-nested-object.d.ts +4 -0
- package/dist/out-tsc/object/for-each-nested-object.js +38 -0
- package/dist/out-tsc/object/for-each-nested-object.js.map +1 -0
- package/dist/out-tsc/object/for-each-nested-object.spec.d.ts +1 -0
- package/dist/out-tsc/object/for-each-nested-object.spec.js +46 -0
- package/dist/out-tsc/object/for-each-nested-object.spec.js.map +1 -0
- package/dist/out-tsc/object/get-path.d.ts +5 -0
- package/dist/out-tsc/object/get-path.js +67 -0
- package/dist/out-tsc/object/get-path.js.map +1 -0
- package/dist/out-tsc/object/get-path.spec.d.ts +1 -0
- package/dist/out-tsc/object/get-path.spec.js +44 -0
- package/dist/out-tsc/object/get-path.spec.js.map +1 -0
- package/dist/out-tsc/object/index.d.ts +13 -0
- package/dist/out-tsc/object/index.js +14 -0
- package/dist/out-tsc/object/index.js.map +1 -0
- package/dist/out-tsc/object/merge-deep.d.ts +4 -0
- package/dist/out-tsc/object/merge-deep.js +60 -0
- package/dist/out-tsc/object/merge-deep.js.map +1 -0
- package/dist/out-tsc/object/merge-deep.spec.d.ts +1 -0
- package/dist/out-tsc/object/merge-deep.spec.js +16 -0
- package/dist/out-tsc/object/merge-deep.spec.js.map +1 -0
- package/dist/out-tsc/object/merge-properties-deep.d.ts +4 -0
- package/dist/out-tsc/object/merge-properties-deep.js +61 -0
- package/dist/out-tsc/object/merge-properties-deep.js.map +1 -0
- package/dist/out-tsc/object/merge-properties-deep.spec.d.ts +1 -0
- package/dist/out-tsc/object/merge-properties-deep.spec.js +24 -0
- package/dist/out-tsc/object/merge-properties-deep.spec.js.map +1 -0
- package/dist/out-tsc/object/omit.d.ts +1 -0
- package/dist/out-tsc/object/omit.js +40 -0
- package/dist/out-tsc/object/omit.js.map +1 -0
- package/dist/out-tsc/object/omit.spec.d.ts +1 -0
- package/dist/out-tsc/object/omit.spec.js +10 -0
- package/dist/out-tsc/object/omit.spec.js.map +1 -0
- package/dist/out-tsc/object/set-path.d.ts +2 -0
- package/dist/out-tsc/object/set-path.js +45 -0
- package/dist/out-tsc/object/set-path.js.map +1 -0
- package/dist/out-tsc/object/set-path.spec.d.ts +1 -0
- package/dist/out-tsc/object/set-path.spec.js +36 -0
- package/dist/out-tsc/object/set-path.spec.js.map +1 -0
- package/dist/out-tsc/object/traverse-path.d.ts +2 -0
- package/dist/out-tsc/object/traverse-path.js +81 -0
- package/dist/out-tsc/object/traverse-path.js.map +1 -0
- package/dist/out-tsc/object/values.d.ts +2 -0
- package/dist/out-tsc/object/values.js +31 -0
- package/dist/out-tsc/object/values.js.map +1 -0
- package/dist/out-tsc/object/values.spec.d.ts +1 -0
- package/dist/out-tsc/object/values.spec.js +7 -0
- package/dist/out-tsc/object/values.spec.js.map +1 -0
- package/dist/out-tsc/string/code.template-tag.d.ts +2 -0
- package/dist/out-tsc/string/code.template-tag.js +38 -0
- package/dist/out-tsc/string/code.template-tag.js.map +1 -0
- package/dist/out-tsc/string/index.d.ts +3 -0
- package/dist/out-tsc/string/index.js +4 -0
- package/dist/out-tsc/string/index.js.map +1 -0
- package/dist/out-tsc/string/parse-file-size.d.ts +5 -0
- package/dist/out-tsc/string/parse-file-size.js +43 -0
- package/dist/out-tsc/string/parse-file-size.js.map +1 -0
- package/dist/out-tsc/string/template.d.ts +15 -0
- package/dist/out-tsc/string/template.js +28 -0
- package/dist/out-tsc/string/template.js.map +1 -0
- package/dist/out-tsc/string/template.spec.d.ts +1 -0
- package/dist/out-tsc/string/template.spec.js +39 -0
- package/dist/out-tsc/string/template.spec.js.map +1 -0
- package/dist/out-tsc/typings.d.ts +1 -0
- package/dist/out-tsc/typings.js +2 -0
- package/dist/out-tsc/typings.js.map +1 -0
- package/lib/index.cjs.js +2437 -1
- package/lib/index.es.js +2268 -893
- package/package.json +5 -5
- package/rollup.config.js +22 -0
- package/spscommerce-utils-4.36.3-ie.tgz +0 -0
- package/spscommerce-utils-5.0.2-ie.tgz +0 -0
- package/vite.config.js +1 -1
package/.pnpm-debug.log
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"0 debug pnpm:scope": {
|
|
3
|
+
"selected": 1,
|
|
4
|
+
"workspacePrefix": "/Users/kkorth/experiments/stupid-stuff-i-hate/design-system"
|
|
5
|
+
},
|
|
6
|
+
"1 error pnpm": {
|
|
7
|
+
"errno": 2,
|
|
8
|
+
"code": "ELIFECYCLE",
|
|
9
|
+
"pkgid": "@spscommerce/utils@4.36.3-ie",
|
|
10
|
+
"stage": "build:es5",
|
|
11
|
+
"script": "tsc -p tsconfig.json",
|
|
12
|
+
"pkgname": "@spscommerce/utils",
|
|
13
|
+
"err": {
|
|
14
|
+
"name": "pnpm",
|
|
15
|
+
"message": "@spscommerce/utils@4.36.3-ie build:es5: `tsc -p tsconfig.json`\nExit status 2",
|
|
16
|
+
"code": "ELIFECYCLE",
|
|
17
|
+
"stack": "pnpm: @spscommerce/utils@4.36.3-ie build:es5: `tsc -p tsconfig.json`\nExit status 2\n at EventEmitter.<anonymous> (/Users/kkorth/.nvm/versions/node/v14.17.2/lib/node_modules/pnpm/dist/pnpm.cjs:105913:20)\n at EventEmitter.emit (events.js:375:28)\n at ChildProcess.<anonymous> (/Users/kkorth/.nvm/versions/node/v14.17.2/lib/node_modules/pnpm/dist/pnpm.cjs:93853:18)\n at ChildProcess.emit (events.js:375:28)\n at maybeClose (internal/child_process.js:1055:16)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function flatten(arg: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten.js","sourceRoot":"","sources":["../../../src/array/flatten.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO,CAAC,GAAQ;IAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACvB,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,CAAC,IAAK,OAAA,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAtB,CAAsB,EAAE,EAAE,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten.spec.js","sourceRoot":"","sources":["../../../src/array/flatten.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAQ,CAAC,SAAS,EAAE;IAClB,IAAI,CAAC,wBAAwB,EAAE;QAC7B,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YAC1C,CAAC;YACD,CAAC;YACD,CAAC,CAAC,CAAC,CAAC;IACR,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __values = (this && this.__values) || function(o) {
|
|
2
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
|
+
if (m) return m.call(o);
|
|
4
|
+
if (o && typeof o.length === "number") return {
|
|
5
|
+
next: function () {
|
|
6
|
+
if (o && i >= o.length) o = void 0;
|
|
7
|
+
return { value: o && o[i++], done: !o };
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Tests if candidate is a subset of array
|
|
14
|
+
*/
|
|
15
|
+
export function isSubset(candidate, array) {
|
|
16
|
+
var e_1, _a;
|
|
17
|
+
/*
|
|
18
|
+
* Set.prototype.has is required by the ECMAScript spec to be
|
|
19
|
+
* implemented in sub-linear time, so by converting array to Set
|
|
20
|
+
* we can avoid n^2 complexity. (In WebKit, Sets are HashMaps
|
|
21
|
+
* internally, so has() is constant time)
|
|
22
|
+
*/
|
|
23
|
+
var set = new Set(array);
|
|
24
|
+
try {
|
|
25
|
+
for (var candidate_1 = __values(candidate), candidate_1_1 = candidate_1.next(); !candidate_1_1.done; candidate_1_1 = candidate_1.next()) {
|
|
26
|
+
var member = candidate_1_1.value;
|
|
27
|
+
if (!set.has(member)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
33
|
+
finally {
|
|
34
|
+
try {
|
|
35
|
+
if (candidate_1_1 && !candidate_1_1.done && (_a = candidate_1.return)) _a.call(candidate_1);
|
|
36
|
+
}
|
|
37
|
+
finally { if (e_1) throw e_1.error; }
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=is-subset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-subset.js","sourceRoot":"","sources":["../../../src/array/is-subset.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAgB,EAAE,KAAY;;IACrD;;;;;OAKG;IACH,IAAM,GAAG,GAAG,IAAI,GAAG,CAAM,KAAK,CAAC,CAAC;;QAChC,KAAqB,IAAA,cAAA,SAAA,SAAS,CAAA,oCAAA,2DAAE;YAA3B,IAAM,MAAM,sBAAA;YACf,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;gBACpB,OAAO,KAAK,CAAC;aACd;SACF;;;;;;;;;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isSubset } from "./is-subset";
|
|
2
|
+
describe("isSubset", function () {
|
|
3
|
+
test("returns true when candidate is a subset of array", function () {
|
|
4
|
+
expect(isSubset([1,
|
|
5
|
+
3,
|
|
6
|
+
5], [1,
|
|
7
|
+
2,
|
|
8
|
+
3,
|
|
9
|
+
4,
|
|
10
|
+
5])).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
test("returns false when candidate is not a subset of array", function () {
|
|
13
|
+
expect(isSubset([1,
|
|
14
|
+
3,
|
|
15
|
+
5,
|
|
16
|
+
7], [1,
|
|
17
|
+
2,
|
|
18
|
+
3,
|
|
19
|
+
4,
|
|
20
|
+
5])).toBe(false);
|
|
21
|
+
});
|
|
22
|
+
test("knows the empty set is always a subset", function () {
|
|
23
|
+
expect(isSubset([], [1,
|
|
24
|
+
2,
|
|
25
|
+
3,
|
|
26
|
+
4,
|
|
27
|
+
5])).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
test("knows that a set is a subset of itself", function () {
|
|
30
|
+
expect(isSubset([1,
|
|
31
|
+
2,
|
|
32
|
+
3,
|
|
33
|
+
4,
|
|
34
|
+
5], [1,
|
|
35
|
+
2,
|
|
36
|
+
3,
|
|
37
|
+
4,
|
|
38
|
+
5])).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=is-subset.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-subset.spec.js","sourceRoot":"","sources":["../../../src/array/is-subset.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,QAAQ,CAAC,UAAU,EAAE;IACnB,IAAI,CAAC,kDAAkD,EAAE;QACvD,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChB,CAAC;YACD,CAAC,CAAC,EAAE,CAAC,CAAC;YACN,CAAC;YACD,CAAC;YACD,CAAC;YACD,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,uDAAuD,EAAE;QAC5D,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChB,CAAC;YACD,CAAC;YACD,CAAC,CAAC,EAAE,CAAC,CAAC;YACN,CAAC;YACD,CAAC;YACD,CAAC;YACD,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wCAAwC,EAAE;QAC7C,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;YACpB,CAAC;YACD,CAAC;YACD,CAAC;YACD,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wCAAwC,EAAE;QAC7C,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChB,CAAC;YACD,CAAC;YACD,CAAC;YACD,CAAC,CAAC,EAAE,CAAC,CAAC;YACN,CAAC;YACD,CAAC;YACD,CAAC;YACD,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Op } from "../function";
|
|
2
|
+
/**
|
|
3
|
+
* Unlike lodash range, includes the specified end number.
|
|
4
|
+
* So range(1, 10) gives you 1-10 instead of 1-9.
|
|
5
|
+
*/
|
|
6
|
+
export function range(start, end) {
|
|
7
|
+
if (!Number.isInteger(start)) {
|
|
8
|
+
throw new Error("start must be an integer");
|
|
9
|
+
}
|
|
10
|
+
if (!Number.isInteger(end)) {
|
|
11
|
+
throw new Error("end must be an integer");
|
|
12
|
+
}
|
|
13
|
+
return new Array(Math.abs(end - start) + 1).fill(start)
|
|
14
|
+
.map(start > end ? Op.sub : Op.add);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=range.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range.js","sourceRoot":"","sources":["../../../src/array/range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,GAAW;IAC9C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;KAC7C;IACD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;KAC3C;IAED,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;SACpD,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { range } from "./range";
|
|
2
|
+
describe("range", function () {
|
|
3
|
+
test("returns an array of integers ranging from a to b", function () {
|
|
4
|
+
expect(range(11, 17)).toEqual([11,
|
|
5
|
+
12,
|
|
6
|
+
13,
|
|
7
|
+
14,
|
|
8
|
+
15,
|
|
9
|
+
16,
|
|
10
|
+
17]);
|
|
11
|
+
});
|
|
12
|
+
test("works (with digits in descending order) if a is greater than b", function () {
|
|
13
|
+
expect(range(17, 11)).toEqual([17,
|
|
14
|
+
16,
|
|
15
|
+
15,
|
|
16
|
+
14,
|
|
17
|
+
13,
|
|
18
|
+
12,
|
|
19
|
+
11]);
|
|
20
|
+
});
|
|
21
|
+
test("throws if either a or b is not an integer", function () {
|
|
22
|
+
expect(function () { return range(Math.PI, 5); }).toThrow();
|
|
23
|
+
expect(function () { return range(5, Math.PI); }).toThrow();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=range.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range.spec.js","sourceRoot":"","sources":["../../../src/array/range.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAQ,CAAC,OAAO,EAAE;IAChB,IAAI,CAAC,kDAAkD,EAAE;QACvD,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE;YAC/B,EAAE;YACF,EAAE;YACF,EAAE;YACF,EAAE;YACF,EAAE;YACF,EAAE,CAAC,CAAC,CAAC;IACT,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,gEAAgE,EAAE;QACrE,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE;YAC/B,EAAE;YACF,EAAE;YACF,EAAE;YACF,EAAE;YACF,EAAE;YACF,EAAE,CAAC,CAAC,CAAC;IACT,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,2CAA2C,EAAE;QAChD,MAAM,CAAC,cAAM,OAAA,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAjB,CAAiB,CAAC,CAAC,OAAO,EAAE,CAAC;QAC1C,MAAM,CAAC,cAAM,OAAA,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,EAAjB,CAAiB,CAAC,CAAC,OAAO,EAAE,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-redeclare, @typescript-eslint/no-extraneous-class */
|
|
2
|
+
/** docs:ignore */
|
|
3
|
+
var __values = (this && this.__values) || function(o) {
|
|
4
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
5
|
+
if (m) return m.call(o);
|
|
6
|
+
if (o && typeof o.length === "number") return {
|
|
7
|
+
next: function () {
|
|
8
|
+
if (o && i >= o.length) o = void 0;
|
|
9
|
+
return { value: o && o[i++], done: !o };
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
13
|
+
};
|
|
14
|
+
/*
|
|
15
|
+
* This was intended to be a replacement for Event that allows subclassing
|
|
16
|
+
* However it doesn't work in all browsers
|
|
17
|
+
* TODO: Drop this, use built-in CustomEvent once IE11 is dead
|
|
18
|
+
*/
|
|
19
|
+
var CustomEvent = /** @class */ (function () {
|
|
20
|
+
function CustomEvent(eventName, initDict) {
|
|
21
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
22
|
+
if (initDict === void 0) { initDict = {}; }
|
|
23
|
+
var event;
|
|
24
|
+
if (typeof Event === "function") {
|
|
25
|
+
event = new Event(eventName, initDict);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
// IE11
|
|
29
|
+
event = document.createEvent("Event");
|
|
30
|
+
event.initEvent(eventName, initDict.bubbles, initDict.cancelable);
|
|
31
|
+
try {
|
|
32
|
+
for (var _d = __values(Object.keys(initDict)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
33
|
+
var key = _e.value;
|
|
34
|
+
if (key !== "bubbles" && key !== "cancelable") {
|
|
35
|
+
event[key] = initDict[key];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
40
|
+
finally {
|
|
41
|
+
try {
|
|
42
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
43
|
+
}
|
|
44
|
+
finally { if (e_1) throw e_1.error; }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
Object.setPrototypeOf(this, event);
|
|
48
|
+
/*
|
|
49
|
+
* Native functions like the getters, setters, and methods on Event.prototype
|
|
50
|
+
* cannot be called with "this" being a custom object. So what we're doing here
|
|
51
|
+
* works around that.
|
|
52
|
+
*/
|
|
53
|
+
var descriptors = Object.getOwnPropertyDescriptors(Event.prototype);
|
|
54
|
+
try {
|
|
55
|
+
for (var _f = __values(Object.keys(descriptors)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
56
|
+
var propKey = _g.value;
|
|
57
|
+
var descriptor = descriptors[propKey];
|
|
58
|
+
try {
|
|
59
|
+
for (var _h = (e_3 = void 0, __values(Object.keys(descriptor))), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
60
|
+
var key = _j.value;
|
|
61
|
+
if (typeof descriptor[key] === "function") {
|
|
62
|
+
descriptor[key] = descriptor[key].bind(event);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
67
|
+
finally {
|
|
68
|
+
try {
|
|
69
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
70
|
+
}
|
|
71
|
+
finally { if (e_3) throw e_3.error; }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
76
|
+
finally {
|
|
77
|
+
try {
|
|
78
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
79
|
+
}
|
|
80
|
+
finally { if (e_2) throw e_2.error; }
|
|
81
|
+
}
|
|
82
|
+
Object.defineProperties(this, descriptors);
|
|
83
|
+
}
|
|
84
|
+
return CustomEvent;
|
|
85
|
+
}());
|
|
86
|
+
export { CustomEvent };
|
|
87
|
+
//# sourceMappingURL=custom-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-event.js","sourceRoot":"","sources":["../../../src/classes/custom-event.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,kBAAkB;;;;;;;;;;;;AAElB;;;;GAIG;AACH;IACE,qBAAY,SAAiB,EAAE,QAAwB;;QAAxB,yBAAA,EAAA,aAAwB;QACrD,IAAI,KAAK,CAAC;QACV,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;YAC/B,KAAK,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;SACxC;aAAM;YACL,OAAO;YACP,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACtC,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;;gBAClE,KAAkB,IAAA,KAAA,SAAA,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA,gBAAA,4BAAE;oBAApC,IAAM,GAAG,WAAA;oBACZ,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,YAAY,EAAE;wBAC7C,KAAK,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;qBAC5B;iBACF;;;;;;;;;SACF;QAED,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAEnC;;;;WAIG;QACH,IAAM,WAAW,GAAG,MAAM,CAAC,yBAAyB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;;YACtE,KAAsB,IAAA,KAAA,SAAA,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA,gBAAA,4BAAE;gBAA3C,IAAM,OAAO,WAAA;gBAChB,IAAM,UAAU,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;;oBACxC,KAAkB,IAAA,oBAAA,SAAA,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA,CAAA,gBAAA,4BAAE;wBAAtC,IAAM,GAAG,WAAA;wBACZ,IAAI,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,UAAU,EAAE;4BACzC,UAAU,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;yBAC/C;qBACF;;;;;;;;;aACF;;;;;;;;;QACD,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC7C,CAAC;IACH,kBAAC;AAAD,CAAC,AAlCD,IAkCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./custom-event";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|