@sindresorhus/is
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -50,3 +50,4 @@ /// <reference types="node" /> | ||
DataView = "DataView", | ||
Promise = "Promise" | ||
Promise = "Promise", | ||
URL = "URL" | ||
} | ||
@@ -68,2 +69,3 @@ declare function is(value: any): TypeName; | ||
const iterable: (value: any) => value is IterableIterator<any>; | ||
const asyncIterable: (value: any) => value is AsyncIterableIterator<any>; | ||
const generator: (value: any) => value is Generator; | ||
@@ -95,2 +97,3 @@ const nativePromise: (value: any) => value is Promise<any>; | ||
const directInstanceOf: <T>(instance: any, klass: Class<T>) => instance is T; | ||
const urlInstance: (value: any) => value is URL; | ||
const truthy: (value: any) => boolean; | ||
@@ -97,0 +100,0 @@ const falsy: (value: any) => boolean; |
@@ -76,2 +76,3 @@ "use strict"; | ||
is.iterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.iterator]); | ||
is.asyncIterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.asyncIterator]); | ||
is.generator = (value) => is.iterable(value) && is.function_(value.next) && is.function_(value.throw); | ||
@@ -107,2 +108,3 @@ is.nativePromise = (value) => isObjectOfType("Promise" /* Promise */)(value); | ||
is.directInstanceOf = (instance, klass) => Object.getPrototypeOf(instance) === klass.prototype; | ||
is.urlInstance = (value) => isObjectOfType("URL" /* URL */)(value); | ||
is.truthy = (value) => Boolean(value); | ||
@@ -109,0 +111,0 @@ is.falsy = (value) => !value; |
{ | ||
"name": "@sindresorhus/is", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"description": "Type check values: `is.string('🦄') //=> true`", | ||
@@ -20,3 +20,3 @@ "license": "MIT", | ||
"test": "npm run lint && npm run build && ava dist/tests", | ||
"prepublish": "npm run build" | ||
"prepublish": "npm run build && del dist/tests" | ||
}, | ||
@@ -23,0 +23,0 @@ "files": [ |
@@ -179,2 +179,13 @@ # is [![Build Status](https://travis-ci.org/sindresorhus/is.svg?branch=master)](https://travis-ci.org/sindresorhus/is) | ||
##### .urlInstance(value) | ||
Returns `true` if `value` is an instance of the [`URL` class](https://developer.mozilla.org/en-US/docs/Web/API/URL). | ||
```js | ||
const url = new URL('https://example.com'); | ||
is.urlInstance(url); | ||
//=> true | ||
``` | ||
##### .truthy(value) | ||
@@ -213,2 +224,3 @@ | ||
##### .iterable(value) | ||
##### .asyncIterable(value) | ||
##### .class(value) | ||
@@ -215,0 +227,0 @@ |
Sorry, the diff of this file is not supported yet
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
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
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
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
373
1
1
34554
6
326