@jackens/nnn 2024.4.14 → 2024.7.9

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 (3) hide show
  1. package/nnn.d.ts +2 -2
  2. package/package.json +2 -4
  3. package/readme.md +126 -126
package/nnn.d.ts CHANGED
@@ -167,12 +167,12 @@ export declare const nanolightJs: (code: string) => HArgs1[];
167
167
  /**
168
168
  * A helper that implements TypeScript’s `Pick` utility type.
169
169
  */
170
- export declare const pick: <T extends Partial<Record<PropertyKey, unknown>>, K extends (keyof T)[]>(obj: Partial<Record<PropertyKey, unknown>>, keys: Partial<Array<unknown>>) => Pick<T, K[number]>;
170
+ 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]>;
171
171
 
172
172
  /**
173
173
  * A helper that implements TypeScript’s `Omit` utility type.
174
174
  */
175
- export declare const omit: <T extends Partial<Record<PropertyKey, unknown>>, K extends (keyof T)[]>(obj: Partial<Record<PropertyKey, unknown>>, keys: Partial<Array<unknown>>) => Omit<T, K[number]>;
175
+ 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]>;
176
176
 
177
177
  /**
178
178
  * A helper for choosing the correct singular and plural.
package/package.json CHANGED
@@ -1,14 +1,13 @@
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/nnn/",
5
5
  "keywords": [
6
6
  "CSS-in-JS",
7
7
  "CSV",
8
8
  "csvParse",
9
9
  "DOM",
10
10
  "escape",
11
- "Gantt",
12
11
  "h",
13
12
  "has",
14
13
  "highlight",
@@ -25,7 +24,6 @@
25
24
  "nnn",
26
25
  "omit",
27
26
  "pick",
28
- "RWD",
29
27
  "SVG",
30
28
  "translation",
31
29
  "typography",
@@ -38,5 +36,5 @@
38
36
  "types": "nnn.d.ts",
39
37
  "name": "@jackens/nnn",
40
38
  "type": "module",
41
- "version": "2024.4.14"
39
+ "version": "2024.7.9"
42
40
  }
package/readme.md CHANGED
@@ -2,14 +2,7 @@
2
2
 
3
3
  Jackens’ JavaScript helpers.
4
4
 
5
- <sub>Version: <code class="version">2024.4.14</code></sub>
6
-
7
- ## Examples
8
-
9
- - [Documentation](https://jackens.github.io/nnn/doc/)
10
- - [Chessboard Demo](https://jackens.github.io/nnn/chessboard/)
11
- - [Gant Chart Demo](https://jackens.github.io/nnn/gantt/)
12
- - [Responsive Web Design Demo](https://jackens.github.io/nnn/rwd/)
5
+ <sub>Version: <code class="version">2024.7.9</code></sub>
13
6
 
14
7
  ## Installation
15
8
 
@@ -25,18 +18,22 @@ npm i @jackens/nnn
25
18
 
26
19
  ## Usage
27
20
 
28
- Bun (or Node.js):
29
-
30
21
  ```js
31
22
  import { «something» } from '@jackens/nnn'
32
23
  ```
33
24
 
34
- The browser (or Bun or Node.js):
25
+ or:
35
26
 
36
27
  ```js
37
28
  import { «something» } from './node_modules/@jackens/nnn/nnn.js'
38
29
  ```
39
30
 
31
+ or:
32
+
33
+ ```js
34
+ import { «something» } from 'https://unpkg.com/@jackens/nnn@2024.7.9/nnn.js'
35
+ ```
36
+
40
37
  ## Exports
41
38
 
42
39
  - `EscapeMap`: The type of arguments of the `escapeValues` and `escape` helpers.
@@ -139,13 +136,13 @@ yyy",zzz
139
136
  42 , "42" , 17
140
137
 
141
138
  `
142
- expect(csvParse(text, { header: false })).toStrictEqual([
139
+ expect(csvParse(text, { header: false })).to.deep.equal([
143
140
  ['aaa\n"aaa"\naaa', 'bbb', 'ccc,ccc'],
144
141
  ['xxx,xxx', 'yyy\nyyy', 'zzz'],
145
142
  [' 42 ', '42', ' 17']
146
143
  ])
147
144
 
148
- expect(csvParse(text)).toStrictEqual([{
145
+ expect(csvParse(text)).to.deep.equal([{
149
146
  'aaa\n"aaa"\naaa': 'xxx,xxx',
150
147
  bbb: 'yyy\nyyy',
151
148
  'ccc,ccc': 'zzz'
@@ -169,13 +166,13 @@ A generic helper for escaping `values` by given `escapeMap` (in *TemplateStrings
169
166
  #### Usage Examples
170
167
 
171
168
  ```js
172
- const escapeMap: EscapeMap = new Map([
169
+ const /** @type {import('../dist/nnn.js').EscapeMap} */ escapeMap = new Map([
173
170
  [undefined, () => 'NULL'],
174
- [Array, (values: Partial<Array<unknown>>) => escapeValues(escapeMap, values).join(', ')],
175
- [Boolean, (value: boolean) => `b'${+value}'`],
176
- [Date, (value: Date) => `'${value.toISOString().replace(/^(.+)T(.+)\..*$/, '$1 $2')}'`],
177
- [Number, (value: number) => `${value}`],
178
- [String, (value: string) => `'${value.replace(/'/g, "''")}'`]
171
+ [Array, (/** @type {Partial<Array<unknown>>} */ values) => escapeValues(escapeMap, values).join(', ')],
172
+ [Boolean, (/** @type {boolean} */ value) => `b'${+value}'`],
173
+ [Date, (/** @type {Date} */ value) => `'${value.toISOString().replace(/^(.+)T(.+)\..*$/, '$1 $2')}'`],
174
+ [Number, (/** @type {number} */ value) => `${value}`],
175
+ [String, (/** @type {string} */ value) => `'${value.replace(/'/g, "''")}'`]
179
176
  ])
