@gtkx/utils 1.0.0-rc.2 → 1.0.0-rc.4
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 +4 -5
- 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 +0 -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 +0 -15
- 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 +3 -3
- package/dist/process/index.js.map +1 -1
- package/dist/process/install-graceful-shutdown.d.ts +0 -6
- 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/resolve-executable.d.ts +0 -11
- package/dist/process/resolve-executable.d.ts.map +1 -1
- package/dist/process/resolve-executable.js +0 -11
- package/dist/process/resolve-executable.js.map +1 -1
- 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 +0 -9
- package/dist/util/package-version.d.ts.map +1 -1
- package/dist/util/package-version.js +0 -9
- 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 +0 -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 +0 -15
- 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 +3 -3
- package/src/process/install-graceful-shutdown.ts +11 -17
- package/src/process/resolve-executable.ts +0 -11
- 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 +0 -9
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize-identifier.d.ts","sourceRoot":"","sources":["../../src/source/sanitize-identifier.ts"],"names":[],"mappings":"AAkDA
|
|
1
|
+
{"version":3,"file":"sanitize-identifier.d.ts","sourceRoot":"","sources":["../../src/source/sanitize-identifier.ts"],"names":[],"mappings":"AAkDA,iBAAS,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -47,17 +47,6 @@ const RESERVED = new Set([
|
|
|
47
47
|
"with",
|
|
48
48
|
"yield",
|
|
49
49
|
]);
|
|
50
|
-
/**
|
|
51
|
-
* Returns the name unchanged, or with a trailing underscore when it collides with a reserved word,
|
|
52
|
-
* so it is safe to emit as a JavaScript identifier.
|
|
53
|
-
*
|
|
54
|
-
* @param name - The candidate identifier.
|
|
55
|
-
* @returns The name, suffixed with `_` when it is a reserved word.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* sanitizeIdentifier("iconName"); // "iconName"
|
|
59
|
-
* sanitizeIdentifier("class"); // "class_"
|
|
60
|
-
*/
|
|
61
50
|
function sanitizeIdentifier(name) {
|
|
62
51
|
return RESERVED.has(name) ? `${name}_` : name;
|
|
63
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize-identifier.js","sourceRoot":"","sources":["../../src/source/sanitize-identifier.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAgB,IAAI,GAAG,CAAC;IAClC,WAAW;IACX,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,UAAU;IACV,UAAU;IACV,SAAS;IACT,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,KAAK;IACL,UAAU;IACV,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,YAAY;IACZ,WAAW;IACX,KAAK;IACL,KAAK;IACL,MAAM;IACN,SAAS;IACT,SAAS;IACT,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,KAAK;IACL,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;CACV,CAAC,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"sanitize-identifier.js","sourceRoot":"","sources":["../../src/source/sanitize-identifier.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAgB,IAAI,GAAG,CAAC;IAClC,WAAW;IACX,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,UAAU;IACV,UAAU;IACV,SAAS;IACT,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,KAAK;IACL,UAAU;IACV,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,YAAY;IACZ,WAAW;IACX,KAAK;IACL,KAAK;IACL,MAAM;IACN,SAAS;IACT,SAAS;IACT,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,KAAK;IACL,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;CACV,CAAC,CAAC;AAEH,SAAS,kBAAkB,CAAC,IAAY;IACpC,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["const RESERVED: Set<string> = new Set([\n \"arguments\",\n \"await\",\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"enum\",\n \"eval\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"interface\",\n \"let\",\n \"new\",\n \"null\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"return\",\n \"static\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"typeof\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\",\n]);\n\nfunction sanitizeIdentifier(name: string): string {\n return RESERVED.has(name) ? `${name}_` : name;\n}\n\nexport { sanitizeIdentifier };\n"]}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encodes a string as a JavaScript string literal, additionally escaping characters that are unsafe
|
|
3
|
-
* to embed in generated source (angle brackets and the line and paragraph separators).
|
|
4
|
-
*
|
|
5
|
-
* @param value - The string to encode.
|
|
6
|
-
* @returns The quoted, source-safe string literal.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* sourceStringLiteral("hello"); // '"hello"'
|
|
10
|
-
*/
|
|
11
1
|
declare function sourceStringLiteral(value: string): string;
|
|
12
2
|
export { sourceStringLiteral };
|
|
13
3
|
//# sourceMappingURL=source-string-literal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-string-literal.d.ts","sourceRoot":"","sources":["../../src/source/source-string-literal.ts"],"names":[],"mappings":"AAYA
|
|
1
|
+
{"version":3,"file":"source-string-literal.d.ts","sourceRoot":"","sources":["../../src/source/source-string-literal.ts"],"names":[],"mappings":"AAYA,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -7,16 +7,6 @@ const SOURCE_ESCAPES = {
|
|
|
7
7
|
[PARAGRAPH_SEPARATOR]: String.raw `\u2029`,
|
|
8
8
|
};
|
|
9
9
|
const UNSAFE_SOURCE_CHARS = new RegExp(`[${Object.keys(SOURCE_ESCAPES).join("")}]`, "g");
|
|
10
|
-
/**
|
|
11
|
-
* Encodes a string as a JavaScript string literal, additionally escaping characters that are unsafe
|
|
12
|
-
* to embed in generated source (angle brackets and the line and paragraph separators).
|
|
13
|
-
*
|
|
14
|
-
* @param value - The string to encode.
|
|
15
|
-
* @returns The quoted, source-safe string literal.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* sourceStringLiteral("hello"); // '"hello"'
|
|
19
|
-
*/
|
|
20
10
|
function sourceStringLiteral(value) {
|
|
21
11
|
return JSON.stringify(value).replaceAll(UNSAFE_SOURCE_CHARS, (char) => SOURCE_ESCAPES[char] ?? char);
|
|
22
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-string-literal.js","sourceRoot":"","sources":["../../src/source/source-string-literal.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAE1D,MAAM,cAAc,GAA2B;IAC3C,GAAG,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACvB,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACpC,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;CAC5C,CAAC;AAEF,MAAM,mBAAmB,GAAG,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAEzF
|
|
1
|
+
{"version":3,"file":"source-string-literal.js","sourceRoot":"","sources":["../../src/source/source-string-literal.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAE1D,MAAM,cAAc,GAA2B;IAC3C,GAAG,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACvB,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;IACpC,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,GAAG,CAAA,QAAQ;CAC5C,CAAC;AAEF,MAAM,mBAAmB,GAAG,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAEzF,SAAS,mBAAmB,CAAC,KAAa;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;AACzG,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["const LINE_SEPARATOR = String.fromCodePoint(0x20_28);\nconst PARAGRAPH_SEPARATOR = String.fromCodePoint(0x20_29);\n\nconst SOURCE_ESCAPES: Record<string, string> = {\n \"<\": String.raw`\\u003C`,\n \">\": String.raw`\\u003E`,\n [LINE_SEPARATOR]: String.raw`\\u2028`,\n [PARAGRAPH_SEPARATOR]: String.raw`\\u2029`,\n};\n\nconst UNSAFE_SOURCE_CHARS = new RegExp(`[${Object.keys(SOURCE_ESCAPES).join(\"\")}]`, \"g\");\n\nfunction sourceStringLiteral(value: string): string {\n return JSON.stringify(value).replaceAll(UNSAFE_SOURCE_CHARS, (char) => SOURCE_ESCAPES[char] ?? char);\n}\n\nexport { sourceStringLiteral };\n"]}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a name to camel case and sanitizes it into a valid JavaScript identifier.
|
|
3
|
-
*
|
|
4
|
-
* @param name - The name to convert.
|
|
5
|
-
* @returns The camel-cased, reserved-word-safe identifier.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* toCamelIdentifier("icon_name"); // "iconName"
|
|
9
|
-
* toCamelIdentifier("class"); // "class_"
|
|
10
|
-
*/
|
|
11
1
|
declare function toCamelIdentifier(name: string): string;
|
|
12
2
|
export { toCamelIdentifier };
|
|
13
3
|
//# sourceMappingURL=to-camel-identifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-camel-identifier.d.ts","sourceRoot":"","sources":["../../src/source/to-camel-identifier.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"to-camel-identifier.d.ts","sourceRoot":"","sources":["../../src/source/to-camel-identifier.ts"],"names":[],"mappings":"AAGA,iBAAS,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { camelCase } from "../string/camel-case.js";
|
|
2
2
|
import { sanitizeIdentifier } from "./sanitize-identifier.js";
|
|
3
|
-
/**
|
|
4
|
-
* Converts a name to camel case and sanitizes it into a valid JavaScript identifier.
|
|
5
|
-
*
|
|
6
|
-
* @param name - The name to convert.
|
|
7
|
-
* @returns The camel-cased, reserved-word-safe identifier.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* toCamelIdentifier("icon_name"); // "iconName"
|
|
11
|
-
* toCamelIdentifier("class"); // "class_"
|
|
12
|
-
*/
|
|
13
3
|
function toCamelIdentifier(name) {
|
|
14
4
|
return sanitizeIdentifier(camelCase(name));
|
|
15
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-camel-identifier.js","sourceRoot":"","sources":["../../src/source/to-camel-identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D
|
|
1
|
+
{"version":3,"file":"to-camel-identifier.js","sourceRoot":"","sources":["../../src/source/to-camel-identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,SAAS,iBAAiB,CAAC,IAAY;IACnC,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import { camelCase } from \"../string/camel-case.ts\";\nimport { sanitizeIdentifier } from \"./sanitize-identifier.ts\";\n\nfunction toCamelIdentifier(name: string): string {\n return sanitizeIdentifier(camelCase(name));\n}\n\nexport { toCamelIdentifier };\n"]}
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts an underscore- or hyphen-delimited string to camel case.
|
|
3
|
-
*
|
|
4
|
-
* Unlike a general-purpose converter, this splits only on `_` and `-` and keeps the first segment
|
|
5
|
-
* verbatim, so GObject acronyms are preserved (`camelCase("GLArea")` stays `"GLArea"`).
|
|
6
|
-
*
|
|
7
|
-
* @param str - The string to convert.
|
|
8
|
-
* @returns The camel-cased string.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* camelCase("icon_name"); // "iconName"
|
|
12
|
-
* camelCase("start-widget"); // "startWidget"
|
|
13
|
-
* camelCase("Box"); // "Box"
|
|
14
|
-
*/
|
|
15
1
|
declare function camelCase(str: string): string;
|
|
16
2
|
export { camelCase };
|
|
17
3
|
//# sourceMappingURL=camel-case.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camel-case.d.ts","sourceRoot":"","sources":["../../src/string/camel-case.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"camel-case.d.ts","sourceRoot":"","sources":["../../src/string/camel-case.ts"],"names":[],"mappings":"AAGA,iBAAS,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { upperFirst } from "./upper-first.js";
|
|
2
2
|
import { mapWordSegments } from "./word-segments.js";
|
|
3
|
-
/**
|
|
4
|
-
* Converts an underscore- or hyphen-delimited string to camel case.
|
|
5
|
-
*
|
|
6
|
-
* Unlike a general-purpose converter, this splits only on `_` and `-` and keeps the first segment
|
|
7
|
-
* verbatim, so GObject acronyms are preserved (`camelCase("GLArea")` stays `"GLArea"`).
|
|
8
|
-
*
|
|
9
|
-
* @param str - The string to convert.
|
|
10
|
-
* @returns The camel-cased string.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* camelCase("icon_name"); // "iconName"
|
|
14
|
-
* camelCase("start-widget"); // "startWidget"
|
|
15
|
-
* camelCase("Box"); // "Box"
|
|
16
|
-
*/
|
|
17
3
|
function camelCase(str) {
|
|
18
4
|
return mapWordSegments(str, (part, index) => (index === 0 ? part : upperFirst(part)));
|
|
19
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camel-case.js","sourceRoot":"","sources":["../../src/string/camel-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"camel-case.js","sourceRoot":"","sources":["../../src/string/camel-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,SAAS,SAAS,CAAC,GAAW;IAC1B,OAAO,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { upperFirst } from \"./upper-first.ts\";\nimport { mapWordSegments } from \"./word-segments.ts\";\n\nfunction camelCase(str: string): string {\n return mapWordSegments(str, (part, index) => (index === 0 ? part : upperFirst(part)));\n}\n\nexport { camelCase };\n"]}
|
package/dist/string/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { camelCase } from "./camel-case.
|
|
2
|
-
export { kebabCase } from "./kebab-case.
|
|
3
|
-
export { lowerFirst } from "./lower-first.
|
|
4
|
-
export { pascalCase } from "./pascal-case.
|
|
5
|
-
export { upperFirst } from "./upper-first.
|
|
1
|
+
export { camelCase } from "./camel-case.ts";
|
|
2
|
+
export { kebabCase } from "./kebab-case.ts";
|
|
3
|
+
export { lowerFirst } from "./lower-first.ts";
|
|
4
|
+
export { pascalCase } from "./pascal-case.ts";
|
|
5
|
+
export { upperFirst } from "./upper-first.ts";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/string/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/string/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { camelCase } from \"./camel-case.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/string/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { camelCase } from \"./camel-case.ts\";\nexport { kebabCase } from \"./kebab-case.ts\";\nexport { lowerFirst } from \"./lower-first.ts\";\nexport { pascalCase } from \"./pascal-case.ts\";\nexport { upperFirst } from \"./upper-first.ts\";\n"]}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a camelCase or PascalCase string to kebab case by lower-casing uppercase letters and
|
|
3
|
-
* inserting hyphens before interior ones.
|
|
4
|
-
*
|
|
5
|
-
* @param str - The string to convert.
|
|
6
|
-
* @returns The kebab-cased string.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* kebabCase("iconName"); // "icon-name"
|
|
10
|
-
* kebabCase("Title"); // "title"
|
|
11
|
-
*/
|
|
12
1
|
declare function kebabCase(str: string): string;
|
|
13
2
|
export { kebabCase };
|
|
14
3
|
//# sourceMappingURL=kebab-case.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kebab-case.d.ts","sourceRoot":"","sources":["../../src/string/kebab-case.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"kebab-case.d.ts","sourceRoot":"","sources":["../../src/string/kebab-case.ts"],"names":[],"mappings":"AAAA,iBAAS,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAItC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a camelCase or PascalCase string to kebab case by lower-casing uppercase letters and
|
|
3
|
-
* inserting hyphens before interior ones.
|
|
4
|
-
*
|
|
5
|
-
* @param str - The string to convert.
|
|
6
|
-
* @returns The kebab-cased string.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* kebabCase("iconName"); // "icon-name"
|
|
10
|
-
* kebabCase("Title"); // "title"
|
|
11
|
-
*/
|
|
12
1
|
function kebabCase(str) {
|
|
13
2
|
return str.replaceAll(/[A-Z]/g, (char, index) => index === 0 ? char.toLowerCase() : `-${char.toLowerCase()}`);
|
|
14
3
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kebab-case.js","sourceRoot":"","sources":["../../src/string/kebab-case.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"kebab-case.js","sourceRoot":"","sources":["../../src/string/kebab-case.ts"],"names":[],"mappings":"AAAA,SAAS,SAAS,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAa,EAAE,EAAE,CACpD,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAC9D,CAAC;AACN,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["function kebabCase(str: string): string {\n return str.replaceAll(/[A-Z]/g, (char, index: number) =>\n index === 0 ? char.toLowerCase() : `-${char.toLowerCase()}`,\n );\n}\n\nexport { kebabCase };\n"]}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts the first character of a string to lower case.
|
|
3
|
-
*
|
|
4
|
-
* @param str - The string to transform.
|
|
5
|
-
* @returns The string with its first character lower-cased.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* lowerFirst("Fred"); // "fred"
|
|
9
|
-
* lowerFirst("FRED"); // "fRED"
|
|
10
|
-
*/
|
|
11
1
|
declare function lowerFirst(str: string): string;
|
|
12
2
|
export { lowerFirst };
|
|
13
3
|
//# sourceMappingURL=lower-first.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lower-first.d.ts","sourceRoot":"","sources":["../../src/string/lower-first.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lower-first.d.ts","sourceRoot":"","sources":["../../src/string/lower-first.ts"],"names":[],"mappings":"AAAA,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts the first character of a string to lower case.
|
|
3
|
-
*
|
|
4
|
-
* @param str - The string to transform.
|
|
5
|
-
* @returns The string with its first character lower-cased.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* lowerFirst("Fred"); // "fred"
|
|
9
|
-
* lowerFirst("FRED"); // "fRED"
|
|
10
|
-
*/
|
|
11
1
|
function lowerFirst(str) {
|
|
12
2
|
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
13
3
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lower-first.js","sourceRoot":"","sources":["../../src/string/lower-first.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lower-first.js","sourceRoot":"","sources":["../../src/string/lower-first.ts"],"names":[],"mappings":"AAAA,SAAS,UAAU,CAAC,GAAW;IAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["function lowerFirst(str: string): string {\n return str.charAt(0).toLowerCase() + str.slice(1);\n}\n\nexport { lowerFirst };\n"]}
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts an underscore- or hyphen-delimited string to Pascal case.
|
|
3
|
-
*
|
|
4
|
-
* Splits only on `_` and `-` and capitalizes each segment's first character, so GObject acronyms
|
|
5
|
-
* are preserved (`pascalCase("GLArea")` stays `"GLArea"`).
|
|
6
|
-
*
|
|
7
|
-
* @param str - The string to convert.
|
|
8
|
-
* @returns The Pascal-cased string.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* pascalCase("icon_name"); // "IconName"
|
|
12
|
-
* pascalCase("scrolled-window"); // "ScrolledWindow"
|
|
13
|
-
*/
|
|
14
1
|
declare function pascalCase(str: string): string;
|
|
15
2
|
export { pascalCase };
|
|
16
3
|
//# sourceMappingURL=pascal-case.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pascal-case.d.ts","sourceRoot":"","sources":["../../src/string/pascal-case.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"pascal-case.d.ts","sourceRoot":"","sources":["../../src/string/pascal-case.ts"],"names":[],"mappings":"AAGA,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import { upperFirst } from "./upper-first.js";
|
|
2
2
|
import { mapWordSegments } from "./word-segments.js";
|
|
3
|
-
/**
|
|
4
|
-
* Converts an underscore- or hyphen-delimited string to Pascal case.
|
|
5
|
-
*
|
|
6
|
-
* Splits only on `_` and `-` and capitalizes each segment's first character, so GObject acronyms
|
|
7
|
-
* are preserved (`pascalCase("GLArea")` stays `"GLArea"`).
|
|
8
|
-
*
|
|
9
|
-
* @param str - The string to convert.
|
|
10
|
-
* @returns The Pascal-cased string.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* pascalCase("icon_name"); // "IconName"
|
|
14
|
-
* pascalCase("scrolled-window"); // "ScrolledWindow"
|
|
15
|
-
*/
|
|
16
3
|
function pascalCase(str) {
|
|
17
4
|
return mapWordSegments(str, upperFirst);
|
|
18
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pascal-case.js","sourceRoot":"","sources":["../../src/string/pascal-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"pascal-case.js","sourceRoot":"","sources":["../../src/string/pascal-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,SAAS,UAAU,CAAC,GAAW;IAC3B,OAAO,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAC5C,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { upperFirst } from \"./upper-first.ts\";\nimport { mapWordSegments } from \"./word-segments.ts\";\n\nfunction pascalCase(str: string): string {\n return mapWordSegments(str, upperFirst);\n}\n\nexport { pascalCase };\n"]}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts the first character of a string to upper case.
|
|
3
|
-
*
|
|
4
|
-
* @param str - The string to transform.
|
|
5
|
-
* @returns The string with its first character upper-cased.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* upperFirst("fred"); // "Fred"
|
|
9
|
-
* upperFirst("Fred"); // "Fred"
|
|
10
|
-
*/
|
|
11
1
|
declare function upperFirst(str: string): string;
|
|
12
2
|
export { upperFirst };
|
|
13
3
|
//# sourceMappingURL=upper-first.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upper-first.d.ts","sourceRoot":"","sources":["../../src/string/upper-first.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"upper-first.d.ts","sourceRoot":"","sources":["../../src/string/upper-first.ts"],"names":[],"mappings":"AAAA,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts the first character of a string to upper case.
|
|
3
|
-
*
|
|
4
|
-
* @param str - The string to transform.
|
|
5
|
-
* @returns The string with its first character upper-cased.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* upperFirst("fred"); // "Fred"
|
|
9
|
-
* upperFirst("Fred"); // "Fred"
|
|
10
|
-
*/
|
|
11
1
|
function upperFirst(str) {
|
|
12
2
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
13
3
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upper-first.js","sourceRoot":"","sources":["../../src/string/upper-first.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"upper-first.js","sourceRoot":"","sources":["../../src/string/upper-first.ts"],"names":[],"mappings":"AAAA,SAAS,UAAU,CAAC,GAAW;IAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["function upperFirst(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport { upperFirst };\n"]}
|
package/dist/util/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { packageVersion } from "./package-version.
|
|
1
|
+
export { packageVersion } from "./package-version.ts";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/util/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { packageVersion } from \"./package-version.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { packageVersion } from \"./package-version.ts\";\n"]}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reads the `version` field from the `package.json` next to the calling module.
|
|
3
|
-
*
|
|
4
|
-
* @param importMetaUrl - The caller's `import.meta.url`, used to resolve the sibling `package.json`.
|
|
5
|
-
* @returns The package's version string.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* packageVersion(import.meta.url); // "1.2.3"
|
|
9
|
-
*/
|
|
10
1
|
declare function packageVersion(importMetaUrl: string): string;
|
|
11
2
|
export { packageVersion };
|
|
12
3
|
//# sourceMappingURL=package-version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../../src/util/package-version.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../../src/util/package-version.ts"],"names":[],"mappings":"AAEA,iBAAS,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
/**
|
|
3
|
-
* Reads the `version` field from the `package.json` next to the calling module.
|
|
4
|
-
*
|
|
5
|
-
* @param importMetaUrl - The caller's `import.meta.url`, used to resolve the sibling `package.json`.
|
|
6
|
-
* @returns The package's version string.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* packageVersion(import.meta.url); // "1.2.3"
|
|
10
|
-
*/
|
|
11
2
|
function packageVersion(importMetaUrl) {
|
|
12
3
|
return createRequire(importMetaUrl)("../package.json").version;
|
|
13
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-version.js","sourceRoot":"","sources":["../../src/util/package-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"package-version.js","sourceRoot":"","sources":["../../src/util/package-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,SAAS,cAAc,CAAC,aAAqB;IACzC,OAAQ,aAAa,CAAC,aAAa,CAAC,CAAC,iBAAiB,CAAyB,CAAC,OAAO,CAAC;AAC5F,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { createRequire } from \"node:module\";\n\nfunction packageVersion(importMetaUrl: string): string {\n return (createRequire(importMetaUrl)(\"../package.json\") as { version: string }).version;\n}\n\nexport { packageVersion };\n"]}
|
package/package.json
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Finds the index of the first item matching `before`, or `list.length` when `before` is `null` or
|
|
3
|
-
* nothing matches. Use it to resolve where a new item should be inserted so it lands before the
|
|
4
|
-
* referenced one, defaulting to the end.
|
|
5
|
-
*
|
|
6
|
-
* @template T - The list item type.
|
|
7
|
-
* @template B - The reference value type.
|
|
8
|
-
* @param list - The list to search.
|
|
9
|
-
* @param before - The item to insert before, or `null` to target the end.
|
|
10
|
-
* @param isMatch - Called with each item and the non-null `before`; return `true` on a match.
|
|
11
|
-
* @returns The matched index, or `list.length`.
|
|
12
|
-
*/
|
|
13
1
|
const indexBeforeOrEnd = <T, B>(
|
|
14
2
|
list: T[],
|
|
15
3
|
before: B | null,
|
package/src/array/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { indexBeforeOrEnd } from "./index-before-or-end.
|
|
2
|
-
export { remove } from "./remove.
|
|
3
|
-
export { sortStringsBy } from "./sort-strings-by.
|
|
4
|
-
export { sortStrings } from "./sort-strings.
|
|
5
|
-
export { uniqBy } from "./uniq-by.
|
|
1
|
+
export { indexBeforeOrEnd } from "./index-before-or-end.ts";
|
|
2
|
+
export { remove } from "./remove.ts";
|
|
3
|
+
export { sortStringsBy } from "./sort-strings-by.ts";
|
|
4
|
+
export { sortStrings } from "./sort-strings.ts";
|
|
5
|
+
export { uniqBy } from "./uniq-by.ts";
|
package/src/array/remove.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Removes the first strictly-equal (`===`) occurrence of `value` from `arr` in place.
|
|
3
|
-
*
|
|
4
|
-
* @template T - The type of the array elements.
|
|
5
|
-
* @param arr - The array to mutate.
|
|
6
|
-
* @param value - The value to remove.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* const items = ["a", "b", "c"];
|
|
10
|
-
* remove(items, "b"); // items is now ["a", "c"]
|
|
11
|
-
*/
|
|
12
1
|
function remove<T>(arr: T[], value: T): void {
|
|
13
2
|
const index = arr.indexOf(value);
|
|
14
3
|
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the items sorted by a string key using locale-aware comparison.
|
|
3
|
-
*
|
|
4
|
-
* @template T - The type of items being sorted.
|
|
5
|
-
* @param items - The items to sort.
|
|
6
|
-
* @param key - Maps an item to the string its order is decided by.
|
|
7
|
-
* @returns A new array of the items in ascending locale order of their keys.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* sortStringsBy([{ name: "b" }, { name: "a" }], (item) => item.name);
|
|
11
|
-
* // [{ name: "a" }, { name: "b" }]
|
|
12
|
-
*/
|
|
13
1
|
function sortStringsBy<T>(items: Iterable<T>, key: (item: T) => string): T[] {
|
|
14
2
|
return [...items].toSorted((a, b) => key(a).localeCompare(key(b)));
|
|
15
3
|
}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the values sorted as strings using locale-aware comparison.
|
|
3
|
-
*
|
|
4
|
-
* @param values - The strings to sort.
|
|
5
|
-
* @returns A new array of the values in ascending locale order.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* sortStrings(["b", "a", "c"]); // ["a", "b", "c"]
|
|
9
|
-
*/
|
|
10
1
|
function sortStrings(values: Iterable<string>): string[] {
|
|
11
2
|
return [...values].toSorted((a, b) => a.localeCompare(b));
|
|
12
3
|
}
|
package/src/array/uniq-by.ts
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a new array of the unique elements of `arr`, keyed by the value the `mapper` returns.
|
|
3
|
-
*
|
|
4
|
-
* When two elements map to the same key the first occurrence is kept and later ones discarded,
|
|
5
|
-
* preserving first-seen order.
|
|
6
|
-
*
|
|
7
|
-
* @template T - The type of elements in the array.
|
|
8
|
-
* @param arr - The array to deduplicate.
|
|
9
|
-
* @param mapper - Maps an element to the key its uniqueness is decided by.
|
|
10
|
-
* @returns A new array containing only the first element seen for each distinct key.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* uniqBy([2.1, 1.2, 2.3], Math.floor); // [2.1, 1.2]
|
|
14
|
-
* uniqBy([{ id: "a" }, { id: "a" }, { id: "b" }], (item) => item.id); // [{ id: "a" }, { id: "b" }]
|
|
15
|
-
*/
|
|
16
1
|
function uniqBy<T>(arr: T[], mapper: (item: T, index: number, array: T[]) => unknown): T[] {
|
|
17
2
|
const seen: Map<unknown, T> = new Map();
|
|
18
3
|
let index = 0;
|
package/src/class/any-class.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import type { AnyClass } from "./any-class.
|
|
1
|
+
import type { AnyClass } from "./any-class.ts";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Returns the direct superclass of `cls`, or `null` when it has no class ancestor.
|
|
5
|
-
*
|
|
6
|
-
* @param cls - The class whose prototype parent to inspect.
|
|
7
|
-
* @returns The parent class, or `null` when there is none.
|
|
8
|
-
*/
|
|
9
3
|
function getParentClass(cls: AnyClass): AnyClass | null {
|
|
10
4
|
const parent: unknown = Object.getPrototypeOf(cls);
|
|
11
5
|
|
package/src/class/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { AnyClass } from "./any-class.
|
|
2
|
-
export { getParentClass } from "./get-parent-class.
|
|
3
|
-
export { walkClassChain } from "./walk-class-chain.
|
|
1
|
+
export type { AnyClass } from "./any-class.ts";
|
|
2
|
+
export { getParentClass } from "./get-parent-class.ts";
|
|
3
|
+
export { walkClassChain } from "./walk-class-chain.ts";
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import type { AnyClass } from "./any-class.
|
|
2
|
-
import { getParentClass } from "./get-parent-class.
|
|
1
|
+
import type { AnyClass } from "./any-class.ts";
|
|
2
|
+
import { getParentClass } from "./get-parent-class.ts";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Walks the class chain from `cls` up through its ancestors, calling `visit` on each and returning
|
|
6
|
-
* the first result that is not `undefined`.
|
|
7
|
-
*
|
|
8
|
-
* @template T - The type produced by the visitor.
|
|
9
|
-
* @param cls - The class to start from, or `null` to visit nothing.
|
|
10
|
-
* @param visit - Called with each class in the chain; a defined return value stops the walk.
|
|
11
|
-
* @returns The first defined result from `visit`, or `undefined` when none was produced.
|
|
12
|
-
*/
|
|
13
4
|
function walkClassChain<T>(cls: AnyClass | null, visit: (ancestor: AnyClass) => T | undefined): T | undefined {
|
|
14
5
|
let current = cls;
|
|
15
6
|
|
package/src/error/error-like.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import { isErrorLike } from "./error-like.
|
|
1
|
+
import { isErrorLike } from "./error-like.ts";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Extracts a human-readable message from an unknown thrown value, falling back to its string form.
|
|
5
|
-
*
|
|
6
|
-
* @param error - The caught value to describe.
|
|
7
|
-
* @returns The value's message when it has one, otherwise its string form.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* errorMessage(new Error("boom")); // "boom"
|
|
11
|
-
* errorMessage(42); // "42"
|
|
12
|
-
*/
|
|
13
3
|
function errorMessage(error: unknown): string {
|
|
14
4
|
return Error.isError(error) || isErrorLike(error) ? error.message : String(error);
|
|
15
5
|
}
|