is-kit 1.1.1 → 1.1.2

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/dist/index.d.mts CHANGED
@@ -324,6 +324,18 @@ declare const isMap: Predicate<Map<unknown, unknown>>;
324
324
  * @returns Predicate narrowing to `Set<unknown>`.
325
325
  */
326
326
  declare const isSet: Predicate<Set<unknown>>;
327
+ /**
328
+ * Checks whether a value is a `WeakMap`.
329
+ *
330
+ * @returns Predicate narrowing to `WeakMap<object, unknown>`.
331
+ */
332
+ declare const isWeakMap: Predicate<WeakMap<object, unknown>>;
333
+ /**
334
+ * Checks whether a value is a `WeakSet`.
335
+ *
336
+ * @returns Predicate narrowing to `WeakSet<object>`.
337
+ */
338
+ declare const isWeakSet: Predicate<WeakSet<object>>;
327
339
  /**
328
340
  * Checks whether a value is promise-like (has a `then` function).
329
341
  *
@@ -401,4 +413,4 @@ declare function narrowKeyTo<A, K extends keyof A>(guard: Guard<A>, key: K): <co
401
413
  */
402
414
  declare const toBooleanPredicates: (guards: readonly Guard<unknown>[]) => ReadonlyArray<(value: unknown) => boolean>;
403
415
 
404
- export { type ChainResult, type Guard, type GuardedOf, type GuardedWithin, type InferSchema, type OutOfGuards, type ParseResult, type Predicate, type Primitive, type Refine, type RefineChain, type Refinement, type Schema, and, andAll, arrayOf, define, equals, equalsBy, equalsKey, guardIn, isArray, isArrayBuffer, isAsyncIterable, isBigInt, isBlob, isBoolean, isDataView, isDate, isError, isFiniteNumber, isFunction, isIterable, isMap, isNull, isNumber, isNumberPrimitive, isObject, isPlainObject, isPromiseLike, isRegExp, isSet, isString, isSymbol, isTypedArray, isURL, isUndefined, narrowKeyTo, nonNull, not, nullable, nullish, oneOf, oneOfValues, optional, or, predicateToRefine, recordOf, required, safeParse, safeParseWith, struct, toBooleanPredicates, tupleOf };
416
+ export { type ChainResult, type Guard, type GuardedOf, type GuardedWithin, type InferSchema, type OutOfGuards, type ParseResult, type Predicate, type Primitive, type Refine, type RefineChain, type Refinement, type Schema, and, andAll, arrayOf, define, equals, equalsBy, equalsKey, guardIn, isArray, isArrayBuffer, isAsyncIterable, isBigInt, isBlob, isBoolean, isDataView, isDate, isError, isFiniteNumber, isFunction, isIterable, isMap, isNull, isNumber, isNumberPrimitive, isObject, isPlainObject, isPromiseLike, isRegExp, isSet, isString, isSymbol, isTypedArray, isURL, isUndefined, isWeakMap, isWeakSet, narrowKeyTo, nonNull, not, nullable, nullish, oneOf, oneOfValues, optional, or, predicateToRefine, recordOf, required, safeParse, safeParseWith, struct, toBooleanPredicates, tupleOf };
package/dist/index.d.ts CHANGED
@@ -324,6 +324,18 @@ declare const isMap: Predicate<Map<unknown, unknown>>;
324
324
  * @returns Predicate narrowing to `Set<unknown>`.
325
325
  */
326
326
  declare const isSet: Predicate<Set<unknown>>;
327
+ /**
328
+ * Checks whether a value is a `WeakMap`.
329
+ *
330
+ * @returns Predicate narrowing to `WeakMap<object, unknown>`.
331
+ */
332
+ declare const isWeakMap: Predicate<WeakMap<object, unknown>>;
333
+ /**
334
+ * Checks whether a value is a `WeakSet`.
335
+ *
336
+ * @returns Predicate narrowing to `WeakSet<object>`.
337
+ */
338
+ declare const isWeakSet: Predicate<WeakSet<object>>;
327
339
  /**
328
340
  * Checks whether a value is promise-like (has a `then` function).
329
341
  *
@@ -401,4 +413,4 @@ declare function narrowKeyTo<A, K extends keyof A>(guard: Guard<A>, key: K): <co
401
413
  */
402
414
  declare const toBooleanPredicates: (guards: readonly Guard<unknown>[]) => ReadonlyArray<(value: unknown) => boolean>;
403
415
 
