How to use the dot-prop.has function in dot-prop

To help you get started, we’ve selected a few dot-prop 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 fliphub / fliphub / modules / json-chain / index.js View on Github external
has(key) {
    this.parse()
    if (key.includes('.')) return dotProp.has(this.data, key)
    return Object.prototype.hasOwnProperty.call(this.data, key)
  }
  // delete. remove
github scalarwaves / leximaven / src / commands / configuration / set.js View on Github external
exports.handler = (argv) => {
  const key = argv.key
  let value = argv.value
  value = tools.checkBoolean(value)
  tools.checkConfig(CFILE)
  const config = noon.load(CFILE)
  const theme = themes.loadTheme(config.theme)
  if (config.verbose) themes.label(theme, 'down', 'Configuration')
  if (dot.has(config, key)) {
    if (/\./i.test(key)) {
      if (/^\w*\.date/i.test(key)) {
        throw new Error("API limits hardcoded, can't set this key.")
      } else {
        dot.set(config, key, value)
      }
    } else {
      config[key] = value
    }
  } else {
    throw new Error(`Option ${key} not found.`)
  }
  noon.save(CFILE, config)
  console.log(`Set option ${chalk.white.bold(key)} to ${chalk.white.bold(value)}.`)
}
github scalarwaves / leximaven / src / commands / configuration / get.js View on Github external
exports.handler = (argv) => {
  const key = argv.key
  let value = null
  tools.checkConfig(CFILE)
  const config = noon.load(CFILE)
  const theme = themes.loadTheme(config.theme)
  if (config.verbose) themes.label(theme, 'down', 'Configuration')
  if (dot.has(config, key)) {
    value = /\./i.test(key) ? dot.get(config, key) : config[key]
  } else {
    throw new Error(`Option ${key} not found.`)
  }
  console.log(`Option ${chalk.white.bold(key)} is ${chalk.white.bold(value)}.`)
}
github omenking / swap-n-pop / src / common / store.ts View on Github external
has(key) {
		return DotProp.has(this.data, key)
	}
	delete(key) {
github liferay / liferay-js-toolkit / packages / liferay-npm-build-support / src / config.js View on Github external
function normalize(cfg, propPath, value) {
	if (!prop.has(cfg, propPath)) {
		prop.set(cfg, propPath, value);
	}
}
github sindresorhus / conf / index.js View on Github external
has(key) {
		if (this._options.accessPropertiesByDotNotation) {
			return dotProp.has(this.store, key);
		}

		return key in this.store;
	}
github kristianmandrup / json-schema-to-es-mapping / src / types / definition / index.js View on Github external
handleFoundReference() {
    const found = dotProp.has(this.schema, this.dotPath);
    if (found) return;
    this.error(
      "resolveRefObject",
      `No value found in schema at: ${this.dotPath} - ${stringify(this.schema)}`
    );
  }
github lerna / lerna / core / project / lib / deprecate-config.js View on Github external
return obj => {
    for (const searchPath of pathsToSearch) {
      if (dotProp.has(obj.config, searchPath)) {
        const fromVal = dotProp.get(obj.config, searchPath);
        const toVal = toValue ? toValue(fromVal) : fromVal;

        log.warn("project", deprecationMessage(obj, target, searchPath, fromVal, toVal));

        dotProp.set(obj.config, target, toVal);
        dotProp.delete(obj.config, searchPath);
      }
    }

    return obj;
  };
}
github netlify / cli / src / base / state / index.js View on Github external
has(key) {
    return dotProp.has(this.all, key)
  }
github yeoman / configstore / index.js View on Github external
has(key) {
		return dotProp.has(this.all, key);
	}

dot-prop

Get, set, or delete a property from a nested object using a dot path

MIT
Latest version published 10 months ago

Package Health Score

80 / 100
Full package analysis