@sindresorhus/is
Advanced tools
Comparing version 1.0.0 to 1.1.0
/// <reference types="node" /> | ||
/// <reference lib="esnext" /> | ||
/// <reference lib="dom" /> | ||
interface URLSearchParams { | ||
append(name: string, value: string): void; | ||
delete(name: string): void; | ||
get(name: string): string | null; | ||
getAll(name: string): string[]; | ||
has(name: string): boolean; | ||
set(name: string, value: string): void; | ||
sort(): void; | ||
forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void; | ||
} | ||
declare var URLSearchParams: { | ||
prototype: URLSearchParams; | ||
new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams; | ||
}; | ||
interface URL { | ||
hash: string; | ||
host: string; | ||
hostname: string; | ||
href: string; | ||
readonly origin: string; | ||
password: string; | ||
pathname: string; | ||
port: string; | ||
protocol: string; | ||
search: string; | ||
readonly searchParams: URLSearchParams; | ||
username: string; | ||
toJSON(): string; | ||
} | ||
declare var URL: { | ||
prototype: URL; | ||
new (url: string, base?: string | URL): URL; | ||
createObjectURL(object: any): string; | ||
revokeObjectURL(url: string): void; | ||
}; | ||
export declare type Class<T = unknown> = new (...args: any[]) => T; | ||
@@ -63,3 +97,3 @@ export declare const enum TypeName { | ||
var asyncIterable: (value: unknown) => value is AsyncIterableIterator<unknown>; | ||
var generator: (value: unknown) => value is Generator; | ||
var generator: (value: unknown) => value is Generator<unknown, any, unknown>; | ||
var nativePromise: (value: unknown) => value is Promise<unknown>; | ||
@@ -66,0 +100,0 @@ var promise: (value: unknown) => value is Promise<unknown>; |
"use strict"; | ||
/// <reference lib="esnext"/> | ||
/// <reference lib="dom"/> | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* ---- */ | ||
// TODO: Use the `URL` global when targeting Node.js 10 | ||
@@ -60,3 +60,2 @@ const URLGlobal = typeof URL === 'undefined' ? require('url').URL : URL; | ||
} | ||
const isObject = (value) => typeof value === 'object'; | ||
is.undefined = isOfType('undefined'); | ||
@@ -77,3 +76,3 @@ is.string = isOfType('string'); | ||
is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value); | ||
is.object = (value) => !is.nullOrUndefined(value) && (is.function_(value) || isObject(value)); | ||
is.object = (value) => !is.null_(value) && (typeof value === 'object' || is.function_(value)); | ||
is.iterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.iterator]); | ||
@@ -83,4 +82,3 @@ is.asyncIterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.asyncIterator]); | ||
is.nativePromise = (value) => isObjectOfType("Promise" /* Promise */)(value); | ||
const hasPromiseAPI = (value) => !is.null_(value) && | ||
isObject(value) && | ||
const hasPromiseAPI = (value) => is.object(value) && | ||
is.function_(value.then) && // eslint-disable-line promise/prefer-await-to-then | ||
@@ -208,3 +206,3 @@ is.function_(value.catch); | ||
}; | ||
is.nodeStream = (value) => !is.nullOrUndefined(value) && isObject(value) && is.function_(value.pipe) && !is.observable(value); | ||
is.nodeStream = (value) => is.object(value) && is.function_(value.pipe) && !is.observable(value); | ||
is.infinite = (value) => value === Infinity || value === -Infinity; | ||
@@ -211,0 +209,0 @@ const isAbsoluteMod2 = (remainder) => (value) => is.integer(value) && Math.abs(value % 2) === remainder; |
{ | ||
"name": "@sindresorhus/is", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Type check values", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -466,1 +466,14 @@ # is [![Build Status](https://travis-ci.org/sindresorhus/is.svg?branch=master)](https://travis-ci.org/sindresorhus/is) | ||
- [Brandon Smith](https://github.com/brandon93s) | ||
--- | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm--sindresorhus-is?utm_source=npm--sindresorhus-is&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
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
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
44394
427
479