404
- export { type ChainResult, type Guard, type GuardedOf, type GuardedWithin, type InferSchema, type OutOfGuards, type ParseResult, type Predicate, type Primitive, type Refine, type RefineChain, type Refinement, type Schema, and, andAll, arrayOf, define, equals, equalsBy, equalsKey, guardIn, isArray, isArrayBuffer, isAsyncIterable, isBigInt, isBlob, isBoolean, isDataView, isDate, isError, isFiniteNumber, isFunction, isIterable, isMap, isNull, isNumber, isNumberPrimitive, isObject, isPlainObject, isPromiseLike, isRegExp, isSet, isString, isSymbol, isTypedArray, isURL, isUndefined, narrowKeyTo, nonNull, not, nullable, nullish, oneOf, oneOfValues, optional, or, predicateToRefine, recordOf, required, safeParse, safeParseWith, struct, toBooleanPredicates, tupleOf };
416
+ export { type ChainResult, type Guard, type GuardedOf, type GuardedWithin, type InferSchema, type OutOfGuards, type ParseResult, type Predicate, type Primitive, type Refine, type RefineChain, type Refinement, type Schema, and, andAll, arrayOf, define, equals, equalsBy, equalsKey, guardIn, isArray, isArrayBuffer, isAsyncIterable, isBigInt, isBlob, isBoolean, isDataView, isDate, isError, isFiniteNumber, isFunction, isIterable, isMap, isNull, isNumber, isNumberPrimitive, isObject, isPlainObject, isPromiseLike, isRegExp, isSet, isString, isSymbol, isTypedArray, isURL, isUndefined, isWeakMap, isWeakSet, narrowKeyTo, nonNull, not, nullable, nullish, oneOf, oneOfValues, optional, or, predicateToRefine, recordOf, required, safeParse, safeParseWith, struct, toBooleanPredicates, tupleOf };
package/dist/index.js CHANGED
@@ -54,6 +54,8 @@ __export(index_exports, {
54
54
  isTypedArray: () => isTypedArray,
55
55
  isURL: () => isURL,
56
56
  isUndefined: () => isUndefined,
57
+ isWeakMap: () => isWeakMap,
58
+ isWeakSet: () => isWeakSet,
57
59
  narrowKeyTo: () => narrowKeyTo,
58
60
  nonNull: () => nonNull,
59
61
  not: () => not,
@@ -160,6 +162,12 @@ var isMap = define(
160
162
  var isSet = define(
161
163
  (value) => getTag(value) === "[object Set]"
162
164
  );
165
+ var isWeakMap = define(
166
+ (value) => getTag(value) === "[object WeakMap]"
167
+ );
168
+ var isWeakSet = define(
169
+ (value) => getTag(value) === "[object WeakSet]"
170
+ );
163
171
  var isPromiseLike = define((value) => {
164
172
  if (!isObject(value) && !isFunction(value)) return false;
165
173
  return typeof value.then === "function";
@@ -309,9 +317,9 @@ function oneOfValues(...values) {
309
317
  function narrowKeyTo(guard, key) {
310
318
  return function(target) {
311
319
  const keyEquals = equalsKey(key, target);
312
- return function(input) {
320
+ return define(function(input) {
313
321
  return guard(input) && keyEquals(input);
314
- };
322
+ });
315
323
  };
316
324
  }
317
325
  // Annotate the CommonJS export names for ESM import in node:
@@ -350,6 +358,8 @@ function narrowKeyTo(guard, key) {
350
358
  isTypedArray,
351
359
  isURL,
352
360
  isUndefined,
361
+ isWeakMap,
362
+ isWeakSet,
353
363
  narrowKeyTo,
354
364
  nonNull,
355
365
  not,
package/dist/index.mjs CHANGED
@@ -84,6 +84,12 @@ var isMap = define(
84
84
  var isSet = define(
85
85
  (value) => getTag(value) === "[object Set]"
86
86
  );
87
+ var isWeakMap = define(
88
+ (value) => getTag(value) === "[object WeakMap]"
89
+ );
90
+ var isWeakSet = define(
91
+ (value) => getTag(value) === "[object WeakSet]"
92
+ );
87
93
  var isPromiseLike = define((value) => {
88
94
  if (!isObject(value) && !isFunction(value)) return false;
89
95
  return typeof value.then === "function";
@@ -233,9 +239,9 @@ function oneOfValues(...values) {
233
239
  function narrowKeyTo(guard, key) {
234
240
  return function(target) {
235
241
  const keyEquals = equalsKey(key, target);
236
- return function(input) {
242
+ return define(function(input) {
237
243
  return guard(input) && keyEquals(input);
238
- };
244
+ });
239
245
  };
240
246
  }
241
247
  export {
@@ -273,6 +279,8 @@ export {
273
279
  isTypedArray,
274
280
  isURL,
275
281
  isUndefined,
282
+ isWeakMap,
283
+ isWeakSet,
276
284
  narrowKeyTo,
277
285
  nonNull,
278
286
  not,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "is-kit",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
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",