@jackens/nnn 2024.7.18 → 2024.8.6
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/nnn.d.ts +3 -3
- package/nnn.js +7 -4
- package/package.json +1 -1
- package/readme.md +14 -8
package/nnn.d.ts
CHANGED
|
@@ -152,17 +152,17 @@ export declare const locale: (map: Partial<Record<PropertyKey, Partial<Record<Pr
|
|
|
152
152
|
export declare const nanolight: (pattern: RegExp, highlighters: Partial<Array<(chunk: string, index: number) => HArgs1>>, code: string) => HArgs1[];
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
|
-
* A helper for highlighting JavaScript.
|
|
155
|
+
* A helper for highlighting JavaScript (see also `nanolight`).
|
|
156
156
|
*/
|
|
157
157
|
export declare const nanolightJs: (code: string) => HArgs1[];
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
|
-
* A helper that implements TypeScript’s `Pick` utility type.
|
|
160
|
+
* A helper that implements TypeScript’s `Pick` utility type (see also `omit`).
|
|
161
161
|
*/
|
|
162
162
|
export declare const pick: <T extends Partial<Record<PropertyKey, unknown>>, K extends Array<keyof T>>(obj: Partial<Record<PropertyKey, unknown>>, keys: Partial<Array<unknown>>) => Pick<T, K[number]>;
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
|
-
* A helper that implements TypeScript’s `Omit` utility type.
|
|
165
|
+
* A helper that implements TypeScript’s `Omit` utility type (see also `pick`).
|
|
166
166
|
*/
|
|
167
167
|
export declare const omit: <T extends Partial<Record<PropertyKey, unknown>>, K extends Array<keyof T>>(obj: Partial<Record<PropertyKey, unknown>>, keys: Partial<Array<unknown>>) => Omit<T, K[number]>;
|
|
168
168
|
|
package/nnn.js
CHANGED
|
@@ -184,7 +184,7 @@ var jsOnParse = (handlers, text) => JSON.parse(text, (key, value) => {
|
|
|
184
184
|
}
|
|
185
185
|
const handler = handlers[key];
|
|
186
186
|
const params = value[key];
|
|
187
|
-
if (
|
|
187
|
+
if (handler instanceof Function && is(Array, params)) {
|
|
188
188
|
return handler(...params);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
@@ -244,9 +244,12 @@ var pro = (ref) => new Proxy(ref, {
|
|
|
244
244
|
var refsInfo = (...refs) => {
|
|
245
245
|
const fns = new Set;
|
|
246
246
|
refs.forEach((ref) => {
|
|
247
|
-
|
|
248
|
-
fns.
|
|
249
|
-
|
|
247
|
+
try {
|
|
248
|
+
while (ref instanceof Function && !fns.has(ref) && `${ref}`.match(/function\s+\w+[\s\S]+\[native code\]/)) {
|
|
249
|
+
fns.add(ref);
|
|
250
|
+
ref = Object.getPrototypeOf(ref);
|
|
251
|
+
}
|
|
252
|
+
} catch {
|
|
250
253
|
}
|
|
251
254
|
});
|
|
252
255
|
return Array.from(fns.values()).map((fn) => [
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Jackens’ JavaScript helpers.
|
|
4
4
|
|
|
5
|
-
<sub>Version: <code class="version">2024.
|
|
5
|
+
<sub>Version: <code class="version">2024.8.6</code></sub>
|
|
6
|
+
|
|
7
|
+
* [Documentation](https://jackens.github.io/nnn/doc/)
|
|
8
|
+
* [Tests](https://jackens.github.io/nnn/test/)
|
|
9
|
+
* [Chessboard Demo](https://jackens.github.io/nnn/chessboard/)
|
|
10
|
+
* [Gantt Chart Demo](https://jackens.github.io/nnn/gantt/)
|
|
11
|
+
* [Responsive Web Design Demo](https://jackens.github.io/nnn/rwd/)
|
|
6
12
|
|
|
7
13
|
## Installation
|
|
8
14
|
|
|
@@ -31,7 +37,7 @@ import { «something» } from './node_modules/@jackens/nnn/nnn.js'
|
|
|
31
37
|
or:
|
|
32
38
|
|
|
33
39
|
```js
|
|
34
|
-
import { «something» } from 'https://unpkg.com/@jackens/nnn@2024.
|
|
40
|
+
import { «something» } from 'https://unpkg.com/@jackens/nnn@2024.8.6/nnn.js'
|
|
35
41
|
```
|
|
36
42
|
|
|
37
43
|
## Exports
|
|
@@ -52,9 +58,9 @@ import { «something» } from 'https://unpkg.com/@jackens/nnn@2024.7.18/nnn.js'
|
|
|
52
58
|
- `jsOnParse`: `JSON.parse` with “JavaScript turned on”.
|
|
53
59
|
- `locale`: Language translations helper.
|
|
54
60
|
- `nanolight`: A generic helper for syntax highlighting (see also `nanolightJs`).
|
|
55
|
-
- `nanolightJs`: A helper for highlighting JavaScript.
|
|
56
|
-
- `omit`: A helper that implements TypeScript’s `Omit` utility type.
|
|
57
|
-
- `pick`: A helper that implements TypeScript’s `Pick` utility type.
|
|
61
|
+
- `nanolightJs`: A helper for highlighting JavaScript (see also `nanolight`).
|
|
62
|
+
- `omit`: A helper that implements TypeScript’s `Omit` utility type (see also `pick`).
|
|
63
|
+
- `pick`: A helper that implements TypeScript’s `Pick` utility type (see also `omit`).
|
|
58
64
|
- `plUral`: A helper for choosing the correct singular and plural.
|
|
59
65
|
- `pro`: A helper that protects calls to nested properties by a `Proxy` that initializes non-existent values with an empty
|
|
60
66
|
- `refsInfo`: A helper that provides information about the given `refs`.
|
|
@@ -738,7 +744,7 @@ A generic helper for syntax highlighting (see also `nanolightJs`).
|
|
|
738
744
|
const nanolightJs: (code: string) => HArgs1[];
|
|
739
745
|
```
|
|
740
746
|
|
|
741
|
-
A helper for highlighting JavaScript.
|
|
747
|
+
A helper for highlighting JavaScript (see also `nanolight`).
|
|
742
748
|
|
|
743
749
|
#### Usage Examples
|
|
744
750
|
|
|
@@ -762,7 +768,7 @@ expect(nanolightJs(codeJs)).to.deep.equal([
|
|
|
762
768
|
const omit: <T extends Partial<Record<PropertyKey, unknown>>, K extends Array<keyof T>>(obj: Partial<Record<PropertyKey, unknown>>, keys: Partial<Array<unknown>>) => Omit<T, K[number]>;
|
|
763
769
|
```
|
|
764
770
|
|
|
765
|
-
A helper that implements TypeScript’s `Omit` utility type.
|
|
771
|
+
A helper that implements TypeScript’s `Omit` utility type (see also `pick`).
|
|
766
772
|
|
|
767
773
|
#### Usage Examples
|
|
768
774
|
|
|
@@ -778,7 +784,7 @@ expect(omit(obj, ['c'])).to.deep.equal({ a: 42, b: '42' })
|
|
|
778
784
|
const pick: <T extends Partial<Record<PropertyKey, unknown>>, K extends Array<keyof T>>(obj: Partial<Record<PropertyKey, unknown>>, keys: Partial<Array<unknown>>) => Pick<T, K[number]>;
|
|
779
785
|
```
|
|
780
786
|
|
|
781
|
-
A helper that implements TypeScript’s `Pick` utility type.
|
|
787
|
+
A helper that implements TypeScript’s `Pick` utility type (see also `omit`).
|
|
782
788
|
|
|
783
789
|
#### Usage Examples
|
|
784
790
|
|