@jackens/nnn 2026.2.23 → 2026.2.25

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 +13 -1
  2. package/nnn.js +6 -9
  3. package/package.json +1 -1
  4. package/readme.md +68 -5
package/nnn.d.ts CHANGED
@@ -145,7 +145,7 @@ export declare const s: {
145
145
  *
146
146
  * `true` if `ref` is not nullish and has `key` as an own property, `false` otherwise.
147
147
  */
148
- export declare const hasOown: (ref: unknown, key: unknown) => boolean;
148
+ export declare const hasOwn: (ref: unknown, key: unknown) => boolean;
149
149
  /**
150
150
  * Checks whether the argument is an array.
151
151
  *
@@ -170,6 +170,18 @@ export declare const isArray: (arg: unknown) => arg is unknown[];
170
170
  * `true` if `arg` is a finite number, `false` otherwise.
171
171
  */
172
172
  export declare const isFiniteNumber: (arg: unknown) => arg is number;
173
+ /**
174
+ * Checks whether the argument is an integer number.
175
+ *
176
+ * @param arg
177
+ *
178
+ * The value to check.
179
+ *
180
+ * @returns
181
+ *
182
+ * `true` if `arg` is an integer number, `false` otherwise.
183
+ */
184
+ export declare const isInteger: (arg: unknown) => arg is number;
173
185
  /**
174
186
  * Checks whether the argument is of type `number` (includes `NaN` and `±Infinity`).
175
187
  *
package/nnn.js CHANGED
@@ -12,9 +12,6 @@ var _c = (node, prefix, result, splitter) => {
12
12
  const queue = [[node, prefix]];
13
13
  while (queue.length > 0) {
14
14
  const [style0, prefix0] = queue.shift();
15
- if (style0 == null || prefix0 == null) {
16
- continue;
17
- }
18
15
  if (isArray(style0)) {
19
16
  result.push(prefix0, prefix0 !== "" ? "{" : "", style0.join(";"), prefix0 !== "" ? "}" : "");
20
17
  } else {
@@ -162,7 +159,7 @@ var fixPlTypography = (node) => {
162
159
  }
163
160
  };
164
161
  // src/nnn/hasOwn.ts
165
- var hasOown = (ref, key) => ref != null && Object.hasOwn(ref, key);
162
+ var hasOwn = (ref, key) => ref != null && Object.hasOwn(ref, key);
166
163
  // src/nnn/isFiniteNumber.ts
167
164
  var isFiniteNumber = Number.isFinite;
168
165
  // src/nnn/jsOnParse.ts
@@ -185,7 +182,7 @@ var jsOnParse = (handlers, text) => JSON.parse(text, (key, value) => {
185
182
  });
186
183
  // src/nnn/monokai.ts
187
184
  var monokai = {
188
- ":root": {
185
+ ":root$$monokai": {
189
186
  __bg: "#faf4f2",
190
187
  __fg: "#29242a",
191
188
  __comment: "#918c8e",
@@ -201,7 +198,7 @@ var monokai = {
201
198
  __punctuation: "#918c8e",
202
199
  __string: "#cc7a0a"
203
200
  },
204
- pre: {
201
+ pre$$monokai: {
205
202
  backgroundColor: "var(--bg)",
206
203
  color: "var(--fg)",
207
204
  margin: 0,
@@ -212,7 +209,7 @@ var monokai = {
212
209
  padding: 0
213
210
  }
214
211
  },
215
- "code>span.": {
212
+ "code>span.$$monokai": {
216
213
  bg: { color: "var(--bg)" },
217
214
  fg: { color: "var(--fg)" },
218
215
  comment: { color: "var(--comment)" },
@@ -228,7 +225,7 @@ var monokai = {
228
225
  punctuation: { color: "var(--punctuation)" },
229
226
  string: { color: "var(--string)" }
230
227
  },
231
- "@media only screen and (prefers-color-scheme: dark)": {
228
+ "@media only screen and (prefers-color-scheme: dark)$$monokai": {
232
229
  ":root": {
233
230
  __bg: "#2d2a2e",
234
231
  __fg: "#fcfcfa",
@@ -386,7 +383,7 @@ export {
386
383
  isNumber,
387
384
  isFiniteNumber,
388
385
  isArray,
389
- hasOown,
386
+ hasOwn,
390
387
  h,
391
388
  fixPlTypography,
392
389
  escapeValues,
package/package.json CHANGED
@@ -44,5 +44,5 @@
44
44
  "name": "@jackens/nnn",
45
45
  "type": "module",
46
46
  "types": "nnn.d.ts",
47
- "version": "2026.2.23"
47
+ "version": "2026.2.25"
48
48
  }
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # nnn
2
2
 
3
- A collection of Jackens’ JavaScript helper utilities (version: `2026.2.23`).
3
+ A collection of Jackens’ JavaScript helper utilities (version: `2026.2.25`).
4
4
 
5
5
  ## Installation
6
6
 
@@ -23,9 +23,10 @@ import {
23
23
  escapeValues,
24
24
  fixPlTypography,
25
25
  h,
26
- hasOown,
26
+ hasOwn,
27
27
  isArray,
28
28
  isFiniteNumber,
29
+ isInteger,
29
30
  isNumber,
30
31
  isRecord,
31
32
  isString,
@@ -57,9 +58,10 @@ import {
57
58
  - [`escapeValues`](#escapeValues): Escapes an array of values using the provided escape map.
58
59
  - [`fixPlTypography`](#fixPlTypography): Applies Polish-specific typographic corrections to a DOM subtree.
59
60
  - [`h`](#h): A lightweight [HyperScript](https://github.com/hyperhype/hyperscript)-style helper for creating and modifying `HTMLElement`s (see also [`s`](#s)).
60
- - [`hasOown`](#hasOown): Checks whether an object has the specified key as its own property.
61
+ - [`hasOwn`](#hasOwn): Checks whether an object has the specified key as its own property.
61
62
  - [`isArray`](#isArray): Checks whether the argument is an array.
62
63
  - [`isFiniteNumber`](#isFiniteNumber): Checks whether the argument is a finite number (excludes `±Infinity` and `NaN`).
64
+ - [`isInteger`](#isInteger): Checks whether the argument is an integer number.
63
65
  - [`isNumber`](#isNumber): Checks whether the argument is of type `number` (includes `NaN` and `±Infinity`).
64
66
  - [`isRecord`](#isRecord): Checks whether the argument is a plain object (not `null` and not an array).
65
67
  - [`isString`](#isString): Checks whether the argument is a string.
@@ -522,10 +524,10 @@ h(div, { $key: { two: 2 } })
522
524
  expect(div.key).to.deep.equal({ one: 1, two: 2 })
523
525
  ```
524
526
 
525
- ### hasOown
527
+ ### hasOwn
526
528
 
527
529
  ```ts
528
- const hasOown: (ref: unknown, key: unknown) => boolean;
530
+ const hasOwn: (ref: unknown, key: unknown) => boolean;
529
531
  ```
530
532
 
531
533
  Checks whether an object has the specified key as its own property.
@@ -544,6 +546,39 @@ The property key to look for.
544
546
 
545
547
  `true` if `ref` is not nullish and has `key` as an own property, `false` otherwise.
546
548
 
549
+ #### Usage Examples
550
+
551
+ ```ts
552
+ const obj = { 42: null, null: 'k,e,y', 'k,e,y': 42 }
553
+
554
+ expect(42 in obj).to.be.true
555
+ expect(hasOwn(obj, 42)).to.be.true
556
+
557
+ expect('42' in obj).to.be.true
558
+ expect(hasOwn(obj, '42')).to.be.true
559
+
560
+ expect('null' in obj).to.be.true
561
+ expect(hasOwn(obj, 'null')).to.be.true
562
+
563
+ expect(null in obj).to.be.true
564
+ expect(hasOwn(obj, null)).to.be.true
565
+
566
+ expect('k,e,y' in obj).to.be.true
567
+ expect(hasOwn(obj, 'k,e,y')).to.be.true
568
+
569
+ expect(['k', 'e', 'y'] in obj).to.be.true
570
+ expect(hasOwn(obj, ['k', 'e', 'y'])).to.be.true
571
+
572
+ expect('toString' in obj).to.be.true
573
+ expect(hasOwn(obj, 'toString')).to.be.false
574
+
575
+ expect(() => 'key' in null).to.throw
576
+ expect(hasOwn(null, 'key')).to.be.false
577
+
578
+ expect(() => 'key' in undefined).to.throw
579
+ expect(hasOwn(undefined, 'key')).to.be.false
580
+ ```
581
+
547
582
  ### isArray
548
583
 
549
584
  ```ts
@@ -594,6 +629,34 @@ expect(isFiniteNumber(NaN)).to.be.false
594
629
  expect(isFiniteNumber(Infinity)).to.be.false
595
630
  ```
596
631
 
632
+ ### isInteger
633
+
634
+ ```ts
635
+ const isInteger: (arg: unknown) => arg is number;
636
+ ```
637
+
638
+ Checks whether the argument is an integer number.
639
+
640
+ #### arg
641
+
642
+ The value to check.
643
+
644
+ #### Returns
645
+
646
+ `true` if `arg` is an integer number, `false` otherwise.
647
+
648
+ #### Usage Examples
649
+
650
+ ```ts
651
+ expect(isInteger(42)).to.be.true
652
+ expect(isInteger(42.00000000000001)).to.be.false
653
+ expect(isInteger(42.000000000000001)).to.be.true // because of loss of precision
654
+ expect(isInteger(Number(42))).to.be.true
655
+ expect(isInteger(new Number(42))).to.be.false
656
+ expect(isInteger(NaN)).to.be.false
657
+ expect(isInteger(Infinity)).to.be.false
658
+ ```
659
+
597
660
  ### isNumber
598
661
 
599
662
  ```ts