@jackens/nnn 2024.7.9 → 2024.7.12
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/package.json +4 -4
- package/readme.md +2 -32
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Jackens",
|
|
3
3
|
"description": "Jackens’ JavaScript helpers.",
|
|
4
|
-
"homepage": "https://jackens.github.io/
|
|
4
|
+
"homepage": "https://jackens.github.io/doc/",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CSS-in-JS",
|
|
7
7
|
"CSV",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
],
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"main": "nnn.js",
|
|
36
|
-
"types": "nnn.d.ts",
|
|
37
36
|
"name": "@jackens/nnn",
|
|
38
37
|
"type": "module",
|
|
39
|
-
"
|
|
40
|
-
|
|
38
|
+
"types": "nnn.d.ts",
|
|
39
|
+
"version": "2024.7.12"
|
|
40
|
+
}
|
package/readme.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Jackens’ JavaScript helpers.
|
|
4
4
|
|
|
5
|
-
<sub>Version: <code class="version">2024.7.
|
|
5
|
+
<sub>Version: <code class="version">2024.7.12</code></sub>
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -31,7 +31,7 @@ import { «something» } from './node_modules/@jackens/nnn/nnn.js'
|
|
|
31
31
|
or:
|
|
32
32
|
|
|
33
33
|
```js
|
|
34
|
-
import { «something» } from 'https://unpkg.com/@jackens/nnn@2024.7.
|
|
34
|
+
import { «something» } from 'https://unpkg.com/@jackens/nnn@2024.7.12/nnn.js'
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## Exports
|
|
@@ -84,8 +84,6 @@ The type of arguments of the `h` and `s` helpers.
|
|
|
84
84
|
type HArgs1 = Partial<Record<PropertyKey, unknown>> | null | undefined | Node | string | number | HArgs;
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Record>` instead of `Record`.
|
|
88
|
-
|
|
89
87
|
The type of arguments of the `h` and `s` helpers.
|
|
90
88
|
|
|
91
89
|
### JcNode
|
|
@@ -104,8 +102,6 @@ The type of arguments of the `jc` helper.
|
|
|
104
102
|
type JcRoot = Partial<Record<PropertyKey, JcNode>>;
|
|
105
103
|
```
|
|
106
104
|
|
|
107
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Record>` instead of `Record`.
|
|
108
|
-
|
|
109
105
|
The type of arguments of the `jc` helper.
|
|
110
106
|
|
|
111
107
|
### csvParse
|
|
@@ -117,8 +113,6 @@ const csvParse: (text: string, { header, separator }?: {
|
|
|
117
113
|
}) => Partial<Array<Partial<Record<PropertyKey, string>>>> | Partial<Array<Partial<Array<string>>>>;
|
|
118
114
|
```
|
|
119
115
|
|
|
120
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Array>`/`Partial<Record>` instead of `Array`/`Record`.
|
|
121
|
-
|
|
122
116
|
A tiny helper for CSV parsing.
|
|
123
117
|
|
|
124
118
|
Options:
|
|
@@ -159,8 +153,6 @@ expect(csvParse(text)).to.deep.equal([{
|
|
|
159
153
|
const escape: (escapeMap: EscapeMap, template: TemplateStringsArray, ...values: Partial<Array<unknown>>) => string;
|
|
160
154
|
```
|
|
161
155
|
|
|
162
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Array>` instead of `Array`.
|
|
163
|
-
|
|
164
156
|
A generic helper for escaping `values` by given `escapeMap` (in *TemplateStrings* flavor).
|
|
165
157
|
|
|
166
158
|
#### Usage Examples
|
|
@@ -196,8 +188,6 @@ expect(actual).to.deep.equal(expected)
|
|
|
196
188
|
const escapeValues: (escapeMap: EscapeMap, values: Partial<Array<unknown>>) => Partial<Array<string>>;
|
|
197
189
|
```
|
|
198
190
|
|
|
199
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Array>` instead of `Array`.
|
|
200
|
-
|
|
201
191
|
A generic helper for escaping `values` by given `escapeMap`.
|
|
202
192
|
|
|
203
193
|
### fixTypography
|
|
@@ -230,8 +220,6 @@ const h: {
|
|
|
230
220
|
};
|
|
231
221
|
```
|
|
232
222
|
|
|
233
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Array>` instead of `Array`.
|
|
234
|
-
|
|
235
223
|
A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper for creating and modifying `HTMLElement`s (see also `s`).
|
|
236
224
|
|
|
237
225
|
- The first argument of type `string` specifies the tag of the element to be created.
|
|
@@ -369,8 +357,6 @@ const is: {
|
|
|
369
357
|
};
|
|
370
358
|
```
|
|
371
359
|
|
|
372
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Array>`/`Partial<Record>` instead of `Array`/`Record`.
|
|
373
|
-
|
|
374
360
|
A helper that checks if the given argument is of a certain type.
|
|
375
361
|
|
|
376
362
|
#### Usage Examples
|
|
@@ -651,8 +637,6 @@ expect(actual).to.deep.equal(expected)
|
|
|
651
637
|
const jsOnParse: (handlers: Partial<Record<PropertyKey, Function>>, text: string) => any;
|
|
652
638
|
```
|
|
653
639
|
|
|
654
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Record>` instead of `Record`.
|
|
655
|
-
|
|
656
640
|
`JSON.parse` with “JavaScript turned on”.
|
|
657
641
|
|
|
658
642
|
Objects having *exactly* one property which is present in the `handlers` map, i.e. objects of the form:
|
|
@@ -720,8 +704,6 @@ expect(actual).to.deep.equal(expected)
|
|
|
720
704
|
const locale: (map: Partial<Record<PropertyKey, Partial<Record<PropertyKey, string>>>>, defaultVersion: string) => (text: string, version?: string) => string;
|
|
721
705
|
```
|
|
722
706
|
|
|
723
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Record>` instead of `Record`.
|
|
724
|
-
|
|
725
707
|
Language translations helper.
|
|
726
708
|
|
|
727
709
|
#### Usage Examples
|
|
@@ -752,8 +734,6 @@ expect(_('toString', 'undefined_version')).to.deep.equal('toString')
|
|
|
752
734
|
const nanolight: (pattern: RegExp, highlighters: Partial<Array<(chunk: string, index: number) => HArgs1>>, code: string) => HArgs1[];
|
|
753
735
|
```
|
|
754
736
|
|
|
755
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Array>` instead of `Array`.
|
|
756
|
-
|
|
757
737
|
A generic helper for syntax highlighting (see also `nanolightJs`).
|
|
758
738
|
|
|
759
739
|
### nanolightJs
|
|
@@ -786,8 +766,6 @@ expect(nanolightJs(codeJs)).to.deep.equal([
|
|
|
786
766
|
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]>;
|
|
787
767
|
```
|
|
788
768
|
|
|
789
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Array>`/`Partial<Record>` instead of `Array`/`Record`.
|
|
790
|
-
|
|
791
769
|
A helper that implements TypeScript’s `Omit` utility type.
|
|
792
770
|
|
|
793
771
|
#### Usage Examples
|
|
@@ -804,8 +782,6 @@ expect(omit(obj, ['c'])).to.deep.equal({ a: 42, b: '42' })
|
|
|
804
782
|
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]>;
|
|
805
783
|
```
|
|
806
784
|
|
|
807
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Array>`/`Partial<Record>` instead of `Array`/`Record`.
|
|
808
|
-
|
|
809
785
|
A helper that implements TypeScript’s `Pick` utility type.
|
|
810
786
|
|
|
811
787
|
#### Usage Examples
|
|
@@ -886,8 +862,6 @@ expect(ref).to.deep.equal({ one: { two: { three: { four: 1234 } } } })
|
|
|
886
862
|
const refsInfo: (...refs: Partial<Array<unknown>>) => Partial<Array<[string, string, Partial<Array<string>>]>>;
|
|
887
863
|
```
|
|
888
864
|
|
|
889
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Array>` instead of `Array`.
|
|
890
|
-
|
|
891
865
|
A helper that provides information about the given `refs`.
|
|
892
866
|
|
|
893
867
|
It returns an array of triples: `[«name», «prototype-name», «array-of-own-property-names»]`.
|
|
@@ -935,8 +909,6 @@ const s: {
|
|
|
935
909
|
};
|
|
936
910
|
```
|
|
937
911
|
|
|
938
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Array>` instead of `Array`.
|
|
939
|
-
|
|
940
912
|
A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper for creating and modifying `SVGElement`s (see also `h`).
|
|
941
913
|
|
|
942
914
|
- The first argument of type `string` specifies the tag of the element to be created.
|
|
@@ -957,8 +929,6 @@ A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style help
|
|
|
957
929
|
const svgUse: (id: string, ...args: Partial<Array<HArgs1>>) => SVGSVGElement;
|
|
958
930
|
```
|
|
959
931
|
|
|
960
|
-
> See [here](https://jackens.github.io/nnn/doc/#Why-Partial-Array-and-Partial-Record) for an explanation of why `Partial<Array>` instead of `Array`.
|
|
961
|
-
|
|
962
932
|
A convenient shortcut for `s('svg', ['use', { 'xlink:href': '#' + id }], ...args)`.
|
|
963
933
|
|
|
964
934
|
### uuid1
|