Comparing version 2.0.4 to 2.0.5
16
cot.js
@@ -164,9 +164,14 @@ // Generated by CoffeeScript 1.10.0 | ||
var db, tryIt; | ||
db = this; | ||
tryIt = function() { | ||
return db.exists(docId).then(function(doc) { | ||
return fn(doc || { | ||
_id: docId | ||
}); | ||
return db.get(docId)["catch"](function(err) { | ||
if (err.statusCode === 404) { | ||
return { | ||
_id: docId | ||
}; | ||
} else { | ||
throw err; | ||
} | ||
}).then(function(doc) { | ||
return db.put(doc); | ||
return db.put(fn(doc)); | ||
}).then(function(res) { | ||
@@ -180,3 +185,2 @@ if (res.ok) { | ||
}; | ||
db = this; | ||
return tryIt(); | ||
@@ -183,0 +187,0 @@ }, |
@@ -19,3 +19,3 @@ { | ||
}, | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"main": "cot.js", | ||
@@ -22,0 +22,0 @@ "dependencies": { |
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
67381
278