react-admin-component
Version:
react library
44 lines • 1.56 kB
JavaScript
function intersectionArr(arr1, arr2) {
var _temp = [];
arr1.forEach(function (v1) {
if (arr2.indexOf(v1) !== -1)
_temp.push(v1);
});
return _temp;
}
export var includePermit = function (permits, require, every) {
if (!require || require.length < 1)
return true;
var _intersection = intersectionArr(require, permits);
return every ? _intersection.length === require.length : _intersection.length > 0;
};
var PrototypeCheck = (function () {
function PrototypeCheck() {
}
PrototypeCheck.getPrototype = function (value) {
return Object.prototype.toString.call(value);
};
PrototypeCheck.checkProtoType = function (value, prototype) {
return this.getPrototype(value) === prototype;
};
PrototypeCheck.isString = function (value) {
return this.checkProtoType(value, '[object String]');
};
PrototypeCheck.isNumber = function (value) {
return this.checkProtoType(value, '[object Number]');
};
PrototypeCheck.isArray = function (value) {
return this.checkProtoType(value, '[object Array]');
};
PrototypeCheck.isFunction = function (value) {
return this.checkProtoType(value, '[object Function]');
};
return PrototypeCheck;
}());
export { PrototypeCheck };
export function uuid(a) {
return a
? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)
: ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid);
}
//# sourceMappingURL=index.js.map