File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 2
2
* @flow
3
3
*/
4
4
import Reference from './reference.js' ;
5
- import { isObject , deepGet } from './../../utils' ;
5
+ import { isObject , deepGet , deepExists } from './../../utils' ;
6
6
7
7
export default class Snapshot {
8
8
static key : String ;
@@ -26,6 +26,7 @@ export default class Snapshot {
26
26
this . priority = snapshot . priority === undefined ? null : snapshot . priority ;
27
27
this . childKeys = snapshot . childKeys || [ ] ;
28
28
}
29
+
29
30
/*
30
31
* DEFAULT API METHODS
31
32
*/
@@ -50,15 +51,15 @@ export default class Snapshot {
50
51
}
51
52
52
53
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 ) ) ;
54
55
}
55
56
56
57
getPriority ( ) {
57
58
return this . priority ;
58
59
}
59
60
60
- hasChild ( key : string ) {
61
- return this . childKeys . includes ( key ) ;
61
+ hasChild ( path : string ) {
62
+ return deepExists ( this . value , path ) ;
62
63
}
63
64
64
65
hasChildren ( ) {
You can’t perform that action at this time.
0 commit comments