Skip to content
This repository has been archived by the owner on Mar 8, 2019. It is now read-only.

Latest commit

 

History

History
45 lines (31 loc) · 803 Bytes

Readme.md

File metadata and controls

45 lines (31 loc) · 803 Bytes

get

Get a property from a model or object. For the reverse, checkout ianstormtaylor/set.

Installation

$ component install ianstormtaylor/get

Example

Plain objects:

var get = require('get');

var person = { name: 'ulysses' };
get(person, 'name'); // ulysses

Getter/setter methods:

var get = require('get')
  , model = require('model');

var Person = model('person').attr('name');
var person = new Person({ name: 'ulysses' });
get(person, 'name'); // ulysses

Get methods:

var Backbone = require('backbone')
  , get = require('get');

var person = new Backbone.Model({ name: 'ulysses' });
get(person, 'name')); // ulysses

API

get(model, prop)

Get the given prop from model.

License

MIT