is-kit 1.7.3 → 1.7.4

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/README.md CHANGED
@@ -371,7 +371,7 @@ https://is-kit-docs.vercel.app/
371
371
 
372
372
  ## 👨‍💻 Development
373
373
 
374
- Requires Node 22 and pnpm 10.33.4.
374
+ Requires Node 22.22.0 and pnpm 11.2.2.
375
375
 
376
376
  - `pnpm lint`
377
377
  - `pnpm build`
package/dist/index.d.mts CHANGED
@@ -11,7 +11,7 @@ type ParseResult<T> = {
11
11
  } | {
12
12
  valid: false;
13
13
  };
14
- type GuardedOf<F> = F extends (value: unknown) => value is infer G ? G : never;
14
+ type GuardedOf<F> = F extends ((value: unknown) => value is infer G) ? G : never;
15
15
  type GuardedWithin<Fs, A> = Extract<Fs extends readonly unknown[] ? GuardedOf<Fs[number]> : never, A>;
16
16
 
17
17
  type Primitive = string | number | boolean | bigint | symbol | null | undefined;
@@ -381,31 +381,31 @@ declare const isDate: Predicate<Date>;
381
381
  *
382
382
  * @returns Predicate narrowing to `RegExp`.
383
383
  */
384
- declare const isRegExp: Predicate<RegExp>;
384
+ declare const isRegExp: Guard<RegExp>;
385
385
  /**
386
386
  * Checks whether a value is a `Map`.
387
387
  *
388
388
  * @returns Predicate narrowing to `Map<unknown, unknown>`.
389
389
  */
390
- declare const isMap: Predicate<Map<unknown, unknown>>;
390
+ declare const isMap: Guard<Map<unknown, unknown>>;
391
391
  /**
392
392
  * Checks whether a value is a `Set`.
393
393
  *
394
394
  * @returns Predicate narrowing to `Set<unknown>`.
395
395
  */
396
- declare const isSet: Predicate<Set<unknown>>;
396
+ declare const isSet: Guard<Set<unknown>>;
397
397
  /**
398
398
  * Checks whether a value is a `WeakMap`.
399
399
  *
400
400
  * @returns Predicate narrowing to `WeakMap<object, unknown>`.
401
401
  */
402
- declare const isWeakMap: Predicate<WeakMap<object, unknown>>;
402
+ declare const isWeakMap: Guard<WeakMap<object, unknown>>;
403
403
  /**
404
404
  * Checks whether a value is a `WeakSet`.
405
405
  *
406
406
  * @returns Predicate narrowing to `WeakSet<object>`.
407
407
  */
408
- declare const isWeakSet: Predicate<WeakSet<object>>;
408
+ declare const isWeakSet: Guard<WeakSet<object>>;
409
409
  /**
410
410
  * Checks whether a value is promise-like (has a `then` function).
411
411
  *
@@ -429,13 +429,13 @@ declare const isAsyncIterable: Predicate<AsyncIterable<unknown>>;
429
429
  *
430
430
  * @returns Predicate narrowing to `ArrayBuffer`.
431
431
  */
432
- declare const isArrayBuffer: Predicate<ArrayBuffer>;
432
+ declare const isArrayBuffer: Guard<ArrayBuffer>;
433
433
  /**
434
434
  * Checks whether a value is a `DataView`.
435
435
  *
436
436
  * @returns Predicate narrowing to `DataView`.
437
437
  */
438
- declare const isDataView: Predicate<DataView<ArrayBufferLike>>;
438
+ declare const isDataView: Guard<DataView<ArrayBufferLike>>;
439
439
  /**
440
440
  * Checks whether a value is a typed array view (any `ArrayBufferView` except DataView).
441
441
  *
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ type ParseResult<T> = {
11
11
  } | {
12
12
  valid: false;
13
13
  };
14
- type GuardedOf<F> = F extends (value: unknown) => value is infer G ? G : never;
14
+ type GuardedOf<F> = F extends ((value: unknown) => value is infer G) ? G : never;
15
15
  type GuardedWithin<Fs, A> = Extract<Fs extends readonly unknown[] ? GuardedOf<Fs[number]> : never, A>;
16
16
 
17
17
  type Primitive = string | number | boolean | bigint | symbol | null | undefined;
@@ -381,31 +381,31 @@ declare const isDate: Predicate<Date>;
381
381
  *
382
382
  * @returns Predicate narrowing to `RegExp`.
383
383
  */
384
- declare const isRegExp: Predicate<RegExp>;
384
+ declare const isRegExp: Guard<RegExp>;
385
385
  /**
386
386
  * Checks whether a value is a `Map`.
387
387
  *
388
388
  * @returns Predicate narrowing to `Map<unknown, unknown>`.
389
389
  */
390
- declare const isMap: Predicate<Map<unknown, unknown>>;
390
+ declare const isMap: Guard<Map<unknown, unknown>>;
391
391
  /**
392
392
  * Checks whether a value is a `Set`.
393
393
  *
394
394
  * @returns Predicate narrowing to `Set<unknown>`.
395
395
  */
