Skip to content

Commit

Permalink
basic Install & Usage sections added.
Browse files Browse the repository at this point in the history
  • Loading branch information
bfontaine committed Feb 5, 2013
1 parent 5354135 commit 8009c97
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,39 @@ ArrayDB
[![Build Status](https://travis-ci.org/bfontaine/ArrayDB.png)](https://travis-ci.org/bfontaine/ArrayDB)

Use your arrays as DB tables, and make queries on them.

Install
-------

```
[sudo] npm install [-g] arraydb
```

Usage
-----

ArrayDB objects expose one method, `.query`, which use pattern-matching:

```js
var ArrayDB = require( 'arraydb' ).ArrayDB;

var a = new ArrayDB([

{ name: "Foo", age: 42 },
{ name: "Bar", age: 24 },
{ name: "Moo", age: 42 }

]);

a.query({ age: 42 }); // [ { name:"Foo", age:42 }, { name:"Moo",age:42} ]
```

You can also monkey-patch `Array` objects:

```js
var ArrayDB = require( 'arraydb' ).ArrayDB;

ArrayDB.monkeyPatch();

typeof [].query === 'function'; // true
```

0 comments on commit 8009c97

Please sign in to comment.