You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
590 B
24 lines
590 B
// cheap lodash replacements
|
|
export function isFunction(input) {
|
|
return typeof input === 'function';
|
|
}
|
|
export function noop() {
|
|
// noop
|
|
}
|
|
function isObjectLike(input) {
|
|
return typeof input === 'object' && input !== null;
|
|
}
|
|
export function isPlainObject(input) {
|
|
if (!isObjectLike(input)) {
|
|
return false;
|
|
}
|
|
if (Object.getPrototypeOf(input) === null) {
|
|
return true;
|
|
}
|
|
let proto = input;
|
|
while (Object.getPrototypeOf(proto) !== null) {
|
|
proto = Object.getPrototypeOf(proto);
|
|
}
|
|
return Object.getPrototypeOf(input) === proto;
|
|
}
|