Skip to content

Commit

Permalink
Merge pull request #71 from CoorpAcademy/improve-readme
Browse files Browse the repository at this point in the history
Add set api documentation
  • Loading branch information
Loïc Calvy committed Oct 10, 2016
2 parents 2177e53 + 6a91b1f commit 03df8c2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Provide an index system to access a file without scanning all nodes.
- [`get(path)`](#getpath)
- [`getBy(index, key)`](#getbyindex-key)
- [`getAll(index)`](#getallindex)
- [`set(path, value)`](#setpath-value)
- [Command Line Interface](#command-line-interface)
- [`squirrel-sync`](#squirrel-sync)
- [`squirrel-watch`](#squirrel-watch)
Expand Down Expand Up @@ -114,6 +115,20 @@ const barBaz = await squirrel.getAll('bar.baz');
console.log(barBaz); // { "qux": { "bar": { "baz": "qux" } } }
```
#### `set(path, value)`
Set file by path. Returns `Promise`;
- `path` (String): the path of the file to get.
- `value` (Object): An object to store in file. Will be serialized.
```JavaScript
const foo = await squirrel.set('/foo', { "foo": "bar" });
console.log(foo); // { "foo": "bar" }
```
## Command Line Interface
### `squirrel-sync`
Expand Down

0 comments on commit 03df8c2

Please sign in to comment.