@lvchengbin/is
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "@lvchengbin/is", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A library, which is possible to be imported as ES6 module separately, for checking the type of a value.", | ||
@@ -5,0 +5,0 @@ "keywords": "is check types es6", |
@@ -32,2 +32,6 @@ # Is | ||
## Using in browsers | ||
If you want to invoke this package to browsers with `<script>` tag or something like that, use [is.js](https://raw.githubusercontent.com/LvChengbin/is/master/dist/is.js). For old browsers which are not supporting ES5 syntax, use [is.bc.js](https://raw.githubusercontent.com/LvChengbin/is/master/dist/is.bc.js). | ||
## Method List | ||
@@ -38,3 +42,3 @@ | ||
```js | ||
import isArguments from '@lvchengbin/is/src/arguments; | ||
import isArguments from '@lvchengbin/is/src/arguments'; | ||
``` | ||
@@ -45,3 +49,3 @@ | ||
```js | ||
import isArray from '@lvchengbin/is/src/array; | ||
import isArray from '@lvchengbin/is/src/array'; | ||
``` | ||
@@ -51,4 +55,8 @@ | ||
For checking if a function is an `arrow function`. | ||
```js | ||
import isArrowFunction from '@lvchengbin/is/src/arrow-function; | ||
import isArrowFunction from '@lvchengbin/is/src/arrow-function'; | ||
isArrowFunction( () => {} ); // returns true | ||
``` | ||
@@ -58,4 +66,8 @@ | ||
For checking if a `function` is an `async function`. | ||
```js | ||
import isAsyncFunction from '@lvchengbin/is/src/async-function; | ||
import isAsyncFunction from '@lvchengbin/is/src/async-function'; | ||
isAsyncFunction( async () => {} ); // returns true | ||
``` | ||
@@ -66,3 +78,3 @@ | ||
```js | ||
import isBoolean from '@lvchengbin/is/src/boolean; | ||
import isBoolean from '@lvchengbin/is/src/boolean'; | ||
``` | ||
@@ -72,4 +84,8 @@ | ||
For checking if an object is a `Date` instance. | ||
```js | ||
import isDate from '@lvchengbin/is/src/date; | ||
import isDate from '@lvchengbin/is/src/date'; | ||
isDate( new Date ); // return true | ||
``` | ||
@@ -79,4 +95,8 @@ | ||
For checking if the value is an email address. | ||
```js | ||
import isEmail from '@lvchengbin/is/src/email; | ||
import isEmail from '@lvchengbin/is/src/email'; | ||
isEmail( 'abc@gmail.com' ); // returns true | ||
``` | ||
@@ -86,4 +106,12 @@ | ||
For checking if a value is empty, and empty values include empty object ({}), empty string (''), empty array ([]), number 0, false. | ||
```js | ||
import isEmpty from '@lvchengbin/is/src/empty; | ||
import isEmpty from '@lvchengbin/is/src/empty'; | ||
isEmpty( '' ); // return true | ||
isEmpty( [] ); // return true | ||
isEmpty( {} ); // return true | ||
isEmpty( 0 ); // return true | ||
isEmpty( false ); // return true | ||
``` | ||
@@ -93,4 +121,8 @@ | ||
For checking if an object is an `Error` instance. | ||
```js | ||
import isError from '@lvchengbin/is/src/error; | ||
import isError from '@lvchengbin/is/src/error'; | ||
isError( new Error ); // returns true | ||
``` | ||
@@ -100,4 +132,10 @@ | ||
For checking if a value is `false`, if the second argument is `true` (by default), the function will check a generalized `false`, it means that the following strings all mean `false`: "false", "no", "0", "", "nay", "n", "disagree". | ||
```js | ||
import isFalse from '@lvchengbin/is/src/false; | ||
import isFalse from '@lvchengbin/is/src/false'; | ||
isFalse( false ); // returns true | ||
isFalse( 'false' ); // returns true | ||
isFalse( 'false', false ); // returns false | ||
``` | ||
@@ -108,3 +146,3 @@ | ||
```js | ||
import isFunction from '@lvchengbin/is/src/function; | ||
import isFunction from '@lvchengbin/is/src/function'; | ||
``` | ||
@@ -115,3 +153,3 @@ | ||
```js | ||
import isInteger from '@lvchengbin/is/src/integer; | ||
import isInteger from '@lvchengbin/is/src/integer'; | ||
``` | ||
@@ -122,3 +160,3 @@ | ||
```js | ||
import isIterable from '@lvchengbin/is/src/iterable; | ||
import isIterable from '@lvchengbin/is/src/iterable'; | ||
``` | ||
@@ -129,3 +167,3 @@ | ||
```js | ||
import isNumber from '@lvchengbin/is/src/number; | ||
import isNumber from '@lvchengbin/is/src/number'; | ||
``` | ||
@@ -136,3 +174,3 @@ | ||
```js | ||
import isObject from '@lvchengbin/is/src/object; | ||
import isObject from '@lvchengbin/is/src/object'; | ||
``` | ||
@@ -143,3 +181,3 @@ | ||
```js | ||
import isPromise from '@lvchengbin/is/src/promise; | ||
import isPromise from '@lvchengbin/is/src/promise'; | ||
``` | ||
@@ -150,3 +188,3 @@ | ||
```js | ||
import isRegExp from '@lvchengbin/is/src/regexp; | ||
import isRegExp from '@lvchengbin/is/src/regexp'; | ||
``` | ||
@@ -157,3 +195,3 @@ | ||
```js | ||
import isString from '@lvchengbin/is/src/string; | ||
import isString from '@lvchengbin/is/src/string'; | ||
``` | ||
@@ -163,4 +201,9 @@ | ||
For checking if a value is `true`, if the second argument is `true` (by default), the function will check a generalized `true`, it means that the following strings all mean `true`: "true", "true", "yes", "ok", "1", "yea", "yep", "y", "agree". | ||
```js | ||
import isTrue from '@lvchengbin/is/src/true; | ||
import isTrue from '@lvchengbin/is/src/true'; | ||
isTrue( true ); // returns true | ||
isTrue( 'true' ); // returns true | ||
isTrue( 'true', false ); // returns false | ||
``` | ||
@@ -171,3 +214,3 @@ | ||
```js | ||
import isUndefined from '@lvchengbin/is/src/undefined; | ||
import isUndefined from '@lvchengbin/is/src/undefined'; | ||
``` | ||
@@ -178,3 +221,3 @@ | ||
```js | ||
import isUrl from '@lvchengbin/is/src/url; | ||
import isUrl from '@lvchengbin/is/src/url'; | ||
``` |
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
35208
202