@gitlab/ui
Version:
GitLab UI Components
29 lines (21 loc) • 667 B
JavaScript
import { isFunction } from './inspect';
// --- Static ---
const from = function () {
return Array.from(...arguments);
};
// --- Instance ---
const arrayIncludes = (array, value) => array.indexOf(value) !== -1;
const concat = function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return Array.prototype.concat.apply([], args);
};
// --- Utilities ---
const createArray = (length, fillFn) => {
const mapFn = isFunction(fillFn) ? fillFn : () => fillFn;
return Array.apply(null, {
length
}).map(mapFn);
};
export { arrayIncludes, concat, createArray, from };