File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 22 * @flow
33 */
44import Reference from './reference.js' ;
5- import { isObject , deepGet } from './../../utils' ;
5+ import { isObject , deepGet , deepExists } from './../../utils' ;
66
77export default class Snapshot {
88 static key : String ;
@@ -26,6 +26,7 @@ export default class Snapshot {
2626 this . priority = snapshot . priority === undefined ? null : snapshot . priority ;
2727 this . childKeys = snapshot . childKeys || [ ] ;
2828 }
29+
2930 /*
3031 * DEFAULT API METHODS
3132 */
@@ -50,15 +51,15 @@ export default class Snapshot {
5051 }
5152
5253 forEach ( fn : ( key : any ) = > any ) {
53- ( this . childKeys || [ ] ) . forEach ( ( key , i ) => fn ( this . value [ key ] , i ) ) ;
54+ return this . childKeys . forEach ( ( key , i ) => fn ( this . value [ key ] , i ) ) ;
5455 }
5556
5657 getPriority ( ) {
5758 return this . priority ;
5859 }
5960
60- hasChild ( key : string ) {
61- return this . childKeys . includes ( key ) ;
61+ hasChild ( path : string ) {
62+ return deepExists ( this . value , path ) ;
6263 }
6364
6465 hasChildren ( ) {
You can’t perform that action at this time.
0 commit comments