mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-24 18:10:11 +00:00
16 lines
544 B
TypeScript
16 lines
544 B
TypeScript
/**
|
|
* Checks if a type is an object
|
|
* @param {any} candidate the entity to check
|
|
*/
|
|
const isObject = (candidate: any): candidate is object =>
|
|
candidate && Object.prototype.toString.call(candidate) === '[object Object]';
|
|
|
|
/**
|
|
* Checks that an object has it own enumerable props
|
|
* @param {Object} object the object to the be tested
|
|
* @return {boolean} true if enumerable keys are present
|
|
*/
|
|
const hasEnumerableKeys = (object: object): boolean => isObject(object) && !!Object.keys(object).length;
|
|
|
|
export { isObject, hasEnumerableKeys };
|