How to use the noon.load function in noon

To help you get started, we’ve selected a few noon 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 scalarwaves / iloa / 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 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 scalarwaves / iloa / src / themes.js View on Github external
exports.loadTheme = (theme) => {
  let dirExists = null
  let load = null
  try {
    fs.statSync('themes')
    dirExists = true
  } catch (e) {
    if (e.code === 'ENOENT') dirExists = false
  }
  const CFILE = `${process.env.HOME}/.iloa.noon`
  const config = noon.load(CFILE)
  if (!dirExists && config.verbose) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/iloa/themes.`))
  load = noon.load(`${TDIR}${theme}.noon`)
  return load
}
github scalarwaves / leximaven / src / themes.js View on Github external
exports.loadTheme = (theme) => {
  let dirExists = null
  let load = null
  try {
    fs.statSync('themes')
    dirExists = true
  } catch (e) {
    if (e.code === 'ENOENT') dirExists = false
  }
  const CFILE = `${process.env.HOME}/.leximaven.noon`
  const config = noon.load(CFILE)
  if (!dirExists && config.verbose) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/leximaven/themes.`))
  load = noon.load(`${TDIR}${theme}.noon`)
  return load
}
github scalarwaves / iloa / bin / themes.js View on Github external
  */exports.loadTheme=function(theme){var dirExists=null;var load=null;try{fs.statSync('themes');dirExists=true;}catch(e){if(e.code==='ENOENT')dirExists=false;}var CFILE=process.env.HOME+'/.iloa.noon';var config=noon.load(CFILE);if(!dirExists&&config.verbose)console.log(chalk.white(process.cwd()+'/themes does not exist, falling back to '+process.env.NODE_PATH+'/iloa/themes.'));load=noon.load(''+TDIR+theme+'.noon');return load;};/**
  * Gets themes for list command
github scalarwaves / leximaven / bin / themes.js View on Github external
  */exports.loadTheme=function(theme){var dirExists=null;var load=null;try{fs.statSync('themes');dirExists=true;}catch(e){if(e.code==='ENOENT')dirExists=false;}var CFILE=process.env.HOME+'/.leximaven.noon';var config=noon.load(CFILE);if(!dirExists&&config.verbose)console.log(chalk.white(process.cwd()+'/themes does not exist, falling back to '+process.env.NODE_PATH+'/leximaven/themes.'));load=noon.load(''+TDIR+theme+'.noon');return load;};/**
  * Gets themes for list command
github scalarwaves / iloa / src / themes.js View on Github external
exports.loadTheme = (theme) => {
  let dirExists = null
  let load = null
  try {
    fs.statSync('themes')
    dirExists = true
  } catch (e) {
    if (e.code === 'ENOENT') dirExists = false
  }
  const CFILE = `${process.env.HOME}/.iloa.noon`
  const config = noon.load(CFILE)
  if (!dirExists && config.verbose) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/iloa/themes.`))
  load = noon.load(`${TDIR}${theme}.noon`)
  return load
}
github scalarwaves / leximaven / src / commands / configuration / init.js View on Github external
obj.dmuse.date.stamp = new Date().toJSON()
  obj.onelook.date.stamp = new Date().toJSON()
  obj.rbrain.date.stamp = new Date().toJSON()
  obj.wordnik.date.stamp = new Date().toJSON()
  let fileExists = null
  try {
    fs.statSync(CFILE)
    fileExists = true
  } catch (e) {
    if (e.code === 'ENOENT') {
      fileExists = false
    }
  }
  if (fileExists) {
    if (argv.f) {
      const config = noon.load(CFILE)
      obj.dmuse.date.stamp = config.dmuse.date.stamp
      obj.dmuse.date.remain = config.dmuse.date.remain
      obj.onelook.date.stamp = config.onelook.date.stamp
      obj.onelook.date.remain = config.onelook.date.remain
      obj.rbrain.date.stamp = config.rbrain.date.stamp
      obj.rbrain.date.remain = config.rbrain.date.remain
      obj.wordnik.date.stamp = config.wordnik.date.stamp
      obj.wordnik.date.remain = config.wordnik.date.remain
      noon.save(CFILE, obj)
      console.log(`Overwrote ${chalk.white.bold(CFILE)}.`)
    } else {
      console.log(`Using configuration at ${chalk.white.bold(CFILE)}.`)
    }
  } else if (!fileExists) {
    noon.save(CFILE, obj)
    console.log(`Created ${chalk.white.bold(CFILE)}.`)
github scalarwaves / leximaven / src / commands / configuration / init.js View on Github external
exports.handler = (argv) => {
  let obj = null
  let configExists = null
  let dirExists = null
  try {
    fs.statSync('default.config.noon')
    configExists = true
  } catch (e) {
    if (e.code === 'ENOENT') configExists = false
  }
  if (configExists) {
    obj = noon.load('default.config.noon')
  } else {
    try {
      fs.statSync(PKGDIR)
      dirExists = true
    } catch (e) {
      if (e.code === 'ENOENT') {
        dirExists = false
      }
    }
    if (dirExists) {
      obj = noon.load(`${PKGDIR}default.config.noon`)
    } else {
      throw new Error('Package dir not found, set NODE_PATH per documentation.')
    }
  }
  obj.dmuse.date.stamp = new Date().toJSON()
github scalarwaves / iloa / src / commands / configuration / init.js View on Github external
exports.handler = (argv) => {
  let obj = null
  let configExists = null
  let dirExists = null
  try {
    fs.statSync('default.config.noon')
    configExists = true
  } catch (e) {
    if (e.code === 'ENOENT') configExists = false
  }
  if (configExists) {
    obj = noon.load('default.config.noon')
  } else {
    try {
      fs.statSync(PKGDIR)
      dirExists = true
    } catch (e) {
      if (e.code === 'ENOENT') {
        dirExists = false
      }
    }
    if (dirExists) {
      obj = noon.load(`${PKGDIR}default.config.noon`)
    } else {
      throw new Error('Package dir not found, set NODE_PATH per documentation.')
    }
  }
  obj.wolf.date.stamp = new Date().toJSON()

noon

no ordinary object notation

Unlicense
Latest version published 2 years ago

Package Health Score

42 / 100
Full package analysis

Popular noon functions