ref: 8b6e0f7c019f532841af40b950c4048422232234 taliaferro/node_modules/set-getter/README.md -rw-r--r-- 2.5 KiB
8b6e0f7c — Nate rebuilding site Sun Feb 9 13:47:19 CST 2020: Fix navbar symbols showing up first. 1 year, 11 months ago

#set-getter NPM version NPM downloads Build Status

Create nested getter properties and any intermediary dot notation ('a.b.c') paths


Install with npm:

$ npm install set-getter --save


var getter = require('set-getter');

set-getter works like set-value by adding a property to an object or an object hierarchy using dot notation. The main difference is that the property is added using Object.defineProperty and is expected to be a getter function that returns a value.


var obj = {};

// root level property
getter(obj, 'foo', function() {
  return 'bar';
//=> 'bar'

// property dot notation
getter(obj, 'bar.baz', function() {
  return 'qux';
//=> 'qux'

// property array notation
getter(obj, ['beep', 'boop'], function() {
  return 'bop';
//=> 'bop'



Defines a getter function on an object using property path notation.


  • obj {Object}: Object to add property to.
  • prop {String|Array}: Property string or array to add.
  • getter {Function}: Getter function to add as a property.


var obj = {};
getter(obj, 'foo', function() {
  return 'bar';


Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

#Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

#Running tests

Install dev dependencies:

$ npm install -d && npm test


Brian Woodward


Copyright © 2016, Brian Woodward. Released under the MIT license.

This file was generated by verb, v0.9.0, on April 29, 2016.