mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-11 12:55:07 +00:00
25 lines
492 B
JavaScript
25 lines
492 B
JavaScript
'use strict';
|
|
|
|
['Function', 'String', 'Number', 'Date', 'RegExp'].forEach(function(name) {
|
|
exports['is' + name] = function(obj) {
|
|
return toString.call(obj) == '[object ' + name + ']';
|
|
};
|
|
});
|
|
|
|
exports.isObject = function(obj) {
|
|
return obj === Object(obj);
|
|
};
|
|
|
|
exports.noop = function() {};
|
|
|
|
exports.slice = Array.prototype.slice;
|
|
|
|
exports.once = function(func) {
|
|
var isCalled = false;
|
|
return function() {
|
|
if (isCalled) return;
|
|
func.apply(this, arguments);
|
|
isCalled = true;
|
|
};
|
|
};
|