@jackens/nnn 2024.2.24 → 2024.2.26

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 +10 -8
  2. package/nnn.js +2 -4
  3. package/package.json +1 -1
  4. package/readme.md +11 -9
package/nnn.d.ts CHANGED
@@ -115,14 +115,16 @@ export declare const has: (key: any, ref: any) => boolean;
115
115
  /**
116
116
  * A helper that checks if the given argument is of a certain type.
117
117
  */
118
- export declare function is(type: BigIntConstructor, arg: any): arg is bigint;
119
- export declare function is(type: BooleanConstructor, arg: any): arg is boolean;
120
- export declare function is(type: NumberConstructor, arg: any): arg is number;
121
- export declare function is(type: ObjectConstructor, arg: any): arg is Partial<Record<PropertyKey, any>>;
122
- export declare function is(type: StringConstructor, arg: any): arg is string;
123
- export declare function is(type: SymbolConstructor, arg: any): arg is symbol;
124
- export declare function is(type: undefined, arg: any): arg is undefined | null;
125
- export declare function is<T extends abstract new (...args: any[]) => any>(type: T, arg: any): arg is InstanceType<T>;
118
+ export declare const is: {
119
+ (type: BigIntConstructor, arg: any): arg is bigint;
120
+ (type: BooleanConstructor, arg: any): arg is boolean;
121
+ (type: NumberConstructor, arg: any): arg is number;
122
+ (type: ObjectConstructor, arg: any): arg is Partial<Record<PropertyKey, any>>;
123
+ (type: StringConstructor, arg: any): arg is string;
124
+ (type: SymbolConstructor, arg: any): arg is symbol;
125
+ (type: undefined, arg: any): arg is undefined | null;
126
+ <T extends abstract new (...args: any[]) => any>(type: T, arg: any): arg is InstanceType<T>;
127
+ };
126
128
 
127
129
  /**
128
130
  * The type of arguments of the `jcss` helper.
package/nnn.js CHANGED
@@ -1,7 +1,5 @@
1
1
  // src/nnn/is.ts
2
- function is(type, arg) {
3
- return arg?.constructor === type;
4
- }
2
+ var is = (type, arg) => arg?.constructor === type;
5
3
 
6
4
  // src/nnn/h.ts
7
5
  var NS = {
@@ -16,7 +14,7 @@ var _h = (namespaceURI) => {
16
14
  if (arg instanceof Node) {
17
15
  child = arg;
18
16
  } else if (is(String, arg) || is(Number, arg)) {
19
- child = new Text(arg);
17
+ child = document.createTextNode(arg);
20
18
  } else if (is(Array, arg)) {
21
19
  child = h(...arg);
22
20
  } else if (arg != null) {
package/package.json CHANGED
@@ -42,5 +42,5 @@
42
42
  "types": "nnn.d.ts",
43
43
  "name": "@jackens/nnn",
44
44
  "type": "module",
45
- "version": "2024.2.24"
45
+ "version": "2024.2.26"
46
46
  }
package/readme.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Jackens’ JavaScript helpers.
4
4
 
5
- <sub>Version: <code class="version">2024.2.24</code></sub>
5
+ <sub>Version: <code class="version">2024.2.26</code></sub>
6
6
 
7
7
  ## Installation
8
8
 
@@ -374,14 +374,16 @@ expect(has('key', null)).toBeFalse()
374
374
  ### is
375
375
 
376
376
  ```ts
377
- function is(type: BigIntConstructor, arg: any): arg is bigint;
378
- function is(type: BooleanConstructor, arg: any): arg is boolean;
379
- function is(type: NumberConstructor, arg: any): arg is number;
380
- function is(type: ObjectConstructor, arg: any): arg is Partial<Record<PropertyKey, any>>;
381
- function is(type: StringConstructor, arg: any): arg is string;
382
- function is(type: SymbolConstructor, arg: any): arg is symbol;
383
- function is(type: undefined, arg: any): arg is undefined | null;
384
- function is<T extends abstract new (...args: any[]) => any>(type: T, arg: any): arg is InstanceType<T>;
377
+ const is: {
378
+ (type: BigIntConstructor, arg: any): arg is bigint;
379
+ (type: BooleanConstructor, arg: any): arg is boolean;
380
+ (type: NumberConstructor, arg: any): arg is number;
381
+ (type: ObjectConstructor, arg: any): arg is Partial<Record<PropertyKey, any>>;
382
+ (type: StringConstructor, arg: any): arg is string;
383
+ (type: SymbolConstructor, arg: any): arg is symbol;
384
+ (type: undefined, arg: any): arg is undefined | null;
385
+ <T extends abstract new (...args: any[]) => any>(type: T, arg: any): arg is InstanceType<T>;
386
+ };
385
387
  ```
386
388
 
387
389
  A helper that checks if the given argument is of a certain type.