Don't import util
We don't really need its full power. Not worth the bloat.
This commit is contained in:
parent
6e07df5896
commit
45c976071a
4 changed files with 6 additions and 7 deletions
3
.gitattributes
vendored
3
.gitattributes
vendored
|
|
@ -1,2 +1 @@
|
||||||
* text=auto
|
* text=auto eol=lf
|
||||||
*.js text eol=lf
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
|
- '10'
|
||||||
- '8'
|
- '8'
|
||||||
- '6'
|
- '6'
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
/// <reference lib="es2017.sharedmemory"/>
|
/// <reference lib="es2017.sharedmemory"/>
|
||||||
/// <reference lib="esnext.asynciterable"/>
|
/// <reference lib="esnext.asynciterable"/>
|
||||||
/// <reference lib="dom"/>
|
/// <reference lib="dom"/>
|
||||||
import util from 'util';
|
|
||||||
import symbolObservable from 'symbol-observable';
|
import symbolObservable from 'symbol-observable';
|
||||||
|
|
||||||
type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
||||||
|
|
@ -245,7 +244,7 @@ namespace is { // tslint:disable-line:no-namespace
|
||||||
return value >= Math.min(...range) && value <= Math.max(...range);
|
return value >= Math.min(...range) && value <= Math.max(...range);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new TypeError(`Invalid range: ${util.inspect(range)}`);
|
throw new TypeError(`Invalid range: ${JSON.stringify(range)}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const NODE_TYPE_ELEMENT = 1;
|
const NODE_TYPE_ELEMENT = 1;
|
||||||
|
|
@ -290,7 +289,7 @@ namespace is { // tslint:disable-line:no-namespace
|
||||||
type ArrayMethod = (fn: (value: any, index: number, array: any[]) => boolean, thisArg?: any) => boolean;
|
type ArrayMethod = (fn: (value: any, index: number, array: any[]) => boolean, thisArg?: any) => boolean;
|
||||||
const predicateOnArray = (method: ArrayMethod, predicate: any, values: any[]) => {
|
const predicateOnArray = (method: ArrayMethod, predicate: any, values: any[]) => {
|
||||||
if (function_(predicate) === false) {
|
if (function_(predicate) === false) {
|
||||||
throw new TypeError(`Invalid predicate: ${util.inspect(predicate)}`);
|
throw new TypeError(`Invalid predicate: ${JSON.stringify(predicate)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (values.length === 0) {
|
if (values.length === 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue