Comparing version 0.8.0 to 0.8.1
@@ -1,2 +0,2 @@ | ||
import { Class, Primitive } from './types'; | ||
import { Class, PlainObject, Primitive } from './types'; | ||
declare const objectTypes: readonly ["Array", "ArrayBuffer", "AsyncFunction", "AsyncGenerator", "AsyncGeneratorFunction", "Date", "Error", "Function", "Generator", "GeneratorFunction", "HTMLElement", "Map", "Object", "Promise", "RegExp", "Set", "WeakMap", "WeakSet"]; | ||
@@ -10,3 +10,3 @@ declare const primitiveTypes: readonly ["bigint", "boolean", "null", "number", "string", "symbol", "undefined"]; | ||
declare namespace is { | ||
export var array: <T>(arg: {} | T) => arg is T extends readonly any[] ? unknown extends T ? never : readonly any[] : any[]; | ||
export var array: (arg: any) => arg is any[]; | ||
export var arrayOf: (target: unknown[], predicate: (v: unknown) => boolean) => boolean; | ||
@@ -36,13 +36,13 @@ export var asyncGeneratorFunction: (value: unknown) => value is (...args: any[]) => Promise<unknown>; | ||
export var plainFunction: (value: unknown) => value is Function; | ||
export var plainObject: (value: unknown) => value is Record<string | number | symbol, unknown>; | ||
export var plainObject: (value: unknown) => value is PlainObject; | ||
export var primitive: (value: unknown) => value is Primitive; | ||
export var promise: (value: unknown) => value is Promise<unknown>; | ||
export var propertyOf: (target: Record<string | number | symbol, unknown>, key: string, predicate?: ((v: unknown) => boolean) | undefined) => boolean; | ||
export var propertyOf: (target: PlainObject, key: string, predicate?: ((v: unknown) => boolean) | undefined) => boolean; | ||
export var regexp: (value: unknown) => value is RegExp; | ||
export var set: (value: unknown) => value is Set<Record<string | number | symbol, unknown>>; | ||
export var set: (value: unknown) => value is Set<PlainObject>; | ||
export var string: (value: unknown) => value is string; | ||
export var symbol: (value: unknown) => value is symbol; | ||
export var undefined: (value: unknown) => value is undefined; | ||
export var weakMap: (value: unknown) => value is WeakMap<Record<string | number | symbol, unknown>, unknown>; | ||
export var weakSet: (value: unknown) => value is WeakSet<Record<string | number | symbol, unknown>>; | ||
export var weakMap: (value: unknown) => value is WeakMap<PlainObject, unknown>; | ||
export var weakSet: (value: unknown) => value is WeakSet<PlainObject>; | ||
export { _a as function, _b as null }; | ||
@@ -49,0 +49,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { Class, Primitive } from './types'; | ||
import { Class, PlainObject, Primitive } from './types'; | ||
declare const objectTypes: readonly ["Array", "ArrayBuffer", "AsyncFunction", "AsyncGenerator", "AsyncGeneratorFunction", "Date", "Error", "Function", "Generator", "GeneratorFunction", "HTMLElement", "Map", "Object", "Promise", "RegExp", "Set", "WeakMap", "WeakSet"]; | ||
@@ -10,3 +10,3 @@ declare const primitiveTypes: readonly ["bigint", "boolean", "null", "number", "string", "symbol", "undefined"]; | ||
declare namespace is { | ||
export var array: <T>(arg: {} | T) => arg is T extends readonly any[] ? unknown extends T ? never : readonly any[] : any[]; | ||
export var array: (arg: any) => arg is any[]; | ||
export var arrayOf: (target: unknown[], predicate: (v: unknown) => boolean) => boolean; | ||
@@ -36,13 +36,13 @@ export var asyncGeneratorFunction: (value: unknown) => value is (...args: any[]) => Promise<unknown>; | ||
export var plainFunction: (value: unknown) => value is Function; | ||
export var plainObject: (value: unknown) => value is Record<string | number | symbol, unknown>; | ||
export var plainObject: (value: unknown) => value is PlainObject; | ||
export var primitive: (value: unknown) => value is Primitive; | ||
export var promise: (value: unknown) => value is Promise<unknown>; | ||
export var propertyOf: (target: Record<string | number | symbol, unknown>, key: string, predicate?: ((v: unknown) => boolean) | undefined) => boolean; | ||
export var propertyOf: (target: PlainObject, key: string, predicate?: ((v: unknown) => boolean) | undefined) => boolean; | ||
export var regexp: (value: unknown) => value is RegExp; | ||
export var set: (value: unknown) => value is Set<Record<string | number | symbol, unknown>>; | ||
export var set: (value: unknown) => value is Set<PlainObject>; | ||
export var string: (value: unknown) => value is string; | ||
export var symbol: (value: unknown) => value is symbol; | ||
export var undefined: (value: unknown) => value is undefined; | ||
export var weakMap: (value: unknown) => value is WeakMap<Record<string | number | symbol, unknown>, unknown>; | ||
export var weakSet: (value: unknown) => value is WeakSet<Record<string | number | symbol, unknown>>; | ||
export var weakMap: (value: unknown) => value is WeakMap<PlainObject, unknown>; | ||
export var weakSet: (value: unknown) => value is WeakSet<PlainObject>; | ||
export { _a as function, _b as null }; | ||
@@ -49,0 +49,0 @@ } |
{ | ||
"name": "is-lite", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "A tiny javascript type testing tool", | ||
@@ -34,25 +34,20 @@ "author": "Gil Barbara <gilbarbara@gmail.com>", | ||
"sideEffects": false, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@gilbarbara/eslint-config": "^0.1.4", | ||
"@gilbarbara/prettier-config": "^0.1.0", | ||
"@gilbarbara/tsconfig": "^0.1.0", | ||
"@size-limit/preset-small-lib": "^4.9.1", | ||
"@types/jest": "^26.0.16", | ||
"@types/node": "^14.14.10", | ||
"@typescript-eslint/eslint-plugin": "^4.9.1", | ||
"@typescript-eslint/parser": "^4.9.1", | ||
"eslint": "^7.15.0", | ||
"eslint-config-airbnb-base": "^14.2.1", | ||
"eslint-config-prettier": "^7.0.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsx-a11y": "^6.4.1", | ||
"eslint-plugin-prettier": "^3.2.0", | ||
"husky": "^4.3.5", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.2.1", | ||
"repo-tools": "^0.2.0", | ||
"@size-limit/preset-small-lib": "^5.0.1", | ||
"@types/jest": "^26.0.24", | ||
"@types/node": "^16.0.1", | ||
"@typescript-eslint/eslint-plugin": "^4.28.2", | ||
"@typescript-eslint/parser": "^4.28.2", | ||
"husky": "^4.3.8", | ||
"jest": "^27.0.6", | ||
"prettier": "^2.3.2", | ||
"repo-tools": "^0.2.2", | ||
"rimraf": "^3.0.2", | ||
"size-limit": "^4.9.1", | ||
"ts-jest": "^26.4.4", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.1.2" | ||
"size-limit": "^5.0.1", | ||
"ts-jest": "^27.0.3", | ||
"ts-node": "^10.0.0", | ||
"typescript": "^4.3.5" | ||
}, | ||
@@ -75,9 +70,8 @@ "scripts": { | ||
}, | ||
"prettier": { | ||
"arrowParens": "avoid", | ||
"printWidth": 100, | ||
"proseWrap": "never", | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
"eslintConfig": { | ||
"extends": [ | ||
"@gilbarbara/eslint-config" | ||
] | ||
}, | ||
"prettier": "@gilbarbara/prettier-config", | ||
"size-limit": [ | ||
@@ -84,0 +78,0 @@ { |
# is-lite | ||
[](https://www.npmjs.com/package/is-lite) [](https://travis-ci.org/gilbarbara/is-lite) [](https://bundlephobia.com/result?p=is-lite) [](https://codeclimate.com/github/gilbarbara/is-lite/maintainability) [](https://codeclimate.com/github/gilbarbara/is-lite/test_coverage) | ||
[](https://www.npmjs.com/package/is-lite) [](https://travis-ci.com/gilbarbara/is-lite) [](https://bundlephobia.com/result?p=is-lite) [](https://codeclimate.com/github/gilbarbara/is-lite/maintainability) [](https://codeclimate.com/github/gilbarbara/is-lite/test_coverage) | ||
@@ -51,2 +51,3 @@ > Lightweight type check tool. | ||
``` | ||
**is.asyncGeneratorFunction(value)** | ||
@@ -63,3 +64,3 @@ | ||
**is.domElement(value) ** | ||
**is.domElement(value)** | ||
Check if `value` is a DOM Element. | ||
@@ -80,3 +81,3 @@ | ||
**is.generator(value) ** | ||
**is.generator(value)** | ||
Check for an object that has its own .next() and .throw() methods and has a function definition for `Symbol.iterator` | ||
@@ -94,4 +95,4 @@ | ||
is.instanceOf(error, APIError); // true | ||
is.instanceOf(error, Error); // false | ||
is.instanceOf(error, APIError); // true | ||
is.instanceOf(error, Error); // false | ||
``` | ||
@@ -173,3 +174,3 @@ | ||
## Contributing | ||
## Contributing | ||
@@ -183,3 +184,3 @@ Contributions, issues and feature requests are welcome! | ||
## License | ||
## License | ||
@@ -191,5 +192,4 @@ Copyright © 2019 [Gil Barbara <gilbarbara@gmail.com>](https://github.com/gilbarbara). | ||
[@sindresorhus/is](https://github.com/sindresorhus/is) is amazing but I needed something even smaller (and simpler). | ||
This package cover the basics and is less than 1k minified+gzipped. | ||
[@sindresorhus/is](https://github.com/sindresorhus/is) is amazing but I needed something even smaller (and simpler). This package cover the basics and is just 1k minified+gzipped. | ||
If you need to support legacy browsers, the **Number.isNaN** polyfill is required. | ||
If you need to support legacy browsers, the **Number.isNaN** polyfill is required. |
@@ -109,2 +109,3 @@ import { Class, PlainObject, Primitive } from './types'; | ||
const tagType = getObjectType(value); | ||
/* istanbul ignore else */ | ||
@@ -111,0 +112,0 @@ if (tagType) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17
189
0
48307