@spscommerce/utils 5.13.0-ie → 5.14.0
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/lib/index.cjs.js +1 -2437
- package/lib/index.es.js +893 -2268
- package/package.json +5 -5
- package/vite.config.js +1 -1
- package/dist/out-tsc/array/flatten.d.ts +0 -1
- package/dist/out-tsc/array/flatten.js +0 -7
- package/dist/out-tsc/array/flatten.js.map +0 -1
- package/dist/out-tsc/array/flatten.spec.d.ts +0 -1
- package/dist/out-tsc/array/flatten.spec.js +0 -10
- package/dist/out-tsc/array/flatten.spec.js.map +0 -1
- package/dist/out-tsc/array/index.d.ts +0 -3
- package/dist/out-tsc/array/index.js +0 -4
- package/dist/out-tsc/array/index.js.map +0 -1
- package/dist/out-tsc/array/is-subset.d.ts +0 -4
- package/dist/out-tsc/array/is-subset.js +0 -41
- package/dist/out-tsc/array/is-subset.js.map +0 -1
- package/dist/out-tsc/array/is-subset.spec.d.ts +0 -1
- package/dist/out-tsc/array/is-subset.spec.js +0 -41
- package/dist/out-tsc/array/is-subset.spec.js.map +0 -1
- package/dist/out-tsc/array/range.d.ts +0 -5
- package/dist/out-tsc/array/range.js +0 -16
- package/dist/out-tsc/array/range.js.map +0 -1
- package/dist/out-tsc/array/range.spec.d.ts +0 -1
- package/dist/out-tsc/array/range.spec.js +0 -26
- package/dist/out-tsc/array/range.spec.js.map +0 -1
- package/dist/out-tsc/classes/custom-event.d.ts +0 -4
- package/dist/out-tsc/classes/custom-event.js +0 -87
- package/dist/out-tsc/classes/custom-event.js.map +0 -1
- package/dist/out-tsc/classes/index.d.ts +0 -1
- package/dist/out-tsc/classes/index.js +0 -2
- package/dist/out-tsc/classes/index.js.map +0 -1
- package/dist/out-tsc/data/doctypes.d.ts +0 -4
- package/dist/out-tsc/data/doctypes.js +0 -302
- package/dist/out-tsc/data/doctypes.js.map +0 -1
- package/dist/out-tsc/data/index.d.ts +0 -1
- package/dist/out-tsc/data/index.js +0 -2
- package/dist/out-tsc/data/index.js.map +0 -1
- package/dist/out-tsc/decorators/cast-to-number.d.ts +0 -5
- package/dist/out-tsc/decorators/cast-to-number.js +0 -29
- package/dist/out-tsc/decorators/cast-to-number.js.map +0 -1
- package/dist/out-tsc/decorators/debounced.broken_spec.d.ts +0 -0
- package/dist/out-tsc/decorators/debounced.broken_spec.js +0 -38
- package/dist/out-tsc/decorators/debounced.broken_spec.js.map +0 -1
- package/dist/out-tsc/decorators/debounced.d.ts +0 -11
- package/dist/out-tsc/decorators/debounced.js +0 -35
- package/dist/out-tsc/decorators/debounced.js.map +0 -1
- package/dist/out-tsc/decorators/index.d.ts +0 -5
- package/dist/out-tsc/decorators/index.js +0 -6
- package/dist/out-tsc/decorators/index.js.map +0 -1
- package/dist/out-tsc/decorators/locked-to-animation-frames.d.ts +0 -4
- package/dist/out-tsc/decorators/locked-to-animation-frames.js +0 -34
- package/dist/out-tsc/decorators/locked-to-animation-frames.js.map +0 -1
- 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 +0 -63
- package/dist/out-tsc/decorators/locked-to-animation-frames.spec.js.map +0 -1
- package/dist/out-tsc/decorators/simple-metadata-decorator-applicator.d.ts +0 -11
- package/dist/out-tsc/decorators/simple-metadata-decorator-applicator.js +0 -80
- package/dist/out-tsc/decorators/simple-metadata-decorator-applicator.js.map +0 -1
- package/dist/out-tsc/decorators/tick-delay.d.ts +0 -6
- package/dist/out-tsc/decorators/tick-delay.js +0 -31
- package/dist/out-tsc/decorators/tick-delay.js.map +0 -1
- package/dist/out-tsc/function/debounce.d.ts +0 -9
- package/dist/out-tsc/function/debounce.js +0 -102
- package/dist/out-tsc/function/debounce.js.map +0 -1
- package/dist/out-tsc/function/debounce.spec.d.ts +0 -1
- package/dist/out-tsc/function/debounce.spec.js +0 -150
- package/dist/out-tsc/function/debounce.spec.js.map +0 -1
- package/dist/out-tsc/function/debounced-function.interface.d.ts +0 -10
- package/dist/out-tsc/function/debounced-function.interface.js +0 -2
- package/dist/out-tsc/function/debounced-function.interface.js.map +0 -1
- package/dist/out-tsc/function/delayed-function.interface.d.ts +0 -10
- package/dist/out-tsc/function/delayed-function.interface.js +0 -2
- package/dist/out-tsc/function/delayed-function.interface.js.map +0 -1
- package/dist/out-tsc/function/index.d.ts +0 -6
- package/dist/out-tsc/function/index.js +0 -7
- package/dist/out-tsc/function/index.js.map +0 -1
- package/dist/out-tsc/function/lock-to-animation-frames.d.ts +0 -7
- package/dist/out-tsc/function/lock-to-animation-frames.js +0 -43
- package/dist/out-tsc/function/lock-to-animation-frames.js.map +0 -1
- 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 +0 -53
- package/dist/out-tsc/function/lock-to-animation-frames.spec.js.map +0 -1
- package/dist/out-tsc/function/on-next-tick.d.ts +0 -8
- package/dist/out-tsc/function/on-next-tick.js +0 -12
- package/dist/out-tsc/function/on-next-tick.js.map +0 -1
- package/dist/out-tsc/function/on-next-tick.spec.d.ts +0 -1
- package/dist/out-tsc/function/on-next-tick.spec.js +0 -13
- package/dist/out-tsc/function/on-next-tick.spec.js.map +0 -1
- package/dist/out-tsc/function/op.d.ts +0 -32
- package/dist/out-tsc/function/op.js +0 -34
- package/dist/out-tsc/function/op.js.map +0 -1
- package/dist/out-tsc/function/op.spec.d.ts +0 -1
- package/dist/out-tsc/function/op.spec.js +0 -94
- package/dist/out-tsc/function/op.spec.js.map +0 -1
- package/dist/out-tsc/index.d.ts +0 -9
- package/dist/out-tsc/index.js +0 -10
- package/dist/out-tsc/index.js.map +0 -1
- package/dist/out-tsc/number/constrain.d.ts +0 -7
- package/dist/out-tsc/number/constrain.js +0 -16
- package/dist/out-tsc/number/constrain.js.map +0 -1
- package/dist/out-tsc/number/decimal-round.d.ts +0 -7
- package/dist/out-tsc/number/decimal-round.js +0 -19
- package/dist/out-tsc/number/decimal-round.js.map +0 -1
- package/dist/out-tsc/number/decimal-round.spec.d.ts +0 -1
- package/dist/out-tsc/number/decimal-round.spec.js +0 -10
- package/dist/out-tsc/number/decimal-round.spec.js.map +0 -1
- package/dist/out-tsc/number/index.d.ts +0 -3
- package/dist/out-tsc/number/index.js +0 -4
- package/dist/out-tsc/number/index.js.map +0 -1
- package/dist/out-tsc/number/to-file-size-string.d.ts +0 -5
- package/dist/out-tsc/number/to-file-size-string.js +0 -24
- package/dist/out-tsc/number/to-file-size-string.js.map +0 -1
- package/dist/out-tsc/object/copy-property.d.ts +0 -6
- package/dist/out-tsc/object/copy-property.js +0 -9
- package/dist/out-tsc/object/copy-property.js.map +0 -1
- package/dist/out-tsc/object/copy-property.spec.d.ts +0 -1
- package/dist/out-tsc/object/copy-property.spec.js +0 -16
- package/dist/out-tsc/object/copy-property.spec.js.map +0 -1
- package/dist/out-tsc/object/crumble-path.d.ts +0 -6
- package/dist/out-tsc/object/crumble-path.js +0 -9
- package/dist/out-tsc/object/crumble-path.js.map +0 -1
- package/dist/out-tsc/object/crumble-path.spec.d.ts +0 -1
- package/dist/out-tsc/object/crumble-path.spec.js +0 -24
- package/dist/out-tsc/object/crumble-path.spec.js.map +0 -1
- package/dist/out-tsc/object/deep-freeze.d.ts +0 -1
- package/dist/out-tsc/object/deep-freeze.js +0 -36
- package/dist/out-tsc/object/deep-freeze.js.map +0 -1
- package/dist/out-tsc/object/deep-freeze.spec.d.ts +0 -1
- package/dist/out-tsc/object/deep-freeze.spec.js +0 -14
- package/dist/out-tsc/object/deep-freeze.spec.js.map +0 -1
- package/dist/out-tsc/object/diff.d.ts +0 -12
- package/dist/out-tsc/object/diff.js +0 -92
- package/dist/out-tsc/object/diff.js.map +0 -1
- package/dist/out-tsc/object/diff.spec.d.ts +0 -1
- package/dist/out-tsc/object/diff.spec.js +0 -40
- package/dist/out-tsc/object/diff.spec.js.map +0 -1
- package/dist/out-tsc/object/for-each-entry-deep.d.ts +0 -4
- package/dist/out-tsc/object/for-each-entry-deep.js +0 -38
- package/dist/out-tsc/object/for-each-entry-deep.js.map +0 -1
- package/dist/out-tsc/object/for-each-entry-deep.spec.d.ts +0 -1
- package/dist/out-tsc/object/for-each-entry-deep.spec.js +0 -24
- package/dist/out-tsc/object/for-each-entry-deep.spec.js.map +0 -1
- package/dist/out-tsc/object/for-each-nested-object.d.ts +0 -4
- package/dist/out-tsc/object/for-each-nested-object.js +0 -38
- package/dist/out-tsc/object/for-each-nested-object.js.map +0 -1
- package/dist/out-tsc/object/for-each-nested-object.spec.d.ts +0 -1
- package/dist/out-tsc/object/for-each-nested-object.spec.js +0 -46
- package/dist/out-tsc/object/for-each-nested-object.spec.js.map +0 -1
- package/dist/out-tsc/object/get-path.d.ts +0 -5
- package/dist/out-tsc/object/get-path.js +0 -67
- package/dist/out-tsc/object/get-path.js.map +0 -1
- package/dist/out-tsc/object/get-path.spec.d.ts +0 -1
- package/dist/out-tsc/object/get-path.spec.js +0 -44
- package/dist/out-tsc/object/get-path.spec.js.map +0 -1
- package/dist/out-tsc/object/index.d.ts +0 -13
- package/dist/out-tsc/object/index.js +0 -14
- package/dist/out-tsc/object/index.js.map +0 -1
- package/dist/out-tsc/object/merge-deep.d.ts +0 -4
- package/dist/out-tsc/object/merge-deep.js +0 -60
- package/dist/out-tsc/object/merge-deep.js.map +0 -1
- package/dist/out-tsc/object/merge-deep.spec.d.ts +0 -1
- package/dist/out-tsc/object/merge-deep.spec.js +0 -16
- package/dist/out-tsc/object/merge-deep.spec.js.map +0 -1
- package/dist/out-tsc/object/merge-properties-deep.d.ts +0 -4
- package/dist/out-tsc/object/merge-properties-deep.js +0 -61
- package/dist/out-tsc/object/merge-properties-deep.js.map +0 -1
- package/dist/out-tsc/object/merge-properties-deep.spec.d.ts +0 -1
- package/dist/out-tsc/object/merge-properties-deep.spec.js +0 -24
- package/dist/out-tsc/object/merge-properties-deep.spec.js.map +0 -1
- package/dist/out-tsc/object/omit.d.ts +0 -1
- package/dist/out-tsc/object/omit.js +0 -40
- package/dist/out-tsc/object/omit.js.map +0 -1
- package/dist/out-tsc/object/omit.spec.d.ts +0 -1
- package/dist/out-tsc/object/omit.spec.js +0 -10
- package/dist/out-tsc/object/omit.spec.js.map +0 -1
- package/dist/out-tsc/object/set-path.d.ts +0 -2
- package/dist/out-tsc/object/set-path.js +0 -45
- package/dist/out-tsc/object/set-path.js.map +0 -1
- package/dist/out-tsc/object/set-path.spec.d.ts +0 -1
- package/dist/out-tsc/object/set-path.spec.js +0 -36
- package/dist/out-tsc/object/set-path.spec.js.map +0 -1
- package/dist/out-tsc/object/traverse-path.d.ts +0 -2
- package/dist/out-tsc/object/traverse-path.js +0 -81
- package/dist/out-tsc/object/traverse-path.js.map +0 -1
- package/dist/out-tsc/object/values.d.ts +0 -2
- package/dist/out-tsc/object/values.js +0 -31
- package/dist/out-tsc/object/values.js.map +0 -1
- package/dist/out-tsc/object/values.spec.d.ts +0 -1
- package/dist/out-tsc/object/values.spec.js +0 -7
- package/dist/out-tsc/object/values.spec.js.map +0 -1
- package/dist/out-tsc/string/code.template-tag.d.ts +0 -2
- package/dist/out-tsc/string/code.template-tag.js +0 -38
- package/dist/out-tsc/string/code.template-tag.js.map +0 -1
- package/dist/out-tsc/string/index.d.ts +0 -3
- package/dist/out-tsc/string/index.js +0 -4
- package/dist/out-tsc/string/index.js.map +0 -1
- package/dist/out-tsc/string/parse-file-size.d.ts +0 -5
- package/dist/out-tsc/string/parse-file-size.js +0 -43
- package/dist/out-tsc/string/parse-file-size.js.map +0 -1
- package/dist/out-tsc/string/template.d.ts +0 -15
- package/dist/out-tsc/string/template.js +0 -28
- package/dist/out-tsc/string/template.js.map +0 -1
- package/dist/out-tsc/string/template.spec.d.ts +0 -1
- package/dist/out-tsc/string/template.spec.js +0 -39
- package/dist/out-tsc/string/template.spec.js.map +0 -1
- package/dist/out-tsc/typings.d.ts +0 -1
- package/dist/out-tsc/typings.js +0 -2
- package/dist/out-tsc/typings.js.map +0 -1
- package/rollup.config.js +0 -22
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/utils",
|
|
3
3
|
"description": "Utility items for frontend projects.",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.14.0",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/utils",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"lodash.padstart": "^4.6.1"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build": "pnpm run build:
|
|
26
|
-
"build:
|
|
27
|
-
"build:js": "rollup -c rollup.config.js",
|
|
25
|
+
"build": "pnpm run build:js && pnpm run build:types",
|
|
26
|
+
"build:js": "vite build",
|
|
28
27
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
|
|
29
28
|
"watch": "vite build --watch",
|
|
30
29
|
"clean": "git clean -fdX",
|
|
31
30
|
"pub": "pnpm pack && node ../../scripts/publish-package.js"
|
|
32
|
-
}
|
|
31
|
+
},
|
|
32
|
+
"readme": "[//]: # \"START_AUTOGENERATED\"\n\n## [@spscommerce/utils](https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/utils#readme)\n\n\n\n\n\nUtility items for frontend projects. \n \n ### Installation \n \n ```shell\nnpm install --save @spscommerce/utils\n```\n\n#### Peer Dependencies\n\n<div class=\"row\">\n <div class=\"col-5\"> \n <table class=\"sps-table\">\n <thead class=\"sps-table__head\">\n <tr class=\"sps-table__row\">\n <th class=\"sps-table__header\">\n <span class=\"sps-table__header-cell-body\"> \n Package\n </span>\n </th>\n <th class=\"sps-table__header text-right\">\n <span class=\"sps-table__header-cell-body\"> \n Version\n </span>\n </th>\n </tr>\n </thead>\n <tbody class=\"sps-table__body\">\n <tr class=\"sps-table__row\"><td class=\"sps-table__cell\"><a href=\"https://lodash.com/\">lodash.isempty</a></td><td class=\"sps-table__cell text-right\">^4.4.0</td></tr>\n<tr class=\"sps-table__row\"><td class=\"sps-table__cell\"><a href=\"https://lodash.com/\">lodash.isnil</a></td><td class=\"sps-table__cell text-right\">^4.0.0</td></tr>\n<tr class=\"sps-table__row\"><td class=\"sps-table__cell\"><a href=\"https://lodash.com/\">lodash.isplainobject</a></td><td class=\"sps-table__cell text-right\">^4.0.6</td></tr>\n<tr class=\"sps-table__row\"><td class=\"sps-table__cell\"><a href=\"https://lodash.com/\">lodash.padstart</a></td><td class=\"sps-table__cell text-right\">^4.6.1</td></tr>\n </tbody>\n </table>\n </div>\n <div class=\"col-7\">\n \n </div>\n</div>\n\n[//]: # \"END_AUTOGENERATED\"\n"
|
|
33
33
|
}
|
package/vite.config.js
CHANGED
|
@@ -7,7 +7,7 @@ import pkg from './package.json';
|
|
|
7
7
|
export default defineConfig({
|
|
8
8
|
build: {
|
|
9
9
|
lib: {
|
|
10
|
-
entry: path.resolve(__dirname, '
|
|
10
|
+
entry: path.resolve(__dirname, 'src/index.ts'),
|
|
11
11
|
formats: ['es', 'cjs'],
|
|
12
12
|
fileName: (format) => `index.${format}.js`,
|
|
13
13
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function flatten(arg: any): any;
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,87 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./custom-event";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|