yamlify-object
Version:
Stringify object/array with yaml syntax
23 lines • 563 B
JavaScript
export function typeOf(value) {
if (Array.isArray(value)) {
return 'array';
}
if (value instanceof Date) {
return 'date';
}
if (value instanceof Error) {
return 'error';
}
if (value instanceof RegExp) {
return 'regexp';
}
if (value === null) {
return 'null';
}
if (typeof value === 'object'
&& Object.prototype.toString.call(value) === '[object Object]') {
return 'object';
}
return typeof value;
}
//# sourceMappingURL=typeOf.js.map