summaryrefslogtreecommitdiff
path: root/share/www/script/couch.js
diff options
context:
space:
mode:
Diffstat (limited to 'share/www/script/couch.js')
-rw-r--r--share/www/script/couch.js30
1 files changed, 15 insertions, 15 deletions
diff --git a/share/www/script/couch.js b/share/www/script/couch.js
index 2f15737d..cf26bb2e 100644
--- a/share/www/script/couch.js
+++ b/share/www/script/couch.js
@@ -243,22 +243,22 @@ CouchDB.request = function(method, uri, options) {
CouchDB.uuids_cache = [];
CouchDB.newUuids = function(n) {
- if (CouchDB.uuids_cache.length >= n) {
- var uuids = CouchDB.uuids_cache.slice(CouchDB.uuids_cache.length - n);
- if(CouchDB.uuids_cache.length - n == 0) {
- CouchDB.uuids_cache = [];
- } else {
- CouchDB.uuids_cache =
- CouchDB.uuids_cache.slice(0, CouchDB.uuids_cache.length - n);
- }
- return uuids;
+ if (CouchDB.uuids_cache.length >= n) {
+ var uuids = CouchDB.uuids_cache.slice(CouchDB.uuids_cache.length - n);
+ if(CouchDB.uuids_cache.length - n == 0) {
+ CouchDB.uuids_cache = [];
} else {
- var req = CouchDB.request("POST", "/_uuids?count=" + (100 + n));
- var result = JSON.parse(req.responseText);
- if (req.status != 200)
- throw result;
CouchDB.uuids_cache =
- CouchDB.uuids_cache.concat(result.uuids.slice(0, 100));
- return result.uuids.slice(100);
+ CouchDB.uuids_cache.slice(0, CouchDB.uuids_cache.length - n);
}
+ return uuids;
+ } else {
+ var req = CouchDB.request("POST", "/_uuids?count=" + (100 + n));
+ var result = JSON.parse(req.responseText);
+ if (req.status != 200)
+ throw result;
+ CouchDB.uuids_cache =
+ CouchDB.uuids_cache.concat(result.uuids.slice(0, 100));
+ return result.uuids.slice(100);
}
+}