@silen/is-weak-map
v1.0.3
Published
Check if the parameter is weakmap
Downloads
6
Maintainers
Readme
is-weak-map
Determine if a value is WeakMap
install
npm i @silen/is-weak-map
api
declare function isWeakMap(val: any): boolean;
usage
const { isWeakMap } = require('@silen/is-weak-map');
// or
import { isWeakMap } from '@silen/is-weak-map';
console.log(isWeakMap(new Buffer(4)));
console.log(isWeakMap(Buffer.alloc(4)));
console.log(isWeakMap(undefined));
console.log(isWeakMap(null));
console.log(isWeakMap(''));
console.log(isWeakMap(true));
console.log(isWeakMap(0));
console.log(isWeakMap(1));
console.log(isWeakMap(1.0));
console.log(isWeakMap('string'));
console.log(isWeakMap({}));
console.log(isWeakMap(function foo() {}));
console.log(isWeakMap(Symbol()));
console.log(isWeakMap(new Set));
console.log(isWeakMap(new Map));
console.log(isWeakMap(new WeakMap));
console.log(isWeakMap(new WeakSet));
// or
console.log(window.Type.isWeakMap(new WeakSet));
This is a demo for testing the usage of isWeakMap
from @silen/is-weak-map
module. You can try the others and do likewise.
others
- type
- isArray
- isUndefined
- isNull
- isBoolean
- isBuffer
- isArrayBuffer
- isFormData
- isArrayBufferView
- isString
- isNumber
- isObject
- isPlainObject
- isDate
- isArguments
- isFile
- isBlob
- isFunction
- isSymbol
- isRegExp
- isInt8Array
- isUint8Array
- isUint8ClampedArray
- isInt16Array
- isUint16Array
- isInt32Array
- isUint32Array
- isFloat32Array
- isFloat64Array
- isError
- isPromise
- isSet
- isWeakSet
- isMap
- isStream
- isURLSearchParams