@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/README.md
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
The React framework for Linux.<br />
|
|
9
|
-
|
|
9
|
+
Write native Linux applications with React and TypeScript.
|
|
10
|
+
Built on the GNOME stack and standard web tooling.
|
|
10
11
|
</p>
|
|
11
12
|
|
|
12
13
|
<p align="center">
|
|
@@ -20,15 +21,13 @@
|
|
|
20
21
|
|
|
21
22
|
<p align="center">
|
|
22
23
|
<a href="https://gtkx.dev">Homepage</a> ·
|
|
23
|
-
<a href="https://gtkx.dev/guide/
|
|
24
|
+
<a href="https://gtkx.dev/guide/getting-started">Documentation</a> ·
|
|
24
25
|
<a href="https://github.com/gtkx-org/gtkx/tree/main/examples">Examples</a> ·
|
|
25
26
|
<a href="https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md">Contributing</a>
|
|
26
27
|
</p>
|
|
27
28
|
|
|
28
29
|
---
|
|
29
30
|
|
|
30
|
-
GTKX generates fully typed bindings for the entire GTK4 and Adwaita surface directly from GObject-Introspection. On top of those bindings you get the React programming model: components and hooks driving GObject instances, with Fast Refresh while you develop.
|
|
31
|
-
|
|
32
31
|
<p align="center">
|
|
33
32
|
<img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/examples/tutorial/assets/screenshot.png" alt="The Tasks app: an Adwaita window with a sidebar of smart views and colored lists on the left, and a boxed task list on the right." />
|
|
34
33
|
</p>
|
|
@@ -109,7 +108,7 @@ React Native and similar frameworks hide the native toolkit so one API can run e
|
|
|
109
108
|
|
|
110
109
|
### Why Node.js, and why generated bindings
|
|
111
110
|
|
|
112
|
-
GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [
|
|
111
|
+
GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [Why GTKX guide](https://gtkx.dev/guide/why-gtkx) covers what running on Node.js means day to day.
|
|
113
112
|
|
|
114
113
|
GTKX generates the TypeScript types and the native FFI calls from the same GObject-Introspection data, so the types cannot drift from the calls they back. Codegen covers the whole GTK4 and Adwaita surface.
|
|
115
114
|
|
|
@@ -122,10 +121,10 @@ GTKX is Linux-only and needs Node.js 24 or later. See [Requirements](#requiremen
|
|
|
122
121
|
Scaffold a new app with the `create-gtkx` initializer:
|
|
123
122
|
|
|
124
123
|
```sh
|
|
125
|
-
npm create gtkx
|
|
124
|
+
npm create gtkx
|
|
126
125
|
```
|
|
127
126
|
|
|
128
|
-
The same command works with other package managers: `pnpm create gtkx
|
|
127
|
+
The same command works with other package managers: `pnpm create gtkx` or `yarn create gtkx`.
|
|
129
128
|
|
|
130
129
|
Then run your new app:
|
|
131
130
|
|
|
@@ -146,7 +145,7 @@ The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tu
|
|
|
146
145
|
|
|
147
146
|
GTKX is Linux-only. You need:
|
|
148
147
|
|
|
149
|
-
- Linux with the GTK4 (4.20 or later), Adwaita (1.8 or later)
|
|
148
|
+
- Linux with the GTK4 (4.20 or later) and GLib development libraries, plus Adwaita (1.8 or later) once your project binds `Adw-1`
|
|
150
149
|
- Node.js 24 or later
|
|
151
150
|
|
|
152
151
|
The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
|
|
@@ -162,7 +161,7 @@ Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
|
|
|
162
161
|
|
|
163
162
|
## Status
|
|
164
163
|
|
|
165
|
-
GTKX 1.0 is
|
|
164
|
+
GTKX 1.0 is released.
|
|
166
165
|
|
|
167
166
|
## Contributing
|
|
168
167
|
|
|
@@ -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
|
declare const indexBeforeOrEnd: <T, B>(list: T[], before: B | null, isMatch: (item: T, before: B) => boolean) => number;
|
|
14
2
|
export { indexBeforeOrEnd };
|
|
15
3
|
//# sourceMappingURL=index-before-or-end.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-before-or-end.d.ts","sourceRoot":"","sources":["../../src/array/index-before-or-end.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index-before-or-end.d.ts","sourceRoot":"","sources":["../../src/array/index-before-or-end.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,gBAAgB,GAAI,CAAC,EAAE,CAAC,EAC1B,MAAM,CAAC,EAAE,EACT,QAAQ,CAAC,GAAG,IAAI,EAChB,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,KACzC,MAQF,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -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 = (list, before, isMatch) => {
|
|
14
2
|
if (before === null) {
|
|
15
3
|
return list.length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-before-or-end.js","sourceRoot":"","sources":["../../src/array/index-before-or-end.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index-before-or-end.js","sourceRoot":"","sources":["../../src/array/index-before-or-end.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,CACrB,IAAS,EACT,MAAgB,EAChB,OAAwC,EAClC,EAAE;IACR,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAE9D,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9C,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["const indexBeforeOrEnd = <T, B>(\n list: T[],\n before: B | null,\n isMatch: (item: T, before: B) => boolean,\n): number => {\n if (before === null) {\n return list.length;\n }\n\n const index = list.findIndex((item) => isMatch(item, before));\n\n return index === -1 ? list.length : index;\n};\n\nexport { indexBeforeOrEnd };\n"]}
|
package/dist/array/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/array/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/array/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { indexBeforeOrEnd } from \"./index-before-or-end.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/array/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { indexBeforeOrEnd } from \"./index-before-or-end.ts\";\nexport { remove } from \"./remove.ts\";\nexport { sortStringsBy } from \"./sort-strings-by.ts\";\nexport { sortStrings } from \"./sort-strings.ts\";\nexport { uniqBy } from \"./uniq-by.ts\";\n"]}
|
package/dist/array/remove.d.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
|
declare function remove<T>(arr: T[], value: T): void;
|
|
13
2
|
export { remove };
|
|
14
3
|
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/array/remove.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/array/remove.ts"],"names":[],"mappings":"AAAA,iBAAS,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAM3C;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/array/remove.js
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(arr, value) {
|
|
13
2
|
const index = arr.indexOf(value);
|
|
14
3
|
if (index !== -1) {
|
package/dist/array/remove.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../src/array/remove.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../src/array/remove.ts"],"names":[],"mappings":"AAAA,SAAS,MAAM,CAAI,GAAQ,EAAE,KAAQ;IACjC,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAEjC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACzB,CAAC;AACL,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["function remove<T>(arr: T[], value: T): void {\n const index = arr.indexOf(value);\n\n if (index !== -1) {\n arr.splice(index, 1);\n }\n}\n\nexport { remove };\n"]}
|
|
@@ -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
|
declare function sortStringsBy<T>(items: Iterable<T>, key: (item: T) => string): T[];
|
|
14
2
|
export { sortStringsBy };
|
|
15
3
|
//# sourceMappingURL=sort-strings-by.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-strings-by.d.ts","sourceRoot":"","sources":["../../src/array/sort-strings-by.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sort-strings-by.d.ts","sourceRoot":"","sources":["../../src/array/sort-strings-by.ts"],"names":[],"mappings":"AAAA,iBAAS,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,CAAC,EAAE,CAE3E;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -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(items, key) {
|
|
14
2
|
return [...items].toSorted((a, b) => key(a).localeCompare(key(b)));
|
|
15
3
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-strings-by.js","sourceRoot":"","sources":["../../src/array/sort-strings-by.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sort-strings-by.js","sourceRoot":"","sources":["../../src/array/sort-strings-by.ts"],"names":[],"mappings":"AAAA,SAAS,aAAa,CAAI,KAAkB,EAAE,GAAwB;IAClE,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["function sortStringsBy<T>(items: Iterable<T>, key: (item: T) => string): T[] {\n return [...items].toSorted((a, b) => key(a).localeCompare(key(b)));\n}\n\nexport { sortStringsBy };\n"]}
|
|
@@ -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
|
declare function sortStrings(values: Iterable<string>): string[];
|
|
11
2
|
export { sortStrings };
|
|
12
3
|
//# sourceMappingURL=sort-strings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-strings.d.ts","sourceRoot":"","sources":["../../src/array/sort-strings.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sort-strings.d.ts","sourceRoot":"","sources":["../../src/array/sort-strings.ts"],"names":[],"mappings":"AAAA,iBAAS,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAEvD;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -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) {
|
|
11
2
|
return [...values].toSorted((a, b) => a.localeCompare(b));
|
|
12
3
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-strings.js","sourceRoot":"","sources":["../../src/array/sort-strings.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sort-strings.js","sourceRoot":"","sources":["../../src/array/sort-strings.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW,CAAC,MAAwB;IACzC,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["function sortStrings(values: Iterable<string>): string[] {\n return [...values].toSorted((a, b) => a.localeCompare(b));\n}\n\nexport { sortStrings };\n"]}
|
package/dist/array/uniq-by.d.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
|
declare function uniqBy<T>(arr: T[], mapper: (item: T, index: number, array: T[]) => unknown): T[];
|
|
17
2
|
export { uniqBy };
|
|
18
3
|
//# sourceMappingURL=uniq-by.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniq-by.d.ts","sourceRoot":"","sources":["../../src/array/uniq-by.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"uniq-by.d.ts","sourceRoot":"","sources":["../../src/array/uniq-by.ts"],"names":[],"mappings":"AAAA,iBAAS,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,OAAO,GAAG,CAAC,EAAE,CAezF;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/array/uniq-by.js
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(arr, mapper) {
|
|
17
2
|
const seen = new Map();
|
|
18
3
|
let index = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniq-by.js","sourceRoot":"","sources":["../../src/array/uniq-by.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"uniq-by.js","sourceRoot":"","sources":["../../src/array/uniq-by.ts"],"names":[],"mappings":"AAAA,SAAS,MAAM,CAAI,GAAQ,EAAE,MAAuD;IAChF,MAAM,IAAI,GAAoB,IAAI,GAAG,EAAE,CAAC;IACxC,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAErC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACjB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACxB,CAAC;QAED,KAAK,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;AACnC,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["function uniqBy<T>(arr: T[], mapper: (item: T, index: number, array: T[]) => unknown): T[] {\n const seen: Map<unknown, T> = new Map();\n let index = 0;\n\n for (const item of arr) {\n const key = mapper(item, index, arr);\n\n if (!seen.has(key)) {\n seen.set(key, item);\n }\n\n index++;\n }\n\n return seen.values().toArray();\n}\n\nexport { uniqBy };\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A constructor value of any (possibly abstract) class producing instances of `T`.
|
|
3
|
-
*/
|
|
1
|
+
/** Any class constructor, abstract ones included, whose instances are `T`. */
|
|
4
2
|
type AnyClass<T extends object = object> = (abstract new (...args: never[]) => T) & {
|
|
3
|
+
/** Object the class's instances inherit from. */
|
|
5
4
|
prototype: T;
|
|
6
5
|
};
|
|
7
6
|
export { type AnyClass };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any-class.d.ts","sourceRoot":"","sources":["../../src/class/any-class.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"any-class.d.ts","sourceRoot":"","sources":["../../src/class/any-class.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,KAAK,QAAQ,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,MAChD,GAAG,IAAI,EAAE,KAAK,EAAE,KACf,CAAC,CAAC,GAAG;IACN,iDAAiD;IACjD,SAAS,EAAE,CAAC,CAAC;CAChB,CAAC;AAEF,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any-class.js","sourceRoot":"","sources":["../../src/class/any-class.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"any-class.js","sourceRoot":"","sources":["../../src/class/any-class.ts"],"names":[],"mappings":"AAQA,OAAO,EAAiB,CAAC","sourcesContent":["/** Any class constructor, abstract ones included, whose instances are `T`. */\ntype AnyClass<T extends object = object> = (abstract new (\n ...args: never[]\n) => T) & {\n /** Object the class's instances inherit from. */\n prototype: T;\n};\n\nexport { type AnyClass };\n"]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import type { AnyClass } from "./any-class.
|
|
2
|
-
/**
|
|
3
|
-
* Returns the direct superclass of `cls`, or `null` when it has no class ancestor.
|
|
4
|
-
*
|
|
5
|
-
* @param cls - The class whose prototype parent to inspect.
|
|
6
|
-
* @returns The parent class, or `null` when there is none.
|
|
7
|
-
*/
|
|
1
|
+
import type { AnyClass } from "./any-class.ts";
|
|
8
2
|
declare function getParentClass(cls: AnyClass): AnyClass | null;
|
|
9
3
|
export { getParentClass };
|
|
10
4
|
//# sourceMappingURL=get-parent-class.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-parent-class.d.ts","sourceRoot":"","sources":["../../src/class/get-parent-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"get-parent-class.d.ts","sourceRoot":"","sources":["../../src/class/get-parent-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,iBAAS,cAAc,CAAC,GAAG,EAAE,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAItD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the direct superclass of `cls`, or `null` when it has no class ancestor.
|
|
3
|
-
*
|
|
4
|
-
* @param cls - The class whose prototype parent to inspect.
|
|
5
|
-
* @returns The parent class, or `null` when there is none.
|
|
6
|
-
*/
|
|
7
1
|
function getParentClass(cls) {
|
|
8
2
|
const parent = Object.getPrototypeOf(cls);
|
|
9
3
|
return typeof parent === "function" && parent !== Function.prototype ? parent : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-parent-class.js","sourceRoot":"","sources":["../../src/class/get-parent-class.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"get-parent-class.js","sourceRoot":"","sources":["../../src/class/get-parent-class.ts"],"names":[],"mappings":"AAEA,SAAS,cAAc,CAAC,GAAa;IACjC,MAAM,MAAM,GAAY,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAEnD,OAAO,OAAO,MAAM,KAAK,UAAU,IAAI,MAAM,KAAK,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAE,MAAmB,CAAC,CAAC,CAAC,IAAI,CAAC;AACvG,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { AnyClass } from \"./any-class.ts\";\n\nfunction getParentClass(cls: AnyClass): AnyClass | null {\n const parent: unknown = Object.getPrototypeOf(cls);\n\n return typeof parent === \"function\" && parent !== Function.prototype ? (parent as AnyClass) : null;\n}\n\nexport { getParentClass };\n"]}
|
package/dist/class/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/class/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/class/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export type { AnyClass } from \"./any-class.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/class/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export type { AnyClass } from \"./any-class.ts\";\nexport { getParentClass } from \"./get-parent-class.ts\";\nexport { walkClassChain } from \"./walk-class-chain.ts\";\n"]}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import type { AnyClass } from "./any-class.
|
|
2
|
-
/**
|
|
3
|
-
* Walks the class chain from `cls` up through its ancestors, calling `visit` on each and returning
|
|
4
|
-
* the first result that is not `undefined`.
|
|
5
|
-
*
|
|
6
|
-
* @template T - The type produced by the visitor.
|
|
7
|
-
* @param cls - The class to start from, or `null` to visit nothing.
|
|
8
|
-
* @param visit - Called with each class in the chain; a defined return value stops the walk.
|
|
9
|
-
* @returns The first defined result from `visit`, or `undefined` when none was produced.
|
|
10
|
-
*/
|
|
1
|
+
import type { AnyClass } from "./any-class.ts";
|
|
11
2
|
declare function walkClassChain<T>(cls: AnyClass | null, visit: (ancestor: AnyClass) => T | undefined): T | undefined;
|
|
12
3
|
export { walkClassChain };
|
|
13
4
|
//# sourceMappingURL=walk-class-chain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk-class-chain.d.ts","sourceRoot":"","sources":["../../src/class/walk-class-chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C
|
|
1
|
+
{"version":3,"file":"walk-class-chain.d.ts","sourceRoot":"","sources":["../../src/class/walk-class-chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,iBAAS,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAc5G;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import { getParentClass } from "./get-parent-class.js";
|
|
2
|
-
/**
|
|
3
|
-
* Walks the class chain from `cls` up through its ancestors, calling `visit` on each and returning
|
|
4
|
-
* the first result that is not `undefined`.
|
|
5
|
-
*
|
|
6
|
-
* @template T - The type produced by the visitor.
|
|
7
|
-
* @param cls - The class to start from, or `null` to visit nothing.
|
|
8
|
-
* @param visit - Called with each class in the chain; a defined return value stops the walk.
|
|
9
|
-
* @returns The first defined result from `visit`, or `undefined` when none was produced.
|
|
10
|
-
*/
|
|
11
2
|
function walkClassChain(cls, visit) {
|
|
12
3
|
let current = cls;
|
|
13
4
|
while (current !== null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk-class-chain.js","sourceRoot":"","sources":["../../src/class/walk-class-chain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"walk-class-chain.js","sourceRoot":"","sources":["../../src/class/walk-class-chain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,SAAS,cAAc,CAAI,GAAoB,EAAE,KAA4C;IACzF,IAAI,OAAO,GAAG,GAAG,CAAC;IAElB,OAAO,OAAO,KAAK,IAAI,EAAE,CAAC;QACtB,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QAE9B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { AnyClass } from \"./any-class.ts\";\nimport { getParentClass } from \"./get-parent-class.ts\";\n\nfunction walkClassChain<T>(cls: AnyClass | null, visit: (ancestor: AnyClass) => T | undefined): T | undefined {\n let current = cls;\n\n while (current !== null) {\n const result = visit(current);\n\n if (result !== undefined) {\n return result;\n }\n\n current = getParentClass(current);\n }\n\n return undefined;\n}\n\nexport { walkClassChain };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-like.js","sourceRoot":"","sources":["../../src/error/error-like.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,SAAS,WAAW,CAAC,KAAc;IAC/B,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC;AACtF,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,IAAI,KAAK,YAAY,UAAU,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACxD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { isRecord } from \"../predicate/is-record.
|
|
1
|
+
{"version":3,"file":"error-like.js","sourceRoot":"","sources":["../../src/error/error-like.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,SAAS,WAAW,CAAC,KAAc;IAC/B,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC;AACtF,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,IAAI,KAAK,YAAY,UAAU,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACxD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { isRecord } from \"../predicate/is-record.ts\";\n\nfunction isErrorLike(value: unknown): value is { message: string } {\n return isRecord(value) && \"message\" in value && typeof value.message === \"string\";\n}\n\nfunction readStream(value: unknown): string {\n if (typeof value === \"string\") {\n return value;\n }\n\n if (value instanceof Uint8Array || Buffer.isBuffer(value)) {\n return value.toString();\n }\n\n return \"\";\n}\n\nexport { isErrorLike, readStream };\n"]}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts a human-readable message from an unknown thrown value, falling back to its string form.
|
|
3
|
-
*
|
|
4
|
-
* @param error - The caught value to describe.
|
|
5
|
-
* @returns The value's message when it has one, otherwise its string form.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* errorMessage(new Error("boom")); // "boom"
|
|
9
|
-
* errorMessage(42); // "42"
|
|
10
|
-
*/
|
|
11
1
|
declare function errorMessage(error: unknown): string;
|
|
12
2
|
export { errorMessage };
|
|
13
3
|
//# sourceMappingURL=error-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-message.d.ts","sourceRoot":"","sources":["../../src/error/error-message.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"error-message.d.ts","sourceRoot":"","sources":["../../src/error/error-message.ts"],"names":[],"mappings":"AAEA,iBAAS,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE5C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
import { isErrorLike } from "./error-like.js";
|
|
2
|
-
/**
|
|
3
|
-
* Extracts a human-readable message from an unknown thrown value, falling back to its string form.
|
|
4
|
-
*
|
|
5
|
-
* @param error - The caught value to describe.
|
|
6
|
-
* @returns The value's message when it has one, otherwise its string form.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* errorMessage(new Error("boom")); // "boom"
|
|
10
|
-
* errorMessage(42); // "42"
|
|
11
|
-
*/
|
|
12
2
|
function errorMessage(error) {
|
|
13
3
|
return Error.isError(error) || isErrorLike(error) ? error.message : String(error);
|
|
14
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-message.js","sourceRoot":"","sources":["../../src/error/error-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"error-message.js","sourceRoot":"","sources":["../../src/error/error-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,SAAS,YAAY,CAAC,KAAc;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACtF,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { isErrorLike } from \"./error-like.ts\";\n\nfunction errorMessage(error: unknown): string {\n return Error.isError(error) || isErrorLike(error) ? error.message : String(error);\n}\n\nexport { errorMessage };\n"]}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Combines the `stderr` and `stdout` of a failed child-process error into a single trimmed string.
|
|
3
|
-
*
|
|
4
|
-
* @param error - The child-process error to read output from.
|
|
5
|
-
* @returns The joined output, or `undefined` when neither stream carried any text.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* formatChildProcessError({ stderr: "boom" }); // "boom"
|
|
9
|
-
*/
|
|
10
1
|
declare function formatChildProcessError(error: unknown): string | undefined;
|
|
11
2
|
export { formatChildProcessError };
|
|
12
3
|
//# sourceMappingURL=format-child-process-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-child-process-error.d.ts","sourceRoot":"","sources":["../../src/error/format-child-process-error.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"format-child-process-error.d.ts","sourceRoot":"","sources":["../../src/error/format-child-process-error.ts"],"names":[],"mappings":"AAGA,iBAAS,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CASnE;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { isRecord } from "../predicate/is-record.js";
|
|
2
2
|
import { readStream } from "./error-like.js";
|
|
3
|
-
/**
|
|
4
|
-
* Combines the `stderr` and `stdout` of a failed child-process error into a single trimmed string.
|
|
5
|
-
*
|
|
6
|
-
* @param error - The child-process error to read output from.
|
|
7
|
-
* @returns The joined output, or `undefined` when neither stream carried any text.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* formatChildProcessError({ stderr: "boom" }); // "boom"
|
|
11
|
-
*/
|
|
12
3
|
function formatChildProcessError(error) {
|
|
13
4
|
if (!isRecord(error)) {
|
|
14
5
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-child-process-error.js","sourceRoot":"","sources":["../../src/error/format-child-process-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"format-child-process-error.js","sourceRoot":"","sources":["../../src/error/format-child-process-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,SAAS,uBAAuB,CAAC,KAAc;IAC3C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACjC,MAAM,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IAE3F,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC;AAED,OAAO,EAAE,uBAAuB,EAAE,CAAC","sourcesContent":["import { isRecord } from \"../predicate/is-record.ts\";\nimport { readStream } from \"./error-like.ts\";\n\nfunction formatChildProcessError(error: unknown): string | undefined {\n if (!isRecord(error)) {\n return undefined;\n }\n\n const { stderr, stdout } = error;\n const details = [readStream(stderr), readStream(stdout)].filter(Boolean).join(\"\\n\").trim();\n\n return details.length > 0 ? details : undefined;\n}\n\nexport { formatChildProcessError };\n"]}
|
package/dist/error/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { errorMessage } from "./error-message.
|
|
2
|
-
export { formatChildProcessError } from "./format-child-process-error.
|
|
3
|
-
export { normalizeError } from "./normalize-error.
|
|
1
|
+
export { errorMessage } from "./error-message.ts";
|
|
2
|
+
export { formatChildProcessError } from "./format-child-process-error.ts";
|
|
3
|
+
export { normalizeError } from "./normalize-error.ts";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/error/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { errorMessage } from \"./error-message.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export { errorMessage } from \"./error-message.ts\";\nexport { formatChildProcessError } from \"./format-child-process-error.ts\";\nexport { normalizeError } from \"./normalize-error.ts\";\n"]}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Coerces an unknown thrown value into an `Error`, reusing it when it already is one and otherwise
|
|
3
|
-
* wrapping its message while copying any error-like own properties.
|
|
4
|
-
*
|
|
5
|
-
* @param error - The caught value to normalize.
|
|
6
|
-
* @returns The value itself when it is an `Error`, otherwise a new `Error` carrying its message.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* normalizeError("boom"); // Error: boom
|
|
10
|
-
*/
|
|
11
1
|
declare function normalizeError(error: unknown): Error;
|
|
12
2
|
export { normalizeError };
|
|
13
3
|
//# sourceMappingURL=normalize-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-error.d.ts","sourceRoot":"","sources":["../../src/error/normalize-error.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"normalize-error.d.ts","sourceRoot":"","sources":["../../src/error/normalize-error.ts"],"names":[],"mappings":"AAGA,iBAAS,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAM7C;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { isErrorLike } from "./error-like.js";
|
|
2
2
|
import { errorMessage } from "./error-message.js";
|
|
3
|
-
/**
|
|
4
|
-
* Coerces an unknown thrown value into an `Error`, reusing it when it already is one and otherwise
|
|
5
|
-
* wrapping its message while copying any error-like own properties.
|
|
6
|
-
*
|
|
7
|
-
* @param error - The caught value to normalize.
|
|
8
|
-
* @returns The value itself when it is an `Error`, otherwise a new `Error` carrying its message.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* normalizeError("boom"); // Error: boom
|
|
12
|
-
*/
|
|
13
3
|
function normalizeError(error) {
|
|
14
4
|
if (Error.isError(error)) {
|
|
15
5
|
return error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-error.js","sourceRoot":"","sources":["../../src/error/normalize-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD
|
|
1
|
+
{"version":3,"file":"normalize-error.js","sourceRoot":"","sources":["../../src/error/normalize-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,SAAS,cAAc,CAAC,KAAc;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { isErrorLike } from \"./error-like.ts\";\nimport { errorMessage } from \"./error-message.ts\";\n\nfunction normalizeError(error: unknown): Error {\n if (Error.isError(error)) {\n return error;\n }\n\n return Object.assign(new Error(errorMessage(error)), isErrorLike(error) ? error : {});\n}\n\nexport { normalizeError };\n"]}
|