180
177
 
181
178
  const sql = escape.bind(null, escapeMap)
@@ -190,7 +187,7 @@ const expected = `
190
187
  FROM table_name
191
188
  WHERE column_name IN (b'1', NULL, NULL, 42, '42', '4''2', NULL, '1980-03-31 04:30:00')`
192
189
 
193
- expect(actual).toStrictEqual(expected)
190
+ expect(actual).to.deep.equal(expected)
194
191
  ```
195
192
 
196
193
  ### escapeValues
@@ -218,7 +215,7 @@ const p = h('p', 'Pchnąć w tę łódź jeża lub ośm skrzyń fig (zob. https:
218
215
 
219
216
  fixTypography(p)
220
217
 
221
- expect(p.innerHTML).toStrictEqual(
218
+ expect(p.innerHTML).to.deep.equal(
222
219
  'Pchnąć <span style="white-space:nowrap">w </span>tę łódź jeża lub ośm skrzyń fig ' +
223
220
  '(zob. https://\u200Bpl.\u200Bwikipedia.\u200Borg/\u200Bwiki/\u200BPangram).')
224
221
  ```
@@ -254,67 +251,67 @@ A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style help
254
251
  ```js
255
252
  const b = h('b')
256
253
 
257
- expect(b.outerHTML).toStrictEqual('<b></b>')
254
+ expect(b.outerHTML).to.deep.equal('<b></b>')
258
255
 
259
256
  const i = h('i', 'text')
260
257
 
261
258
  h(b, i)
262
259
 
263
- expect(i.outerHTML).toStrictEqual('<i>text</i>')
264
- expect(b.outerHTML).toStrictEqual('<b><i>text</i></b>')
260
+ expect(i.outerHTML).to.deep.equal('<i>text</i>')
261
+ expect(b.outerHTML).to.deep.equal('<b><i>text</i></b>')
265
262
 
266
263
  h(i, { $className: 'some class' })
267
264
 
268
- expect(i.outerHTML).toStrictEqual('<i class="some class">text</i>')
269
- expect(b.outerHTML).toStrictEqual('<b><i class="some class">text</i></b>')
265
+ expect(i.outerHTML).to.deep.equal('<i class="some class">text</i>')
266
+ expect(b.outerHTML).to.deep.equal('<b><i class="some class">text</i></b>')
270
267
  ```
271
268
 
272
269
  ```js
273
- expect(h('span', 'text').outerHTML).toStrictEqual('<span>text</span>')
274
- expect(h('span', { $innerText: 'text' }).outerHTML).toStrictEqual('<span>text</span>')
270
+ expect(h('span', 'text').outerHTML).to.deep.equal('<span>text</span>')
271
+ expect(h('span', { $innerText: 'text' }).outerHTML).to.deep.equal('<span>text</span>')
275
272
  ```
276
273
 
