@silen/is-reg-exp
v1.0.3
Published
Check if the parameter is regexp
Downloads
7
Maintainers
Readme
is-reg-exp
Determine if a value is RegExp
install
npm i @silen/is-reg-exp
api
declare function isRegExp(val: any): boolean;
usage
const { isRegExp } = require('@silen/is-reg-exp');
// or
import { isRegExp } from '@silen/is-reg-exp';
console.log(isRegExp(new Buffer(4)));
console.log(isRegExp(Buffer.alloc(4)));
console.log(isRegExp(undefined));
console.log(isRegExp(null));
console.log(isRegExp(''));
console.log(isRegExp(true));
console.log(isRegExp(0));
console.log(isRegExp(1));
console.log(isRegExp(1.0));
console.log(isRegExp('string'));
console.log(isRegExp({}));
console.log(isRegExp(function foo() {}));
console.log(isRegExp(Symbol()));
console.log(isRegExp(new Set));
console.log(isRegExp(new Map));
console.log(isRegExp(new WeakMap));
console.log(isRegExp(new WeakSet));
// or
console.log(window.Type.isRegExp(new WeakSet));
This is a demo for testing the usage of isRegExp
from @silen/is-reg-exp
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
- isInt8Array
- isUint8Array
- isUint8ClampedArray
- isInt16Array
- isUint16Array
- isInt32Array
- isUint32Array
- isFloat32Array
- isFloat64Array
- isError
- isPromise
- isSet
- isWeakSet
- isMap
- isWeakMap
- isStream
- isURLSearchParams