Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function inPath(basePath, childPath) {
if (basePath === childPath) return true
var partsA = prop.split(basePath) || []
, partsB = prop.split(childPath) || []
if (partsA.length > partsB.length)
return false
return partsA.every(
(part, idx) => clean(part) === clean(partsB[idx]))
}
module.exports = function update(model, path, value) {
var parts = prop.split(path)
, newModel = copy(model)
, part, islast;
if ( newModel === undefined )
newModel = IS_ARRAY.test(parts[0]) ? [] : {}
var current = newModel
for (var idx = 0; idx < parts.length; idx++) {
islast = idx === (parts.length - 1)
part = paths.clean(parts[idx])
if ( islast )
current[part] = value
else {
fields[key]._deps && fields[key]._deps.forEach(function (node) {
//eslint-disable-line no-loop-func
node = split(node)[0];
if (! ~nodes.indexOf(node)) nodes.push(node);
if (! ~excludes.indexOf('' + key + '-' + node)) edges.push([key, node]);
});
}
export default function update(model, path, value) {
var parts = prop.split(path)
, newModel = copy(model)
, part, islast;
if (newModel == null)
newModel = IS_ARRAY.test(parts[0]) ? [] : {}
var current = newModel
for (var idx = 0; idx < parts.length; idx++) {
islast = idx === (parts.length - 1)
part = clean(parts[idx])
if (islast)
current[part] = value
else {
function addNode(depPath, key) {
var node = split(depPath)[0];
if (!~nodes.indexOf(node)) nodes.push(node);
if (!~excludes.indexOf(`${key}-${node}`)) edges.push([key, node]);
}
export function inPath(basePath, childPath) {
if (basePath === childPath) return true
var partsA = prop.split(basePath) || []
, partsB = prop.split(childPath) || []
if (partsA.length > partsB.length)
return false
return partsA.every(
(part, idx) => clean(part) === clean(partsB[idx]))
}