Skip to content

daaku/nodejs-dotaccess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotaccess Build Status

A library to access objects using dot notation strings. For example:

var dotaccess = require('dotaccess')
var obj = {
  answer: 42,
  deep: {
    trench: 43,
    'funky names': 44,
    'including a .': 45
  }
}

// prints 42
console.log(dotaccess.get(obj, 'answer'))

// prints 43
console.log(dotaccess.get(obj, 'deep.trench'))

// can use an array of part names also prints 43
console.log(dotaccess.get(obj, ['deep', 'trench']))

// prints 44, spaces are allowed
console.log(dotaccess.get(obj, 'deep.funky names'))

// overwrite existing values
dotaccess.set(obj, 'deep.funky names', 99, true)

// can also set stuff
dotaccess.set(obj, 'deep.an even funkier_name', 'green')

// or unset stuff
dotaccess.unset(obj, 'deep')

About

A library to access object with "dot notation strings"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •