项目作者: rnsloan

项目描述 :
A datastore kind of like a cross between Backbone's Model and Collection
高级语言: CoffeeScript
项目地址: git://github.com/rnsloan/holborn.git
创建时间: 2014-06-29T17:27:29Z
项目社区:https://github.com/rnsloan/holborn

开源协议:

下载


holborn Build Status

A datastore kind of like a cross between Backbone’s Model and Collection

Getting started

nodejs

npm install holborn

Browser

browser/holborn.js

Requires IE9+

API

Initialising

Create a new store by initialising with the keys

var store = new Holborn['name', 'age', 'sex']

add

  1. store.add({name: 'john', age: 15, sex: 'male'})
  2. store.add({name: 'frank', age: 27, sex: 'male'},{name: 'mary', age: 23, sex: 'female'})

all

  1. store.all() >>
  2. [{id: 1, name: 'frank', age: 27, sex: 'male'},{id: 2, name: 'mary', age: 23, sex: 'female'}]

find

  1. store.find('name', 'frank') >>
  2. [{id: 1, name: 'frank', age: 23, sex: 'male'}]
  3. store.find({age: 23, name: 'frank'}) >>
  4. [{id: 1, name: 'frank', age: 23, sex: 'male'}]

length

  1. store.length() >>
  2. 2

remove

  1. test.remove('age', 23)
  2. test.remove({age: 23, name: 'frank'})

update

  1. test.update({name: 'frank', age: 23}, {name: 'roger'})
  2. test.update({age: 23, name: 'keith'}, {name: 'roger', age: 45})

Development

Running spec tests and linting

  1. $ grunt test

Coverage (you will need to pipe the results)

  1. $ grunt cov > cov.html

Building coffeescript to js

  1. $ grunt build

Bump the version

  1. $ grunt bump

Linting coffeescript (by rules defined in coffeelint.json)

  1. $ grunt lint

Watching files for changes. Will trigger test job on file changes

  1. $ grunt watch

License

MIT