Skip to content

Commit 3f7aea7

Browse files
committed
removed dependency to loaddash
1 parent 8158f0a commit 3f7aea7

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
},
5656
"dependencies": {
5757
"global-input-message": "^1.7.2",
58-
"lodash": "^4.17.15",
5958
"qrcode.react": "^0.9.3",
6059
"react": "^16.9.0"
6160
}

src/index.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, {Component} from 'react';
22
import {createMessageConnector,encrypt,decrypt} from "global-input-message";
3-
import cloneDeep from "lodash/cloneDeep";
43
import DisplayQRCode from "./DisplayQRCode";
54
export class GlobalInputConnect extends Component {
65
RENDER_TYPE={
@@ -66,7 +65,34 @@ export class GlobalInputConnect extends Component {
6665
message:"form is missing in initData of the mobileConfig in the GlobalInputConnect component"
6766
}
6867
}
69-
this.mobileConfig=cloneDeep(this.props.mobileConfig);
68+
var simpleClone=function(obj) {
69+
var copy;
70+
if (null == obj || "object" != typeof obj) {
71+
return obj;
72+
}
73+
if (obj instanceof Date) {
74+
copy = new Date();
75+
copy.setTime(obj.getTime());
76+
return copy;
77+
}
78+
if (obj instanceof Array) {
79+
copy = [];
80+
for (var i = 0, len = obj.length; i < len; i++) {
81+
copy[i] = simpleClone(obj[i]);
82+
}
83+
return copy;
84+
}
85+
if (obj instanceof Object) {
86+
copy = {};
87+
for (var attr in obj) {
88+
if (obj.hasOwnProperty(attr)) copy[attr] = simpleClone(obj[attr]);
89+
}
90+
return copy;
91+
}
92+
throw new Error("Unable to copy obj! Its type isn't supported.");
93+
};
94+
95+
this.mobileConfig=simpleClone(this.props.mobileConfig);
7096
this.mobileConfig.onRegistered=next=>{
7197
next();
7298
this.onGlobalInputConnected();

0 commit comments

Comments
 (0)