@gtkx/utils 1.0.0-rc.3 → 1.0.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/README.md +8 -9
- package/dist/array/index-before-or-end.d.ts +0 -12
- package/dist/array/index-before-or-end.d.ts.map +1 -1
- package/dist/array/index-before-or-end.js +0 -12
- package/dist/array/index-before-or-end.js.map +1 -1
- package/dist/array/index.d.ts +5 -5
- package/dist/array/index.js.map +1 -1
- package/dist/array/remove.d.ts +0 -11
- package/dist/array/remove.d.ts.map +1 -1
- package/dist/array/remove.js +0 -11
- package/dist/array/remove.js.map +1 -1
- package/dist/array/sort-strings-by.d.ts +0 -12
- package/dist/array/sort-strings-by.d.ts.map +1 -1
- package/dist/array/sort-strings-by.js +0 -12
- package/dist/array/sort-strings-by.js.map +1 -1
- package/dist/array/sort-strings.d.ts +0 -9
- package/dist/array/sort-strings.d.ts.map +1 -1
- package/dist/array/sort-strings.js +0 -9
- package/dist/array/sort-strings.js.map +1 -1
- package/dist/array/uniq-by.d.ts +0 -15
- package/dist/array/uniq-by.d.ts.map +1 -1
- package/dist/array/uniq-by.js +0 -15
- package/dist/array/uniq-by.js.map +1 -1
- package/dist/class/any-class.d.ts +2 -3
- package/dist/class/any-class.d.ts.map +1 -1
- package/dist/class/any-class.js.map +1 -1
- package/dist/class/get-parent-class.d.ts +1 -7
- package/dist/class/get-parent-class.d.ts.map +1 -1
- package/dist/class/get-parent-class.js +0 -6
- package/dist/class/get-parent-class.js.map +1 -1
- package/dist/class/index.d.ts +3 -3
- package/dist/class/index.js.map +1 -1
- package/dist/class/walk-class-chain.d.ts +1 -10
- package/dist/class/walk-class-chain.d.ts.map +1 -1
- package/dist/class/walk-class-chain.js +0 -9
- package/dist/class/walk-class-chain.js.map +1 -1
- package/dist/error/error-like.js.map +1 -1
- package/dist/error/error-message.d.ts +0 -10
- package/dist/error/error-message.d.ts.map +1 -1
- package/dist/error/error-message.js +0 -10
- package/dist/error/error-message.js.map +1 -1
- package/dist/error/format-child-process-error.d.ts +0 -9
- package/dist/error/format-child-process-error.d.ts.map +1 -1
- package/dist/error/format-child-process-error.js +0 -9
- package/dist/error/format-child-process-error.js.map +1 -1
- package/dist/error/index.d.ts +3 -3
- package/dist/error/index.js.map +1 -1
- package/dist/error/normalize-error.d.ts +0 -10
- package/dist/error/normalize-error.d.ts.map +1 -1
- package/dist/error/normalize-error.js +0 -10
- package/dist/error/normalize-error.js.map +1 -1
- package/dist/index.d.ts +12 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/log/create-logger.d.ts +1 -12
- package/dist/log/create-logger.d.ts.map +1 -1
- package/dist/log/create-logger.js +0 -11
- package/dist/log/create-logger.js.map +1 -1
- package/dist/log/default-logger.d.ts +4 -30
- package/dist/log/default-logger.d.ts.map +1 -1
- package/dist/log/default-logger.js +3 -29
- package/dist/log/default-logger.js.map +1 -1
- package/dist/log/index.d.ts +5 -3
- package/dist/log/index.d.ts.map +1 -1
- package/dist/log/index.js +3 -1
- package/dist/log/index.js.map +1 -1
- package/dist/log/logger.d.ts +2 -43
- package/dist/log/logger.d.ts.map +1 -1
- package/dist/log/logger.js +3 -34
- package/dist/log/logger.js.map +1 -1
- package/dist/map/get-or-insert.d.ts +1 -16
- package/dist/map/get-or-insert.d.ts.map +1 -1
- package/dist/map/get-or-insert.js +0 -15
- package/dist/map/get-or-insert.js.map +1 -1
- package/dist/map/index.d.ts +1 -1
- package/dist/map/index.js.map +1 -1
- package/dist/object/index.d.ts +3 -3
- package/dist/object/index.js.map +1 -1
- package/dist/object/omit.d.ts +0 -12
- package/dist/object/omit.d.ts.map +1 -1
- package/dist/object/omit.js +0 -12
- package/dist/object/omit.js.map +1 -1
- package/dist/object/pick-by.d.ts +0 -12
- package/dist/object/pick-by.d.ts.map +1 -1
- package/dist/object/pick-by.js +0 -12
- package/dist/object/pick-by.js.map +1 -1
- package/dist/object/structured-clone.d.ts +0 -16
- package/dist/object/structured-clone.d.ts.map +1 -1
- package/dist/object/structured-clone.js +0 -16
- package/dist/object/structured-clone.js.map +1 -1
- package/dist/predicate/index.d.ts +6 -6
- package/dist/predicate/index.js.map +1 -1
- package/dist/predicate/is-deep-equal.d.ts.map +1 -1
- package/dist/predicate/is-deep-equal.js +0 -13
- package/dist/predicate/is-deep-equal.js.map +1 -1
- package/dist/predicate/is-plain-object.d.ts +0 -14
- package/dist/predicate/is-plain-object.d.ts.map +1 -1
- package/dist/predicate/is-plain-object.js +0 -14
- package/dist/predicate/is-plain-object.js.map +1 -1
- package/dist/predicate/is-record.d.ts +0 -11
- package/dist/predicate/is-record.d.ts.map +1 -1
- package/dist/predicate/is-record.js +0 -11
- package/dist/predicate/is-record.js.map +1 -1
- package/dist/predicate/is-same-array-by.d.ts +0 -12
- package/dist/predicate/is-same-array-by.d.ts.map +1 -1
- package/dist/predicate/is-same-array-by.js +0 -12
- package/dist/predicate/is-same-array-by.js.map +1 -1
- package/dist/predicate/is-same-array.d.ts +0 -12
- package/dist/predicate/is-same-array.d.ts.map +1 -1
- package/dist/predicate/is-same-array.js +0 -12
- package/dist/predicate/is-same-array.js.map +1 -1
- package/dist/predicate/is-shallow-equal.d.ts.map +1 -1
- package/dist/predicate/is-shallow-equal.js +0 -14
- package/dist/predicate/is-shallow-equal.js.map +1 -1
- package/dist/process/exit-code-for-signal.d.ts +0 -11
- package/dist/process/exit-code-for-signal.d.ts.map +1 -1
- package/dist/process/exit-code-for-signal.js +0 -11
- package/dist/process/exit-code-for-signal.js.map +1 -1
- package/dist/process/index.d.ts +4 -3
- package/dist/process/index.d.ts.map +1 -1
- package/dist/process/index.js +2 -1
- package/dist/process/index.js.map +1 -1
- package/dist/process/install-graceful-shutdown.d.ts +1 -7
- package/dist/process/install-graceful-shutdown.d.ts.map +1 -1
- package/dist/process/install-graceful-shutdown.js +7 -13
- package/dist/process/install-graceful-shutdown.js.map +1 -1
- package/dist/process/kill-marked-processes.d.ts +4 -0
- package/dist/process/kill-marked-processes.d.ts.map +1 -0
- package/dist/process/kill-marked-processes.js +38 -0
- package/dist/process/kill-marked-processes.js.map +1 -0
- package/dist/process/process-guard.d.ts +2 -0
- package/dist/process/process-guard.d.ts.map +1 -0
- package/dist/process/process-guard.js +16 -0
- package/dist/process/process-guard.js.map +1 -0
- package/dist/process/resolve-executable.d.ts +2 -12
- package/dist/process/resolve-executable.d.ts.map +1 -1
- package/dist/process/resolve-executable.js +6 -14
- package/dist/process/resolve-executable.js.map +1 -1
- package/dist/process/spawn-with-parent-death-signal.d.ts +8 -0
- package/dist/process/spawn-with-parent-death-signal.d.ts.map +1 -0
- package/dist/process/spawn-with-parent-death-signal.js +50 -0
- package/dist/process/spawn-with-parent-death-signal.js.map +1 -0
- package/dist/set/drain.d.ts +0 -8
- package/dist/set/drain.d.ts.map +1 -1
- package/dist/set/drain.js +0 -8
- package/dist/set/drain.js.map +1 -1
- package/dist/set/index.d.ts +1 -1
- package/dist/set/index.js.map +1 -1
- package/dist/source/index.d.ts +3 -3
- package/dist/source/index.js.map +1 -1
- package/dist/source/sanitize-identifier.d.ts +0 -11
- package/dist/source/sanitize-identifier.d.ts.map +1 -1
- package/dist/source/sanitize-identifier.js +0 -11
- package/dist/source/sanitize-identifier.js.map +1 -1
- package/dist/source/source-string-literal.d.ts +0 -10
- package/dist/source/source-string-literal.d.ts.map +1 -1
- package/dist/source/source-string-literal.js +0 -10
- package/dist/source/source-string-literal.js.map +1 -1
- package/dist/source/to-camel-identifier.d.ts +0 -10
- package/dist/source/to-camel-identifier.d.ts.map +1 -1
- package/dist/source/to-camel-identifier.js +0 -10
- package/dist/source/to-camel-identifier.js.map +1 -1
- package/dist/string/camel-case.d.ts +0 -14
- package/dist/string/camel-case.d.ts.map +1 -1
- package/dist/string/camel-case.js +0 -14
- package/dist/string/camel-case.js.map +1 -1
- package/dist/string/index.d.ts +5 -5
- package/dist/string/index.js.map +1 -1
- package/dist/string/kebab-case.d.ts +0 -11
- package/dist/string/kebab-case.d.ts.map +1 -1
- package/dist/string/kebab-case.js +0 -11
- package/dist/string/kebab-case.js.map +1 -1
- package/dist/string/lower-first.d.ts +0 -10
- package/dist/string/lower-first.d.ts.map +1 -1
- package/dist/string/lower-first.js +0 -10
- package/dist/string/lower-first.js.map +1 -1
- package/dist/string/pascal-case.d.ts +0 -13
- package/dist/string/pascal-case.d.ts.map +1 -1
- package/dist/string/pascal-case.js +0 -13
- package/dist/string/pascal-case.js.map +1 -1
- package/dist/string/upper-first.d.ts +0 -10
- package/dist/string/upper-first.d.ts.map +1 -1
- package/dist/string/upper-first.js +0 -10
- package/dist/string/upper-first.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/package-version.d.ts +1 -10
- package/dist/util/package-version.d.ts.map +1 -1
- package/dist/util/package-version.js +2 -11
- package/dist/util/package-version.js.map +1 -1
- package/package.json +1 -1
- package/src/array/index-before-or-end.ts +0 -12
- package/src/array/index.ts +5 -5
- package/src/array/remove.ts +0 -11
- package/src/array/sort-strings-by.ts +0 -12
- package/src/array/sort-strings.ts +0 -9
- package/src/array/uniq-by.ts +0 -15
- package/src/class/any-class.ts +2 -3
- package/src/class/get-parent-class.ts +1 -7
- package/src/class/index.ts +3 -3
- package/src/class/walk-class-chain.ts +2 -11
- package/src/error/error-like.ts +1 -1
- package/src/error/error-message.ts +1 -11
- package/src/error/format-child-process-error.ts +2 -11
- package/src/error/index.ts +3 -3
- package/src/error/normalize-error.ts +2 -12
- package/src/index.ts +12 -13
- package/src/log/create-logger.ts +1 -12
- package/src/log/default-logger.ts +4 -30
- package/src/log/index.ts +5 -3
- package/src/log/logger.ts +4 -45
- package/src/map/get-or-insert.ts +1 -16
- package/src/map/index.ts +1 -1
- package/src/object/index.ts +3 -3
- package/src/object/omit.ts +0 -12
- package/src/object/pick-by.ts +0 -12
- package/src/object/structured-clone.ts +1 -17
- package/src/predicate/index.ts +6 -6
- package/src/predicate/is-deep-equal.ts +2 -15
- package/src/predicate/is-plain-object.ts +0 -14
- package/src/predicate/is-record.ts +0 -11
- package/src/predicate/is-same-array-by.ts +0 -12
- package/src/predicate/is-same-array.ts +1 -13
- package/src/predicate/is-shallow-equal.ts +2 -16
- package/src/process/exit-code-for-signal.ts +0 -11
- package/src/process/index.ts +4 -3
- package/src/process/install-graceful-shutdown.ts +12 -18
- package/src/process/kill-marked-processes.ts +44 -0
- package/src/process/process-guard.ts +20 -0
- package/src/process/resolve-executable.ts +7 -14
- package/src/process/spawn-with-parent-death-signal.ts +74 -0
- package/src/set/drain.ts +0 -8
- package/src/set/index.ts +1 -1
- package/src/source/index.ts +3 -3
- package/src/source/sanitize-identifier.ts +0 -11
- package/src/source/source-string-literal.ts +0 -10
- package/src/source/to-camel-identifier.ts +2 -12
- package/src/string/camel-case.ts +2 -16
- package/src/string/index.ts +5 -5
- package/src/string/kebab-case.ts +0 -11
- package/src/string/lower-first.ts +0 -10
- package/src/string/pascal-case.ts +2 -15
- package/src/string/upper-first.ts +0 -10
- package/src/util/index.ts +1 -1
- package/src/util/package-version.ts +2 -11
- package/dist/function/call-method.d.ts +0 -3
- package/dist/function/call-method.d.ts.map +0 -1
- package/dist/function/call-method.js +0 -19
- package/dist/function/call-method.js.map +0 -1
- package/dist/function/index.d.ts +0 -2
- package/dist/function/index.d.ts.map +0 -1
- package/dist/function/index.js +0 -2
- package/dist/function/index.js.map +0 -1
- package/src/function/call-method.ts +0 -22
- package/src/function/index.ts +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
export * from "./array/index.
|
|
2
|
-
export * from "./class/index.
|
|
3
|
-
export * from "./error/index.
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./util/index.js";
|
|
1
|
+
export * from "./array/index.ts";
|
|
2
|
+
export * from "./class/index.ts";
|
|
3
|
+
export * from "./error/index.ts";
|
|
4
|
+
export * from "./log/index.ts";
|
|
5
|
+
export * from "./map/index.ts";
|
|
6
|
+
export * from "./object/index.ts";
|
|
7
|
+
export * from "./predicate/index.ts";
|
|
8
|
+
export * from "./process/index.ts";
|
|
9
|
+
export * from "./set/index.ts";
|
|
10
|
+
export * from "./source/index.ts";
|
|
11
|
+
export * from "./string/index.ts";
|
|
12
|
+
export * from "./util/index.ts";
|
|
14
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./array/index.ts\";\nexport * from \"./class/index.ts\";\nexport * from \"./error/index.ts\";\nexport * from \"./log/index.ts\";\nexport * from \"./map/index.ts\";\nexport * from \"./object/index.ts\";\nexport * from \"./predicate/index.ts\";\nexport * from \"./process/index.ts\";\nexport * from \"./set/index.ts\";\nexport * from \"./source/index.ts\";\nexport * from \"./string/index.ts\";\nexport * from \"./util/index.ts\";\n"]}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import { Logger, type LoggerOptions } from "./logger.
|
|
2
|
-
/**
|
|
3
|
-
* Creates a {@link Logger} scoped to the given namespace.
|
|
4
|
-
*
|
|
5
|
-
* @param namespace - Namespace added to the log prefix and matched against debug configuration.
|
|
6
|
-
* @param options - Further logger options, excluding the namespace.
|
|
7
|
-
* @returns A new namespaced logger.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* const log = createLogger("react");
|
|
11
|
-
* log.info("mounted");
|
|
12
|
-
*/
|
|
1
|
+
import { Logger, type LoggerOptions } from "./logger.ts";
|
|
13
2
|
declare function createLogger(namespace: string, options?: Omit<LoggerOptions, "namespace">): Logger;
|
|
14
3
|
export { createLogger };
|
|
15
4
|
//# sourceMappingURL=create-logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-logger.d.ts","sourceRoot":"","sources":["../../src/log/create-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzD
|
|
1
|
+
{"version":3,"file":"create-logger.d.ts","sourceRoot":"","sources":["../../src/log/create-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzD,iBAAS,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,IAAI,CAAC,aAAa,EAAE,WAAW,CAAM,GAAG,MAAM,CAE/F;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
import { Logger } from "./logger.js";
|
|
2
|
-
/**
|
|
3
|
-
* Creates a {@link Logger} scoped to the given namespace.
|
|
4
|
-
*
|
|
5
|
-
* @param namespace - Namespace added to the log prefix and matched against debug configuration.
|
|
6
|
-
* @param options - Further logger options, excluding the namespace.
|
|
7
|
-
* @returns A new namespaced logger.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* const log = createLogger("react");
|
|
11
|
-
* log.info("mounted");
|
|
12
|
-
*/
|
|
13
2
|
function createLogger(namespace, options = {}) {
|
|
14
3
|
return new Logger({ ...options, namespace });
|
|
15
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-logger.js","sourceRoot":"","sources":["../../src/log/create-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,aAAa,CAAC;AAEzD
|
|
1
|
+
{"version":3,"file":"create-logger.js","sourceRoot":"","sources":["../../src/log/create-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,aAAa,CAAC;AAEzD,SAAS,YAAY,CAAC,SAAiB,EAAE,UAA4C,EAAE;IACnF,OAAO,IAAI,MAAM,CAAC,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { Logger, type LoggerOptions } from \"./logger.ts\";\n\nfunction createLogger(namespace: string, options: Omit<LoggerOptions, \"namespace\"> = {}): Logger {\n return new Logger({ ...options, namespace });\n}\n\nexport { createLogger };\n"]}
|
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
import { Logger } from "./logger.
|
|
2
|
-
/**
|
|
3
|
-
* The default namespace-less {@link Logger} backing the module-level {@link info}, {@link warn},
|
|
4
|
-
* {@link error}, and {@link debug} functions.
|
|
5
|
-
*/
|
|
1
|
+
import { Logger } from "./logger.ts";
|
|
6
2
|
declare const logger: Logger;
|
|
7
|
-
/**
|
|
8
|
-
* Writes an informational line through the shared {@link logger}.
|
|
9
|
-
*
|
|
10
|
-
* @param message - The message text.
|
|
11
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
12
|
-
*/
|
|
13
3
|
declare function info(message: string, ...rest: unknown[]): void;
|
|
14
|
-
/**
|
|
15
|
-
* Writes a warning line through the shared {@link logger}.
|
|
16
|
-
*
|
|
17
|
-
* @param message - The message text.
|
|
18
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
19
|
-
*/
|
|
20
4
|
declare function warn(message: string, ...rest: unknown[]): void;
|
|
21
|
-
/**
|
|
22
|
-
* Writes an error line through the shared {@link logger}.
|
|
23
|
-
*
|
|
24
|
-
* @param message - The message text.
|
|
25
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
26
|
-
*/
|
|
27
5
|
declare function error(message: string, ...rest: unknown[]): void;
|
|
28
|
-
/**
|
|
29
|
-
* Writes a debug line through the shared {@link logger} when debug output is enabled.
|
|
30
|
-
*
|
|
31
|
-
* @param message - The message text.
|
|
32
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
33
|
-
*/
|
|
34
6
|
declare function debug(message: string, ...rest: unknown[]): void;
|
|
35
|
-
export { logger, info, warn, error
|
|
7
|
+
export { logger, info, warn, error };
|
|
8
|
+
/** @internal */
|
|
9
|
+
export { debug };
|
|
36
10
|
//# sourceMappingURL=default-logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-logger.d.ts","sourceRoot":"","sources":["../../src/log/default-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC
|
|
1
|
+
{"version":3,"file":"default-logger.d.ts","sourceRoot":"","sources":["../../src/log/default-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,QAAA,MAAM,MAAM,EAAE,MAAqB,CAAC;AAEpC,iBAAS,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAEvD;AAED,iBAAS,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAEvD;AAED,iBAAS,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAExD;AAED,iBAAS,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAExD;AAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACrC,gBAAgB;AAChB,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1,44 +1,18 @@
|
|
|
1
1
|
import { Logger } from "./logger.js";
|
|
2
|
-
/**
|
|
3
|
-
* The default namespace-less {@link Logger} backing the module-level {@link info}, {@link warn},
|
|
4
|
-
* {@link error}, and {@link debug} functions.
|
|
5
|
-
*/
|
|
6
2
|
const logger = new Logger();
|
|
7
|
-
/**
|
|
8
|
-
* Writes an informational line through the shared {@link logger}.
|
|
9
|
-
*
|
|
10
|
-
* @param message - The message text.
|
|
11
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
12
|
-
*/
|
|
13
3
|
function info(message, ...rest) {
|
|
14
4
|
logger.info(message, ...rest);
|
|
15
5
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Writes a warning line through the shared {@link logger}.
|
|
18
|
-
*
|
|
19
|
-
* @param message - The message text.
|
|
20
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
21
|
-
*/
|
|
22
6
|
function warn(message, ...rest) {
|
|
23
7
|
logger.warn(message, ...rest);
|
|
24
8
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Writes an error line through the shared {@link logger}.
|
|
27
|
-
*
|
|
28
|
-
* @param message - The message text.
|
|
29
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
30
|
-
*/
|
|
31
9
|
function error(message, ...rest) {
|
|
32
10
|
logger.error(message, ...rest);
|
|
33
11
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Writes a debug line through the shared {@link logger} when debug output is enabled.
|
|
36
|
-
*
|
|
37
|
-
* @param message - The message text.
|
|
38
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
39
|
-
*/
|
|
40
12
|
function debug(message, ...rest) {
|
|
41
13
|
logger.debug(message, ...rest);
|
|
42
14
|
}
|
|
43
|
-
export { logger, info, warn, error
|
|
15
|
+
export { logger, info, warn, error };
|
|
16
|
+
/** @internal */
|
|
17
|
+
export { debug };
|
|
44
18
|
//# sourceMappingURL=default-logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-logger.js","sourceRoot":"","sources":["../../src/log/default-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC
|
|
1
|
+
{"version":3,"file":"default-logger.js","sourceRoot":"","sources":["../../src/log/default-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,MAAM,GAAW,IAAI,MAAM,EAAE,CAAC;AAEpC,SAAS,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;IAC7C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;IAC7C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;IAC9C,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;IAC9C,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACrC,gBAAgB;AAChB,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["import { Logger } from \"./logger.ts\";\n\nconst logger: Logger = new Logger();\n\nfunction info(message: string, ...rest: unknown[]): void {\n logger.info(message, ...rest);\n}\n\nfunction warn(message: string, ...rest: unknown[]): void {\n logger.warn(message, ...rest);\n}\n\nfunction error(message: string, ...rest: unknown[]): void {\n logger.error(message, ...rest);\n}\n\nfunction debug(message: string, ...rest: unknown[]): void {\n logger.debug(message, ...rest);\n}\n\nexport { logger, info, warn, error };\n/** @internal */\nexport { debug };\n"]}
|
package/dist/log/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { createLogger } from "./create-logger.
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
export { createLogger } from "./create-logger.ts";
|
|
2
|
+
export { error, info, logger, warn } from "./default-logger.ts";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export { debug } from "./default-logger.ts";
|
|
5
|
+
export { Logger, type OutputStream } from "./logger.ts";
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/log/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChE,gBAAgB;AAChB,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/log/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { createLogger } from "./create-logger.js";
|
|
2
|
-
export {
|
|
2
|
+
export { error, info, logger, warn } from "./default-logger.js";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export { debug } from "./default-logger.js";
|
|
3
5
|
export { Logger } from "./logger.js";
|
|
4
6
|
//# sourceMappingURL=index.js.map
|
package/dist/log/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChE,gBAAgB;AAChB,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC","sourcesContent":["export { createLogger } from \"./create-logger.ts\";\nexport { error, info, logger, warn } from \"./default-logger.ts\";\n/** @internal */\nexport { debug } from \"./default-logger.ts\";\nexport { Logger, type OutputStream } from \"./logger.ts\";\n"]}
|
package/dist/log/logger.d.ts
CHANGED
|
@@ -1,63 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal writable-stream shape a {@link Logger} writes formatted lines to.
|
|
3
|
-
*/
|
|
4
1
|
type OutputStream = {
|
|
5
2
|
write(chunk: string): unknown;
|
|
6
|
-
/** Whether the stream is a terminal, used to decide if colored output is emitted. */
|
|
7
3
|
isTTY?: boolean | undefined;
|
|
8
4
|
};
|
|
9
|
-
/**
|
|
10
|
-
* Options for constructing a {@link Logger}.
|
|
11
|
-
*/
|
|
12
5
|
type LoggerOptions = {
|
|
13
|
-
/** Namespace appended to the log prefix and matched against debug configuration. */
|
|
14
6
|
namespace?: string | undefined;
|
|
15
|
-
/** Stream to write log lines to; defaults to `process.stderr`. */
|
|
16
7
|
stream?: OutputStream | undefined;
|
|
17
|
-
|
|
18
|
-
debugEnabled?: boolean | undefined;
|
|
8
|
+
isDebugEnabled?: boolean | undefined;
|
|
19
9
|
};
|
|
20
|
-
/**
|
|
21
|
-
* Writes prefixed, optionally colored log lines to an output stream, with debug lines gated by
|
|
22
|
-
* command-line and environment configuration.
|
|
23
|
-
*/
|
|
24
10
|
declare class Logger {
|
|
25
11
|
private stream;
|
|
26
12
|
private prefix;
|
|
27
|
-
private
|
|
13
|
+
private isDebugEnabled;
|
|
28
14
|
private colors;
|
|
29
|
-
/**
|
|
30
|
-
* @param options - Namespace, target stream, and debug configuration for the logger.
|
|
31
|
-
*/
|
|
32
15
|
constructor(options?: LoggerOptions);
|
|
33
16
|
private write;
|
|
34
|
-
/**
|
|
35
|
-
* Writes an informational line.
|
|
36
|
-
*
|
|
37
|
-
* @param message - The message text.
|
|
38
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
39
|
-
*/
|
|
40
17
|
info(message: string, ...rest: unknown[]): void;
|
|
41
|
-
/**
|
|
42
|
-
* Writes a line marked as a warning.
|
|
43
|
-
*
|
|
44
|
-
* @param message - The message text.
|
|
45
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
46
|
-
*/
|
|
47
18
|
warn(message: string, ...rest: unknown[]): void;
|
|
48
|
-
/**
|
|
49
|
-
* Writes a line marked as an error.
|
|
50
|
-
*
|
|
51
|
-
* @param message - The message text.
|
|
52
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
53
|
-
*/
|
|
54
19
|
error(message: string, ...rest: unknown[]): void;
|
|
55
|
-
/**
|
|
56
|
-
* Writes a line only when debug output is enabled for this logger.
|
|
57
|
-
*
|
|
58
|
-
* @param message - The message text.
|
|
59
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
60
|
-
*/
|
|
61
20
|
debug(message: string, ...rest: unknown[]): void;
|
|
62
21
|
}
|
|
63
22
|
export { Logger, type OutputStream, type LoggerOptions };
|
package/dist/log/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/log/logger.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/log/logger.ts"],"names":[],"mappings":"AAIA,KAAK,YAAY,GAAG;IAChB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,KAAK,aAAa,GAAG;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IAClC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC,CAAC;AAgDF,cAAM,MAAM;IACR,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,MAAM,CAAS;gBAEX,OAAO,GAAE,aAAkB;IAOvC,OAAO,CAAC,KAAK;IAKb,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAOnD;AAED,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,CAAC"}
|
package/dist/log/logger.js
CHANGED
|
@@ -34,63 +34,32 @@ function isDebugEnabled(namespace, argv, env) {
|
|
|
34
34
|
function getPrefix(namespace) {
|
|
35
35
|
return namespace === undefined ? BASE_PREFIX : `[gtkx:${namespace}]`;
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Writes prefixed, optionally colored log lines to an output stream, with debug lines gated by
|
|
39
|
-
* command-line and environment configuration.
|
|
40
|
-
*/
|
|
41
37
|
class Logger {
|
|
42
38
|
stream;
|
|
43
39
|
prefix;
|
|
44
|
-
|
|
40
|
+
isDebugEnabled;
|
|
45
41
|
colors;
|
|
46
|
-
/**
|
|
47
|
-
* @param options - Namespace, target stream, and debug configuration for the logger.
|
|
48
|
-
*/
|
|
49
42
|
constructor(options = {}) {
|
|
50
43
|
this.stream = options.stream ?? process.stderr;
|
|
51
44
|
this.prefix = getPrefix(options.namespace);
|
|
52
|
-
this.
|
|
45
|
+
this.isDebugEnabled = options.isDebugEnabled ?? isDebugEnabled(options.namespace, process.argv, process.env);
|
|
53
46
|
this.colors = getColors(this.stream);
|
|
54
47
|
}
|
|
55
48
|
write(message, rest) {
|
|
56
49
|
const suffix = rest.length === 0 ? "" : ` ${rest.map((value) => formatValue(value)).join(" ")}`;
|
|
57
50
|
this.stream.write(`${this.prefix} ${message}${suffix}\n`);
|
|
58
51
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Writes an informational line.
|
|
61
|
-
*
|
|
62
|
-
* @param message - The message text.
|
|
63
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
64
|
-
*/
|
|
65
52
|
info(message, ...rest) {
|
|
66
53
|
this.write(message, rest);
|
|
67
54
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Writes a line marked as a warning.
|
|
70
|
-
*
|
|
71
|
-
* @param message - The message text.
|
|
72
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
73
|
-
*/
|
|
74
55
|
warn(message, ...rest) {
|
|
75
56
|
this.write(`${this.colors.yellow("warn")} ${message}`, rest);
|
|
76
57
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Writes a line marked as an error.
|
|
79
|
-
*
|
|
80
|
-
* @param message - The message text.
|
|
81
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
82
|
-
*/
|
|
83
58
|
error(message, ...rest) {
|
|
84
59
|
this.write(`${this.colors.red("error")} ${message}`, rest);
|
|
85
60
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Writes a line only when debug output is enabled for this logger.
|
|
88
|
-
*
|
|
89
|
-
* @param message - The message text.
|
|
90
|
-
* @param rest - Extra values appended after the message, formatted for display.
|
|
91
|
-
*/
|
|
92
61
|
debug(message, ...rest) {
|
|
93
|
-
if (!this.
|
|
62
|
+
if (!this.isDebugEnabled) {
|
|
94
63
|
return;
|
|
95
64
|
}
|
|
96
65
|
this.write(message, rest);
|
package/dist/log/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/log/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/log/logger.ts"],"names":[],"mappings":"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","sourcesContent":["import pc from \"picocolors\";\n\ntype Colors = ReturnType<typeof pc.createColors>;\n\ntype OutputStream = {\n write(chunk: string): unknown;\n isTTY?: boolean | undefined;\n};\n\ntype LoggerOptions = {\n namespace?: string | undefined;\n stream?: OutputStream | undefined;\n isDebugEnabled?: boolean | undefined;\n};\n\nconst BASE_PREFIX = \"[gtkx]\";\n\nfunction getColors(stream: OutputStream): Colors {\n return pc.createColors(pc.isColorSupported && stream.isTTY === true);\n}\n\nfunction formatValue(value: unknown): string {\n if (typeof value === \"string\") {\n return value;\n }\n\n if (value instanceof Error) {\n return value.stack ?? value.message;\n }\n\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\nfunction isDebugEnabled(namespace: string | undefined, argv: string[], env: NodeJS.ProcessEnv): boolean {\n if (argv.includes(\"--debug\")) {\n return true;\n }\n\n const spec = env.GTKX_DEBUG;\n\n if (!spec) {\n return false;\n }\n\n const names = new Set(spec.split(/[\\s,]+/).filter((name) => name.length > 0));\n\n if (names.has(\"1\") || names.has(\"*\")) {\n return true;\n }\n\n return namespace !== undefined && names.has(namespace);\n}\n\nfunction getPrefix(namespace: string | undefined): string {\n return namespace === undefined ? BASE_PREFIX : `[gtkx:${namespace}]`;\n}\n\nclass Logger {\n private stream: OutputStream;\n private prefix: string;\n private isDebugEnabled: boolean;\n private colors: Colors;\n\n constructor(options: LoggerOptions = {}) {\n this.stream = options.stream ?? process.stderr;\n this.prefix = getPrefix(options.namespace);\n this.isDebugEnabled = options.isDebugEnabled ?? isDebugEnabled(options.namespace, process.argv, process.env);\n this.colors = getColors(this.stream);\n }\n\n private write(message: string, rest: unknown[]): void {\n const suffix = rest.length === 0 ? \"\" : ` ${rest.map((value) => formatValue(value)).join(\" \")}`;\n this.stream.write(`${this.prefix} ${message}${suffix}\\n`);\n }\n\n info(message: string, ...rest: unknown[]): void {\n this.write(message, rest);\n }\n\n warn(message: string, ...rest: unknown[]): void {\n this.write(`${this.colors.yellow(\"warn\")} ${message}`, rest);\n }\n\n error(message: string, ...rest: unknown[]): void {\n this.write(`${this.colors.red(\"error\")} ${message}`, rest);\n }\n\n debug(message: string, ...rest: unknown[]): void {\n if (!this.isDebugEnabled) {\n return;\n }\n\n this.write(message, rest);\n }\n}\n\nexport { Logger, type OutputStream, type LoggerOptions };\n"]}
|
|
@@ -3,21 +3,6 @@ type GetSet<K, V> = {
|
|
|
3
3
|
set(key: K, value: V): unknown;
|
|
4
4
|
has(key: K): boolean;
|
|
5
5
|
};
|
|
6
|
-
/**
|
|
7
|
-
* Returns the value stored under `key`, or inserts and returns the value produced by `factory` when
|
|
8
|
-
* the key is absent. Works with both `Map` and `WeakMap`, and caches a computed `undefined` value.
|
|
9
|
-
*
|
|
10
|
-
* @template K - The key type.
|
|
11
|
-
* @template V - The value type.
|
|
12
|
-
* @param map - The `Map` or `WeakMap` to read from and populate.
|
|
13
|
-
* @param key - The key to look up.
|
|
14
|
-
* @param factory - Produces the value to insert when `key` is absent; called at most once.
|
|
15
|
-
* @returns The existing or newly-inserted value.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* const counts = new Map<string, number[]>();
|
|
19
|
-
* getOrInsert(counts, "a", () => []).push(1); // counts is Map { "a" => [1] }
|
|
20
|
-
*/
|
|
21
6
|
declare function getOrInsert<K, V>(map: GetSet<K, V>, key: K, factory: (key: K) => V): V;
|
|
22
|
-
export { getOrInsert
|
|
7
|
+
export { getOrInsert };
|
|
23
8
|
//# sourceMappingURL=get-or-insert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-or-insert.d.ts","sourceRoot":"","sources":["../../src/map/get-or-insert.ts"],"names":[],"mappings":"AAAA,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI;IAChB,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;IAC/B,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"get-or-insert.d.ts","sourceRoot":"","sources":["../../src/map/get-or-insert.ts"],"names":[],"mappings":"AAAA,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI;IAChB,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;IAC/B,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,iBAAS,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAS/E;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the value stored under `key`, or inserts and returns the value produced by `factory` when
|
|
3
|
-
* the key is absent. Works with both `Map` and `WeakMap`, and caches a computed `undefined` value.
|
|
4
|
-
*
|
|
5
|
-
* @template K - The key type.
|
|
6
|
-
* @template V - The value type.
|
|
7
|
-
* @param map - The `Map` or `WeakMap` to read from and populate.
|
|
8
|
-
* @param key - The key to look up.
|
|
9
|
-
* @param factory - Produces the value to insert when `key` is absent; called at most once.
|
|
10
|
-
* @returns The existing or newly-inserted value.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* const counts = new Map<string, number[]>();
|
|
14
|
-
* getOrInsert(counts, "a", () => []).push(1); // counts is Map { "a" => [1] }
|
|
15
|
-
*/
|
|
16
1
|
function getOrInsert(map, key, factory) {
|
|
17
2
|
if (map.has(key)) {
|
|
18
3
|
return map.get(key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-or-insert.js","sourceRoot":"","sources":["../../src/map/get-or-insert.ts"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"get-or-insert.js","sourceRoot":"","sources":["../../src/map/get-or-insert.ts"],"names":[],"mappings":"AAMA,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\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 };\n"]}
|
package/dist/map/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getOrInsert } from "./get-or-insert.
|
|
1
|
+
export { getOrInsert } from "./get-or-insert.ts";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/map/index.js.map
CHANGED
|
@@ -1 +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.
|
|
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.ts\";\n"]}
|
package/dist/object/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { omit } from "./omit.
|
|
2
|
-
export { pickBy } from "./pick-by.
|
|
3
|
-
export { structuredClone } from "./structured-clone.
|
|
1
|
+
export { omit } from "./omit.ts";
|
|
2
|
+
export { pickBy } from "./pick-by.ts";
|
|
3
|
+
export { structuredClone } from "./structured-clone.ts";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/object/index.js.map
CHANGED
|
@@ -1 +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.
|
|
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.ts\";\nexport { pickBy } from \"./pick-by.ts\";\nexport { structuredClone } from \"./structured-clone.ts\";\n"]}
|
package/dist/object/omit.d.ts
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
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
1
|
declare function omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
14
2
|
export { omit };
|
|
15
3
|
//# sourceMappingURL=omit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.d.ts","sourceRoot":"","sources":["../../src/object/omit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"omit.d.ts","sourceRoot":"","sources":["../../src/object/omit.ts"],"names":[],"mappings":"AAAA,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"}
|
package/dist/object/omit.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
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
1
|
function omit(obj, keys) {
|
|
14
2
|
const excluded = new Set(keys);
|
|
15
3
|
const result = {};
|
package/dist/object/omit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../src/object/omit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../src/object/omit.ts"],"names":[],"mappings":"AAAA,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":["function 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"]}
|
package/dist/object/pick-by.d.ts
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
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
1
|
declare function pickBy<T extends Record<string, unknown>>(obj: T, shouldPick: (value: T[keyof T], key: keyof T) => boolean): Partial<T>;
|
|
14
2
|
export { pickBy };
|
|
15
3
|
//# sourceMappingURL=pick-by.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick-by.d.ts","sourceRoot":"","sources":["../../src/object/pick-by.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pick-by.d.ts","sourceRoot":"","sources":["../../src/object/pick-by.ts"],"names":[],"mappings":"AAAA,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"}
|
package/dist/object/pick-by.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
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
1
|
function pickBy(obj, shouldPick) {
|
|
14
2
|
const result = {};
|
|
15
3
|
for (const key of Object.keys(obj)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick-by.js","sourceRoot":"","sources":["../../src/object/pick-by.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pick-by.js","sourceRoot":"","sources":["../../src/object/pick-by.ts"],"names":[],"mappings":"AAAA,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":["function 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"]}
|
|
@@ -1,19 +1,3 @@
|
|
|
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
1
|
declare function structuredClone<T>(value: T): T;
|
|
18
2
|
export { structuredClone };
|
|
19
3
|
//# sourceMappingURL=structured-clone.d.ts.map
|