@sindresorhus/is
Advanced tools
Comparing version 5.0.1 to 5.1.0
@@ -5,4 +5,4 @@ /// <reference types="node" resolution-mode="require"/> | ||
import type { Buffer } from 'node:buffer'; | ||
import type { Class, Falsy, TypedArray, ObservableLike, Primitive } from './types.js'; | ||
declare const objectTypeNames: readonly ["Function", "Generator", "AsyncGenerator", "GeneratorFunction", "AsyncGeneratorFunction", "AsyncFunction", "Observable", "Array", "Buffer", "Blob", "Object", "RegExp", "Date", "Error", "Map", "Set", "WeakMap", "WeakSet", "ArrayBuffer", "SharedArrayBuffer", "DataView", "Promise", "URL", "FormData", "URLSearchParams", "HTMLElement", "NaN", "Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array", "BigInt64Array", "BigUint64Array"]; | ||
import type { Class, Falsy, TypedArray, ObservableLike, Primitive, WeakRef } from './types.js'; | ||
declare const objectTypeNames: readonly ["Function", "Generator", "AsyncGenerator", "GeneratorFunction", "AsyncGeneratorFunction", "AsyncFunction", "Observable", "Array", "Buffer", "Blob", "Object", "RegExp", "Date", "Error", "Map", "Set", "WeakMap", "WeakSet", "WeakRef", "ArrayBuffer", "SharedArrayBuffer", "DataView", "Promise", "URL", "FormData", "URLSearchParams", "HTMLElement", "NaN", "Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array", "BigInt64Array", "BigUint64Array"]; | ||
declare type ObjectTypeName = typeof objectTypeNames[number]; | ||
@@ -46,2 +46,3 @@ declare const primitiveTypeNames: readonly ["null", "undefined", "string", "number", "bigint", "boolean", "symbol"]; | ||
var weakSet: (value: unknown) => value is WeakSet<object>; | ||
var weakRef: (value: unknown) => value is WeakRef<object>; | ||
var int8Array: (value: unknown) => value is Int8Array; | ||
@@ -181,2 +182,3 @@ var uint8Array: (value: unknown) => value is Uint8Array; | ||
weakSet: <T extends object = object>(value: unknown) => asserts value is WeakSet<T>; | ||
weakRef: <T extends object = object>(value: unknown) => asserts value is WeakRef<T>; | ||
int8Array: (value: unknown) => asserts value is Int8Array; | ||
@@ -183,0 +185,0 @@ uint8Array: (value: unknown) => asserts value is Uint8Array; |
@@ -36,2 +36,3 @@ const typedArrayTypeNames = [ | ||
'WeakSet', | ||
'WeakRef', | ||
'ArrayBuffer', | ||
@@ -165,2 +166,3 @@ 'SharedArrayBuffer', | ||
is.weakSet = (value) => isObjectOfType('WeakSet')(value); // eslint-disable-line @typescript-eslint/ban-types | ||
is.weakRef = (value) => isObjectOfType('WeakRef')(value); // eslint-disable-line @typescript-eslint/ban-types | ||
is.int8Array = isObjectOfType('Int8Array'); | ||
@@ -353,2 +355,3 @@ is.uint8Array = isObjectOfType('Uint8Array'); | ||
weakSet: (value) => assertType(is.weakSet(value), 'WeakSet', value), | ||
weakRef: (value) => assertType(is.weakRef(value), 'WeakRef', value), | ||
int8Array: (value) => assertType(is.int8Array(value), 'Int8Array', value), | ||
@@ -355,0 +358,0 @@ uint8Array: (value) => assertType(is.uint8Array(value), 'Uint8Array', value), |
@@ -26,1 +26,5 @@ /** | ||
export declare type Falsy = false | 0 | 0n | '' | null | undefined; | ||
export interface WeakRef<T extends object> { | ||
readonly [Symbol.toStringTag]: 'WeakRef'; | ||
deref(): T | undefined; | ||
} |
{ | ||
"name": "@sindresorhus/is", | ||
"version": "5.0.1", | ||
"version": "5.1.0", | ||
"description": "Type check values", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -201,2 +201,3 @@ # is | ||
##### .weakSet(value) | ||
##### .weakRef(value) | ||
@@ -203,0 +204,0 @@ #### Typed arrays |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58785
702
671