File tree Expand file tree Collapse file tree 7 files changed +7146
-3984
lines changed
ast/source/Object/src/lib
file/packages/Object/src/lib Expand file tree Collapse file tree 7 files changed +7146
-3984
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ var PrimitiveType = {
18
18
var InstanceType = {
19
19
OBJECT : Object ,
20
20
ARRAY : Array ,
21
+ SET : Set ,
22
+ MAP : Map ,
21
23
REGEXP : RegExp ,
22
24
DATE : Date
23
25
} ;
@@ -3085,25 +3087,45 @@ var _Object = function (_extendableBuiltin2) {
3085
3087
return copy ;
3086
3088
}
3087
3089
3090
+ if ( item instanceof InstanceType . SET ) {
3091
+ var _copy = new Set ( ) ;
3092
+
3093
+ item . forEach ( function ( v ) {
3094
+ return _copy . add ( _clone ( v ) ) ;
3095
+ } ) ;
3096
+
3097
+ return _copy ;
3098
+ }
3099
+
3100
+ if ( item instanceof InstanceType . MAP ) {
3101
+ var _copy2 = new Map ( ) ;
3102
+
3103
+ item . forEach ( function ( v , k ) {
3104
+ return _copy2 . set ( k , _clone ( v ) ) ;
3105
+ } ) ;
3106
+
3107
+ return _copy2 ;
3108
+ }
3109
+
3088
3110
if ( item instanceof InstanceType . OBJECT ) {
3089
- var _copy = { } ;
3111
+ var _copy3 = { } ;
3090
3112
3091
3113
// $FlowFixMe
3092
3114
Object . getOwnPropertySymbols ( item ) . forEach ( function ( s ) {
3093
- return _copy [ s ] = _clone ( item [ s ] ) ;
3115
+ return _copy3 [ s ] = _clone ( item [ s ] ) ;
3094
3116
} ) ;
3095
3117
3096
3118
if ( includeNonEnumerable ) {
3097
3119
Object . getOwnPropertyNames ( item ) . forEach ( function ( k ) {
3098
- return _copy [ k ] = _clone ( item [ k ] ) ;
3120
+ return _copy3 [ k ] = _clone ( item [ k ] ) ;
3099
3121
} ) ;
3100
3122
} else {
3101
3123
Object . keys ( item ) . forEach ( function ( k ) {
3102
- return _copy [ k ] = _clone ( item [ k ] ) ;
3124
+ return _copy3 [ k ] = _clone ( item [ k ] ) ;
3103
3125
} ) ;
3104
3126
}
3105
3127
3106
- return _copy ;
3128
+ return _copy3 ;
3107
3129
}
3108
3130
3109
3131
throw new Error ( "Unable to copy object: " + item ) ;
Original file line number Diff line number Diff line change 24
24
var InstanceType = {
25
25
OBJECT : Object ,
26
26
ARRAY : Array ,
27
+ SET : Set ,
28
+ MAP : Map ,
27
29
REGEXP : RegExp ,
28
30
DATE : Date
29
31
} ;
3091
3093
return copy ;
3092
3094
}
3093
3095
3096
+ if ( item instanceof InstanceType . SET ) {
3097
+ var _copy = new Set ( ) ;
3098
+
3099
+ item . forEach ( function ( v ) {
3100
+ return _copy . add ( _clone ( v ) ) ;
3101
+ } ) ;
3102
+
3103
+ return _copy ;
3104
+ }
3105
+
3106
+ if ( item instanceof InstanceType . MAP ) {
3107
+ var _copy2 = new Map ( ) ;
3108
+
3109
+ item . forEach ( function ( v , k ) {
3110
+ return _copy2 . set ( k , _clone ( v ) ) ;
3111
+ } ) ;
3112
+
3113
+ return _copy2 ;
3114
+ }
3115
+
3094
3116
if ( item instanceof InstanceType . OBJECT ) {
3095
- var _copy = { } ;
3117
+ var _copy3 = { } ;
3096
3118
3097
3119
// $FlowFixMe
3098
3120
Object . getOwnPropertySymbols ( item ) . forEach ( function ( s ) {
3099
- return _copy [ s ] = _clone ( item [ s ] ) ;
3121
+ return _copy3 [ s ] = _clone ( item [ s ] ) ;
3100
3122
} ) ;
3101
3123
3102
3124
if ( includeNonEnumerable ) {
3103
3125
Object . getOwnPropertyNames ( item ) . forEach ( function ( k ) {
3104
- return _copy [ k ] = _clone ( item [ k ] ) ;
3126
+ return _copy3 [ k ] = _clone ( item [ k ] ) ;
3105
3127
} ) ;
3106
3128
} else {
3107
3129
Object . keys ( item ) . forEach ( function ( k ) {
3108
- return _copy [ k ] = _clone ( item [ k ] ) ;
3130
+ return _copy3 [ k ] = _clone ( item [ k ] ) ;
3109
3131
} ) ;
3110
3132
}
3111
3133
3112
- return _copy ;
3134
+ return _copy3 ;
3113
3135
}
3114
3136
3115
3137
throw new Error ( "Unable to copy object: " + item ) ;
You can’t perform that action at this time.
0 commit comments