Skip to content

Commit

Permalink
Removing a conditional via ternary, updating the README example
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Oct 24, 2015
1 parent 93959e2 commit 5652af5
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 22 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,13 @@ store1.join(store2, "user", "inner").then(function (records) {
console.error(e.stack || e.message || e);
});

store1.join(store2, "user", "inner", [{age: 31}]).then(function (records) {
console.log(records);
// []
}, function (e) {
console.error(e.stack || e.message || e);
});

store1.join(store2, "user", "left").then(function (records) {
console.log(records);
// [{"users_id":"abc","users_name":"jason","users_age":35,"values_id":"ghi","values_user":"abc","values_value":40},
Expand Down
10 changes: 3 additions & 7 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.9.2
* @version 1.9.3
*/
"use strict";

Expand Down Expand Up @@ -613,11 +613,7 @@ class Haro {

if (other.total > 0) {
if (where.length > 0) {
if (!where[1]) {
promise = this.offload([[this.id, other.id], this.find(where[0], true), other.toArray(null, true), this.key, on, type], "join");
} else {
promise = this.offload([[this.id, other.id], this.find(where, true), other.find(where, true), this.key, on, type], "join");
}
promise = this.offload([[this.id, other.id], this.find(where[0], true), !where[1] ? other.toArray(null, true) : other.find(where, true), this.key, on, type], "join");
} else {
promise = this.offload([[this.id, other.id], this.toArray(null, true), other.toArray(null, true), this.key, on, type], "join");
}
Expand Down Expand Up @@ -1266,7 +1262,7 @@ function factory (data = null, config = {}, indexes = []) {
}

factory.transform = cast;
factory.version = "1.9.2";
factory.version = "1.9.3";

// Node, AMD & window supported
if (typeof exports !== "undefined") {
Expand Down
10 changes: 3 additions & 7 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.9.2
* @version 1.9.3
*/
"use strict";

Expand Down Expand Up @@ -672,11 +672,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons

if (other.total > 0) {
if (where.length > 0) {
if (!where[1]) {
promise = this.offload([[this.id, other.id], this.find(where[0], true), other.toArray(null, true), this.key, on, type], "join");
} else {
promise = this.offload([[this.id, other.id], this.find(where, true), other.find(where, true), this.key, on, type], "join");
}
promise = this.offload([[this.id, other.id], this.find(where[0], true), !where[1] ? other.toArray(null, true) : other.find(where, true), this.key, on, type], "join");
} else {
promise = this.offload([[this.id, other.id], this.toArray(null, true), other.toArray(null, true), this.key, on, type], "join");
}
Expand Down Expand Up @@ -1420,7 +1416,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}

factory.transform = cast;
factory.version = "1.9.2";
factory.version = "1.9.3";

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

Large diffs are not rendered by default.

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.9.2",
"version": "1.9.3",
"description": "Harō is a modern immutable DataStore using Maps, Sets, Promises, & Tuples",
"main": "lib/haro.js",
"scripts": {
Expand Down
6 changes: 1 addition & 5 deletions src/haro.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,7 @@ class Haro {

if (other.total > 0) {
if (where.length > 0) {
if (!where[1]) {
promise = this.offload([[this.id, other.id], this.find(where[0], true), other.toArray(null, true), this.key, on, type], "join");
} else {
promise = this.offload([[this.id, other.id], this.find(where, true), other.find(where, true), this.key, on, type], "join");
}
promise = this.offload([[this.id, other.id], this.find(where[0], true), !where[1] ? other.toArray(null, true) : other.find(where, true), this.key, on, type], "join");
} else {
promise = this.offload([[this.id, other.id], this.toArray(null, true), other.toArray(null, true), this.key, on, type], "join");
}
Expand Down

0 comments on commit 5652af5

Please sign in to comment.