How to use getobject - 10 common examples

To help you get started, we’ve selected a few getobject examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tkellen / js-expander / index.js View on Github external
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;
};
github damkraw / grunt-gitinfo / tasks / gitInfo.js View on Github external
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();
                    }
                );
github tkellen / js-expander / index.js View on Github external
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);
github assemble / assemble / lib / cache.js View on Github external
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;
};
github meiblorn / ngx-fullpage / config / helpers / utils.js View on Github external
static get(obj, prop) {
        return getObject.get(obj, prop);
    }
github assemble / assemble / lib / cache.js View on Github external
Cache.prototype.get = function get(key, create) {
  if (!key) {
    return this.cache;
  }
  return getobject.get(this.cache, key, create);
};
github spanishdict / spotcheck / lib / report.js View on Github external
var keys = _.countBy(data, function(item) {
    var value = getobject.get(item, key);
    if (opts.isJson) {
      value = JSON.stringify(value);
    }
    return value;
  });
  return keys;
github tkellen / js-expander / index.js View on Github external
expander.get = function (data, lookup, options) {
  if (!lookup) {
    return objectExpand(data, data, options);
  } else {
    return expander.process(data, getobject.get(data, lookup), options);
  }
};
github tkellen / js-remapped / index.js View on Github external
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);
    }
  });
};
github tkellen / js-expander / index.js View on Github external
expander.getRaw = function (data, lookup) {
  if (!lookup) {
    return data;
  } else {
    return getobject.get(data, lookup);
  }
};

getobject

get.and.set.deep.objects.easily = true

MIT
Latest version published 3 years ago

Package Health Score

66 / 100
Full package analysis

Popular getobject functions