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.
 
 
 
 
StackGenVis/frontend/node_modules/engine/node_modules/get-value/index.js

58 lines
1.1 KiB

/*!
* get-value <https://github.com/jonschlinkert/get-value>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
var utils = require('./utils');
module.exports = function getValue(obj, prop, fn) {
if (!utils.isObject(obj)) return {};
if (Array.isArray(prop)) {
prop = utils.flatten(prop).join('.');
}
if (typeof prop !== 'string') return obj;
var path;
if (fn && typeof fn === 'function') {
path = fn(prop);
} else if (fn === true) {
path = escapePath(prop);
} else {
path = prop.split(/[[.\]]/).filter(Boolean);
}
var len = path.length, i = -1;
var last = null;
while(++i < len) {
var key = path[i];
last = obj[key];
if (!last) { return last; }
if (utils.isObject(obj)) {
obj = last;
}
}
return last;
};
function escape(str) {
return str.split('\\.').join(utils.nonchars[0]);
}
function unescape(str) {
return str.split(utils.nonchars[0]).join('.');
}
function escapePath(str) {
return escape(str).split('.').map(function (seg) {
return unescape(seg);
});
}