Skip to content

Commit 5751ada

Browse files
committed
Rebuilt.
1 parent 8a3f5d4 commit 5751ada

File tree

5 files changed

+66
-66
lines changed

5 files changed

+66
-66
lines changed

dist/arango.all.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -302,48 +302,48 @@ extend(BaseCollection.prototype, {
302302
});
303303
return promise;
304304
},
305-
createHashIndex: function createHashIndex(fields, unique, cb) {
306-
if (typeof unique === 'function') {
307-
cb = unique;
308-
unique = undefined;
305+
createHashIndex: function createHashIndex(fields, opts, cb) {
306+
if (typeof opts === 'function') {
307+
cb = opts;
308+
opts = undefined;
309309
}
310310
if (typeof fields === 'string') {
311311
fields = [fields];
312312
}
313+
if (typeof opts === 'boolean') {
314+
opts = { unique: opts };
315+
}
313316

314317
var _connection$promisify14 = this._connection.promisify(cb);
315318

316319
var promise = _connection$promisify14.promise;
317320
var callback = _connection$promisify14.callback;
318321

319-
this._api.post('index', {
320-
type: 'hash',
321-
fields: fields,
322-
unique: Boolean(unique)
323-
}, { collection: this.name }, function (err, res) {
322+
opts = extend({ unique: false }, opts, { type: 'hash', fields: fields });
323+
this._api.post('index', opts, { collection: this.name }, function (err, res) {
324324
if (err) callback(err);else callback(null, res.body);
325325
});
326326
return promise;
327327
},
328-
createSkipList: function createSkipList(fields, unique, cb) {
329-
if (typeof unique === 'function') {
330-
cb = unique;
331-
unique = undefined;
328+
createSkipList: function createSkipList(fields, opts, cb) {
329+
if (typeof opts === 'function') {
330+
cb = opts;
331+
opts = undefined;
332332
}
333333
if (typeof fields === 'string') {
334334
fields = [fields];
335335
}
336+
if (typeof opts === 'boolean') {
337+
opts = { unique: opts };
338+
}
336339

337340
var _connection$promisify15 = this._connection.promisify(cb);
338341

339342
var promise = _connection$promisify15.promise;
340343
var callback = _connection$promisify15.callback;
341344

342-
this._api.post('index', {
343-
type: 'skiplist',
344-
fields: fields,
345-
unique: Boolean(unique)
346-
}, { collection: this.name }, function (err, res) {
345+
opts = extend({ unique: false }, opts, { type: 'skiplist', fields: fields });
346+
this._api.post('index', opts, { collection: this.name }, function (err, res) {
347347
if (err) callback(err);else callback(null, res.body);
348348
});
349349
return promise;

dist/arango.all.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/arango.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -302,48 +302,48 @@ extend(BaseCollection.prototype, {
302302
});
303303
return promise;
304304
},
305-
createHashIndex: function createHashIndex(fields, unique, cb) {
306-
if (typeof unique === 'function') {
307-
cb = unique;
308-
unique = undefined;
305+
createHashIndex: function createHashIndex(fields, opts, cb) {
306+
if (typeof opts === 'function') {
307+
cb = opts;
308+
opts = undefined;
309309
}
310310
if (typeof fields === 'string') {
311311
fields = [fields];
312312
}
313+
if (typeof opts === 'boolean') {
314+
opts = { unique: opts };
315+
}
313316

314317
var _connection$promisify14 = this._connection.promisify(cb);
315318

316319
var promise = _connection$promisify14.promise;
317320
var callback = _connection$promisify14.callback;
318321

319-
this._api.post('index', {
320-
type: 'hash',
321-
fields: fields,
322-
unique: Boolean(unique)
323-
}, { collection: this.name }, function (err, res) {
322+
opts = extend({ unique: false }, opts, { type: 'hash', fields: fields });
323+
this._api.post('index', opts, { collection: this.name }, function (err, res) {
324324
if (err) callback(err);else callback(null, res.body);
325325
});
326326
return promise;
327327
},
328-
createSkipList: function createSkipList(fields, unique, cb) {
329-
if (typeof unique === 'function') {
330-
cb = unique;
331-
unique = undefined;
328+
createSkipList: function createSkipList(fields, opts, cb) {
329+
if (typeof opts === 'function') {
330+
cb = opts;
331+
opts = undefined;
332332
}
333333
if (typeof fields === 'string') {
334334
fields = [fields];
335335
}
336+
if (typeof opts === 'boolean') {
337+
opts = { unique: opts };
338+
}
336339

337340
var _connection$promisify15 = this._connection.promisify(cb);
338341

339342
var promise = _connection$promisify15.promise;
340343
var callback = _connection$promisify15.callback;
341344

342-
this._api.post('index', {
343-
type: 'skiplist',
344-
fields: fields,
345-
unique: Boolean(unique)
346-
}, { collection: this.name }, function (err, res) {
345+
opts = extend({ unique: false }, opts, { type: 'skiplist', fields: fields });
346+
this._api.post('index', opts, { collection: this.name }, function (err, res) {
347347
if (err) callback(err);else callback(null, res.body);
348348
});
349349
return promise;

dist/arango.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/collection.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -297,48 +297,48 @@ extend(BaseCollection.prototype, {
297297
});
298298
return promise;
299299
},
300-
createHashIndex: function createHashIndex(fields, unique, cb) {
301-
if (typeof unique === 'function') {
302-
cb = unique;
303-
unique = undefined;
300+
createHashIndex: function createHashIndex(fields, opts, cb) {
301+
if (typeof opts === 'function') {
302+
cb = opts;
303+
opts = undefined;
304304
}
305305
if (typeof fields === 'string') {
306306
fields = [fields];
307307
}
308+
if (typeof opts === 'boolean') {
309+
opts = { unique: opts };
310+
}
308311

309312
var _connection$promisify14 = this._connection.promisify(cb);
310313

311314
var promise = _connection$promisify14.promise;
312315
var callback = _connection$promisify14.callback;
313316

314-
this._api.post('index', {
315-
type: 'hash',
316-
fields: fields,
317-
unique: Boolean(unique)
318-
}, { collection: this.name }, function (err, res) {
317+
opts = extend({ unique: false }, opts, { type: 'hash', fields: fields });
318+
this._api.post('index', opts, { collection: this.name }, function (err, res) {
319319
if (err) callback(err);else callback(null, res.body);
320320
});
321321
return promise;
322322
},
323-
createSkipList: function createSkipList(fields, unique, cb) {
324-
if (typeof unique === 'function') {
325-
cb = unique;
326-
unique = undefined;
323+
createSkipList: function createSkipList(fields, opts, cb) {
324+
if (typeof opts === 'function') {
325+
cb = opts;
326+
opts = undefined;
327327
}
328328
if (typeof fields === 'string') {
329329
fields = [fields];
330330
}
331+
if (typeof opts === 'boolean') {
332+
opts = { unique: opts };
333+
}
331334

332335
var _connection$promisify15 = this._connection.promisify(cb);
333336

334337
var promise = _connection$promisify15.promise;
335338
var callback = _connection$promisify15.callback;
336339

337-
this._api.post('index', {
338-
type: 'skiplist',
339-
fields: fields,
340-
unique: Boolean(unique)
341-
}, { collection: this.name }, function (err, res) {
340+
opts = extend({ unique: false }, opts, { type: 'skiplist', fields: fields });
341+
this._api.post('index', opts, { collection: this.name }, function (err, res) {
342342
if (err) callback(err);else callback(null, res.body);
343343
});
344344
return promise;

0 commit comments

Comments
 (0)