lg_frontend/utils/checkTypes.js

9 lines
286 B
JavaScript
Raw Permalink Normal View History

2024-02-19 16:02:13 +00:00
const checkTypes = {};
['Array', 'Object', 'String', 'Number', 'Boolean', 'Null', 'Undefined', 'RegExp', 'Function'].forEach(type => {
checkTypes[`is${type}`] = function (data) {
return Object.prototype.toString.call(data) === `[object ${type}]`
}
})
export default checkTypes