277
274
  ```js
278
275
  expect(h('div', { style: 'margin:0;padding:0' }).outerHTML)
279
- .toStrictEqual('<div style="margin:0;padding:0"></div>')
276
+ .to.deep.equal('<div style="margin:0;padding:0"></div>')
280
277
  expect(h('div', { $style: 'margin:0;padding:0' }).outerHTML)
281
- .toStrictEqual('<div style="margin: 0px; padding: 0px;"></div>')
278
+ .to.deep.equal('<div style="margin: 0px; padding: 0px;"></div>')
282
279
  expect(h('div', { $style: { margin: 0, padding: 0 } }).outerHTML)
283
- .toStrictEqual('<div style="margin: 0px; padding: 0px;"></div>')
280
+ .to.deep.equal('<div style="margin: 0px; padding: 0px;"></div>')
284
281
  ```
285
282
 
286
283
  ```js
287
284
  const input1 = h('input', { value: 42 })
288
285
  const input2 = h('input', { $value: '42' })
289
286
 
290
- expect(input1.value).toStrictEqual('42')
291
- expect(input2.value).toStrictEqual('42')
287
+ expect(input1.value).to.deep.equal('42')
288
+ expect(input2.value).to.deep.equal('42')
292
289
 
293
- expect(input1.outerHTML).toStrictEqual('<input value="42">')
294
- expect(input2.outerHTML).toStrictEqual('<input>')
290
+ expect(input1.outerHTML).to.deep.equal('<input value="42">')
291
+ expect(input2.outerHTML).to.deep.equal('<input>')
295
292
 
296
293
  const checkbox1 = h('input', { type: 'checkbox', checked: true })
297
294
  const checkbox2 = h('input', { type: 'checkbox', $checked: true })
298
295
 
299
- expect(checkbox1.checked).toBeTrue()
300
- expect(checkbox2.checked).toBeTrue()
296
+ expect(checkbox1.checked).to.be.true
297
+ expect(checkbox2.checked).to.be.true
301
298
 
302
- expect(checkbox1.outerHTML).toStrictEqual('<input type="checkbox" checked="">')
303
- expect(checkbox2.outerHTML).toStrictEqual('<input type="checkbox">')
299
+ expect(checkbox1.outerHTML).to.deep.equal('<input type="checkbox" checked="">')
300
+ expect(checkbox2.outerHTML).to.deep.equal('<input type="checkbox">')
304
301
  ```
305
302
 
306
303
  ```js
307
304
  const div = h('div')
308
305
 
309
- expect(div.key).toBeUndefined()
306
+ expect(div.key).to.be.undefined
310
307
 
311
308
  h(div, { $key: { one: 1 } })
312
309
 
313
- expect(div.key).toStrictEqual({ one: 1 })
310
+ expect(div.key).to.deep.equal({ one: 1 })
314
311
 
315
312
  h(div, { $key: { two: 2 } })
316
313
 
317
- expect(div.key).toStrictEqual({ one: 1, two: 2 })
314
+ expect(div.key).to.deep.equal({ one: 1, two: 2 })
318
315
  ```
319
316
 
320
317
  ### has
@@ -330,17 +327,17 @@ A replacement for the `in` operator (not to be confused with the `for-in` loop)
330
327
  ```js
331
328
  const obj = { key: 'K', null: 'N' }
332
329
 
333
- expect('key' in obj).toBeTrue()
334
- expect(has('key', obj)).toBeTrue()
330
+ expect('key' in obj).to.be.true
331
+ expect(has('key', obj)).to.be.true
335
332
 
336
- expect('null' in obj).toBeTrue()
337
- expect(has('null', obj)).toBeTrue()
333
+ expect('null' in obj).to.be.true
334
+ expect(has('null', obj)).to.be.true
338
335
 
339
- expect(null in obj).toBeTrue()
340
- expect(has(null, obj)).toBeFalse()
336
+ expect(null in obj).to.be.true
337
+ expect(has(null, obj)).to.be.false
341
338
 
342
- expect('toString' in obj).toBeTrue()
343
- expect(has('toString', obj)).toBeFalse()
339
+ expect('toString' in obj).to.be.true
340
+ expect(has('toString', obj)).to.be.false
344
341
  ```
345
342
 
346
343
  ```js
@@ -353,7 +350,7 @@ try {
353
350
  }
354
351
 
355
352
  expect(typeError instanceof TypeError) // Cannot use 'in' operator to search for 'key' in null
356
- expect(has('key', null)).toBeFalse()
353
+ expect(has('key', null)).to.be.false
357
354
  ```
