Rebase branch
This commit is contained in:
parent
19c5359b28
commit
e50162b58e
2 changed files with 1 additions and 14 deletions
|
|
@ -48,8 +48,7 @@ export const enum TypeName {
|
||||||
ArrayBuffer = 'ArrayBuffer',
|
ArrayBuffer = 'ArrayBuffer',
|
||||||
SharedArrayBuffer = 'SharedArrayBuffer',
|
SharedArrayBuffer = 'SharedArrayBuffer',
|
||||||
DataView = 'DataView',
|
DataView = 'DataView',
|
||||||
Promise = 'Promise',
|
Promise = 'Promise'
|
||||||
URL = 'URL'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const toString = Object.prototype.toString;
|
const toString = Object.prototype.toString;
|
||||||
|
|
@ -178,7 +177,6 @@ namespace is { // tslint:disable-line:no-namespace
|
||||||
export const dataView = isObjectOfType<DataView>(TypeName.DataView);
|
export const dataView = isObjectOfType<DataView>(TypeName.DataView);
|
||||||
|
|
||||||
export const directInstanceOf = <T>(instance: any, klass: Class<T>): instance is T => Object.getPrototypeOf(instance) === klass.prototype;
|
export const directInstanceOf = <T>(instance: any, klass: Class<T>): instance is T => Object.getPrototypeOf(instance) === klass.prototype;
|
||||||
export const urlInstance = (value: any): value is URL => isObjectOfType<URL>(TypeName.URL)(value);
|
|
||||||
|
|
||||||
export const truthy = (value: any) => Boolean(value);
|
export const truthy = (value: any) => Boolean(value);
|
||||||
export const falsy = (value: any) => !value;
|
export const falsy = (value: any) => !value;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import net from 'net';
|
||||||
import Stream from 'stream';
|
import Stream from 'stream';
|
||||||
import util from 'util';
|
import util from 'util';
|
||||||
import tempy from 'tempy';
|
import tempy from 'tempy';
|
||||||
import {URL} from 'url';
|
|
||||||
import test, {TestContext, Context} from 'ava';
|
import test, {TestContext, Context} from 'ava';
|
||||||
import {JSDOM} from 'jsdom';
|
import {JSDOM} from 'jsdom';
|
||||||
import {Subject, Observable} from 'rxjs';
|
import {Subject, Observable} from 'rxjs';
|
||||||
|
|
@ -535,16 +534,6 @@ test('is.directInstanceOf', t => {
|
||||||
t.false(m.directInstanceOf(errorSubclass, Error));
|
t.false(m.directInstanceOf(errorSubclass, Error));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('is.urlInstance', t => {
|
|
||||||
const url = new URL('https://google.com');
|
|
||||||
|
|
||||||
t.true(m.urlInstance(url));
|
|
||||||
|
|
||||||
t.false(m.urlInstance({}));
|
|
||||||
t.false(m.urlInstance(undefined));
|
|
||||||
t.false(m.urlInstance(null));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('is.truthy', t => {
|
test('is.truthy', t => {
|
||||||
t.true(m.truthy('unicorn'));
|
t.true(m.truthy('unicorn'));
|
||||||
t.true(m.truthy('🦄'));
|
t.true(m.truthy('🦄'));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue