@jackens/nnn 2025.2.4 → 2025.4.29

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.
Files changed (4) hide show
  1. package/nnn.d.ts +15 -17
  2. package/nnn.js +20 -21
  3. package/package.json +6 -5
  4. package/readme.md +51 -141
package/nnn.d.ts CHANGED
@@ -105,19 +105,21 @@ export declare const svgUse: (id: string, ...args: Partial<Array<HArgs1>>) => SV
105
105
  */
106
106
  export declare const hasOwn: (ref: unknown, key: unknown) => boolean;
107
107
  /**
108
- * A helper that checks if the given argument is of a certain type.
109
- */
110
- export declare const is: {
111
- (type: ArrayConstructor, arg: unknown): arg is Partial<Array<unknown>>;
112
- (type: BigIntConstructor, arg: unknown): arg is bigint;
113
- (type: BooleanConstructor, arg: unknown): arg is boolean;
114
- (type: NumberConstructor, arg: unknown): arg is number;
115
- (type: ObjectConstructor, arg: unknown): arg is Partial<Record<PropertyKey, unknown>>;
116
- (type: StringConstructor, arg: unknown): arg is string;
117
- (type: SymbolConstructor, arg: unknown): arg is symbol;
118
- (type: undefined, arg: unknown): arg is undefined | null;
119
- <T extends abstract new (...args: Partial<Array<any>>) => unknown>(type: T, arg: unknown): arg is InstanceType<T>;
120
- };
108
+ * A helper that checks if the given argument is of type `any[]`.
109
+ */
110
+ export declare const isArray: (arg: any) => arg is any[];
111
+ /**
112
+ * A helper that checks if the given argument is of type `number`.
113
+ */
114
+ export declare const isNumber: (arg: any) => arg is number;
115
+ /**
116
+ * A helper that checks if the given argument is of type `Partial<Record<PropertyKey, unknown>>`.
117
+ */
118
+ export declare const isRecord: (arg: any) => arg is Partial<Record<PropertyKey, unknown>>;
119
+ /**
120
+ * A helper that checks if the given argument is of type `string`.
121
+ */
122
+ export declare const isString: (arg: any) => arg is string;
121
123
  /**
122
124
  * `JSON.parse` with “JavaScript turned on”.
123
125
  *
@@ -134,10 +136,6 @@ export declare const is: {
134
136
  * ```
135
137
  */
136
138
  export declare const jsOnParse: (handlers: Partial<Record<PropertyKey, Function>>, text: string) => any;
137
- /**
138
- * Language translations helper.
139
- */
140
- export declare const locale: (map: Partial<Record<PropertyKey, Partial<Record<PropertyKey, string>>>>, defaultVersion: string) => (text: string, version?: string) => string;
141
139
  /**
142
140
  * A generic helper for syntax highlighting (see also `nanolightJs`).
143
141
  */
package/nnn.js CHANGED
@@ -1,5 +1,8 @@
1
1
  // src/nnn/is.ts
2
- var is = (type, arg) => arg?.constructor === type;
2
+ var isArray = Array.isArray;
3
+ var isNumber = (arg) => typeof arg === "number";
4
+ var isRecord = (arg) => typeof arg === "object" && arg != null && !isArray(arg);
5
+ var isString = (arg) => typeof arg === "string";
3
6
 
4
7
  // src/nnn/c.ts