358
355
 
359
356
  ### is
@@ -379,58 +376,61 @@ A helper that checks if the given argument is of a certain type.
379
376
  #### Usage Examples
380
377
 
381
378
  ```js
382
- expect(is(Number, 42)).toBeTrue()
383
- expect(is(Number, Number(42))).toBeTrue()
384
- expect(is(Number, new Number(42))).toBeTrue()
385
- expect(is(Number, NaN)).toBeTrue()
386
- expect(is(String, '42')).toBeTrue()
387
- expect(is(String, String('42'))).toBeTrue()
388
- expect(is(String, new String('42'))).toBeTrue()
389
- expect(is(Symbol, Symbol('42'))).toBeTrue()
390
- expect(is(Symbol, Object(Symbol('42')))).toBeTrue()
391
- expect(is(undefined, undefined)).toBeTrue()
392
- expect(is(undefined, null)).toBeTrue()
393
- expect(is(Object, {})).toBeTrue()
394
- expect(is(Array, [])).toBeTrue()
395
- expect(is(RegExp, /42/)).toBeTrue()
396
- expect(is(Date, new Date(42))).toBeTrue()
397
- expect(is(Set, new Set(['42', 42]))).toBeTrue()
398
- expect(is(Map, new Map([[{ j: 42 }, { J: '42' }], [{ c: 42 }, { C: '42' }]]))).toBeTrue()
379
+ expect(is(Number, 42)).to.be.true
380
+ expect(is(Number, Number(42))).to.be.true
381
+
382
+ expect(is(Number, new Number(42))).to.be.true
383
+ expect(is(Number, NaN)).to.be.true
384
+ expect(is(String, '42')).to.be.true
385
+ expect(is(String, String('42'))).to.be.true
386
+
387
+ expect(is(String, new String('42'))).to.be.true
388
+ expect(is(Symbol, Symbol('42'))).to.be.true
389
+ expect(is(Symbol, Object(Symbol('42')))).to.be.true
390
+ expect(is(undefined, undefined)).to.be.true
391
+ expect(is(undefined, null)).to.be.true
392
+ expect(is(Object, {})).to.be.true
393
+ expect(is(Array, [])).to.be.true
394
+ expect(is(RegExp, /42/)).to.be.true
395
+ expect(is(Date, new Date(42))).to.be.true
396
+ expect(is(Set, new Set(['42', 42]))).to.be.true
397
+ expect(is(Map, new Map([[{ j: 42 }, { J: '42' }], [{ c: 42 }, { C: '42' }]]))).to.be.true
399
398
  ```
400
399
 
401
400
  ```js
402
- const iz = (type: unknown, arg: unknown) => ({}).toString.call(arg).slice(8, -1) === type?.name
401
+ const iz = (/** @type {unknown} */ type, /** @type {unknown} */ arg) =>
402
+ ({}).toString.call(arg).slice(8, -1) === type?.name
403
403
 
404
404
  class FooBar { }
405
405
 
406
- expect(is(FooBar, new FooBar())).toBeTrue()
407
- expect(iz(FooBar, new FooBar())).toBeFalse()
406
+ expect(is(FooBar, new FooBar())).to.be.true
407
+ expect(iz(FooBar, new FooBar())).to.be.false
408
408
 
409
- expect(is(Object, new FooBar())).toBeFalse()
410
- expect(iz(Object, new FooBar())).toBeTrue()
409
+ expect(is(Object, new FooBar())).to.be.false
410
+ expect(iz(Object, new FooBar())).to.be.true
411
411
 
412
412
  const fakeFooBar = {}
413
413
 
414
414
  fakeFooBar[Symbol.toStringTag] = FooBar.name
415
415
 
416
- expect(is(FooBar, fakeFooBar)).toBeFalse()
417
- expect(iz(FooBar, fakeFooBar)).toBeTrue()
416
+ expect(is(FooBar, fakeFooBar)).to.be.false
417
+ expect(iz(FooBar, fakeFooBar)).to.be.true
418
418
 
419
- expect(is(Object, fakeFooBar)).toBeTrue()
420
- expect(iz(Object, fakeFooBar)).toBeFalse()
419
+ expect(is(Object, fakeFooBar)).to.be.true
420
+ expect(iz(Object, fakeFooBar)).to.be.false
421
421
  ```
