@@ -12,7 +12,7 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
12
12
13
13
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
14
14
15
- var _componentMap = null ;
15
+ var _componentMap = new WeakMap ( ) ;
16
16
17
17
var ReactJsonSchema = function ( ) {
18
18
function ReactJsonSchema ( ) {
@@ -34,7 +34,7 @@ var ReactJsonSchema = function () {
34
34
} , {
35
35
key : 'parseSubSchemas' ,
36
36
value : function parseSubSchemas ( ) {
37
- var subSchemas = arguments . length <= 0 || arguments [ 0 ] === undefined ? [ ] : arguments [ 0 ] ;
37
+ var subSchemas = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : [ ] ;
38
38
39
39
var Components = [ ] ;
40
40
var index = 0 ;
@@ -70,11 +70,10 @@ var ReactJsonSchema = function () {
70
70
} , {
71
71
key : 'createComponent' ,
72
72
value : function createComponent ( schema ) {
73
- var component = schema . component ;
74
- var children = schema . children ;
75
- var text = schema . text ;
76
-
77
- var rest = _objectWithoutProperties ( schema , [ 'component' , 'children' , 'text' ] ) ;
73
+ var component = schema . component ,
74
+ children = schema . children ,
75
+ text = schema . text ,
76
+ rest = _objectWithoutProperties ( schema , [ 'component' , 'children' , 'text' ] ) ;
78
77
79
78
var Component = this . resolveComponent ( schema ) ;
80
79
var Children = typeof text !== 'undefined' ? text : this . resolveComponentChildren ( schema ) ;
@@ -83,6 +82,7 @@ var ReactJsonSchema = function () {
83
82
} , {
84
83
key : 'resolveComponent' ,
85
84
value : function resolveComponent ( schema ) {
85
+ var _componentMap = this . getComponentMap ( ) ;
86
86
var Component = null ;
87
87
if ( schema . hasOwnProperty ( 'component' ) ) {
88
88
if ( schema . component === Object ( schema . component ) ) {
@@ -105,12 +105,12 @@ var ReactJsonSchema = function () {
105
105
} , {
106
106
key : 'getComponentMap' ,
107
107
value : function getComponentMap ( ) {
108
- return _componentMap ;
108
+ return _componentMap . get ( this ) ;
109
109
}
110
110
} , {
111
111
key : 'setComponentMap' ,
112
112
value : function setComponentMap ( componentMap ) {
113
- _componentMap = componentMap ;
113
+ _componentMap . set ( this , componentMap ) ;
114
114
}
115
115
} ] ) ;
116
116
0 commit comments