utils.js
let types = [
"Number",
"String",
"Undefined",
"Null",
"Boolean",
"Array",
"Object",
];
let utils = {};
for (let i = 0; i < types.length; i++) {
const type = types[i];
utils[`is${type}`] = isType(type);
}
function isType(type) {
return (content) => {
return Object.prototype.toString.call(content) == `[object ${type}]`;
};
}