422
422
 
423
423
  ```js
424
424
  const num = 42
425
425
  const str = '42'
426
426
 
427
- expect(is(Number, num)).toBeTrue()
427
+ expect(is(Number, num)).to.be.true
428
428
 
429
429
  try {
430
430
  num.constructor = str.constructor
431
431
  } catch { /* empty */ }
432
432
 
433
- expect(is(Number, num)).toBeTrue()
433
+ expect(is(Number, num)).to.be.true
434
434
  ```
435
435
 
436
436
  ### jc
@@ -474,7 +474,7 @@ a{
474
474
  padding:1
475
475
  }`.replace(/\n\s*/g, '')
476
476
 
477
- expect(actual).toStrictEqual(expected)
477
+ expect(actual).to.deep.equal(expected)
478
478
  ```
479
479
 
480
480
  ```js
@@ -502,7 +502,7 @@ a.b{
502
502
  padding:1
503
503
  }`.replace(/\n\s*/g, '')
504
504
 
505
- expect(actual).toStrictEqual(expected)
505
+ expect(actual).to.deep.equal(expected)
506
506
  ```
507
507
 
508
508
  ```js
@@ -577,7 +577,7 @@ div.c2{
577
577
  }
578
578
  }`.replace(/\n\s*/g, '')
579
579
 
580
- expect(actual).toStrictEqual(expected)
580
+ expect(actual).to.deep.equal(expected)
581
581
  ```
582
582
 
583
583
  ```js
@@ -600,7 +600,7 @@ a.b.d,a.c.d{
600
600
  margin:2
601
601
  }`.replace(/\n\s*/g, '')
602
602
 
603
- expect(actual).toStrictEqual(expected)
603
+ expect(actual).to.deep.equal(expected)
604
604
  ```
605
605
 
606
606
  ```js
@@ -621,7 +621,7 @@ const expected = `
621
621
  margin:2
622
622
  }`.replace(/\n\s*/g, '')
623
623
 
624
- expect(actual).toStrictEqual(expected)
624
+ expect(actual).to.deep.equal(expected)
625
625
  ```
626
626
 
627
627
  ```js
@@ -642,7 +642,7 @@ const expected = `
642
642
  margin:2
643
643
  }`.replace(/\n\s*/g, '')
644
644
 
645
- expect(actual).toStrictEqual(expected)
645
+ expect(actual).to.deep.equal(expected)
646
646
  ```
647
647
 
648
648
  ### jsOnParse
@@ -671,7 +671,7 @@ handlers['«handlerName»'](...«params»)
671
671
 
672
672
  ```js
673
673
  const handlers = {
674
- $hello: (name: string) => `Hello ${name}!`,
674
+ $hello: (/** @type {string} */ name) => `Hello ${name}!`,
675
675
  $foo: () => 'bar'
676
676
  }
677
677
 
@@ -711,7 +711,7 @@ const expected = [
711
711
  }
712
712
  ]
713
713
 
714
- expect(actual).toStrictEqual(expected)
714
+ expect(actual).to.deep.equal(expected)
715
715
  ```
716
716
 
717
717
  ### locale
@@ -732,18 +732,18 @@ const _ = locale({
732
732
  button: { Login: 'Zaloguj' }
733
733
  }, 'default')
734
734
 
735
- expect(_('Login')).toStrictEqual('Login')
736
- expect(_('Password')).toStrictEqual('Hasło')
735
+ expect(_('Login')).to.deep.equal('Login')
736
+ expect(_('Password')).to.deep.equal('Hasło')
737
737
 
738
- expect(_('Undefined text')).toStrictEqual('Undefined text')
738
+ expect(_('Undefined text')).to.deep.equal('Undefined text')
739
739
 
740
- expect(_('Login', 'button')).toStrictEqual('Zaloguj')
740
+ expect(_('Login', 'button')).to.deep.equal('Zaloguj')
741
741
 
742
- expect(_('Password', 'undefined_version')).toStrictEqual('Hasło')
743
- expect(_('Undefined text', 'undefined_version')).toStrictEqual('Undefined text')
742
+ expect(_('Password', 'undefined_version')).to.deep.equal('Hasło')
743
+ expect(_('Undefined text', 'undefined_version')).to.deep.equal('Undefined text')
744
744
 
745
- expect(_('toString')).toStrictEqual('toString')
746
- expect(_('toString', 'undefined_version')).toStrictEqual('toString')
745
+ expect(_('toString')).to.deep.equal('toString')
746
+ expect(_('toString', 'undefined_version')).to.deep.equal('toString')
747
747
  ```
