@gtkx/utils 0.21.0 → 1.0.0-rc.2
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/README.md +173 -0
- package/dist/array/index-before-or-end.d.ts +15 -0
- package/dist/array/index-before-or-end.d.ts.map +1 -0
- package/dist/array/index-before-or-end.js +21 -0
- package/dist/array/index-before-or-end.js.map +1 -0
- package/dist/array/index.d.ts +6 -0
- package/dist/array/index.d.ts.map +1 -0
- package/dist/array/index.js +6 -0
- package/dist/array/index.js.map +1 -0
- package/dist/array/remove.d.ts +14 -0
- package/dist/array/remove.d.ts.map +1 -0
- package/dist/array/remove.js +19 -0
- package/dist/array/remove.js.map +1 -0
- package/dist/array/sort-strings-by.d.ts +15 -0
- package/dist/array/sort-strings-by.d.ts.map +1 -0
- package/dist/array/sort-strings-by.js +17 -0
- package/dist/array/sort-strings-by.js.map +1 -0
- package/dist/array/sort-strings.d.ts +12 -0
- package/dist/array/sort-strings.d.ts.map +1 -0
- package/dist/array/sort-strings.js +14 -0
- package/dist/array/sort-strings.js.map +1 -0
- package/dist/array/uniq-by.d.ts +18 -0
- package/dist/array/uniq-by.d.ts.map +1 -0
- package/dist/array/uniq-by.js +29 -0
- package/dist/array/uniq-by.js.map +1 -0
- package/dist/class/any-class.d.ts +8 -0
- package/dist/class/any-class.d.ts.map +1 -0
- package/dist/class/any-class.js +2 -0
- package/dist/class/any-class.js.map +1 -0
- package/dist/class/get-parent-class.d.ts +10 -0
- package/dist/class/get-parent-class.d.ts.map +1 -0
- package/dist/class/get-parent-class.js +12 -0
- package/dist/class/get-parent-class.js.map +1 -0
- package/dist/class/index.d.ts +4 -0
- package/dist/class/index.d.ts.map +1 -0
- package/dist/class/index.js +3 -0
- package/dist/class/index.js.map +1 -0
- package/dist/class/walk-class-chain.d.ts +13 -0
- package/dist/class/walk-class-chain.d.ts.map +1 -0
- package/dist/class/walk-class-chain.js +23 -0
- package/dist/class/walk-class-chain.js.map +1 -0
- package/dist/error/error-like.d.ts +6 -0
- package/dist/error/error-like.d.ts.map +1 -0
- package/dist/error/error-like.js +15 -0
- package/dist/error/error-like.js.map +1 -0
- package/dist/error/error-message.d.ts +13 -0
- package/dist/error/error-message.d.ts.map +1 -0
- package/dist/error/error-message.js +16 -0
- package/dist/error/error-message.js.map +1 -0
- package/dist/error/format-child-process-error.d.ts +12 -0
- package/dist/error/format-child-process-error.d.ts.map +1 -0
- package/dist/error/format-child-process-error.js +21 -0
- package/dist/error/format-child-process-error.js.map +1 -0
- package/dist/error/index.d.ts +4 -0
- package/dist/error/index.d.ts.map +1 -0
- package/dist/error/index.js +4 -0
- package/dist/error/index.js.map +1 -0
- package/dist/error/normalize-error.d.ts +13 -0
- package/dist/error/normalize-error.d.ts.map +1 -0
- package/dist/error/normalize-error.js +20 -0
- package/dist/error/normalize-error.js.map +1 -0
- package/dist/function/call-method.d.ts +3 -0
- package/dist/function/call-method.d.ts.map +1 -0
- package/dist/function/call-method.js +19 -0
- package/dist/function/call-method.js.map +1 -0
- package/dist/function/index.d.ts +2 -0
- package/dist/function/index.d.ts.map +1 -0
- package/dist/function/index.js +2 -0
- package/dist/function/index.js.map +1 -0
- package/dist/index.d.ts +13 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/log/create-logger.d.ts +15 -0
- package/dist/log/create-logger.d.ts.map +1 -0
- package/dist/log/create-logger.js +17 -0
- package/dist/log/create-logger.js.map +1 -0
- package/dist/log/default-logger.d.ts +36 -0
- package/dist/log/default-logger.d.ts.map +1 -0
- package/dist/log/default-logger.js +44 -0
- package/dist/log/default-logger.js.map +1 -0
- package/dist/log/index.d.ts +4 -0
- package/dist/log/index.d.ts.map +1 -0
- package/dist/log/index.js +4 -0
- package/dist/log/index.js.map +1 -0
- package/dist/log/logger.d.ts +64 -0
- package/dist/log/logger.d.ts.map +1 -0
- package/dist/log/logger.js +100 -0
- package/dist/log/logger.js.map +1 -0
- package/dist/map/get-or-insert.d.ts +23 -0
- package/dist/map/get-or-insert.d.ts.map +1 -0
- package/dist/map/get-or-insert.js +25 -0
- package/dist/map/get-or-insert.js.map +1 -0
- package/dist/map/index.d.ts +2 -0
- package/dist/map/index.d.ts.map +1 -0
- package/dist/map/index.js +2 -0
- package/dist/map/index.js.map +1 -0
- package/dist/object/index.d.ts +4 -0
- package/dist/object/index.d.ts.map +1 -0
- package/dist/object/index.js +4 -0
- package/dist/object/index.js.map +1 -0
- package/dist/object/omit.d.ts +15 -0
- package/dist/object/omit.d.ts.map +1 -0
- package/dist/object/omit.js +24 -0
- package/dist/object/omit.js.map +1 -0
- package/dist/object/pick-by.d.ts +15 -0
- package/dist/object/pick-by.d.ts.map +1 -0
- package/dist/object/pick-by.js +24 -0
- package/dist/object/pick-by.js.map +1 -0
- package/dist/object/structured-clone.d.ts +19 -0
- package/dist/object/structured-clone.d.ts.map +1 -0
- package/dist/object/structured-clone.js +28 -0
- package/dist/object/structured-clone.js.map +1 -0
- package/dist/predicate/are-object-keys-equal.d.ts +3 -0
- package/dist/predicate/are-object-keys-equal.d.ts.map +1 -0
- package/dist/predicate/are-object-keys-equal.js +9 -0
- package/dist/predicate/are-object-keys-equal.js.map +1 -0
- package/dist/predicate/index.d.ts +7 -0
- package/dist/predicate/index.d.ts.map +1 -0
- package/dist/predicate/index.js +7 -0
- package/dist/predicate/index.js.map +1 -0
- package/dist/predicate/is-deep-equal.d.ts +3 -0
- package/dist/predicate/is-deep-equal.d.ts.map +1 -0
- package/dist/predicate/is-deep-equal.js +35 -0
- package/dist/predicate/is-deep-equal.js.map +1 -0
- package/dist/predicate/is-plain-object.d.ts +17 -0
- package/dist/predicate/is-plain-object.d.ts.map +1 -0
- package/dist/predicate/is-plain-object.js +23 -0
- package/dist/predicate/is-plain-object.js.map +1 -0
- package/dist/predicate/is-record.d.ts +14 -0
- package/dist/predicate/is-record.d.ts.map +1 -0
- package/dist/predicate/is-record.js +16 -0
- package/dist/predicate/is-record.js.map +1 -0
- package/dist/predicate/is-same-array-by.d.ts +15 -0
- package/dist/predicate/is-same-array-by.d.ts.map +1 -0
- package/dist/predicate/is-same-array-by.js +20 -0
- package/dist/predicate/is-same-array-by.js.map +1 -0
- package/dist/predicate/is-same-array.d.ts +15 -0
- package/dist/predicate/is-same-array.d.ts.map +1 -0
- package/dist/predicate/is-same-array.js +18 -0
- package/dist/predicate/is-same-array.js.map +1 -0
- package/dist/predicate/is-shallow-equal.d.ts +3 -0
- package/dist/predicate/is-shallow-equal.d.ts.map +1 -0
- package/dist/predicate/is-shallow-equal.js +28 -0
- package/dist/predicate/is-shallow-equal.js.map +1 -0
- package/dist/process/exit-code-for-signal.d.ts +14 -0
- package/dist/process/exit-code-for-signal.d.ts.map +1 -0
- package/dist/process/exit-code-for-signal.js +19 -0
- package/dist/process/exit-code-for-signal.js.map +1 -0
- package/dist/process/index.d.ts +4 -0
- package/dist/process/index.d.ts.map +1 -0
- package/dist/process/index.js +4 -0
- package/dist/process/index.js.map +1 -0
- package/dist/process/install-graceful-shutdown.d.ts +16 -0
- package/dist/process/install-graceful-shutdown.d.ts.map +1 -0
- package/dist/process/install-graceful-shutdown.js +89 -0
- package/dist/process/install-graceful-shutdown.js.map +1 -0
- package/dist/process/resolve-executable.d.ts +14 -0
- package/dist/process/resolve-executable.d.ts.map +1 -0
- package/dist/process/resolve-executable.js +47 -0
- package/dist/process/resolve-executable.js.map +1 -0
- package/dist/set/drain.d.ts +11 -0
- package/dist/set/drain.d.ts.map +1 -0
- package/dist/set/drain.js +16 -0
- package/dist/set/drain.js.map +1 -0
- package/dist/set/index.d.ts +2 -0
- package/dist/set/index.d.ts.map +1 -0
- package/dist/set/index.js +2 -0
- package/dist/set/index.js.map +1 -0
- package/dist/source/index.d.ts +4 -0
- package/dist/source/index.d.ts.map +1 -0
- package/dist/source/index.js +4 -0
- package/dist/source/index.js.map +1 -0
- package/dist/source/sanitize-identifier.d.ts +14 -0
- package/dist/source/sanitize-identifier.d.ts.map +1 -0
- package/dist/source/sanitize-identifier.js +65 -0
- package/dist/source/sanitize-identifier.js.map +1 -0
- package/dist/source/source-string-literal.d.ts +13 -0
- package/dist/source/source-string-literal.d.ts.map +1 -0
- package/dist/source/source-string-literal.js +24 -0
- package/dist/source/source-string-literal.js.map +1 -0
- package/dist/source/to-camel-identifier.d.ts +13 -0
- package/dist/source/to-camel-identifier.d.ts.map +1 -0
- package/dist/source/to-camel-identifier.js +17 -0
- package/dist/source/to-camel-identifier.js.map +1 -0
- package/dist/string/camel-case.d.ts +17 -0
- package/dist/string/camel-case.d.ts.map +1 -0
- package/dist/string/camel-case.js +21 -0
- package/dist/string/camel-case.js.map +1 -0
- package/dist/string/index.d.ts +6 -0
- package/dist/string/index.d.ts.map +1 -0
- package/dist/string/index.js +6 -0
- package/dist/string/index.js.map +1 -0
- package/dist/string/kebab-case.d.ts +14 -0
- package/dist/string/kebab-case.d.ts.map +1 -0
- package/dist/string/kebab-case.js +16 -0
- package/dist/string/kebab-case.js.map +1 -0
- package/dist/string/lower-first.d.ts +13 -0
- package/dist/string/lower-first.d.ts.map +1 -0
- package/dist/string/lower-first.js +15 -0
- package/dist/string/lower-first.js.map +1 -0
- package/dist/string/pascal-case.d.ts +16 -0
- package/dist/string/pascal-case.d.ts.map +1 -0
- package/dist/string/pascal-case.js +20 -0
- package/dist/string/pascal-case.js.map +1 -0
- package/dist/string/upper-first.d.ts +13 -0
- package/dist/string/upper-first.d.ts.map +1 -0
- package/dist/string/upper-first.js +15 -0
- package/dist/string/upper-first.js.map +1 -0
- package/dist/string/word-segments.d.ts +3 -0
- package/dist/string/word-segments.d.ts.map +1 -0
- package/dist/string/word-segments.js +12 -0
- package/dist/string/word-segments.js.map +1 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +2 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/package-version.d.ts +12 -0
- package/dist/util/package-version.d.ts.map +1 -0
- package/dist/util/package-version.js +15 -0
- package/dist/util/package-version.js.map +1 -0
- package/package.json +18 -7
- package/src/array/index-before-or-end.ts +27 -0
- package/src/array/index.ts +5 -0
- package/src/array/remove.ts +20 -0
- package/src/array/sort-strings-by.ts +17 -0
- package/src/array/sort-strings.ts +14 -0
- package/src/array/uniq-by.ts +33 -0
- package/src/class/any-class.ts +10 -0
- package/src/class/get-parent-class.ts +15 -0
- package/src/class/index.ts +3 -0
- package/src/class/walk-class-chain.ts +29 -0
- package/src/error/error-like.ts +19 -0
- package/src/error/error-message.ts +17 -0
- package/src/error/format-child-process-error.ts +24 -0
- package/src/error/index.ts +3 -0
- package/src/error/normalize-error.ts +22 -0
- package/src/function/call-method.ts +22 -0
- package/src/function/index.ts +1 -0
- package/src/index.ts +13 -10
- package/src/log/create-logger.ts +18 -0
- package/src/log/default-logger.ts +49 -0
- package/src/log/index.ts +3 -0
- package/src/log/logger.ts +142 -0
- package/src/map/get-or-insert.ts +33 -0
- package/src/map/index.ts +1 -0
- package/src/object/index.ts +3 -0
- package/src/object/omit.ts +26 -0
- package/src/object/pick-by.ts +30 -0
- package/src/object/structured-clone.ts +31 -0
- package/src/predicate/are-object-keys-equal.ts +15 -0
- package/src/predicate/index.ts +6 -0
- package/src/predicate/is-deep-equal.ts +41 -0
- package/src/predicate/is-plain-object.ts +25 -0
- package/src/predicate/is-record.ts +16 -0
- package/src/predicate/is-same-array-by.ts +21 -0
- package/src/predicate/is-same-array.ts +19 -0
- package/src/predicate/is-shallow-equal.ts +32 -0
- package/src/process/exit-code-for-signal.ts +20 -0
- package/src/process/index.ts +3 -0
- package/src/process/install-graceful-shutdown.ts +126 -0
- package/src/process/resolve-executable.ts +57 -0
- package/src/set/drain.ts +17 -0
- package/src/set/index.ts +1 -0
- package/src/source/index.ts +3 -0
- package/src/source/sanitize-identifier.ts +66 -0
- package/src/source/source-string-literal.ts +27 -0
- package/src/source/to-camel-identifier.ts +18 -0
- package/src/string/camel-case.ts +22 -0
- package/src/string/index.ts +5 -0
- package/src/string/kebab-case.ts +18 -0
- package/src/string/lower-first.ts +15 -0
- package/src/string/pascal-case.ts +21 -0
- package/src/string/upper-first.ts +15 -0
- package/src/string/word-segments.ts +15 -0
- package/src/util/index.ts +1 -0
- package/src/util/package-version.ts +16 -0
- package/dist/class.d.ts +0 -16
- package/dist/class.d.ts.map +0 -1
- package/dist/class.js +0 -2
- package/dist/class.js.map +0 -1
- package/dist/collection.d.ts +0 -58
- package/dist/collection.d.ts.map +0 -1
- package/dist/collection.js +0 -98
- package/dist/collection.js.map +0 -1
- package/dist/error.d.ts +0 -13
- package/dist/error.d.ts.map +0 -1
- package/dist/error.js +0 -13
- package/dist/error.js.map +0 -1
- package/dist/graceful-shutdown.d.ts +0 -70
- package/dist/graceful-shutdown.d.ts.map +0 -1
- package/dist/graceful-shutdown.js +0 -94
- package/dist/graceful-shutdown.js.map +0 -1
- package/dist/source.d.ts +0 -34
- package/dist/source.d.ts.map +0 -1
- package/dist/source.js +0 -99
- package/dist/source.js.map +0 -1
- package/dist/string.d.ts +0 -59
- package/dist/string.d.ts.map +0 -1
- package/dist/string.js +0 -73
- package/dist/string.js.map +0 -1
- package/src/class.ts +0 -17
- package/src/collection.ts +0 -103
- package/src/error.ts +0 -12
- package/src/graceful-shutdown.ts +0 -141
- package/src/source.ts +0 -103
- package/src/string.ts +0 -74
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-or-insert.js","sourceRoot":"","sources":["../../src/map/get-or-insert.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,SAAS,WAAW,CAAO,GAAiB,EAAE,GAAM,EAAE,OAAsB;IACxE,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACf,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,CAAM,CAAC;IAC7B,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEpB,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,WAAW,EAAe,CAAC","sourcesContent":["type GetSet<K, V> = {\n get(key: K): V | undefined;\n set(key: K, value: V): unknown;\n has(key: K): boolean;\n};\n\n/**\n * Returns the value stored under `key`, or inserts and returns the value produced by `factory` when\n * the key is absent. Works with both `Map` and `WeakMap`, and caches a computed `undefined` value.\n *\n * @template K - The key type.\n * @template V - The value type.\n * @param map - The `Map` or `WeakMap` to read from and populate.\n * @param key - The key to look up.\n * @param factory - Produces the value to insert when `key` is absent; called at most once.\n * @returns The existing or newly-inserted value.\n *\n * @example\n * const counts = new Map<string, number[]>();\n * getOrInsert(counts, \"a\", () => []).push(1); // counts is Map { \"a\" => [1] }\n */\nfunction getOrInsert<K, V>(map: GetSet<K, V>, key: K, factory: (key: K) => V): V {\n if (map.has(key)) {\n return map.get(key) as V;\n }\n\n const value = factory(key);\n map.set(key, value);\n\n return value;\n}\n\nexport { getOrInsert, type GetSet };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/map/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/map/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { getOrInsert } from \"./get-or-insert.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/object/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/object/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { omit } from \"./omit.js\";\nexport { pickBy } from \"./pick-by.js\";\nexport { structuredClone } from \"./structured-clone.js\";\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new object holding every entry of `obj` except the named keys.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the source object.
|
|
5
|
+
* @template K - The keys to leave out.
|
|
6
|
+
* @param obj - The object to copy entries from.
|
|
7
|
+
* @param keys - The keys to leave out of the result.
|
|
8
|
+
* @returns A new object without the named keys.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* omit({ a: 1, b: 2 }, ["a"]); // { b: 2 }
|
|
12
|
+
*/
|
|
13
|
+
declare function omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
14
|
+
export { omit };
|
|
15
|
+
//# sourceMappingURL=omit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omit.d.ts","sourceRoot":"","sources":["../../src/object/omit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,iBAAS,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAWhF;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new object holding every entry of `obj` except the named keys.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the source object.
|
|
5
|
+
* @template K - The keys to leave out.
|
|
6
|
+
* @param obj - The object to copy entries from.
|
|
7
|
+
* @param keys - The keys to leave out of the result.
|
|
8
|
+
* @returns A new object without the named keys.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* omit({ a: 1, b: 2 }, ["a"]); // { b: 2 }
|
|
12
|
+
*/
|
|
13
|
+
function omit(obj, keys) {
|
|
14
|
+
const excluded = new Set(keys);
|
|
15
|
+
const result = {};
|
|
16
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
17
|
+
if (!excluded.has(key)) {
|
|
18
|
+
result[key] = value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
export { omit };
|
|
24
|
+
//# sourceMappingURL=omit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../src/object/omit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,SAAS,IAAI,CAAsC,GAAM,EAAE,IAAS;IAChE,MAAM,QAAQ,GAAqB,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACxB,CAAC;IACL,CAAC;IAED,OAAO,MAAoB,CAAC;AAChC,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAC","sourcesContent":["/**\n * Creates a new object holding every entry of `obj` except the named keys.\n *\n * @template T - The type of the source object.\n * @template K - The keys to leave out.\n * @param obj - The object to copy entries from.\n * @param keys - The keys to leave out of the result.\n * @returns A new object without the named keys.\n *\n * @example\n * omit({ a: 1, b: 2 }, [\"a\"]); // { b: 2 }\n */\nfunction omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const excluded: Set<PropertyKey> = new Set(keys);\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n if (!excluded.has(key)) {\n result[key] = value;\n }\n }\n\n return result as Omit<T, K>;\n}\n\nexport { omit };\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new object of the entries of `obj` that satisfy the predicate.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the source object.
|
|
5
|
+
* @param obj - The object to pick entries from.
|
|
6
|
+
* @param shouldPick - Called with each value and key; return `true` to keep the entry.
|
|
7
|
+
* @returns A new object holding only the entries the predicate kept.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* pickBy({ a: 1, b: 2 }, (value) => value > 1); // { b: 2 }
|
|
11
|
+
* pickBy({ a: 1, b: 2 }, (_value, key) => key !== "a"); // { b: 2 }
|
|
12
|
+
*/
|
|
13
|
+
declare function pickBy<T extends Record<string, unknown>>(obj: T, shouldPick: (value: T[keyof T], key: keyof T) => boolean): Partial<T>;
|
|
14
|
+
export { pickBy };
|
|
15
|
+
//# sourceMappingURL=pick-by.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pick-by.d.ts","sourceRoot":"","sources":["../../src/object/pick-by.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,iBAAS,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7C,GAAG,EAAE,CAAC,EACN,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,OAAO,GACzD,OAAO,CAAC,CAAC,CAAC,CAYZ;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new object of the entries of `obj` that satisfy the predicate.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the source object.
|
|
5
|
+
* @param obj - The object to pick entries from.
|
|
6
|
+
* @param shouldPick - Called with each value and key; return `true` to keep the entry.
|
|
7
|
+
* @returns A new object holding only the entries the predicate kept.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* pickBy({ a: 1, b: 2 }, (value) => value > 1); // { b: 2 }
|
|
11
|
+
* pickBy({ a: 1, b: 2 }, (_value, key) => key !== "a"); // { b: 2 }
|
|
12
|
+
*/
|
|
13
|
+
function pickBy(obj, shouldPick) {
|
|
14
|
+
const result = {};
|
|
15
|
+
for (const key of Object.keys(obj)) {
|
|
16
|
+
const value = obj[key];
|
|
17
|
+
if (shouldPick(value, key)) {
|
|
18
|
+
result[key] = value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
export { pickBy };
|
|
24
|
+
//# sourceMappingURL=pick-by.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pick-by.js","sourceRoot":"","sources":["../../src/object/pick-by.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,SAAS,MAAM,CACX,GAAM,EACN,UAAwD;IAExD,MAAM,MAAM,GAAe,EAAE,CAAC;IAE9B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAgB,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QAEvB,IAAI,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACxB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["/**\n * Creates a new object of the entries of `obj` that satisfy the predicate.\n *\n * @template T - The type of the source object.\n * @param obj - The object to pick entries from.\n * @param shouldPick - Called with each value and key; return `true` to keep the entry.\n * @returns A new object holding only the entries the predicate kept.\n *\n * @example\n * pickBy({ a: 1, b: 2 }, (value) => value > 1); // { b: 2 }\n * pickBy({ a: 1, b: 2 }, (_value, key) => key !== \"a\"); // { b: 2 }\n */\nfunction pickBy<T extends Record<string, unknown>>(\n obj: T,\n shouldPick: (value: T[keyof T], key: keyof T) => boolean,\n): Partial<T> {\n const result: Partial<T> = {};\n\n for (const key of Object.keys(obj) as (keyof T)[]) {\n const value = obj[key];\n\n if (shouldPick(value, key)) {\n result[key] = value;\n }\n }\n\n return result;\n}\n\nexport { pickBy };\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively copies arrays and plain objects, sharing every other value by reference. The result
|
|
3
|
+
* mirrors exactly the structure `isDeepEqual` traverses, so comparing a value against its earlier
|
|
4
|
+
* clone detects in-place mutations of the original. Unlike the global of the same name, class
|
|
5
|
+
* instances such as `Date` and `Map` are shared rather than copied, and no value is ever rejected.
|
|
6
|
+
*
|
|
7
|
+
* @template T - The type of the value.
|
|
8
|
+
* @param value - The value to clone.
|
|
9
|
+
* @returns A clone whose arrays and plain objects are fresh and whose other values are shared.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const source = { a: [{ b: 1 }] };
|
|
13
|
+
* const copy = structuredClone(source);
|
|
14
|
+
* source.a[0].b = 2;
|
|
15
|
+
* copy.a[0].b; // 1
|
|
16
|
+
*/
|
|
17
|
+
declare function structuredClone<T>(value: T): T;
|
|
18
|
+
export { structuredClone };
|
|
19
|
+
//# sourceMappingURL=structured-clone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structured-clone.d.ts","sourceRoot":"","sources":["../../src/object/structured-clone.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,iBAAS,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAUvC;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isPlainObject } from "../predicate/is-plain-object.js";
|
|
2
|
+
/**
|
|
3
|
+
* Recursively copies arrays and plain objects, sharing every other value by reference. The result
|
|
4
|
+
* mirrors exactly the structure `isDeepEqual` traverses, so comparing a value against its earlier
|
|
5
|
+
* clone detects in-place mutations of the original. Unlike the global of the same name, class
|
|
6
|
+
* instances such as `Date` and `Map` are shared rather than copied, and no value is ever rejected.
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type of the value.
|
|
9
|
+
* @param value - The value to clone.
|
|
10
|
+
* @returns A clone whose arrays and plain objects are fresh and whose other values are shared.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const source = { a: [{ b: 1 }] };
|
|
14
|
+
* const copy = structuredClone(source);
|
|
15
|
+
* source.a[0].b = 2;
|
|
16
|
+
* copy.a[0].b; // 1
|
|
17
|
+
*/
|
|
18
|
+
function structuredClone(value) {
|
|
19
|
+
if (Array.isArray(value)) {
|
|
20
|
+
return value.map((item) => structuredClone(item));
|
|
21
|
+
}
|
|
22
|
+
if (isPlainObject(value)) {
|
|
23
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, structuredClone(entry)]));
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
export { structuredClone };
|
|
28
|
+
//# sourceMappingURL=structured-clone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structured-clone.js","sourceRoot":"","sources":["../../src/object/structured-clone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE;;;;;;;;;;;;;;;GAeG;AACH,SAAS,eAAe,CAAI,KAAQ;IAChC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAa,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAM,CAAC;IACpE,CAAC;IAED,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAM,CAAC;IAC/G,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { isPlainObject } from \"../predicate/is-plain-object.js\";\n\n/**\n * Recursively copies arrays and plain objects, sharing every other value by reference. The result\n * mirrors exactly the structure `isDeepEqual` traverses, so comparing a value against its earlier\n * clone detects in-place mutations of the original. Unlike the global of the same name, class\n * instances such as `Date` and `Map` are shared rather than copied, and no value is ever rejected.\n *\n * @template T - The type of the value.\n * @param value - The value to clone.\n * @returns A clone whose arrays and plain objects are fresh and whose other values are shared.\n *\n * @example\n * const source = { a: [{ b: 1 }] };\n * const copy = structuredClone(source);\n * source.a[0].b = 2;\n * copy.a[0].b; // 1\n */\nfunction structuredClone<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map((item: unknown) => structuredClone(item)) as T;\n }\n\n if (isPlainObject(value)) {\n return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, structuredClone(entry)])) as T;\n }\n\n return value;\n}\n\nexport { structuredClone };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"are-object-keys-equal.d.ts","sourceRoot":"","sources":["../../src/predicate/are-object-keys-equal.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,kBAAkB,GACpB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1B,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,OAAO,KAClD,OAQF,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const areObjectKeysEqual = (a, b, isValueEqual) => {
|
|
2
|
+
const keysA = Object.keys(a);
|
|
3
|
+
if (keysA.length !== Object.keys(b).length) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
return keysA.every((key) => Object.hasOwn(b, key) && isValueEqual(a[key], b[key]));
|
|
7
|
+
};
|
|
8
|
+
export { areObjectKeysEqual };
|
|
9
|
+
//# sourceMappingURL=are-object-keys-equal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"are-object-keys-equal.js","sourceRoot":"","sources":["../../src/predicate/are-object-keys-equal.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,CACvB,CAA0B,EAC1B,CAA0B,EAC1B,YAAiD,EAC1C,EAAE;IACT,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAE7B,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACvF,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["const areObjectKeysEqual = (\n a: Record<string, unknown>,\n b: Record<string, unknown>,\n isValueEqual: (a: unknown, b: unknown) => boolean,\n): boolean => {\n const keysA = Object.keys(a);\n\n if (keysA.length !== Object.keys(b).length) {\n return false;\n }\n\n return keysA.every((key) => Object.hasOwn(b, key) && isValueEqual(a[key], b[key]));\n};\n\nexport { areObjectKeysEqual };\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { isDeepEqual } from "./is-deep-equal.js";
|
|
2
|
+
export { isPlainObject } from "./is-plain-object.js";
|
|
3
|
+
export { isRecord } from "./is-record.js";
|
|
4
|
+
export { isSameArrayBy } from "./is-same-array-by.js";
|
|
5
|
+
export { isSameArray } from "./is-same-array.js";
|
|
6
|
+
export { isShallowEqual } from "./is-shallow-equal.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/predicate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { isDeepEqual } from "./is-deep-equal.js";
|
|
2
|
+
export { isPlainObject } from "./is-plain-object.js";
|
|
3
|
+
export { isRecord } from "./is-record.js";
|
|
4
|
+
export { isSameArrayBy } from "./is-same-array-by.js";
|
|
5
|
+
export { isSameArray } from "./is-same-array.js";
|
|
6
|
+
export { isShallowEqual } from "./is-shallow-equal.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/predicate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { isDeepEqual } from \"./is-deep-equal.js\";\nexport { isPlainObject } from \"./is-plain-object.js\";\nexport { isRecord } from \"./is-record.js\";\nexport { isSameArrayBy } from \"./is-same-array-by.js\";\nexport { isSameArray } from \"./is-same-array.js\";\nexport { isShallowEqual } from \"./is-shallow-equal.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-deep-equal.d.ts","sourceRoot":"","sources":["../../src/predicate/is-deep-equal.ts"],"names":[],"mappings":"AAwBA,iBAAS,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAcpD;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { areObjectKeysEqual } from "./are-object-keys-equal.js";
|
|
2
|
+
import { isPlainObject } from "./is-plain-object.js";
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether two values are deeply equal: identical, arrays of the same length whose elements
|
|
5
|
+
* are deeply equal in order, or plain objects with the same own enumerable keys and deeply equal
|
|
6
|
+
* values. Values that are neither both arrays nor both plain objects are equal only when identical.
|
|
7
|
+
*
|
|
8
|
+
* @param a - The first value.
|
|
9
|
+
* @param b - The second value.
|
|
10
|
+
* @returns `true` when the values are deeply equal.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* isDeepEqual({ a: [1, { b: 2 }] }, { a: [1, { b: 2 }] }); // true
|
|
14
|
+
* isDeepEqual({ a: [1] }, { a: [2] }); // false
|
|
15
|
+
*/
|
|
16
|
+
const isDeepArrayEqual = (a, b) => {
|
|
17
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return a.every((item, index) => isDeepEqual(item, b[index]));
|
|
21
|
+
};
|
|
22
|
+
function isDeepEqual(a, b) {
|
|
23
|
+
if (a === b) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
27
|
+
return isDeepArrayEqual(a, b);
|
|
28
|
+
}
|
|
29
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
30
|
+
return areObjectKeysEqual(a, b, isDeepEqual);
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
export { isDeepEqual };
|
|
35
|
+
//# sourceMappingURL=is-deep-equal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-deep-equal.js","sourceRoot":"","sources":["../../src/predicate/is-deep-equal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAU,EAAE,CAAU,EAAW,EAAE;IACzD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,SAAS,WAAW,CAAC,CAAU,EAAE,CAAU;IACvC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,OAAO,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,aAAa,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,OAAO,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { areObjectKeysEqual } from \"./are-object-keys-equal.js\";\nimport { isPlainObject } from \"./is-plain-object.js\";\n\n/**\n * Checks whether two values are deeply equal: identical, arrays of the same length whose elements\n * are deeply equal in order, or plain objects with the same own enumerable keys and deeply equal\n * values. Values that are neither both arrays nor both plain objects are equal only when identical.\n *\n * @param a - The first value.\n * @param b - The second value.\n * @returns `true` when the values are deeply equal.\n *\n * @example\n * isDeepEqual({ a: [1, { b: 2 }] }, { a: [1, { b: 2 }] }); // true\n * isDeepEqual({ a: [1] }, { a: [2] }); // false\n */\nconst isDeepArrayEqual = (a: unknown, b: unknown): boolean => {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) {\n return false;\n }\n\n return a.every((item, index) => isDeepEqual(item, b[index]));\n};\n\nfunction isDeepEqual(a: unknown, b: unknown): boolean {\n if (a === b) {\n return true;\n }\n\n if (Array.isArray(a) || Array.isArray(b)) {\n return isDeepArrayEqual(a, b);\n }\n\n if (isPlainObject(a) && isPlainObject(b)) {\n return areObjectKeysEqual(a, b, isDeepEqual);\n }\n\n return false;\n}\n\nexport { isDeepEqual };\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a value is a plain object, i.e. one whose prototype is `Object.prototype` or `null`.
|
|
3
|
+
*
|
|
4
|
+
* Class instances, arrays, and other exotic objects return `false`.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The value to test.
|
|
7
|
+
* @returns `true` when `value` is a plain object.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* isPlainObject({ a: 1 }); // true
|
|
11
|
+
* isPlainObject(Object.create(null)); // true
|
|
12
|
+
* isPlainObject([1, 2]); // false
|
|
13
|
+
* isPlainObject(new Date()); // false
|
|
14
|
+
*/
|
|
15
|
+
declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
16
|
+
export { isPlainObject };
|
|
17
|
+
//# sourceMappingURL=is-plain-object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-plain-object.d.ts","sourceRoot":"","sources":["../../src/predicate/is-plain-object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,iBAAS,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQvE;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a value is a plain object, i.e. one whose prototype is `Object.prototype` or `null`.
|
|
3
|
+
*
|
|
4
|
+
* Class instances, arrays, and other exotic objects return `false`.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The value to test.
|
|
7
|
+
* @returns `true` when `value` is a plain object.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* isPlainObject({ a: 1 }); // true
|
|
11
|
+
* isPlainObject(Object.create(null)); // true
|
|
12
|
+
* isPlainObject([1, 2]); // false
|
|
13
|
+
* isPlainObject(new Date()); // false
|
|
14
|
+
*/
|
|
15
|
+
function isPlainObject(value) {
|
|
16
|
+
if (typeof value !== "object" || value === null) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const proto = Object.getPrototypeOf(value);
|
|
20
|
+
return proto === Object.prototype || proto === null;
|
|
21
|
+
}
|
|
22
|
+
export { isPlainObject };
|
|
23
|
+
//# sourceMappingURL=is-plain-object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-plain-object.js","sourceRoot":"","sources":["../../src/predicate/is-plain-object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,SAAS,aAAa,CAAC,KAAc;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,KAAK,GAAY,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAEpD,OAAO,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AACxD,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["/**\n * Checks whether a value is a plain object, i.e. one whose prototype is `Object.prototype` or `null`.\n *\n * Class instances, arrays, and other exotic objects return `false`.\n *\n * @param value - The value to test.\n * @returns `true` when `value` is a plain object.\n *\n * @example\n * isPlainObject({ a: 1 }); // true\n * isPlainObject(Object.create(null)); // true\n * isPlainObject([1, 2]); // false\n * isPlainObject(new Date()); // false\n */\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const proto: unknown = Object.getPrototypeOf(value);\n\n return proto === Object.prototype || proto === null;\n}\n\nexport { isPlainObject };\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a value is a non-null object (including arrays and class instances, excluding `null`).
|
|
3
|
+
*
|
|
4
|
+
* @param value - The value to test.
|
|
5
|
+
* @returns `true` when `value` is a non-null object.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* isRecord({ a: 1 }); // true
|
|
9
|
+
* isRecord(null); // false
|
|
10
|
+
* isRecord("x"); // false
|
|
11
|
+
*/
|
|
12
|
+
declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
13
|
+
export { isRecord };
|
|
14
|
+
//# sourceMappingURL=is-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-record.d.ts","sourceRoot":"","sources":["../../src/predicate/is-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAElE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a value is a non-null object (including arrays and class instances, excluding `null`).
|
|
3
|
+
*
|
|
4
|
+
* @param value - The value to test.
|
|
5
|
+
* @returns `true` when `value` is a non-null object.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* isRecord({ a: 1 }); // true
|
|
9
|
+
* isRecord(null); // false
|
|
10
|
+
* isRecord("x"); // false
|
|
11
|
+
*/
|
|
12
|
+
function isRecord(value) {
|
|
13
|
+
return typeof value === "object" && value !== null;
|
|
14
|
+
}
|
|
15
|
+
export { isRecord };
|
|
16
|
+
//# sourceMappingURL=is-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-record.js","sourceRoot":"","sources":["../../src/predicate/is-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,SAAS,QAAQ,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACvD,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["/**\n * Checks whether a value is a non-null object (including arrays and class instances, excluding `null`).\n *\n * @param value - The value to test.\n * @returns `true` when `value` is a non-null object.\n *\n * @example\n * isRecord({ a: 1 }); // true\n * isRecord(null); // false\n * isRecord(\"x\"); // false\n */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nexport { isRecord };\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether two arrays have the same length and elements the comparator treats as equal, in order.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the array elements.
|
|
5
|
+
* @param a - The first array.
|
|
6
|
+
* @param b - The second array.
|
|
7
|
+
* @param isEqual - Compares elements at the same index; return `true` when they are equal.
|
|
8
|
+
* @returns `true` when the arrays are element-wise equal under `isEqual`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* isSameArrayBy([{ id: 1 }], [{ id: 1 }], (x, y) => x.id === y.id); // true
|
|
12
|
+
*/
|
|
13
|
+
declare function isSameArrayBy<T>(a: T[], b: T[], isEqual: (x: T, y: T) => boolean): boolean;
|
|
14
|
+
export { isSameArrayBy };
|
|
15
|
+
//# sourceMappingURL=is-same-array-by.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-same-array-by.d.ts","sourceRoot":"","sources":["../../src/predicate/is-same-array-by.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,iBAAS,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO,CAMnF;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether two arrays have the same length and elements the comparator treats as equal, in order.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the array elements.
|
|
5
|
+
* @param a - The first array.
|
|
6
|
+
* @param b - The second array.
|
|
7
|
+
* @param isEqual - Compares elements at the same index; return `true` when they are equal.
|
|
8
|
+
* @returns `true` when the arrays are element-wise equal under `isEqual`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* isSameArrayBy([{ id: 1 }], [{ id: 1 }], (x, y) => x.id === y.id); // true
|
|
12
|
+
*/
|
|
13
|
+
function isSameArrayBy(a, b, isEqual) {
|
|
14
|
+
if (a.length !== b.length) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return a.every((item, index) => isEqual(item, b[index]));
|
|
18
|
+
}
|
|
19
|
+
export { isSameArrayBy };
|
|
20
|
+
//# sourceMappingURL=is-same-array-by.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-same-array-by.js","sourceRoot":"","sources":["../../src/predicate/is-same-array-by.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,SAAS,aAAa,CAAI,CAAM,EAAE,CAAM,EAAE,OAAgC;IACtE,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAM,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["/**\n * Checks whether two arrays have the same length and elements the comparator treats as equal, in order.\n *\n * @template T - The type of the array elements.\n * @param a - The first array.\n * @param b - The second array.\n * @param isEqual - Compares elements at the same index; return `true` when they are equal.\n * @returns `true` when the arrays are element-wise equal under `isEqual`.\n *\n * @example\n * isSameArrayBy([{ id: 1 }], [{ id: 1 }], (x, y) => x.id === y.id); // true\n */\nfunction isSameArrayBy<T>(a: T[], b: T[], isEqual: (x: T, y: T) => boolean): boolean {\n if (a.length !== b.length) {\n return false;\n }\n\n return a.every((item, index) => isEqual(item, b[index] as T));\n}\n\nexport { isSameArrayBy };\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether two arrays have the same length and strictly equal (`===`) elements in order.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the array elements.
|
|
5
|
+
* @param a - The first array.
|
|
6
|
+
* @param b - The second array.
|
|
7
|
+
* @returns `true` when the arrays are element-wise strictly equal.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* isSameArray([1, 2], [1, 2]); // true
|
|
11
|
+
* isSameArray([1, 2], [2, 1]); // false
|
|
12
|
+
*/
|
|
13
|
+
declare function isSameArray<T>(a: T[], b: T[]): boolean;
|
|
14
|
+
export { isSameArray };
|
|
15
|
+
//# sourceMappingURL=is-same-array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-same-array.d.ts","sourceRoot":"","sources":["../../src/predicate/is-same-array.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,iBAAS,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAE/C;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isSameArrayBy } from "./is-same-array-by.js";
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether two arrays have the same length and strictly equal (`===`) elements in order.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of the array elements.
|
|
6
|
+
* @param a - The first array.
|
|
7
|
+
* @param b - The second array.
|
|
8
|
+
* @returns `true` when the arrays are element-wise strictly equal.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* isSameArray([1, 2], [1, 2]); // true
|
|
12
|
+
* isSameArray([1, 2], [2, 1]); // false
|
|
13
|
+
*/
|
|
14
|
+
function isSameArray(a, b) {
|
|
15
|
+
return isSameArrayBy(a, b, (x, y) => x === y);
|
|
16
|
+
}
|
|
17
|
+
export { isSameArray };
|
|
18
|
+
//# sourceMappingURL=is-same-array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-same-array.js","sourceRoot":"","sources":["../../src/predicate/is-same-array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,SAAS,WAAW,CAAI,CAAM,EAAE,CAAM;IAClC,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { isSameArrayBy } from \"./is-same-array-by.js\";\n\n/**\n * Checks whether two arrays have the same length and strictly equal (`===`) elements in order.\n *\n * @template T - The type of the array elements.\n * @param a - The first array.\n * @param b - The second array.\n * @returns `true` when the arrays are element-wise strictly equal.\n *\n * @example\n * isSameArray([1, 2], [1, 2]); // true\n * isSameArray([1, 2], [2, 1]); // false\n */\nfunction isSameArray<T>(a: T[], b: T[]): boolean {\n return isSameArrayBy(a, b, (x, y) => x === y);\n}\n\nexport { isSameArray };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-shallow-equal.d.ts","sourceRoot":"","sources":["../../src/predicate/is-shallow-equal.ts"],"names":[],"mappings":"AAmBA,iBAAS,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAUvD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { areObjectKeysEqual } from "./are-object-keys-equal.js";
|
|
2
|
+
import { isPlainObject } from "./is-plain-object.js";
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether two values are shallowly equal: identical, or plain objects with the same own
|
|
5
|
+
* enumerable keys and strictly equal (`===`) values. Values that are not both plain objects are
|
|
6
|
+
* equal only when identical.
|
|
7
|
+
*
|
|
8
|
+
* @param a - The first value.
|
|
9
|
+
* @param b - The second value.
|
|
10
|
+
* @returns `true` when the values are shallowly equal.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* isShallowEqual({ a: 1 }, { a: 1 }); // true
|
|
14
|
+
* isShallowEqual({ a: 1 }, { a: 2 }); // false
|
|
15
|
+
* isShallowEqual(3, 3); // true
|
|
16
|
+
*/
|
|
17
|
+
const isStrictEqual = (a, b) => a === b;
|
|
18
|
+
function isShallowEqual(a, b) {
|
|
19
|
+
if (a === b) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
23
|
+
return areObjectKeysEqual(a, b, isStrictEqual);
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
export { isShallowEqual };
|
|
28
|
+
//# sourceMappingURL=is-shallow-equal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-shallow-equal.js","sourceRoot":"","sources":["../../src/predicate/is-shallow-equal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,aAAa,GAAG,CAAC,CAAU,EAAE,CAAU,EAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AAEnE,SAAS,cAAc,CAAC,CAAU,EAAE,CAAU;IAC1C,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,aAAa,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,OAAO,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { areObjectKeysEqual } from \"./are-object-keys-equal.js\";\nimport { isPlainObject } from \"./is-plain-object.js\";\n\n/**\n * Checks whether two values are shallowly equal: identical, or plain objects with the same own\n * enumerable keys and strictly equal (`===`) values. Values that are not both plain objects are\n * equal only when identical.\n *\n * @param a - The first value.\n * @param b - The second value.\n * @returns `true` when the values are shallowly equal.\n *\n * @example\n * isShallowEqual({ a: 1 }, { a: 1 }); // true\n * isShallowEqual({ a: 1 }, { a: 2 }); // false\n * isShallowEqual(3, 3); // true\n */\nconst isStrictEqual = (a: unknown, b: unknown): boolean => a === b;\n\nfunction isShallowEqual(a: unknown, b: unknown): boolean {\n if (a === b) {\n return true;\n }\n\n if (isPlainObject(a) && isPlainObject(b)) {\n return areObjectKeysEqual(a, b, isStrictEqual);\n }\n\n return false;\n}\n\nexport { isShallowEqual };\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps a terminating signal to its conventional process exit code (130 for `SIGINT`, 143 otherwise),
|
|
3
|
+
* or 0 when no signal is given.
|
|
4
|
+
*
|
|
5
|
+
* @param signal - The signal that triggered termination, or `null`.
|
|
6
|
+
* @returns The conventional exit code for the signal.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* exitCodeForSignal("SIGINT"); // 130
|
|
10
|
+
* exitCodeForSignal(null); // 0
|
|
11
|
+
*/
|
|
12
|
+
declare function exitCodeForSignal(signal: NodeJS.Signals | null): number;
|
|
13
|
+
export { exitCodeForSignal };
|
|
14
|
+
//# sourceMappingURL=exit-code-for-signal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit-code-for-signal.d.ts","sourceRoot":"","sources":["../../src/process/exit-code-for-signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,iBAAS,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,GAAG,MAAM,CAMhE;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps a terminating signal to its conventional process exit code (130 for `SIGINT`, 143 otherwise),
|
|
3
|
+
* or 0 when no signal is given.
|
|
4
|
+
*
|
|
5
|
+
* @param signal - The signal that triggered termination, or `null`.
|
|
6
|
+
* @returns The conventional exit code for the signal.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* exitCodeForSignal("SIGINT"); // 130
|
|
10
|
+
* exitCodeForSignal(null); // 0
|
|
11
|
+
*/
|
|
12
|
+
function exitCodeForSignal(signal) {
|
|
13
|
+
if (!signal) {
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
return signal === "SIGINT" ? 130 : 143;
|
|
17
|
+
}
|
|
18
|
+
export { exitCodeForSignal };
|
|
19
|
+
//# sourceMappingURL=exit-code-for-signal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit-code-for-signal.js","sourceRoot":"","sources":["../../src/process/exit-code-for-signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,SAAS,iBAAiB,CAAC,MAA6B;IACpD,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,CAAC,CAAC;IACb,CAAC;IAED,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC3C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["/**\n * Maps a terminating signal to its conventional process exit code (130 for `SIGINT`, 143 otherwise),\n * or 0 when no signal is given.\n *\n * @param signal - The signal that triggered termination, or `null`.\n * @returns The conventional exit code for the signal.\n *\n * @example\n * exitCodeForSignal(\"SIGINT\"); // 130\n * exitCodeForSignal(null); // 0\n */\nfunction exitCodeForSignal(signal: NodeJS.Signals | null): number {\n if (!signal) {\n return 0;\n }\n\n return signal === \"SIGINT\" ? 130 : 143;\n}\n\nexport { exitCodeForSignal };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/process/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/process/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { exitCodeForSignal } from \"./exit-code-for-signal.js\";\nexport { installGracefulShutdown } from \"./install-graceful-shutdown.js\";\nexport { resolveExecutable } from \"./resolve-executable.js\";\n"]}
|