@@ -215,7 +215,7 @@ Bucket.prototype.reload = function() {
215215 */
216216Bucket . prototype . add = function ( data , callback ) {
217217 var id = uuid ( ) ;
218- return this . update ( { id, data } , callback ) ;
218+ return this . update ( id , data , callback ) ;
219219} ;
220220
221221/**
@@ -245,8 +245,11 @@ Bucket.prototype.get = function( id, callback ) {
245245 */
246246Bucket . prototype . update = function ( id , data , updateInfo , options , callback ) {
247247 // Callback could be 3rd or 4th argument
248- if ( typeof updateInfo === 'function' || typeof options === 'function' ) {
249- callback = typeof updateInfo === 'function' ? updateInfo : options ;
248+ if ( typeof updateInfo === 'function' ) {
249+ callback = updateInfo ;
250+ options = { sync : true } ;
251+ } else if ( typeof options === 'function' ) {
252+ callback = options ;
250253 options = { sync : true } ;
251254 }
252255
@@ -308,7 +311,7 @@ Bucket.prototype.getVersion = function( id, callback ) {
308311 */
309312Bucket . prototype . touch = function ( id , callback ) {
310313 const task = this . storeAPI . get ( id )
311- . then ( object => this . update ( { id : object . id , data : object . data } ) ) ;
314+ . then ( object => this . update ( object . id , object . data ) ) ;
312315
313316 return deprecateCallback ( callback , task ) ;
314317} ;
0 commit comments