748
748
 
749
749
  ### nanolight
@@ -769,7 +769,7 @@ A helper for highlighting JavaScript.
769
769
  ```js
770
770
  const codeJs = 'const answerToLifeTheUniverseAndEverything = 42'
771
771
 
772
- expect(nanolightJs(codeJs)).toStrictEqual([
772
+ expect(nanolightJs(codeJs)).to.deep.equal([
773
773
  ['span', { class: 'keyword' }, 'const'],
774
774
  ' ',
775
775
  ['span', { class: 'literal' }, 'answerToLifeTheUniverseAndEverything'],
@@ -783,7 +783,7 @@ expect(nanolightJs(codeJs)).toStrictEqual([
783
783
  ### omit
784
784
 
785
785
  ```ts
786
- const omit: <T extends Partial<Record<PropertyKey, unknown>>, K extends (keyof T)[]>(obj: Partial<Record<PropertyKey, unknown>>, keys: Partial<Array<unknown>>) => Omit<T, K[number]>;
786
+ 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
787
  ```
788
788
 
789
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`.
@@ -795,13 +795,13 @@ A helper that implements TypeScript’s `Omit` utility type.
795
795
  ```js
796
796
  const obj = { a: 42, b: '42', c: 17 }
797
797
 
798
- expect(omit(obj, ['c'])).toStrictEqual({ a: 42, b: '42' })
798
+ expect(omit(obj, ['c'])).to.deep.equal({ a: 42, b: '42' })
799
799
  ```
800
800
 
801
801
  ### pick
802
802
 
803
803
  ```ts
804
- const pick: <T extends Partial<Record<PropertyKey, unknown>>, K extends (keyof T)[]>(obj: Partial<Record<PropertyKey, unknown>>, keys: Partial<Array<unknown>>) => Pick<T, K[number]>;
804
+ 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
805
  ```
806
806
 
807
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`.
@@ -813,7 +813,7 @@ A helper that implements TypeScript’s `Pick` utility type.
813
813
  ```js
814
814
  const obj = { a: 42, b: '42', c: 17 }
815
815
 
816
- expect(pick(obj, ['a', 'b'])).toStrictEqual({ a: 42, b: '42' })
816
+ expect(pick(obj, ['a', 'b'])).to.deep.equal({ a: 42, b: '42' })
817
817
  ```
818
818
 
819
819
  ### plUral
@@ -829,17 +829,17 @@ A helper for choosing the correct singular and plural.
829
829
  ```js
830
830
  const auto = plUral.bind(null, 'auto', 'auta', 'aut')
831
831
 
832
- expect(auto(0)).toStrictEqual('aut')
833
- expect(auto(1)).toStrictEqual('auto')
834
- expect(auto(17)).toStrictEqual('aut')
835
- expect(auto(42)).toStrictEqual('auta')
832
+ expect(auto(0)).to.deep.equal('aut')
833
+ expect(auto(1)).to.deep.equal('auto')
834
+ expect(auto(17)).to.deep.equal('aut')
835
+ expect(auto(42)).to.deep.equal('auta')
836
836
 
837
837
  const car = plUral.bind(null, 'car', 'cars', 'cars')
838
838
 
