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/set-value/index.js

57 lines
1.1 KiB

/*!
* set-value <https://github.com/jonschlinkert/set-value>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
var isObject = require('isobject');
var nc = require('noncharacters');
module.exports = function setValue(obj, path, val) {
if (path == null) {
return obj;
}
path = escape(path);
var seg = (/^(.+)\.(.+)$/).exec(path);
if (seg !== null) {
create(obj, seg[1], seg[2], val);
return obj;
}
obj[unescape(path)] = val;
return obj;
};
function create(obj, path, child, val) {
if (!path) return obj;
var arr = path.split('.');
var len = arr.length, i = 0;
while (len--) {
var key = unescape(arr[i++]);
if (!obj[key] || !isObject(obj[key])) {
obj[key] = {};
}
obj = obj[key];
}
if (typeof child === 'string') {
child = unescape(child);
}
return (obj[child] = val);
}
/**
* Escape => `\\.`
*/
function escape(str) {
return str.split('\\.').join(nc[1]);
}
/**
* Unescaped dots
*/
function unescape(str) {
return str.split(nc[1]).join('.');
}