bootstrap-vue
Version:
With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extens
23 lines (14 loc) • 694 B
JavaScript
import { isFunction } from './inspect'
// --- Static ---
export const from = (...args) => Array.from(...args)
// --- Instance ---
export const arrayIncludes = (array, value) => array.indexOf(value) !== -1
export const concat = (...args) => Array.prototype.concat.apply([], args)
// --- Utilities ---
export const createArray = (length, fillFn) => {
const mapFn = isFunction(fillFn) ? fillFn : () => fillFn
return Array.apply(null, { length }).map(mapFn)
}
export const flatten = array => array.reduce((result, item) => concat(result, item), [])
export const flattenDeep = array =>
array.reduce((result, item) => concat(result, Array.isArray(item) ? flattenDeep(item) : item), [])