Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var stringExpand = function (data, lookup, options) {
var property;
// as long as this contains a template string, keep traversing
while(property = findProperty(lookup)) {
// if this doesn't solely contain a template lookup (e.g. '<%= key %>'), then
// recursively process it as a template to handle interpolated strings (e.g. 'hi <%= key %>).
if (property.src !== lookup) {
lookup = _.template(lookup, data, options);
} else {
// expand to the literal value of this key
lookup = expander.process(data, getobject.get(data, property.prop), options);
}
}
// do one final check for templates.
if (hasTemplate(lookup)) {
lookup = _.template(lookup, data, options);
}
return lookup;
};
function (err, result) {
if (err) {
grunt.log.debug("Couldn't set config:", conf_key);
} else {
getobject.set(gitinfo, conf_key, result.stdout);
if (grunt.option("verbose")) {
// could be unnecessary
grunt.verbose.ok(conf_key, "=", result.stdout);
} else {
grunt.log.debug(conf_key, "=", result.stdout);
}
}
cb();
}
);
var API = function (prop, value) {
if (arguments.length === 2) {
emitter.emit('set', prop, value);
return getobject.set(data, prop, value);
} else {
return expander.get(data, prop, options);
}
};
API.on = emitter.on.bind(emitter);
Cache.prototype.set = function set(key, value, resolve) {
if (arguments.length === 1 && typeOf(key) === 'object') {
this.process(key);
this.emit('set', key, value);
return this;
}
if (typeOf(value) === 'object') {
this.process(value);
}
value = expand(this.cache, value);
if (resolve) {
expander.set(this.cache, key, value);
} else {
getobject.set(this.cache, key, value);
}
this.emit('set', key, value);
return this;
};
static get(obj, prop) {
return getObject.get(obj, prop);
}
Cache.prototype.get = function get(key, create) {
if (!key) {
return this.cache;
}
return getobject.get(this.cache, key, create);
};
var keys = _.countBy(data, function(item) {
var value = getobject.get(item, key);
if (opts.isJson) {
value = JSON.stringify(value);
}
return value;
});
return keys;
expander.get = function (data, lookup, options) {
if (!lookup) {
return objectExpand(data, data, options);
} else {
return expander.process(data, getobject.get(data, lookup), options);
}
};
return traverse(mapping).map(function (item) {
if (typeof item === 'string') {
var value = getobject.get(source, item);
if (value === undefined) {
value = getobject.get(defaults, this.path);
}
this.update(value);
}
});
};
expander.getRaw = function (data, lookup) {
if (!lookup) {
return data;
} else {
return getobject.get(data, lookup);
}
};