expresser
Version:
A ready to use Node.js web app wrapper, built on top of Express.
29 lines (28 loc) • 990 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isString = exports.isFunction = exports.isArray = exports.isObject = exports.getTag = void 0;
const getTag = (value) => {
const toString = Object.prototype.toString;
if (value == null) {
return value === undefined ? "[object Undefined]" : "[object Null]";
}
return toString.call(value);
};
exports.getTag = getTag;
const isObject = (value) => {
return typeof value === "object" && value !== null;
};
exports.isObject = isObject;
const isArray = (value) => {
return value && Array.isArray(value);
};
exports.isArray = isArray;
const isFunction = (value) => {
return typeof value === "function";
};
exports.isFunction = isFunction;
const isString = (value) => {
const type = typeof value;
return type === "string" || (type === "object" && value != null && !Array.isArray(value) && (0, exports.getTag)(value) == "[object String]");
};
exports.isString = isString;