396
- declare const isSet: Predicate<Set<unknown>>;
396
+ declare const isSet: Guard<Set<unknown>>;
397
397
  /**
398
398
  * Checks whether a value is a `WeakMap`.
399
399
  *
400
400
  * @returns Predicate narrowing to `WeakMap<object, unknown>`.
401
401
  */
402
- declare const isWeakMap: Predicate<WeakMap<object, unknown>>;
402
+ declare const isWeakMap: Guard<WeakMap<object, unknown>>;
403
403
  /**
404
404
  * Checks whether a value is a `WeakSet`.
405
405
  *
406
406
  * @returns Predicate narrowing to `WeakSet<object>`.
407
407
  */
408
- declare const isWeakSet: Predicate<WeakSet<object>>;
408
+ declare const isWeakSet: Guard<WeakSet<object>>;
409
409
  /**
410
410
  * Checks whether a value is promise-like (has a `then` function).
411
411
  *
@@ -429,13 +429,13 @@ declare const isAsyncIterable: Predicate<AsyncIterable<unknown>>;
429
429
  *
430
430
  * @returns Predicate narrowing to `ArrayBuffer`.
431
431
  */
432
- declare const isArrayBuffer: Predicate<ArrayBuffer>;
432
+ declare const isArrayBuffer: Guard<ArrayBuffer>;
433
433
  /**
434
434
  * Checks whether a value is a `DataView`.
435
435
  *
436
436
  * @returns Predicate narrowing to `DataView`.
437
437
  */