5
8
  var _c = (node, prefix, result, split) => {
@@ -9,7 +12,7 @@ var _c = (node, prefix, result, split) => {
9
12
  if (style0 == null || prefix0 == null) {
10
13
  continue;
11
14
  }
12
- if (is(Array, style0)) {
15
+ if (isArray(style0)) {
13
16
  result.push(prefix0, prefix0 !== "" ? "{" : "", style0.join(";"), prefix0 !== "" ? "}" : "");
14
17
  } else {
15
18
  const todo = [];
@@ -17,7 +20,7 @@ var _c = (node, prefix, result, split) => {
17
20
  let attributesPushed = false;
18
21
  for (const key in style0) {
19
22
  const value = style0[key];
20
- if (is(String, value) || is(Number, value)) {
23
+ if (isString(value) || isNumber(value)) {
21
24
  if (!attributesPushed) {
22
25
  attributesPushed = true;
23
26
  attributes = [];
@@ -77,21 +80,19 @@ var NS = {
77
80
  var _h = (namespaceURI) => {
78
81
  const createElement = namespaceURI == null ? (tag) => document.createElement(tag) : (tag) => document.createElementNS(namespaceURI, tag);
79
82
  const h = (tagOrNode, ...args) => {
80
- const node = is(String, tagOrNode) ? createElement(tagOrNode) : tagOrNode;
83
+ const node = isString(tagOrNode) ? createElement(tagOrNode) : tagOrNode;
81
84
  args.forEach((arg) => {
82
85
  let child = null;
83
86
  if (arg instanceof Node) {
84
87
  child = arg;
85
- } else if (is(String, arg) || is(Number, arg)) {
86
- child = document.createTextNode(arg);
87
- } else if (is(Array, arg)) {
88
+ } else if (isArray(arg)) {
88
89
  child = h(...arg);
89
- } else if (arg != null) {
90
+ } else if (isRecord(arg)) {
90
91
  for (const name in arg) {
91
92
  const value = arg[name];
92
93
  if (name[0] === "$") {
93
94
  const name1 = name.slice(1);
94
- if (is(Object, value)) {
95
+ if (isRecord(value)) {
95
96
  node[name1] = node[name1] ?? {};
96
97
  Object.assign(node[name1], value);
97
98
  } else {
@@ -108,7 +109,7 @@ var _h = (namespaceURI) => {
108
109
  } else if (value === false) {
109
110
  node.removeAttributeNS(ns, basename);
110
111
  } else {
111
- node.setAttributeNS(ns, basename, is(String, value) ? value : "" + value);
112
+ node.setAttributeNS(ns, basename, value);
112
113
  }
113
114
  }
114
115
  } else {
@@ -117,11 +118,13 @@ var _h = (namespaceURI) => {
117
118
  } else if (value === false) {
118
119
  node.removeAttribute(name);
119
120
  } else {
120
- node.setAttribute(name, is(String, value) ? value : "" + value);
121
+ node.setAttribute(name, "" + value);
121
122
  }
122
123
  }
123
124
  }
124
125
  }
126
+ } else if (arg != null) {
127
+ child = document.createTextNode(arg);
125
128
  }
126
129
  if (child != null) {
127
130
  node.appendChild(child);
@@ -170,7 +173,7 @@ var fixTypography = (node) => {
170
173
  var hasOwn = (ref, key) => ref != null && Object.hasOwn(ref, key);
171
174
  // src/nnn/jsOnParse.ts
172
175
  var jsOnParse = (handlers, text) => JSON.parse(text, (key, value) => {
173
- if (is(Object, value)) {
176
+ if (isRecord(value)) {
174
177
  let isSecondKey = false;
175
178
  for (key in value) {
176
179
  if (isSecondKey) {
@@ -180,18 +183,12 @@ var jsOnParse = (handlers, text) => JSON.parse(text, (key, value) => {
180
183
  }
181
184
  const handler = handlers[key];
182
185
  const params = value[key];
183
- if (handler instanceof Function && is(Array, params)) {
186
+ if (handler instanceof Function && isArray(params)) {
184
187
  return handler(...params);
185
188
  }
186
189
  }
187
190
  return value;
188
191
  });
189
- // src/nnn/locale.ts
190
- var locale = (map, defaultVersion) => (text, version = defaultVersion) => {
191
- const textV = map?.[version]?.[text];
192
- const textD = map?.[defaultVersion]?.[text];
193
- return is(String, textV) ? textV : is(String, textD) ? textD : text;
194
- };
195
192
  // src/nnn/nanolight.ts
196
193
  var nanolight = (pattern, highlighters, code) => {
197
194
  const result = [];
@@ -247,9 +244,11 @@ export {
247
244
  omit,
248
245
  nanolightJs,
249
246
  nanolight,
250
- locale,
251
247
  jsOnParse,
252
- is,
248
+ isString,
249
+ isRecord,
250
+ isNumber,
251
+ isArray,
253
252
  hasOwn,
254
253
  h,
255
254
  fixTypography,
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/nnn/doc/",
4
+ "homepage": "https://jackens.github.io/doc/",
5
5
  "keywords": [
6
6
  "c",
7
7
  "CSS-in-JS",
@@ -15,17 +15,18 @@
15
15
  "HyperScript",
16
16
  "in",
17
17
  "is",
18
+ "isArray",
19
+ "isNumber",
20
+ "isRecord",
21
+ "isString",
18
22
  "JS-to-CSS",
19
23
  "JSON",
20
24
  "jsOnParse",
21
- "locale",
22
- "localization",
23
25
  "nanolight",
24
26
  "nnn",
25
27
  "omit",
26
28
  "pick",
27
29
  "SVG",
28
- "translation",
29
30
  "typography",
30
31
  "uuid",
31
32
  "uuid1",
@@ -36,5 +37,5 @@
36
37
  "name": "@jackens/nnn",
37
38
  "type": "module",
38
39
  "types": "nnn.d.ts",
39
- "version": "2025.2.4"
40
+ "version": "2025.4.29"
40
41
  }
package/readme.md CHANGED
@@ -2,14 +2,6 @@
2
2
 
3
3
  Jackens’ JavaScript helpers.
4
4
 
5
- <sub>Version: <code class="version">2025.2.4</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/)
12
-
13
5
  ## Installation
14
6
 
15
7
  ```sh
@@ -34,12 +26,6 @@ or
34
26
  import { «something» } from './node_modules/@jackens/nnn/nnn.js'
35
27
  ```
36
28
 
37
- or
38
-
39
- ```js
40
- import { «something» } from 'https://unpkg.com/@jackens/nnn@2025.2.4/nnn.js'
41
- ```
42
-
43
29
  ## Exports
44
30
 
45
31
  - `CNode`: The type of arguments of the `c` helper.
@@ -54,9 +40,11 @@ import { «something» } from 'https://unpkg.com/@jackens/nnn@2025.2.4/nnn.js'
54
40
  - `fixTypography`: A helper that implements typographic corrections specific to Polish typography.
55
41
  - `h`: A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper for creating and modifying `HTMLElement`s (see also `s`).
56
42
  - `hasOwn`: A replacement for the `in` operator (not to be confused with the `for-in` loop) that works properly.
57
- - `is`: A helper that checks if the given argument is of a certain type.
43
+ - `isArray`: A helper that checks if the given argument is of type `any[]`.
44
+ - `isNumber`: A helper that checks if the given argument is of type `number`.
45
+ - `isRecord`: A helper that checks if the given argument is of type `Partial<Record<PropertyKey, unknown>>`.
46
+ - `isString`: A helper that checks if the given argument is of type `string`.
58
47
  - `jsOnParse`: `JSON.parse` with “JavaScript turned on”.
59
- - `locale`: Language translations helper.
60
48
  - `nanolight`: A generic helper for syntax highlighting (see also `nanolightJs`).
61
49
  - `nanolightJs`: A helper for highlighting JavaScript (see also `nanolight`).
62
50
  - `omit`: A helper that implements TypeScript’s `Omit` utility type (see also `pick`).
@@ -127,7 +115,7 @@ The `root` parameter provides a hierarchical description of CSS rules.
127
115
 
128
116
  #### Usage Examples
129
117
 
130
- ```js
118
+ ```ts
131
119
  const actual = c({
132
120
  a: {
133
121
  color: 'red',
@@ -153,7 +141,7 @@ a{
153
141
  expect(actual).to.deep.equal(expected)
154
142
  ```
155
143
 
156
- ```js
144
+ ```ts
157
145
  const actual = c({
158
146
  a: {
159
147
  '.b': {
@@ -181,7 +169,7 @@ a.b{
181
169
  expect(actual).to.deep.equal(expected)
182
170
  ```
183
171
 
184
- ```js
172
+ ```ts
185
173
  const actual = c({
186
174
  '@font-face$$1': {
187
175
  fontFamily: 'Jackens',
@@ -256,7 +244,7 @@ div.c2{
256
244
  expect(actual).to.deep.equal(expected)
257
245
  ```
258
246
 
259
- ```js
247
+ ```ts
260
248
  const actual = c({
261
249
  a: {
262
250
  '.b,.c': {
@@ -279,7 +267,7 @@ a.b.d,a.c.d{
279
267
  expect(actual).to.deep.equal(expected)
280
268
  ```
281
269
 
282
- ```js
270
+ ```ts
283
271
  const actual = c({
284
272
  '.b,.c': {
285
273
  margin: 1,
@@ -300,7 +288,7 @@ const expected = `
300
288
  expect(actual).to.deep.equal(expected)
301
289
  ```
302
290
 
303
- ```js
291
+ ```ts
304
292
  const actual = c({
305
293
  '.a,.b': {
306
294
  margin: 1,
@@ -347,7 +335,7 @@ Options:
347
335
 
348
336
  #### Usage Examples
349
337
 
350
- ```js
338
+ ```ts
351
339
  const text = `"aaa
352
340
  ""aaa""
353
341
  aaa",bbb, "ccc,ccc"
@@ -383,14 +371,14 @@ A generic helper for escaping `values` by given `escapeMap` (in *TemplateStrings
383
371
 
384
372
  #### Usage Examples
385
373
 
386
- ```js
387
- const /** @type {EscapeMap} */ escapeMap = new Map([
374
+ ```ts
375
+ const escapeMap: EscapeMap = new Map([
388
376
  [undefined, () => 'NULL'],
389
- [Array, (/** @type {Partial<Array<unknown>>} */ values) => escapeValues(escapeMap, values).join(', ')],
390
- [Boolean, (/** @type {boolean} */ value) => `b'${+value}'`],
391
- [Date, (/** @type {Date} */ value) => `'${value.toISOString().replace(/^(.+)T(.+)\..*$/, '$1 $2')}'`],
392
- [Number, (/** @type {number} */ value) => `${value}`],
393
- [String, (/** @type {string} */ value) => `'${value.replace(/'/g, "''")}'`]
377
+ [Array, (values: Partial<Array<unknown>>) => escapeValues(escapeMap, values).join(', ')],
378
+ [Boolean, (value: boolean) => `b'${+value}'`],
379
+ [Date, (value: Date) => `'${value.toISOString().replace(/^(.+)T(.+)\..*$/, '$1 $2')}'`],
380
+ [Number, (value: number) => `${value}`],
381
+ [String, (value: string) => `'${value.replace(/'/g, "''")}'`]
394
382
  ])
395
383
 
396
384
  const sql = escape.bind(null, escapeMap)
@@ -426,7 +414,7 @@ A helper that implements typographic corrections specific to Polish typography.
426
414
 
427
415
  #### Usage Examples
428
416
 
429
- ```js
417
+ ```ts
430
418
  const p = h('p', 'Pchnąć w tę łódź jeża lub ośm skrzyń fig (zob. https://pl.wikipedia.org/wiki/Pangram).')
431
419
 
432
420
  fixTypography(p)
@@ -458,7 +446,7 @@ A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style help
458
446
 
459
447
  #### Usage Examples
460
448
 
461
- ```js
449
+ ```ts
462
450
  const b = h('b')
463
451
 
464
452
  expect(b.outerHTML).to.deep.equal('<b></b>')
@@ -476,12 +464,12 @@ expect(i.outerHTML).to.deep.equal('<i class="some class">text</i>')
476
464
  expect(b.outerHTML).to.deep.equal('<b><i class="some class">text</i></b>')
477
465
  ```
478
466
 
479
- ```js
467
+ ```ts
480
468
  expect(h('span', 'text').outerHTML).to.deep.equal('<span>text</span>')
481
469
  expect(h('span', { $innerText: 'text' }).outerHTML).to.deep.equal('<span>text</span>')
482
470
  ```
483
471
 
484
- ```js
472
+ ```ts
485
473
  expect(h('div', { style: 'margin:0;padding:0' }).outerHTML)
486
474
  .to.deep.equal('<div style="margin:0;padding:0"></div>')
487
475
  expect(h('div', { $style: 'margin:0;padding:0' }).outerHTML)
@@ -490,7 +478,7 @@ expect(h('div', { $style: { margin: 0, padding: 0 } }).outerHTML)
490
478
  .to.deep.equal('<div style="margin: 0px; padding: 0px;"></div>')
491
479
  ```
492
480
 
493
- ```js
481
+ ```ts
494
482
  const input1 = h('input', { value: 42 })
495
483
  const input2 = h('input', { $value: '42' })
496
484
 
@@ -510,7 +498,7 @@ expect(checkbox1.outerHTML).to.deep.equal('<input type="checkbox" checked="">')
510
498
  expect(checkbox2.outerHTML).to.deep.equal('<input type="checkbox">')
511
499
  ```
512
500
 
513
- ```js
501
+ ```ts
514
502
  const div = h('div')
515
503
 
516
504
  expect(div.key).to.be.undefined
@@ -534,7 +522,7 @@ A replacement for the `in` operator (not to be confused with the `for-in` loop)
534
522
 
535
523
  #### Usage Examples
536
524
 
537
- ```js
525
+ ```ts
538
526
  const obj = { 42: null, null: 'k,e,y', 'k,e,y': 42 }
539
527
 
540
528
  expect(42 in obj).to.be.true
@@ -565,86 +553,38 @@ expect(() => 'key' in undefined).to.throw
565
553
  expect(hasOwn(undefined, 'key')).to.be.false
566
554
  ```
567
555
 
568
- ### is
556
+ ### isArray
569
557
 
570
558
  ```ts
571
- const is: {
572
- (type: ArrayConstructor, arg: unknown): arg is Partial<Array<unknown>>;
573
- (type: BigIntConstructor, arg: unknown): arg is bigint;
574
- (type: BooleanConstructor, arg: unknown): arg is boolean;
575
- (type: NumberConstructor, arg: unknown): arg is number;
576
- (type: ObjectConstructor, arg: unknown): arg is Partial<Record<PropertyKey, unknown>>;
577
- (type: StringConstructor, arg: unknown): arg is string;
578
- (type: SymbolConstructor, arg: unknown): arg is symbol;
579
- (type: undefined, arg: unknown): arg is undefined | null;
580
- <T extends abstract new (...args: Partial<Array<any>>) => unknown>(type: T, arg: unknown): arg is InstanceType<T>;
581
- };
559
+ const isArray: (arg: any) => arg is any[];
582
560
  ```
583
561
 
584
- A helper that checks if the given argument is of a certain type.
562
+ A helper that checks if the given argument is of type `any[]`.
585
563
 
586
- #### Usage Examples
564
+ ### isNumber
587
565
 
588
- ```js
589
- expect(is(Number, 42)).to.be.true
590
- expect(is(Number, Number(42))).to.be.true
591
- expect(is(Number, new Number(42))).to.be.true
592
- expect(is(Number, NaN)).to.be.true
593
-
594
- expect(is(String, '42')).to.be.true
595
- expect(is(String, String('42'))).to.be.true
596
- expect(is(String, new String('42'))).to.be.true
597
-
598
- expect(is(Symbol, Symbol('42'))).to.be.true
599
- expect(is(Symbol, Object(Symbol('42')))).to.be.true
600
-
601
- expect(is(undefined, undefined)).to.be.true
602
- expect(is(undefined, null)).to.be.true
603
-
604
- expect(is(Object, {})).to.be.true
605
- expect(is(Array, [])).to.be.true
606
- expect(is(RegExp, /42/)).to.be.true
607
- expect(is(Date, new Date(42))).to.be.true
608
- expect(is(Set, new Set(['42', 42]))).to.be.true
609
- expect(is(Map, new Map([[{ j: 42 }, { J: '42' }], [{ c: 42 }, { C: '42' }]]))).to.be.true
566
+ ```ts
567
+ const isNumber: (arg: any) => arg is number;
610
568
  ```
611
569
 
612
- ```js
613
- const iz = (/** @type {unknown} */ type, /** @type {unknown} */ arg) =>
614
- ({}).toString.call(arg).slice(8, -1) === type?.name
615
-
616
- class FooBar { }
617
-
618
- expect(is(FooBar, new FooBar())).to.be.true
619
- expect(iz(FooBar, new FooBar())).to.be.false
620
-
621
- expect(is(Object, new FooBar())).to.be.false
622
- expect(iz(Object, new FooBar())).to.be.true
623
-
624
- const fakeFooBar = {}
625
-
626
- fakeFooBar[Symbol.toStringTag] = FooBar.name
570
+ A helper that checks if the given argument is of type `number`.
627
571
 
628
- expect(is(FooBar, fakeFooBar)).to.be.false
629
- expect(iz(FooBar, fakeFooBar)).to.be.true
572
+ ### isRecord
630
573
 
631
- expect(is(Object, fakeFooBar)).to.be.true
632
- expect(iz(Object, fakeFooBar)).to.be.false
574
+ ```ts
575
+ const isRecord: (arg: any) => arg is Partial<Record<PropertyKey, unknown>>;
633
576
  ```
634
577
 
635
- ```js
636
- const num = 42
637
- const str = '42'
638
-
639
- expect(is(Number, num)).to.be.true
578
+ A helper that checks if the given argument is of type `Partial<Record<PropertyKey, unknown>>`.
640
579
 
641
- try {
642
- num.constructor = str.constructor
643
- } catch { /* empty */ }
580
+ ### isString
644
581
 
645
- expect(is(Number, num)).to.be.true
582
+ ```ts
583
+ const isString: (arg: any) => arg is string;
646
584
  ```
647
585
 
586
+ A helper that checks if the given argument is of type `string`.
587
+
648
588
  ### jsOnParse
649
589
 
650
590
  ```ts
@@ -667,9 +607,9 @@ handlers['«handlerName»'](...«params»)
667
607
 
668
608
  #### Usage Examples
669
609
 
670
- ```js
610
+ ```ts
671
611
  const handlers = {
672
- $hello: (/** @type {string} */ name) => `Hello ${name}!`,
612
+ $hello: (name: string) => `Hello ${name}!`,
673
613
  $foo: () => 'bar'
674
614
  }
675
615
 
@@ -712,36 +652,6 @@ const expected = [
712
652
  expect(actual).to.deep.equal(expected)
713
653
  ```
714
654
 
715
- ### locale
716
-
717
- ```ts
718
- const locale: (map: Partial<Record<PropertyKey, Partial<Record<PropertyKey, string>>>>, defaultVersion: string) => (text: string, version?: string) => string;
719
- ```
720
-
721
- Language translations helper.
722
-
723
- #### Usage Examples
724
-
725
- ```js
726
- const _ = locale({
727
- default: { Password: 'Hasło' },
728
- button: { Login: 'Zaloguj' }
729
- }, 'default')
730
-
731
- expect(_('Login')).to.deep.equal('Login')
732
- expect(_('Password')).to.deep.equal('Hasło')
733
-
734
- expect(_('Undefined text')).to.deep.equal('Undefined text')
735
-
736
- expect(_('Login', 'button')).to.deep.equal('Zaloguj')
737
-
738
- expect(_('Password', 'undefined_version')).to.deep.equal('Hasło')
739
- expect(_('Undefined text', 'undefined_version')).to.deep.equal('Undefined text')
740
-
741
- expect(_('toString')).to.deep.equal('toString')
742
- expect(_('toString', 'undefined_version')).to.deep.equal('toString')
743
- ```
744
-
745
655
  ### nanolight
746
656
 
747
657
  ```ts
@@ -760,7 +670,7 @@ A helper for highlighting JavaScript (see also `nanolight`).
760
670
 
761
671
  #### Usage Examples
762
672
 
763
- ```js
673
+ ```ts
764
674
  const codeJs = 'const answerToLifeTheUniverseAndEverything = 42'
765
675
 
766
676
  expect(nanolightJs(codeJs)).to.deep.equal([
@@ -784,7 +694,7 @@ A helper that implements TypeScript’s `Omit` utility type (see also `pick`).
784
694
 
785
695
  #### Usage Examples
786
696
 
787
- ```js
697
+ ```ts
788
698
  const obj = { a: 42, b: '42', c: 17 }
789
699
 
790
700
  expect(omit(obj, ['c'])).to.deep.equal({ a: 42, b: '42' })
@@ -800,7 +710,7 @@ A helper that implements TypeScript’s `Pick` utility type (see also `omit`).
800
710
 
801
711
  #### Usage Examples
802
712
 
803
- ```js
713
+ ```ts
804
714
  const obj = { a: 42, b: '42', c: 17 }
805
715
 
806
716
  expect(pick(obj, ['a', 'b'])).to.deep.equal({ a: 42, b: '42' })
@@ -816,7 +726,7 @@ A helper for choosing the correct singular and plural.
816
726
 
817
727
  #### Usage Examples
818
728
 
819
- ```js
729
+ ```ts
820
730
  const auto = plUral.bind(null, 'auto', 'auta', 'aut')
821
731
 
822
732
  expect(auto(0)).to.deep.equal('aut')
@@ -843,7 +753,7 @@ object.
843
753
 
844
754
  #### Usage Examples
845
755
 
846
- ```js
756
+ ```ts
847
757
  const ref = {}
848
758
 
849
759
  pro(ref).one.two[3][4] = 1234
@@ -911,7 +821,7 @@ A helper that generates a UUID v1 identifier (with a creation timestamp).
911
821
 
912
822
  #### Usage Examples
913
823
 
914
- ```js
824
+ ```ts
915
825
  for (let i = 1; i <= 22136; ++i) {
916
826
  const uuid = uuid1()
917
827
 
@@ -925,12 +835,12 @@ for (let i = 1; i <= 22136; ++i) {
925
835
  }
926
836
  ```
927
837
 
928
- ```js
838
+ ```ts
929
839
  expect(uuid1(new Date(), '000123456789abc').split('-')[4]).to.deep.equal('123456789abc')
930
840
  expect(uuid1(new Date(), '123456789').split('-')[4]).to.deep.equal('000123456789')
931
841
  ```
932
842
 
933
- ```js
843
+ ```ts
934
844
  expect(uuid1(new Date(323325000000)).startsWith('c1399400-9a71-11bd')).to.be.true
935
845
  ```
936
846