Travis build: 1947

This commit is contained in:
30secondsofcode
2018-04-12 05:36:08 +00:00
parent c6713c8466
commit 35b997fe61
2 changed files with 10 additions and 10 deletions

View File

@ -7551,12 +7551,12 @@ getType(new Set([1, 2, 3])); // 'set'
### is
Checks if the provided value is of the specified type (doesn't work with literals).
Checks if the provided value is of the specified type.
Use the `instanceof` operator to check if the provided value is of the specified `type`.
Ensure the value is not `undefined` or `null` using `Array.includes()`, and compare the `constructor` property on the value with `type` to check if the provided value is of the specified `type`.
```js
const is = (type, val) => val instanceof type;
const is = (type, val) => ![, null].includes(val) && val.constructor === type;
```
<details>
@ -7570,11 +7570,11 @@ is(RegExp, /./g); // true
is(Set, new Set()); // true
is(WeakMap, new WeakMap()); // true
is(WeakSet, new WeakSet()); // true
is(String, ''); // false
is(String, ''); // true
is(String, new String('')); // true
is(Number, 1); // false
is(Number, 1); // true
is(Number, new Number(1)); // true
is(Boolean, true); // false
is(Boolean, true); // true
is(Boolean, new Boolean(true)); // true
```

File diff suppressed because one or more lines are too long