Add is.class() (#2)
This commit is contained in:
parent
103c5afe6f
commit
119c41d39b
3 changed files with 19 additions and 1 deletions
4
index.js
4
index.js
|
|
@ -130,11 +130,13 @@ is.plainObject = x => {
|
|||
// eslint-disable-next-line no-return-assign
|
||||
return getObjectType(x) === 'Object' &&
|
||||
(prototype = Object.getPrototypeOf(x), prototype === null ||
|
||||
prototype === Object.getPrototypeOf({}));
|
||||
prototype === Object.getPrototypeOf({}));
|
||||
};
|
||||
|
||||
is.iterable = x => !is.null(x) && !is.undefined(x) && typeof x[Symbol.iterator] === 'function';
|
||||
|
||||
is.class = x => typeof x === 'function' && x.toString().startsWith('class ');
|
||||
|
||||
const typedArrayTypes = new Set([
|
||||
'Int8Array',
|
||||
'Uint8Array',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue