origami
Fold utilities
Last updated 5 years ago by phated .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install origami 
SYNC missed versions from official npm registry.

origami

Fold utilities

API

construct

Fold in a constructor to instantiate with data.

function Model(data){
  this.data = data;
}

when.resolve({ hello: 'world' })
  .fold(construct, Model)
  .then(function(model){
    // `model` is an instance of Model
  });

reach

Fold in a deep object path to extract from data.

var data = {
  some: {
    deep: {
      prop: 'hello world'
    }
  }
};

when.resolve(data)
  .fold(reach, 'some.deep.prop')
  .then(function(val){
    // `val` is 'hello world'
  });

Old origami

If you are looking for the old version of origami, please use npm install origami@0.1.0.

Current Tags

  • 0.3.0                                ...           latest (5 years ago)

2 Versions

  • 0.3.0                                ...           5 years ago
  • 0.2.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 1
Dependencies (1)
Dev Dependencies (3)

Copyright 2014 - 2016 © taobao.org |