0.0.3 • Published 9 years ago

use-this v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

use-this

Just some underscore implementations.

Possible use:

var person = [
    {name: { first: 'Gian', last: 'Febrian' } },
    {name: { first: 'Suci', last: 'Alfia' } }
];

To get nested property value

useThis(person).getThis('name.first', 0); //Gian
useThis(person).getThis('name.first', 0); //Suci

To pluck nested property value

useThis(person).pluckThis('name.first'); 
//['Gian', 'Suci']

To pair property value

useThis(person).pairThese('name.first', 'name.last'); 
//{Gian: 'Febrian', Suci: 'Alfia'}

To fill template object

var template = { fullName: '{name.first} {name.last}' }
var pattern = { 
    'name.first': {value: 'propertyValue'}, 
    'name.last': {value: 'propertyValue'}}

useThis(person).fillThisTemplate(template, pattern); 
//[ { fullName: 'Gian Febrian' }, { fullName: 'Suci Alfia' } ]
0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago