activejson
v1.0.3
Published
handle json like an active_record
Downloads
4
Readme
activeJson
JSON query Engine like an ActiveRecord
Usage
var activeJson = require('./activeJson')
var articles = [
{ id: 1, title: "article1"},
{ id: 2, title: "article2"},
{ id: 3, title: "article3"},
]
find
activeJson(articles).find(1)
// {id: 1, title: "article1"}
select
activeJson(articles).select(["id"]).find(2)
// {id: 2}
find_by
activeJson(articles).find_by({title: "article3"})
// {id:3, title: "article3"}
where
activeJson(articles).where({title: "article1"}).where({title: "articles3"}).execute()
//[{id:1, title: "articles"}, {id:3, title: "article3"}]
all
activeJson(articles).all()
delete
activeJson(articles).delete({title: 'test'})