@@ -12,7 +12,7 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
1212
1313function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
1414
15- var _componentMap = null ;
15+ var _componentMap = new WeakMap ( ) ;
1616
1717var ReactJsonSchema = function ( ) {
1818 function ReactJsonSchema ( ) {
@@ -34,7 +34,7 @@ var ReactJsonSchema = function () {
3434 } , {
3535 key : 'parseSubSchemas' ,
3636 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 ] : [ ] ;
3838
3939 var Components = [ ] ;
4040 var index = 0 ;
@@ -70,11 +70,10 @@ var ReactJsonSchema = function () {
7070 } , {
7171 key : 'createComponent' ,
7272 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' ] ) ;
7877
7978 var Component = this . resolveComponent ( schema ) ;
8079 var Children = typeof text !== 'undefined' ? text : this . resolveComponentChildren ( schema ) ;
@@ -83,6 +82,7 @@ var ReactJsonSchema = function () {
8382 } , {
8483 key : 'resolveComponent' ,
8584 value : function resolveComponent ( schema ) {
85+ var _componentMap = this . getComponentMap ( ) ;
8686 var Component = null ;
8787 if ( schema . hasOwnProperty ( 'component' ) ) {
8888 if ( schema . component === Object ( schema . component ) ) {
@@ -105,12 +105,12 @@ var ReactJsonSchema = function () {
105105 } , {
106106 key : 'getComponentMap' ,
107107 value : function getComponentMap ( ) {
108- return _componentMap ;
108+ return _componentMap . get ( this ) ;
109109 }
110110 } , {
111111 key : 'setComponentMap' ,
112112 value : function setComponentMap ( componentMap ) {
113- _componentMap = componentMap ;
113+ _componentMap . set ( this , componentMap ) ;
114114 }
115115 } ] ) ;
116116
0 commit comments