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

ianstormtaylor/get

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Get a property from a model or object.

Resources

Stars

Watchers

Forks

Packages

No packages published