UNPKG

bootstrap-vue

Version:

BootstrapVue, with over 40 plugins and more than 80 custom components, custom directives, and over 300 icons, provides one of the most comprehensive implementations of Bootstrap v4 components and grid system for Vue.js. With extensive and automated WAI-AR

22 lines (19 loc) 680 B
import identity from './identity' import { isArray } from './inspect' import { keys } from './object' /** * Given an array of properties or an object of property keys, * plucks all the values off the target object, returning a new object * that has props that reference the original prop values * * @param {{}|string[]} keysToPluck * @param {{}} objToPluck * @param {Function} transformFn * @return {{}} */ const pluckProps = (keysToPluck, objToPluck, transformFn = identity) => (isArray(keysToPluck) ? keysToPluck.slice() : keys(keysToPluck)).reduce((memo, prop) => { memo[transformFn(prop)] = objToPluck[prop] return memo }, {}) export default pluckProps