dot-access

Access object properties using dot notation.

dot-access

Access object properties using dot notation.

var dotAccess = require('dot-access');

var user = { 
  fullname: { 
    first: 'Joe', 
    last: 'M' 
  } 
};

// get
dotAccess.get(user, 'fullname.first'); // 'Joe'

// or set
dotAccess.set(user, 'fullname.last', 'T'); // 'T'

Install with component(1):

$ component install Ntran013/dot-access

MIT