Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
has(key) {
this.parse()
if (key.includes('.')) return dotProp.has(this.data, key)
return Object.prototype.hasOwnProperty.call(this.data, key)
}
// delete. remove
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)}.`)
}
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)}.`)
}
has(key) {
return DotProp.has(this.data, key)
}
delete(key) {
function normalize(cfg, propPath, value) {
if (!prop.has(cfg, propPath)) {
prop.set(cfg, propPath, value);
}
}
has(key) {
if (this._options.accessPropertiesByDotNotation) {
return dotProp.has(this.store, key);
}
return key in this.store;
}
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)}`
);
}
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;
};
}
has(key) {
return dotProp.has(this.all, key)
}