@@ -7,7 +7,6 @@ var autoId = require('firebase-auto-ids');
77var Query = require ( './query' ) ;
88var Snapshot = require ( './snapshot' ) ;
99var Queue = require ( './queue' ) . Queue ;
10- var Timestamp = require ( './timestamp' ) ;
1110var utils = require ( './utils' ) ;
1211var Auth = require ( './firebase-auth' ) ;
1312var validate = require ( './validators' ) ;
@@ -187,11 +186,11 @@ MockFirebase.prototype.update = function (changes, callback) {
187186 self . _defer ( 'update' , _ . toArray ( arguments ) , function ( ) {
188187 if ( ! err ) {
189188 var base = self . getData ( ) ;
190- var data = _ . isPlainObject ( base ) ? base : { } ;
189+ var data = _ . isObject ( base ) ? base : { } ;
191190 // operate as a multi-set
192191 _ . keys ( changes ) . forEach ( function ( key ) {
193192 var val = changes [ key ] ;
194- _ . set ( data , key . replace ( / ^ \/ / , '' ) . replace ( / \/ / g, '.' ) , _ . isPlainObject ( val ) ? utils . updateToRtdbObject ( val ) : val ) ;
193+ _ . set ( data , key . replace ( / ^ \/ / , '' ) . replace ( / \/ / g, '.' ) , _ . isObject ( val ) ? utils . updateToRtdbObject ( val ) : val ) ;
195194 } ) ;
196195 data = utils . removeEmptyRtdbProperties ( data ) ;
197196 self . _dataChanged ( data ) ;
@@ -445,16 +444,16 @@ MockFirebase.prototype._dataChanged = function (unparsedData) {
445444 var data = utils . cleanData ( unparsedData ) ;
446445
447446 if ( utils . isServerTimestamp ( data ) ) {
448- data = Timestamp . fromMillis ( utils . getServerTime ( ) ) ;
447+ data = utils . getServerTime ( ) ;
449448 }
450449
451450 if ( pri !== this . priority ) {
452451 this . _priChanged ( pri ) ;
453452 }
454453 if ( ! _ . isEqual ( data , this . data ) ) {
455454 // _.keys() in Lodash 3 automatically coerces non-object to object
456- var oldKeys = _ . isPlainObject ( this . data ) ? _ . keys ( this . data ) . sort ( ) : [ ] ;
457- var newKeys = _ . isPlainObject ( data ) ? _ . keys ( data ) . sort ( ) : [ ] ;
455+ var oldKeys = _ . isObject ( this . data ) ? _ . keys ( this . data ) . sort ( ) : [ ] ;
456+ var newKeys = _ . isObject ( data ) ? _ . keys ( data ) . sort ( ) : [ ] ;
458457 var keysToRemove = _ . difference ( oldKeys , newKeys ) ;
459458 var keysToChange = _ . difference ( newKeys , keysToRemove ) ;
460459 var events = [ ] ;
@@ -463,22 +462,22 @@ MockFirebase.prototype._dataChanged = function (unparsedData) {
463462 self . _removeChild ( key , events ) ;
464463 } ) ;
465464
466- if ( ! _ . isPlainObject ( data ) ) {
465+ if ( ! _ . isObject ( data ) ) {
467466 events . push ( false ) ;
468467 this . data = data ;
469468 }
470469 else {
471470 keysToChange . forEach ( function ( key ) {
472471 var childData = unparsedData [ key ] ;
473472 if ( utils . isServerTimestamp ( childData ) ) {
474- childData = Timestamp . fromMillis ( utils . getServerTime ( ) ) ;
473+ childData = utils . getServerTime ( ) ;
475474 }
476475 self . _updateOrAdd ( key , childData , events ) ;
477476 } ) ;
478477 }
479478
480479 // update order of my child keys
481- if ( _ . isPlainObject ( this . data ) )
480+ if ( _ . isObject ( this . data ) )
482481 this . _resort ( ) ;
483482
484483 // trigger parent notifications after all children have
@@ -489,7 +488,7 @@ MockFirebase.prototype._dataChanged = function (unparsedData) {
489488
490489MockFirebase . prototype . _priChanged = function ( newPriority ) {
491490 if ( utils . isServerTimestamp ( newPriority ) ) {
492- newPriority = Timestamp . fromMillis ( utils . getServerTime ( ) ) ;
491+ newPriority = utils . getServerTime ( ) ;
493492 }
494493 this . priority = newPriority ;
495494 if ( this . parent ) {
@@ -574,7 +573,7 @@ MockFirebase.prototype._triggerAll = function (events) {
574573} ;
575574
576575MockFirebase . prototype . _updateOrAdd = function ( key , data , events ) {
577- var exists = _ . isPlainObject ( this . data ) && this . data . hasOwnProperty ( key ) ;
576+ var exists = _ . isObject ( this . data ) && this . data . hasOwnProperty ( key ) ;
578577 if ( ! exists ) {
579578 return this . _addChild ( key , data , events ) ;
580579 }
@@ -584,7 +583,7 @@ MockFirebase.prototype._updateOrAdd = function (key, data, events) {
584583} ;
585584
586585MockFirebase . prototype . _addChild = function ( key , data , events ) {
587- if ( ! _ . isPlainObject ( this . data ) ) {
586+ if ( ! _ . isObject ( this . data ) ) {
588587 this . data = { } ;
589588 }
590589 this . _addKey ( key ) ;
@@ -611,7 +610,7 @@ MockFirebase.prototype._removeChild = function (key, events) {
611610
612611MockFirebase . prototype . _updateChild = function ( key , data , events ) {
613612 var cdata = utils . cleanData ( data ) ;
614- if ( _ . isPlainObject ( this . data ) && _ . has ( this . data , key ) && ! _ . isEqual ( this . data [ key ] , cdata ) ) {
613+ if ( _ . isObject ( this . data ) && _ . has ( this . data , key ) && ! _ . isEqual ( this . data [ key ] , cdata ) ) {
615614 this . data [ key ] = cdata ;
616615 var c = this . child ( key ) ;
617616 c . _dataChanged ( data ) ;
@@ -630,7 +629,7 @@ MockFirebase.prototype._nextErr = function (type) {
630629} ;
631630
632631MockFirebase . prototype . _hasChild = function ( key ) {
633- return _ . isPlainObject ( this . data ) && _ . has ( this . data , key ) ;
632+ return _ . isObject ( this . data ) && _ . has ( this . data , key ) ;
634633} ;
635634
636635MockFirebase . prototype . _childData = function ( key ) {
0 commit comments