Add is.directInstanceOf() (#38)
This commit is contained in:
parent
4ce2ee9d39
commit
70b08940be
3 changed files with 29 additions and 0 deletions
|
|
@ -162,6 +162,10 @@ namespace is { // tslint:disable-line:no-namespace
|
|||
export const arrayBuffer = isObjectOfType(TypeName.ArrayBuffer);
|
||||
export const sharedArrayBuffer = isObjectOfType(TypeName.SharedArrayBuffer);
|
||||
|
||||
// TODO: Remove `object` checks when targeting ES2015 or higher
|
||||
// See `Notes`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf
|
||||
export const directInstanceOf = (instance: any, klass: any) => object(instance) && object(klass) && Object.getPrototypeOf(instance) === klass.prototype;
|
||||
|
||||
export const truthy = (value: any) => Boolean(value);
|
||||
export const falsy = (value: any) => !value;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue