Comparing version 2.1.2 to 2.1.3
111
lib/model.js
@@ -900,6 +900,8 @@ var util = require(__dirname+'/util.js'); | ||
if (promise instanceof Promise) { | ||
promise.then(resolve).error(reject); | ||
promise.then(function() { | ||
resolve(data) | ||
}).error(reject); | ||
} | ||
else { | ||
resolve(); | ||
resolve(data); | ||
} | ||
@@ -937,6 +939,47 @@ }).error(reject); | ||
for(var i=0; i<data.data.length; i++) { | ||
reduction = []; | ||
if (Array.isArray(data.data[i][1])) { | ||
for(var j=0; j<data.data[i][1].length; j++) { | ||
newDoc = new self(data.data[i][1][j]); | ||
(function(i) { | ||
reduction = []; | ||
if (Array.isArray(data.data[i][1])) { | ||
for(var j=0; j<data.data[i][1].length; j++) { | ||
(function(j) { | ||
newDoc = new self(data.data[i][1][j]); | ||
newDoc.setSaved(true); | ||
newDoc._emitRetrieve(); | ||
promise = util.hook({ | ||
postHooks: newDoc._getModel()._post.retrieve, | ||
doc: newDoc, | ||
async: newDoc._getModel()._async.retrieve, | ||
fn: function() {} | ||
}) | ||
if (promise instanceof Promise) { | ||
promise.then(function() { | ||
var promise = newDoc.validate(); | ||
if (promise instanceof Promise) { | ||
promise.then(function() { | ||
resolve(data) | ||
}).error(reject); | ||
} | ||
else { | ||
resolve(data); | ||
} | ||
}).error(reject); | ||
promises.push(promise); | ||
} | ||
else { | ||
promise = newDoc.validate(); | ||
if (promise instanceof Promise) promises.push(promise); | ||
} | ||
reduction.push(newDoc) | ||
})(j); | ||
} | ||
result.push({ | ||
group: data.data[i][0], | ||
reduction: reduction | ||
}) | ||
} | ||
else { | ||
newDoc = new self(data.data[i][1]); | ||
newDoc.setSaved(true); | ||
@@ -956,6 +999,8 @@ | ||
if (promise instanceof Promise) { | ||
promise.then(resolve).error(reject); | ||
promise.then(function() { | ||
resolve(result) | ||
}).error(reject); | ||
} | ||
else { | ||
resolve(); | ||
resolve(result); | ||
} | ||
@@ -970,44 +1015,8 @@ }).error(reject); | ||
reduction.push(newDoc) | ||
result.push({ | ||
group: data.data[i][0], | ||
reduction: newDoc | ||
}) | ||
} | ||
result.push({ | ||
group: data.data[i][0], | ||
reduction: reduction | ||
}) | ||
} | ||
else { | ||
newDoc = new self(data.data[i][1]); | ||
newDoc.setSaved(true); | ||
newDoc._emitRetrieve(); | ||
promise = util.hook({ | ||
postHooks: newDoc._getModel()._post.retrieve, | ||
doc: newDoc, | ||
async: newDoc._getModel()._async.retrieve, | ||
fn: function() {} | ||
}) | ||
if (promise instanceof Promise) { | ||
promise.then(function() { | ||
var promise = newDoc.validate(); | ||
if (promise instanceof Promise) { | ||
promise.then(resolve).error(reject); | ||
} | ||
else { | ||
resolve(); | ||
} | ||
}).error(reject); | ||
promises.push(promise); | ||
} | ||
else { | ||
promise = newDoc.validate(); | ||
if (promise instanceof Promise) promises.push(promise); | ||
} | ||
result.push({ | ||
group: data.data[i][0], | ||
reduction: newDoc | ||
}) | ||
} | ||
})(i); | ||
} | ||
@@ -1045,3 +1054,5 @@ }, reject); | ||
if (promise instanceof Promise) { | ||
promise.then(resolve).error(reject); | ||
promise.then(function() { | ||
resolve(newDoc); | ||
}).error(reject); | ||
} | ||
@@ -1048,0 +1059,0 @@ else { |
{ | ||
"name": "thinky", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "RethinkDB ORM for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/thinky.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
217569
5857