UNPKG

glad

Version:

A robust Node Js API framework.

32 lines (26 loc) 584 B
/** * @module type * * The type module is useful when it comes to testing the type of something. */ module.exports = { array : typeof [], object: typeof {}, function : typeof Function, number : typeof 1, boolean : typeof true, symbol : typeof Symbol(), string : typeof '', isObject (val) { return (val !== undefined) && val.constructor === Object; }, isNotObject (val) { return !this.isObject(val); }, isArray (val) { return (val !== undefined) && val.constructor === Array; }, isNotArray (val) { return !this.isArray(val); } };