UNPKG

bootstrap-vue

Version:

BootstrapVue provides one of the most comprehensive implementations of Bootstrap 4 components and grid system for Vue.js and with extensive and automated WAI-ARIA accessibility markup.

19 lines (17 loc) 635 B
import { keys } from './object' import { isArray } from './array' import identity from './identity' /** * Given an array of properties or an object of property keys, * plucks all the values off the target object. * @param {{}|string[]} keysToPluck * @param {{}} objToPluck * @param {Function} transformFn * @return {{}} */ export default function pluckProps (keysToPluck, objToPluck, transformFn = identity) { return (isArray(keysToPluck) ? keysToPluck.slice() : keys(keysToPluck)).reduce((memo, prop) => { // eslint-disable-next-line no-sequences return (memo[transformFn(prop)] = objToPluck[prop]), memo }, {}) }