@silen/is-map
v1.0.3
Published
Check if the parameter is map
Downloads
9
Readme
is-map
Determine if a value is Map
install
npm i @silen/is-map
api
declare function isMap(val: any): boolean;
usage
const { isMap } = require('@silen/is-map');
// or
import { isMap } from '@silen/is-map';
console.log(isMap(new Buffer(4)));
console.log(isMap(Buffer.alloc(4)));
console.log(isMap(undefined));
console.log(isMap(null));
console.log(isMap(''));
console.log(isMap(true));
console.log(isMap(0));
console.log(isMap(1));
console.log(isMap(1.0));
console.log(isMap('string'));
console.log(isMap({}));
console.log(isMap(function foo() {}));
console.log(isMap(Symbol()));
console.log(isMap(new Set));
console.log(isMap(new Map));
console.log(isMap(new WeakMap));
console.log(isMap(new WeakSet));
// or
console.log(window.Type.isMap(new WeakSet));
This is a demo for testing the usage of isMap
from @silen/is-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
- isWeakMap
- isStream
- isURLSearchParams