839
- expect(car(0)).toStrictEqual('cars')
840
- expect(car(1)).toStrictEqual('car')
841
- expect(car(17)).toStrictEqual('cars')
842
- expect(car(42)).toStrictEqual('cars')
839
+ expect(car(0)).to.deep.equal('cars')
840
+ expect(car(1)).to.deep.equal('car')
841
+ expect(car(17)).to.deep.equal('cars')
842
+ expect(car(42)).to.deep.equal('cars')
843
843
  ```
844
844
 
845
845
  ### pro
@@ -857,27 +857,27 @@ const ref = {}
857
857
 
858
858
  pro(ref).one.two[3][4] = 1234
859
859
 
860
- expect(ref).toStrictEqual({ one: { two: { 3: { 4: 1234 } } } })
860
+ expect(ref).to.deep.equal({ one: { two: { 3: { 4: 1234 } } } })
861
861
 
862
862
  pro(ref).one.two.tree = 123
863
863
 
864
- expect(ref).toStrictEqual({ one: { two: { 3: { 4: 1234 }, tree: 123 } } })
864
+ expect(ref).to.deep.equal({ one: { two: { 3: { 4: 1234 }, tree: 123 } } })
865
865
 
866
866
  pro(ref).one.two = undefined
867
867
 
868
- expect(ref).toStrictEqual({ one: { two: undefined } })
868
+ expect(ref).to.deep.equal({ one: { two: undefined } })
869
869
 
870
870
  delete pro(ref).one.two
871
871
 
872
- expect(ref).toStrictEqual({ one: {} })
872
+ expect(ref).to.deep.equal({ one: {} })
873
873
 
874
874
  pro(ref).one.two.three.four
875
875
 
876
- expect(ref).toStrictEqual({ one: { two: { three: { four: {} } } } })
876
+ expect(ref).to.deep.equal({ one: { two: { three: { four: {} } } } })
877
877
 
878
878
  pro(ref).one.two.three.four = 1234
879
879
 
880
- expect(ref).toStrictEqual({ one: { two: { three: { four: 1234 } } } })
880
+ expect(ref).to.deep.equal({ one: { two: { three: { four: 1234 } } } })
881
881
  ```
882
882
 
883
883
  ### refsInfo
@@ -897,8 +897,8 @@ It returns an array of triples: `[«name», «prototype-name», «array-of-own-p
897
897
  ```js
898
898
  const info = refsInfo(Array, Function)
899
899
 
900
- expect(info.find(item => item?.[0] === 'Array')?.[2]?.includes('length')).toBeTrue()
901
- expect(info.find(item => item?.[0] === 'Function')?.[2]?.includes('length')).toBeTrue()
900
+ expect(info.find(item => item?.[0] === 'Array')?.[2]?.includes('length')).to.be.true
901
+ expect(info.find(item => item?.[0] === 'Function')?.[2]?.includes('length')).to.be.true
902
902
  ```
903
903
 
904
904
  ```js
@@ -981,23 +981,23 @@ A helper that generates a UUID v1 identifier (with a creation timestamp).
981
981
  for (let i = 1; i <= 22136; ++i) {
982
982
  const uuid = uuid1()
983
983
 
984
- i === 1 && expect(uuid.split('-')[3]).toStrictEqual('8001')
985
- i === 4095 && expect(uuid.split('-')[3]).toStrictEqual('8fff')
986
- i === 4096 && expect(uuid.split('-')[3]).toStrictEqual('9000')
987
- i === 9029 && expect(uuid.split('-')[3]).toStrictEqual('a345')
988
- i === 13398 && expect(uuid.split('-')[3]).toStrictEqual('b456')
989
- i === 16384 && expect(uuid.split('-')[3]).toStrictEqual('8000')
990
- i === 17767 && expect(uuid.split('-')[3]).toStrictEqual('8567')
984
+ i === 1 && expect(uuid.split('-')[3]).to.deep.equal('8001')
985
+ i === 4095 && expect(uuid.split('-')[3]).to.deep.equal('8fff')
986
+ i === 4096 && expect(uuid.split('-')[3]).to.deep.equal('9000')
987
+ i === 9029 && expect(uuid.split('-')[3]).to.deep.equal('a345')
988
+ i === 13398 && expect(uuid.split('-')[3]).to.deep.equal('b456')
989
+ i === 16384 && expect(uuid.split('-')[3]).to.deep.equal('8000')
990
+ i === 17767 && expect(uuid.split('-')[3]).to.deep.equal('8567')
991
991
  }
992
992
  ```
993
993
 
994
994
  ```js
995
- expect(uuid1({ node: '000123456789abc' }).split('-')[4]).toStrictEqual('123456789abc')
996
- expect(uuid1({ node: '123456789' }).split('-')[4]).toStrictEqual('000123456789')
995
+ expect(uuid1({ node: '000123456789abc' }).split('-')[4]).to.deep.equal('123456789abc')
996
+ expect(uuid1({ node: '123456789' }).split('-')[4]).to.deep.equal('000123456789')
997
997
  ```
998
998
 
999
999
  ```js
1000
- expect(uuid1({ date: new Date(323325000000) }).startsWith('c1399400-9a71-11bd')).toBeTrue()
1000
+ expect(uuid1({ date: new Date(323325000000) }).startsWith('c1399400-9a71-11bd')).to.be.true
1001
1001
  ```
1002
1002
 
1003
1003
  ## Why Partial\<Array\> and Partial\<Record\>