StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
792 B
23 lines
792 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 {{}}
|
|
*/
|
|
|
|
var pluckProps = function pluckProps(keysToPluck, objToPluck) {
|
|
var transformFn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : identity;
|
|
return (isArray(keysToPluck) ? keysToPluck.slice() : keys(keysToPluck)).reduce(function (memo, prop) {
|
|
memo[transformFn(prop)] = objToPluck[prop];
|
|
return memo;
|
|
}, {});
|
|
};
|
|
|
|
export default pluckProps; |