File tree Expand file tree Collapse file tree 3 files changed +25
-17
lines changed Expand file tree Collapse file tree 3 files changed +25
-17
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @secjs/utils" ,
3- "version" : " 1.7.0 " ,
3+ "version" : " 1.7.1 " ,
44 "description" : " " ,
55 "license" : " MIT" ,
66 "author" : " João Lenon" ,
2424 "@types/debug" : " 4.1.5" ,
2525 "@types/jest" : " 27.0.1" ,
2626 "@types/kind-of" : " 6.0.0" ,
27+ "@types/lodash" : " 4.14.178" ,
2728 "@types/mime-types" : " 2.1.1" ,
2829 "@types/ms" : " 0.7.31" ,
2930 "@types/node" : " 14.17.0" ,
168169 "change-case" : " 4.1.2" ,
169170 "http-status-codes" : " 2.2.0" ,
170171 "kind-of" : " 6.0.3" ,
172+ "lodash" : " 4.17.21" ,
171173 "mime-types" : " 2.1.34" ,
172174 "ms" : " 2.1.3" ,
173175 "pluralize" : " 8.0.0" ,
Original file line number Diff line number Diff line change 77 * file that was distributed with this source code.
88 */
99
10+ import { cloneDeep } from 'lodash'
11+
1012export class Json {
1113 /**
1214 * Deep copy any object properties without reference
1315 *
1416 * @param object The object to be copied
1517 * @return A copy from object without any reference
1618 */
17- static copy < T > ( object : T ) : T {
18- const copy : any = { }
19-
20- for ( const i in object ) {
21- const item = object [ i ]
22- copy [ i ] =
23- item != null && typeof item === 'object' ? this . copy ( item ) : item
24- }
25-
26- return copy
19+ static copy < T = any > ( object : T ) : T {
20+ return cloneDeep ( object )
2721 }
2822
2923 /**
You can’t perform that action at this time.
0 commit comments