1.0.5 • Published 5 years ago

js-variable-type v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

区分Javascript变量值类型

用法

安装

	npm install js-variable-type
import {
	isObject,
	isArray,
	isString,
	isNumber,
	isNull,
	isUndefined,
	isDate,
	isRegExp,
	isBoolean,
	isFunction,
	isError
} from 'js-variable-type';

	console.log(`{} is Object ? -> ${isObject({})}`);
	console.log(`[] is Array ? -> ${isArray([])}`);
	console.log(`'string' is String ? -> ${isString('string')}`);
	console.log(`100 is Number ? -> ${isNumber(100)}`);
	console.log(`null is Null ? -> ${isNull(null)}`);
	console.log(`undefined is Undefined ? -> ${isUndefined(undefined)}`);
	console.log(`new Date() is isDate ? -> ${isDate(new Date())}`);
	console.log(`new RegExp() is RegExp ? -> ${isRegExp(new RegExp())}`);
	console.log(`true is Boolean ? -> ${isBoolean(true)}`);
	console.log(`() => {} is Funtion ? -> ${isFunction(this.onDialogRedirect)}`);
	console.log(`new Error() is Error ? -> ${isError(new Error('ddd'))}`);
1.0.5

5 years ago

1.0.4

5 years ago