mutate opts obj by normalizing Key values into form [ { path:x },... ] qualify relative paths against basedir
11511
function normalizeOpts(obj, basedir, pkg) {
    obj = obj || {};

    u.each(OPTSKEYS, function(key) {
      obj[key] = normalizeOptsKey(obj[key], basedir, pkg);
    });

    normalizeFqImages(obj);

    return obj;
  }
134900
function mutateJsonFile(targetPath, source, mutator) {
  if (!mutator) {
    mutator = source;
    source = null;
  }
  let sourceConfig = source;
  try {
    // console.log('targetPath', targetPath);

    let targetConfig = readJson(targetPath);

    // console.log('source', source);
    if (typeof source === 'string') {
      sourceConfig = readJson(source);
    }
    // console.log('sourceConfig', targetPath, sourceConfig)
    sourceConfig = sourceConfig ? sourceConfig : targetConfig;

    let newConfig = mutator(targetConfig, sourceConfig);

    writeJson(targetPath, newConfig, {spaces: 2});

  } catch (e) {
    log.error('Error: operating on aurelia.json. Reverting to previous version ;{}', e);
    writeJson(targetPath, sourceConfig, {spaces: 2});
  }
}
598272
function dig (obj, ...path) {
  const key = path.shift()
  if (key == null || obj == null) {
    return
  }
  const val = obj[key]
  if (typeof val === 'object') {
    return dig(val, ...path)
  }
  return val
}
827496
function objGetObj(obj, _key) {
  var key = Array.isArray(_key) ? _key : String(_key).split('.');
  var p, n, ok=1;
  var ret = {ok:ok, path:key, obj:obj};
  for(p=0; p<key.length; p++) {
    n = key[p];
    if(!obj.hasOwnProperty(n) || isPrimitive(obj[n])) {
      ok = 0;
      break
    }
    obj = obj[n];
  }
  ret.ok= ok;
  ret.path = key.slice(0,p);
  ret.obj=obj;
  return ret
}
365758
function createPathOptions(str, opts) {
    var pathProxy = createPathProxyFromString(str);
    opts = opts || {};
    opts.buildPath = function (path) {
        if (path.setData) {
            path.setData(pathProxy.data);
            // Svg and vml renderer don't have context
            var ctx = path.getContext();
            if (ctx) {
                path.rebuildPath(ctx);
            }
        }
        else {
            var ctx = path;
            pathProxy.rebuildPath(ctx);
        }
    };

    opts.applyTransform = function (m) {
        transformPath(pathProxy, m);
        this.dirty(true);
    };

    return opts;
}
842110
function(obj, env, keypath) {
    if (!_.isObject(obj) || _.isArray(obj)) { return; }

    if (hasKeyPath(obj, ['options', 'reconfigureOverrides', env])) {
      var options = obj.options,
          overrides = obj.options.reconfigureOverrides[env];

      for (var key in overrides) {
        var update = { 
          key: keypath+'.options.'+key,
          oldVal: (typeof options[key] === 'undefined') ? 'undefined' : util.inspect(options[key]),
        };

        if (_.isObject(options[key]) && _.isObject(overrides[key])) { 
          var newVal = _.extend(options[key], overrides[key]);
          update.newVal = util.inspect(newVal);
        } else {
          options[key] = overrides[key];
          update.newVal = util.inspect(overrides[key]);
        }

        updates.push(update);
      }
    }
    
    for (var objKey in obj) {
      updateOptions(obj[objKey], env, keypath+'.'+objKey);
    }
  }
579243
def set(obj, glob, value, separator="/", afilter=None):
    
    changed = 0
    globlist = __safe_path__(glob, separator)
    for path in _inner_search(obj, globlist, separator):
        changed += 1
        dpath.path.set(obj, path, value, create_missing=False, afilter=afilter)
    return changed
67967
function _setPathIn (obj, parts, value) {
    var key = parts[0];
    var partsLen = parts.length;
    var v;

    if (partsLen === 1) {
        v = value;
    } else {
        var targetKey = _getPathKey(obj, key, false);

        v = _setPathIn(
            isUndefined(targetKey) ? targetKey : obj[targetKey],
            slice(parts, 1, partsLen),
            value
        );
    }

    return _isArrayIndex(obj, key) ? _setIndex(obj, key, v) : _setIn(obj, key, v);
}
986911
function baseGet (coll, path) {
  return (path || []).reduce((curr, key) => {
    if (!curr) { return }
    return curr[key]
  }, coll)
}
82669
function normalizeSlaveConfig(opt) {
    // exec path
    if (typeof opt === 'string') {
      opt = { exec: opt };
    }
    if (!opt.exec) {
      return null;
    } else {
      return opt;
    }
  }
325358
function updateKeys(obj, _) {
    var newObj = null;
    if (_.isArray(obj)) {
        newObj = [];
    } else if (_.isObject(obj)) {
        newObj = {};
    } else {
        return obj;
    }
    _.forEach(obj, function(value, key) {
        if (key.replace) {
            var newKey = key.replace(/\$|\./g, '_');
            newObj[newKey] = updateKeys(value, _);
        } else {
            newObj[key] = updateKeys(value, _);
        }
    });
    return newObj;
}
788071
function mergeDefaultOptions(opts) {
    const copy = {};
    copyKeys(copy, _defaultOptions);
    copyKeys(copy, opts);
    Object.keys(_defaultOptions).forEach((key) => {
        const obj = _defaultOptions[key];
        if (typeof obj === 'object') {
            const objCopy = {};
            copyKeys(objCopy, obj);
            copyKeys(objCopy, copy[key]);
            copy[key] = objCopy;
        }
    });
    return copy;
}
900059
function correctPlistBlanks(obj) {
    for (const key in obj) {
      const val = obj[key];
      if (!val) obj[key] = "";
    }

    return obj;
  }
483750
function nestedApply(obj, path, fun) {
	if (path.length === 0) {
		const _ret = fun(obj);
		return {
			ret: _ret,
			newObj: obj
		};
	}
	// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments
	let newObj = obj;
	const last = path.pop();
	for (const elem of path) {
		if (!newObj[elem])
			newObj[elem] = {};
		newObj = newObj[elem];
	}
	const ret = fun(newObj[last]);
	return {
		ret,
		newObj
	};
}
289918
function expandKeys(object) {
  var hasFlattenedKeys = _.some(object, function(val, key) {
    return key.split('.').length > 1;
  });
  if (!hasFlattenedKeys) return object;

  return _.reduce(object, function(payload, value, key) {
    var path = key.split('.');
    if (path.length === 1) {
      var obj = {};
      obj[key] = value;
      payload = deepExtend(payload, obj);
      return payload;
    }
    var subKey = path.pop();
    var localObj = payload;
    while (path.length) {
      var subPath = path.shift();
      localObj = localObj[subPath] = localObj[subPath] || {};
    }
    localObj[subKey] = object[key];
    return payload;
  }, {});
}
338135
def coerce(cls, key, value):
        """"""
        if not isinstance(value, MutationDict):
            if isinstance(value, dict):
                return MutationDict(value)

            # this call will raise ValueError
            return Mutable.coerce(key, value)
        else:
            return value
70905
function(obj, pathSoFar, interesting, ret) {
            for (var f=0; f<obj.length; f++) {
                var thisPath = pathSoFar+obj[f].name+".";
                if (obj[f].type == "string") {
                    ret.push(thisPath);
                }
                else {
                    buildStringPaths(interesting[obj[f].type], thisPath, interesting, ret);
                }
            }
        }