438
- declare const isDataView: Predicate<DataView<ArrayBufferLike>>;
438
+ declare const isDataView: Guard<DataView<ArrayBufferLike>>;
439
439
  /**
440
440
  * Checks whether a value is a typed array view (any `ArrayBufferView` except DataView).
441
441
  *
package/dist/index.js CHANGED
@@ -123,6 +123,7 @@ var OBJECT_TAG_ERROR = "[object Error]";
123
123
  var getTag = (value) => objectToString.call(value);
124
124
 
125
125
  // src/core/object.ts
126
+ var defineTagGuard = (tag) => define((value) => getTag(value) === tag);
126
127
  var defineOptionalInstanceGuard = (constructor) => constructor === void 0 ? define(() => false) : define(
127
128
  (value) => typeof constructor === "function" && value instanceof constructor
128
129
  );
@@ -145,21 +146,11 @@ var isArray = define(Array.isArray);
145
146
  var isDate = define(
146
147
  (value) => getTag(value) === OBJECT_TAG_DATE && !Number.isNaN(value.getTime())
147
148
  );
148
- var isRegExp = define(
149
- (value) => getTag(value) === OBJECT_TAG_REGEXP
150
- );
151
- var isMap = define(
152
- (value) => getTag(value) === OBJECT_TAG_MAP
153
- );
154
- var isSet = define(
155
- (value) => getTag(value) === OBJECT_TAG_SET
156
- );
157
- var isWeakMap = define(
158
- (value) => getTag(value) === OBJECT_TAG_WEAK_MAP
159
- );
160
- var isWeakSet = define(
161
- (value) => getTag(value) === OBJECT_TAG_WEAK_SET
162
- );
149
+ var isRegExp = defineTagGuard(OBJECT_TAG_REGEXP);
150
+ var isMap = defineTagGuard(OBJECT_TAG_MAP);
151
+ var isSet = defineTagGuard(OBJECT_TAG_SET);
152
+ var isWeakMap = defineTagGuard(OBJECT_TAG_WEAK_MAP);
153
+ var isWeakSet = defineTagGuard(OBJECT_TAG_WEAK_SET);
163
154
  var isPromiseLike = define(
164
155
  (value) => isFunction(readObjectProperty(value, "then"))
165
156
  );
@@ -169,12 +160,8 @@ var isIterable = define(
169
160
  var isAsyncIterable = define(
170
161
  (value) => isFunction(readObjectProperty(value, Symbol.asyncIterator))
171
162
  );
172
- var isArrayBuffer = define(
173
- (value) => getTag(value) === OBJECT_TAG_ARRAY_BUFFER
174
- );
175
- var isDataView = define(
176
- (value) => getTag(value) === OBJECT_TAG_DATA_VIEW
177
- );
163
+ var isArrayBuffer = defineTagGuard(OBJECT_TAG_ARRAY_BUFFER);
164
+ var isDataView = defineTagGuard(OBJECT_TAG_DATA_VIEW);
178
165
  var isTypedArray = define(
179
166
  (value) => ArrayBuffer.isView(value) && getTag(value) !== OBJECT_TAG_DATA_VIEW
180
167
  );
@@ -213,9 +200,7 @@ function equalsKey(key, target) {
213
200
  }
214
201
 
215
202
  // src/core/key.ts
216
- var hasKey = (key) => define(
217
- (input) => isObject(input) && Object.hasOwn(input, key)
218
- );
203
+ var hasKey = (key) => define((input) => isObject(input) && Object.hasOwn(input, key));
219
204
  var hasKeys = (...keys) => {
220
205
  if (keys.length === 0) {
221
206
  return define(() => false);
package/dist/index.mjs CHANGED
@@ -24,6 +24,7 @@ var OBJECT_TAG_ERROR = "[object Error]";
24
24
  var getTag = (value) => objectToString.call(value);
25
25
 
26
26
  // src/core/object.ts
27
+ var defineTagGuard = (tag) => define((value) => getTag(value) === tag);
27
28
  var defineOptionalInstanceGuard = (constructor) => constructor === void 0 ? define(() => false) : define(
28
29
  (value) => typeof constructor === "function" && value instanceof constructor
29
30
  );
@@ -46,21 +47,11 @@ var isArray = define(Array.isArray);
46
47
  var isDate = define(
47
48
  (value) => getTag(value) === OBJECT_TAG_DATE && !Number.isNaN(value.getTime())
48
49
  );
49
- var isRegExp = define(
50
- (value) => getTag(value) === OBJECT_TAG_REGEXP
51
- );
52
- var isMap = define(
53
- (value) => getTag(value) === OBJECT_TAG_MAP
54
- );
55
- var isSet = define(
56
- (value) => getTag(value) === OBJECT_TAG_SET
57
- );
58
- var isWeakMap = define(
59
- (value) => getTag(value) === OBJECT_TAG_WEAK_MAP
60
- );
61
- var isWeakSet = define(
62
- (value) => getTag(value) === OBJECT_TAG_WEAK_SET
63
- );
50
+ var isRegExp = defineTagGuard(OBJECT_TAG_REGEXP);
51
+ var isMap = defineTagGuard(OBJECT_TAG_MAP);
52
+ var isSet = defineTagGuard(OBJECT_TAG_SET);
53
+ var isWeakMap = defineTagGuard(OBJECT_TAG_WEAK_MAP);
54
+ var isWeakSet = defineTagGuard(OBJECT_TAG_WEAK_SET);
64
55
  var isPromiseLike = define(
65
56
  (value) => isFunction(readObjectProperty(value, "then"))
66
57
  );
@@ -70,12 +61,8 @@ var isIterable = define(
70
61
  var isAsyncIterable = define(
71
62
  (value) => isFunction(readObjectProperty(value, Symbol.asyncIterator))
72
63
  );
73
- var isArrayBuffer = define(
74
- (value) => getTag(value) === OBJECT_TAG_ARRAY_BUFFER
75
- );
76
- var isDataView = define(
77
- (value) => getTag(value) === OBJECT_TAG_DATA_VIEW
78
- );
64
+ var isArrayBuffer = defineTagGuard(OBJECT_TAG_ARRAY_BUFFER);
65
+ var isDataView = defineTagGuard(OBJECT_TAG_DATA_VIEW);
79
66
  var isTypedArray = define(
80
67
  (value) => ArrayBuffer.isView(value) && getTag(value) !== OBJECT_TAG_DATA_VIEW
81
68
  );
@@ -114,9 +101,7 @@ function equalsKey(key, target) {
114
101
  }
115
102
 
116
103
  // src/core/key.ts
117
- var hasKey = (key) => define(
118
- (input) => isObject(input) && Object.hasOwn(input, key)
119
- );
104
+ var hasKey = (key) => define((input) => isObject(input) && Object.hasOwn(input, key));
120
105
  var hasKeys = (...keys) => {
121
106
  if (keys.length === 0) {
122
107
  return define(() => false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "is-kit",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "Make 'isXXX' easier. Let's make your code type safe and more readable!",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -37,16 +37,11 @@
37
37
  "author": "nyaomaru",
38
38
  "license": "MIT",
39
39
  "devDependencies": {
40
- "@eslint/js": "^9.33.0",
41
40
  "@types/jest": "^30.0.0",
42
- "@typescript-eslint/eslint-plugin": "^8.12.0",
43
- "@typescript-eslint/parser": "^8.12.0",
44
- "eslint": "^9.33.0",
45
- "eslint-config-prettier": "^10.1.8",
46
- "eslint-plugin-prettier": "^5.5.4",
47
41
  "jest": "^30.0.5",
48
42
  "lefthook": "^2.0.13",
49
- "prettier": "^3.6.2",
43
+ "oxfmt": "^0.52.0",
44
+ "oxlint": "^1.67.0",
50
45
  "ts-jest": "^29.4.1",
51
46
  "tsd": "^0.33.0",
52
47
  "tsup": "^8.5.0",
@@ -62,7 +57,9 @@
62
57
  "scripts": {
63
58
  "test": "jest",
64
59
  "test:types": "tsd",
65
- "lint": "eslint .",
60
+ "lint": "oxlint .",
61
+ "format": "oxfmt .",
62
+ "format:check": "oxfmt --check .",
66
63
  "build": "tsup",
67
64
  "typedoc": "typedoc --out docs/public/api"
68
65
  }