@jackens/nnn 2023.12.3 → 2023.12.19

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/chartable.d.ts CHANGED
@@ -38,4 +38,4 @@ export function chartable({ bottom, gapX, gapY, headerColumn, headerRow, id, lef
38
38
  zxY?: number[][];
39
39
  }): SVGSVGElement;
40
40
 
41
- export const tests: Record<string, () => void>;
41
+ export const tests: Record<string, () => void>;
package/eq.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  */
4
4
  export function eq(x: any, y: any): boolean;
5
5
 
6
- export const tests: Record<string, () => void>;
6
+ export const tests: Record<string, () => void>;
package/escape.d.ts CHANGED
@@ -13,4 +13,4 @@ export function escape(escapeMap: EscapeMap, template: TemplateStringsArray, ...
13
13
  */
14
14
  export function escapeValues(escapeMap: EscapeMap, values: any[]): string[];
15
15
 
16
- export const tests: Record<string, () => void>;
16
+ export const tests: Record<string, () => void>;
@@ -3,4 +3,4 @@
3
3
  */
4
4
  export function fixTypography(node: Node): void;
5
5
 
6
- export const tests: Record<string, () => void>;
6
+ export const tests: Record<string, () => void>;
package/h.d.ts CHANGED
@@ -23,7 +23,9 @@ export type HArgs1 = Record<string, any> | null | undefined | Node | string | nu
23
23
  * - All other arguments of type `string`/`number` are converted to `Text` nodes and appended to the element being created or modified.
24
24
  * - All other arguments of type `HArgs` are passed to `h` and the results are appended to the element being created or modified.
25
25
  */
26
- export function h<T extends keyof HTMLElementTagNameMap>(tag: T, ...args1: HArgs1[]): HTMLElementTagNameMap[T];,export function h<N extends Node>(node: N, ...args1: HArgs1[]): N;,export function h(tagOrNode: string | Node, ...args1: HArgs1[]): Node;
26
+ export function h<T extends keyof HTMLElementTagNameMap>(tag: T, ...args1: HArgs1[]): HTMLElementTagNameMap[T];
27
+ export function h<N extends Node>(node: N, ...args1: HArgs1[]): N;
28
+ export function h(tagOrNode: string | Node, ...args1: HArgs1[]): Node;
27
29
 
28
30
  /**
29
31
  * A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper for creating and modifying `SVGElement`s (see also `h`).
@@ -40,6 +42,8 @@ export function h<T extends keyof HTMLElementTagNameMap>(tag: T, ...args1: HArgs
40
42
  * - All other arguments of type `string`/`number` are converted to `Text` nodes and appended to the element being created or modified.
41
43
  * - All other arguments of type `HArgs` are passed to `s` and the results are appended to the element being created or modified.
42
44
  */
43
- export function s<T extends keyof SVGElementTagNameMap>(tag: T, ...args1: HArgs1[]): SVGElementTagNameMap[T];,export function s<N extends Node>(node: N, ...args1: HArgs1[]): N;,export function s(tagOrNode: string | Node, ...args1: HArgs1[]): Node;
45
+ export function s<T extends keyof SVGElementTagNameMap>(tag: T, ...args1: HArgs1[]): SVGElementTagNameMap[T];
46
+ export function s<N extends Node>(node: N, ...args1: HArgs1[]): N;
47
+ export function s(tagOrNode: string | Node, ...args1: HArgs1[]): Node;
44
48
 
45
- export const tests: Record<string, () => void>;
49
+ export const tests: Record<string, () => void>;
package/has.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  */
4
4
  export function has(key: any, ref: any): boolean;
5
5
 
6
- export const tests: Record<string, () => void>;
6
+ export const tests: Record<string, () => void>;
package/is.d.ts CHANGED
@@ -11,4 +11,4 @@ export const is: {
11
11
  <T extends abstract new (...args: any[]) => any>(type: T, arg: any): arg is InstanceType<T>;
12
12
  };
13
13
 
14
- export const tests: Record<string, () => void>;
14
+ export const tests: Record<string, () => void>;
package/jcss.d.ts CHANGED
@@ -23,4 +23,4 @@ export type JcssRoot = Record<string, JcssNode>;
23
23
  */
24
24
  export function jcss(root: JcssRoot, splitter?: string): string;
25
25
 
26
- export const tests: Record<string, () => void>;
26
+ export const tests: Record<string, () => void>;
package/jsOnParse.d.ts CHANGED
@@ -15,4 +15,4 @@
15
15
  */
16
16
  export function jsOnParse(handlers: Record<string, Function>, text: string): any;
17
17
 
18
- export const tests: Record<string, () => void>;
18
+ export const tests: Record<string, () => void>;
package/locale.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  */
4
4
  export function locale(locales: Record<string, Record<string, string | Record<string, string>>>, defaultLanguage: string, languages?: readonly string[]): (text?: string | undefined, version?: string | undefined) => string;
5
5
 
6
- export const tests: Record<string, () => void>;
6
+ export const tests: Record<string, () => void>;
package/nanolight.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * A generic helper for syntax highlighting (see also `nanolightJs`).
3
3
  */
4
- export function nanolight(pattern: RegExp, highlighters: ((chunk: string, index: number) => import('./h.js').HArgs)[], code: string): import("./h.js").HArgs[];
4
+ export function nanolight(pattern: RegExp, highlighters: ((chunk: string, index: number) => import('./h.js').HArgs1)[], code: string): import("./h.js").HArgs1[];
5
5
 
6
- export const tests: Record<string, () => void>;
6
+ export const tests: Record<string, () => void>;
package/nanolight.js CHANGED
@@ -3,10 +3,10 @@
3
3
  */
4
4
  export const nanolight = (
5
5
  /** @type {RegExp} */ pattern,
6
- /** @type {((chunk: string, index: number) => import('./h.js').HArgs)[]} */ highlighters,
6
+ /** @type {((chunk: string, index: number) => import('./h.js').HArgs1)[]} */ highlighters,
7
7
  /** @type {string} */ code
8
8
  ) => {
9
- const /** @type {import('./h.js').HArgs[]} */ result = []
9
+ const /** @type {import('./h.js').HArgs1[]} */ result = []
10
10
 
11
11
  code.split(pattern).forEach((chunk, index) => {
12
12
  index %= highlighters.length
package/nanolightJs.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * A helper for highlighting JavaScript.
3
3
  */
4
- export const nanolightJs: (code?: string | undefined) => import("./h.js").HArgs[];
4
+ export const nanolightJs: (code?: string | undefined) => import("./h.js").HArgs1[];
5
5
 
6
- export const tests: Record<string, () => void>;
6
+ export const tests: Record<string, () => void>;
package/package.json CHANGED
@@ -40,5 +40,5 @@
40
40
  "types": "nnn.d.ts",
41
41
  "name": "@jackens/nnn",
42
42
  "type": "module",
43
- "version": "2023.12.3"
43
+ "version": "2023.12.19"
44
44
  }
package/plUral.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  */
4
4
  export function plUral(singular: string, plural2: string, plural5: string, value: number): string;
5
5
 
6
- export const tests: Record<string, () => void>;
6
+ export const tests: Record<string, () => void>;
package/pro.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  */
4
4
  export function pro(ref: any): any;
5
5
 
6
- export const tests: Record<string, () => void>;
6
+ export const tests: Record<string, () => void>;
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # nnn
2
2
 
3
- Jackens’ JavaScript helpers (version: 2023.12.3).
3
+ Jackens’ JavaScript helpers.
4
4
 
5
5
  ## Installation
6
6
 
@@ -54,9 +54,7 @@ import { «something» } from './node_modules/@jackens/nnn/nnn.js'
54
54
  - `s`: A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper for creating and modifying `SVGElement`s (see also `h`).
55
55
  - `uuid1`: A helper that generates a UUID v1 identifier (with a creation timestamp).
56
56
 
57
- <a href="#EscapeMap" id="EscapeMap" name="EscapeMap">
58
- <h3>EscapeMap</h3>
59
- </a>
57
+ ### EscapeMap
60
58
 
61
59
  ```ts
62
60
  export type EscapeMap = Map<any, (value?: any) => string>;
@@ -64,9 +62,7 @@ export type EscapeMap = Map<any, (value?: any) => string>;
64
62
 
65
63
  The type of arguments of the `escapeValues` and `escape` helpers.
66
64
 
67
- <a href="#HArgs" id="HArgs" name="HArgs">
68
- <h3>HArgs</h3>
69
- </a>
65
+ ### HArgs
70
66
 
71
67
  ```ts
72
68
  export type HArgs = [string | Node, ...HArgs1[]];
@@ -74,9 +70,7 @@ export type HArgs = [string | Node, ...HArgs1[]];
74
70
 
75
71
  The type of arguments of the `h` and `s` helpers.
76
72
 
77
- <a href="#HArgs1" id="HArgs1" name="HArgs1">
78
- <h3>HArgs1</h3>
79
- </a>
73
+ ### HArgs1
80
74
 
81
75
  ```ts
82
76
  export type HArgs1 = Record<string, any> | null | undefined | Node | string | number | [string | Node, ...HArgs1[]];
@@ -84,9 +78,7 @@ export type HArgs1 = Record<string, any> | null | undefined | Node | string | nu
84
78
 
85
79
  The type of arguments of the `h` and `s` helpers.
86
80
 
87
- <a href="#JcssNode" id="JcssNode" name="JcssNode">
88
- <h3>JcssNode</h3>
89
- </a>
81
+ ### JcssNode
90
82
 
91
83
  ```ts
92
84
  export type JcssNode = {
@@ -96,9 +88,7 @@ export type JcssNode = {
96
88
 
97
89
  The type of arguments of the `jcss` helper.
98
90
 
99
- <a href="#JcssRoot" id="JcssRoot" name="JcssRoot">
100
- <h3>JcssRoot</h3>
101
- </a>
91
+ ### JcssRoot
102
92
 
103
93
  ```ts
104
94
  export type JcssRoot = Record<string, JcssNode>;
@@ -106,9 +96,7 @@ export type JcssRoot = Record<string, JcssNode>;
106
96
 
107
97
  The type of arguments of the `jcss` helper.
108
98
 
109
- <a href="#chartable" id="chartable" name="chartable">
110
- <h3>chartable</h3>
111
- </a>
99
+ ### chartable
112
100
 
113
101
  ```ts
114
102
  export function chartable({ bottom, gapX, gapY, headerColumn, headerRow, id, left, maxY, right, singleScale, table, title, top, xLabels, zLabels, zxY }?: {
@@ -151,9 +139,7 @@ Options:
151
139
  - `zLabels`: data series labels
152
140
  - `zxY`: chart data
153
141
 
154
- <a href="#eq" id="eq" name="eq">
155
- <h3>eq</h3>
156
- </a>
142
+ ### eq
157
143
 
158
144
  ```ts
159
145
  export function eq(x: any, y: any): boolean;
@@ -195,9 +181,7 @@ console.assert(!eq(
195
181
  ))
196
182
  ```
197
183
 
198
- <a href="#escape" id="escape" name="escape">
199
- <h3>escape</h3>
200
- </a>
184
+ ### escape
201
185
 
202
186
  ```ts
203
187
  export function escape(escapeMap: EscapeMap, template: TemplateStringsArray, ...values: any[]): string;
@@ -232,9 +216,7 @@ const expected = `
232
216
  console.assert(actual === expected)
233
217
  ```
234
218
 
235
- <a href="#escapeValues" id="escapeValues" name="escapeValues">
236
- <h3>escapeValues</h3>
237
- </a>
219
+ ### escapeValues
238
220
 
239
221
  ```ts
240
222
  export function escapeValues(escapeMap: EscapeMap, values: any[]): string[];
@@ -242,9 +224,7 @@ export function escapeValues(escapeMap: EscapeMap, values: any[]): string[];
242
224
 
243
225
  A generic helper for escaping `values` by given `escapeMap`.
244
226
 
245
- <a href="#fixTypography" id="fixTypography" name="fixTypography">
246
- <h3>fixTypography</h3>
247
- </a>
227
+ ### fixTypography
248
228
 
249
229
  ```ts
250
230
  export function fixTypography(node: Node): void;
@@ -264,9 +244,7 @@ console.assert(p.innerHTML ===
264
244
  '(zob. https://\u200Bpl.\u200Bwikipedia.\u200Borg/\u200Bwiki/\u200BPangram).')
265
245
  ```
266
246
 
267
- <a href="#h" id="h" name="h">
268
- <h3>h</h3>
269
- </a>
247
+ ### h
270
248
 
271
249
  ```ts
272
250
  export function h<T extends keyof HTMLElementTagNameMap>(tag: T, ...args1: HArgs1[]): HTMLElementTagNameMap[T];
@@ -356,9 +334,7 @@ h(div, { $key: { two: 2 } })
356
334
  console.assert(eq(div.key, { one: 1, two: 2 }))
357
335
  ```
358
336
 
359
- <a href="#has" id="has" name="has">
360
- <h3>has</h3>
361
- </a>
337
+ ### has
362
338
 
363
339
  ```ts
364
340
  export function has(key: any, ref: any): boolean;
@@ -397,9 +373,7 @@ console.assert(typeError instanceof TypeError) // Cannot use 'in' operator to se
397
373
  console.assert(!has('key', null))
398
374
  ```
399
375
 
400
- <a href="#is" id="is" name="is">
401
- <h3>is</h3>
402
- </a>
376
+ ### is
403
377
 
404
378
  ```ts
405
379
  export const is: {
@@ -459,9 +433,7 @@ console.assert(is(Object, fakeFooBar))
459
433
  console.assert(!iz(Object, fakeFooBar))
460
434
  ```
461
435
 
462
- <a href="#jcss" id="jcss" name="jcss">
463
- <h3>jcss</h3>
464
- </a>
436
+ ### jcss
465
437
 
466
438
  ```ts
467
439
  export function jcss(root: JcssRoot, splitter?: string): string;
@@ -673,9 +645,7 @@ const expected = `
673
645
  console.assert(actual === expected)
674
646
  ```
675
647
 
676
- <a href="#jsOnParse" id="jsOnParse" name="jsOnParse">
677
- <h3>jsOnParse</h3>
678
- </a>
648
+ ### jsOnParse
679
649
 
680
650
  ```ts
681
651
  export function jsOnParse(handlers: Record<string, Function>, text: string): any;
@@ -740,9 +710,7 @@ const expected = [
740
710
  console.assert(eq(actual, expected))
741
711
  ```
742
712
 
743
- <a href="#locale" id="locale" name="locale">
744
- <h3>locale</h3>
745
- </a>
713
+ ### locale
746
714
 
747
715
  ```ts
748
716
  export function locale(locales: Record<string, Record<string, string | Record<string, string>>>, defaultLanguage: string, languages?: readonly string[]): (text?: string | undefined, version?: string | undefined) => string;
@@ -775,22 +743,18 @@ console.assert(_('toString') === 'toString')
775
743
  console.assert(_('toString', 'undefined_version') === 'toString')
776
744
  ```
777
745
 
778
- <a href="#nanolight" id="nanolight" name="nanolight">
779
- <h3>nanolight</h3>
780
- </a>
746
+ ### nanolight
781
747
 
782
748
  ```ts
783
- export function nanolight(pattern: RegExp, highlighters: ((chunk: string, index: number) => import('./h.js').HArgs)[], code: string): import("./h.js").HArgs[];
749
+ export function nanolight(pattern: RegExp, highlighters: ((chunk: string, index: number) => import('./h.js').HArgs1)[], code: string): import("./h.js").HArgs1[];
784
750
  ```
785
751
 
786
752
  A generic helper for syntax highlighting (see also `nanolightJs`).
787
753
 
788
- <a href="#nanolightJs" id="nanolightJs" name="nanolightJs">
789
- <h3>nanolightJs</h3>
790
- </a>
754
+ ### nanolightJs
791
755
 
792
756
  ```ts
793
- export const nanolightJs: (code?: string | undefined) => import("./h.js").HArgs[];
757
+ export const nanolightJs: (code?: string | undefined) => import("./h.js").HArgs1[];
794
758
  ```
795
759
 
796
760
  A helper for highlighting JavaScript.
@@ -804,9 +768,7 @@ console.assert(h('pre', ['code', ...nanolightJs(codeJs)]).outerHTML ===
804
768
  '<pre><code><b>const</b> <i>answerToLifeTheUniverseAndEverything</i> <b>=</b> <u>42</u></code></pre>')
805
769
  ```
806
770
 
807
- <a href="#plUral" id="plUral" name="plUral">
808
- <h3>plUral</h3>
809
- </a>
771
+ ### plUral
810
772
 
811
773
  ```ts
812
774
  export function plUral(singular: string, plural2: string, plural5: string, value: number): string;
@@ -832,9 +794,7 @@ console.assert(car(17) === 'cars')
832
794
  console.assert(car(42) === 'cars')
833
795
  ```
834
796
 
835
- <a href="#pro" id="pro" name="pro">
836
- <h3>pro</h3>
837
- </a>
797
+ ### pro
838
798
 
839
799
  ```ts
840
800
  export function pro(ref: any): any;
@@ -872,9 +832,7 @@ pro(ref).one.two.three.four = 1234
872
832
  console.assert(eq(ref, { one: { two: { three: { four: 1234 } } } }))
873
833
  ```
874
834
 
875
- <a href="#refsInfo" id="refsInfo" name="refsInfo">
876
- <h3>refsInfo</h3>
877
- </a>
835
+ ### refsInfo
878
836
 
879
837
  ```ts
880
838
  export function refsInfo(...refs: any[]): [string, string, string[]][];
@@ -917,9 +875,7 @@ const browserFingerprint = () => {
917
875
  console.log(browserFingerprint())
918
876
  ```
919
877
 
920
- <a href="#s" id="s" name="s">
921
- <h3>s</h3>
922
- </a>
878
+ ### s
923
879
 
924
880
  ```ts
925
881
  export function s<T extends keyof SVGElementTagNameMap>(tag: T, ...args1: HArgs1[]): SVGElementTagNameMap[T];
@@ -941,9 +897,7 @@ A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style help
941
897
  - All other arguments of type `string`/`number` are converted to `Text` nodes and appended to the element being created or modified.
942
898
  - All other arguments of type `HArgs` are passed to `s` and the results are appended to the element being created or modified.
943
899
 
944
- <a href="#uuid1" id="uuid1" name="uuid1">
945
- <h3>uuid1</h3>
946
- </a>
900
+ ### uuid1
947
901
 
948
902
  ```ts
949
903
  export function uuid1({ date, node }?: {
package/refsInfo.d.ts CHANGED
@@ -5,4 +5,4 @@
5
5
  */
6
6
  export function refsInfo(...refs: any[]): [string, string, string[]][];
7
7
 
8
- export const tests: Record<string, () => void>;
8
+ export const tests: Record<string, () => void>;
package/tests.d.ts CHANGED
@@ -1 +1 @@
1
- export const tests: Record<string, () => void>;
1
+ export const tests: Record<string, () => void>;
package/uuid1.d.ts CHANGED
@@ -9,4 +9,4 @@ export const tests: Record<string, () => void>;
9
9
  export function uuid1({ date, node }?: {
10
10
  date?: Date | undefined;
11
11
  node?: string | undefined;
12
- }): string;
12
+ }): string;