Skip to content

Commit

Permalink
Fixing README, version bump for npm
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Jul 2, 2015
1 parent 7a4bb50 commit ce8adaa
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 40 deletions.
67 changes: 34 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ store.batch(data, 'set').then(function (records) {
console.log(store.search(function (age) {
return age < 30;
}, 'age')); // [[$uuid, {name: 'Jane Doe', age: 28}]]
}).catch(function (e) {
console.error(e.stack || e.message || e);
}, function (e) {
console.error(e.stack || e.message || e);
});
```

Expand Down Expand Up @@ -469,26 +469,27 @@ Example setting the URI of the DataStore:
var store = haro(null, {key: 'id'});
store.setUri('https://api.somedomain.com').then(function (records) {
console.log(records); // [[$id, {...}], ...]
}).catch(function (e) {
console.error(e.stack || e.message || e);
console.log(records); // [[$id, {...}], ...]
}, function (arg) {
console.error(arg[0]); // [body, statusCode]
});
```

Example of pagination, by specifying `clear`:
```javascript
var store = haro(null, {key: 'id'});
store.setUri('https://api.somedomain.com?page=1').then(function (records) {
console.log(records); // [[$id, {...}], ...]
}).catch(function (e) {
console.error(e.stack || e.message || e);
console.log(records); // [[$id, {...}], ...]
}, function (arg) {
console.log(arg[0]); // [body, statusCode]
});
// Later, based on user interaction, change the page
store.setUri('https://api.somedomain.com?page=2', true).then(function (records) {
console.log(records); // [[$id, {...}], ...]
}).catch(function (e) {
console.error(e.stack || e.message || e);
console.log(records); // [[$id, {...}], ...]
}, function (arg) {
console.error(arg[0]); // [body, statusCode]
});
```

Expand All @@ -503,11 +504,11 @@ var store = haro(null, {index: ['name', 'age']}),
data = [{name: 'John Doe', age: 30}, {name: 'Jane Doe', age: 28}];
store.batch(data, 'set').then(function (records) {
console.log(store.sort(function (a, b) {
return a < b ? -1 : (a > b ? 1 : 0);
})); // [{name: 'Jane Doe', age: 28}, {name: 'John Doe', age: 30}]
}).catch(function (e) {
console.error(e.stack || e.message || e);
console.log(store.sort(function (a, b) {
return a < b ? -1 : (a > b ? 1 : 0);
})); // [{name: 'Jane Doe', age: 28}, {name: 'John Doe', age: 30}]
}, function (e) {
console.error(e.stack || e.message || e);
});
```

Expand All @@ -522,9 +523,9 @@ var store = haro(null, {index: ['name', 'age']}),
data = [{name: 'John Doe', age: 30}, {name: 'Jane Doe', age: 28}];
store.batch(data, 'set').then(function (records) {
console.log(store.sortBy('age')); // [[$uuid, {name: 'Jane Doe', age: 28}], [$uuid, {name: 'John Doe', age: 30}]]
}).catch(function (e) {
console.error(e.stack || e.message || e);
console.log(store.sortBy('age')); // [[$uuid, {name: 'Jane Doe', age: 28}], [$uuid, {name: 'John Doe', age: 30}]]
}, function (e) {
console.error(e.stack || e.message || e);
});
```

Expand All @@ -540,9 +541,9 @@ var store = haro(null, {key: 'id'}),
interval;
store.setUri('https://api.somedomain.com').then(function (records) {
console.log(records); // [[$id, {...}], ...]
}).catch(function (e) {
console.error(e.stack || e.message || e);
console.log(records); // [[$id, {...}], ...]
}, function (arg) {
console.error(arg[0]); // [body, statusCode]
});
// Synchronizing the store every minute
Expand All @@ -562,9 +563,9 @@ var store = haro(),
data = [{name: 'John Doe', age: 30}, {name: 'Jane Doe', age: 28}];
store.batch(data, 'set').then(function (records) {
console.log(store.toArray()); // [{name: 'John Doe', age: 30}, {name: 'Jane Doe', age: 28}]
}).catch(function (e) {
console.error(e.stack || e.message || e);
console.log(store.toArray()); // [{name: 'John Doe', age: 30}, {name: 'Jane Doe', age: 28}]
}, function (e) {
console.error(e.stack || e.message || e);
});
```

Expand All @@ -579,15 +580,15 @@ var store = haro(),
data = [{name: 'John Doe', age: 30}, {name: 'Jane Doe', age: 28}];
store.batch(data, 'set').then(function (records) {
var iterator = store.values(),
item = iterator.next();
var iterator = store.values(),
item = iterator.next();
do {
console.log(item.value);
item = iterator.next();
} while (!item.done);
}).catch(function (e) {
console.error(e.stack || e.message || e);
do {
console.log(item.value);
item = iterator.next();
} while (!item.done);
}, function (e) {
console.error(e.stack || e.message || e);
});
```

Expand Down
4 changes: 2 additions & 2 deletions lib/haro.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @copyright 2015
* @license BSD-3-Clause
* @link http://haro.rocks
* @version 1.2.2
* @version 1.2.3
*/
"use strict";

Expand Down Expand Up @@ -525,7 +525,7 @@ function factory (data=null, config={}, indexes=[]) {
return new Haro(data, config, indexes);
}

factory.version = "1.2.2";
factory.version = "1.2.3";

// Node, AMD & window supported
if (typeof exports !== "undefined") {
Expand Down
4 changes: 2 additions & 2 deletions lib/haro.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @copyright 2015
* @license BSD-3-Clause
* @link http://haro.rocks
* @version 1.2.2
* @version 1.2.3
*/
"use strict";

Expand Down Expand Up @@ -603,7 +603,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return new Haro(data, config, indexes);
}

factory.version = "1.2.2";
factory.version = "1.2.3";

// Node, AMD & window supported
if (typeof exports !== "undefined") {
Expand Down
2 changes: 1 addition & 1 deletion lib/haro.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/haro.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haro",
"version": "1.2.2",
"version": "1.2.3",
"description": "Harō is a modern immutable DataStore using Maps, Sets, Promises, & Tuples",
"main": "lib/haro.js",
"scripts": {
Expand Down

0 comments on commit ce8adaa

Please sign in to comment.