Skip to content

Commit c8c2eb2

Browse files
authored
Migrate instances of lodash.assign to object.assign (#2757)
1 parent 365f34b commit c8c2eb2

File tree

95 files changed

+627
-504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+627
-504
lines changed

.changeset/brave-cycles-matter.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
"victory-area": patch
3+
"victory-axis": patch
4+
"victory-bar": patch
5+
"victory-box-plot": patch
6+
"victory-brush-container": patch
7+
"victory-brush-line": patch
8+
"victory-candlestick": patch
9+
"victory-canvas": patch
10+
"victory-chart": patch
11+
"victory-core": patch
12+
"victory-cursor-container": patch
13+
"victory-errorbar": patch
14+
"victory-group": patch
15+
"victory-histogram": patch
16+
"victory-legend": patch
17+
"victory-line": patch
18+
"victory-native": patch
19+
"victory-pie": patch
20+
"victory-polar-axis": patch
21+
"victory-scatter": patch
22+
"victory-selection-container": patch
23+
"victory-shared-events": patch
24+
"victory-stack": patch
25+
"victory-tooltip": patch
26+
"victory-voronoi": patch
27+
"victory-voronoi-container": patch
28+
"victory": patch
29+
"victory-create-container": patch
30+
"victory-vendor": patch
31+
"victory-zoom-container": patch
32+
---
33+
34+
Replace instances of lodash.assign with Object.assign

demo/js/components/events-demo.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { VictoryArea } from "victory-area";
66
import { VictoryBar } from "victory-bar";
77
import { VictoryLine } from "victory-line";
88
import { VictoryTheme, VictoryLabel } from "victory-core";
9-
import { merge } from "lodash";
109

1110
class App extends React.Component {
1211
render() {
@@ -104,7 +103,7 @@ class App extends React.Component {
104103
target: "data",
105104
mutation: (props) => {
106105
return {
107-
style: merge({}, props.style, { stroke: "lime" }),
106+
style: Object.assign({}, props.style, { stroke: "lime" }),
108107
};
109108
},
110109
},
@@ -113,7 +112,7 @@ class App extends React.Component {
113112
target: "labels",
114113
mutation: (props) => {
115114
return {
116-
style: merge({}, props.style, { fill: "green" }),
115+
style: Object.assign({}, props.style, { fill: "green" }),
117116
text: "waddup",
118117
};
119118
},

demo/js/components/external-events-demo.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { VictoryBar } from "victory-bar";
88
import { VictoryLine } from "victory-line";
99
import { VictoryZoomContainer } from "victory-zoom-container";
1010
import { VictoryVoronoiContainer } from "victory-voronoi-container";
11-
import { range, assign } from "lodash";
11+
import { range } from "lodash";
1212

1313
class App extends React.Component {
1414
constructor() {
@@ -52,8 +52,8 @@ class App extends React.Component {
5252
mutation: (props) => {
5353
const fill = props.style && props.style.fill;
5454
return fill === "blue"
55-
? { style: assign({}, props.style, { fill: "red" }) }
56-
: { style: assign({}, props.style, { fill: "blue" }) };
55+
? { style: Object.assign({}, props.style, { fill: "red" }) }
56+
: { style: Object.assign({}, props.style, { fill: "blue" }) };
5757
},
5858
callback,
5959
},

demo/js/components/immutable-demo.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-magic-numbers, react/no-multi-comp */
22
import React from "react";
33
import PropTypes from "prop-types";
4-
import { assign, merge, keys, random, range, round } from "lodash";
4+
import { keys, random, range, round } from "lodash";
55
import { fromJS } from "immutable";
66
import { VictoryClipContainer, VictoryLabel, VictoryTheme } from "victory-core";
77

@@ -36,7 +36,7 @@ class Wrapper extends React.Component {
3636
renderChildren(props) {
3737
const children = React.Children.toArray(props.children);
3838
return children.map((child) => {
39-
return React.cloneElement(child, assign({}, child.props, props));
39+
return React.cloneElement(child, Object.assign({}, child.props, props));
4040
});
4141
}
4242

@@ -214,7 +214,7 @@ class App extends React.Component {
214214
target: "data",
215215
mutation: (props) => {
216216
return {
217-
style: merge({}, props.style, { fill: "gold" }),
217+
style: Object.assign({}, props.style, { fill: "gold" }),
218218
};
219219
},
220220
},
@@ -223,7 +223,7 @@ class App extends React.Component {
223223
target: "data",
224224
mutation: (props) => {
225225
return {
226-
style: merge({}, props.style, { fill: "orange" }),
226+
style: Object.assign({}, props.style, { fill: "orange" }),
227227
};
228228
},
229229
},
@@ -232,7 +232,7 @@ class App extends React.Component {
232232
target: "data",
233233
mutation: (props) => {
234234
return {
235-
style: merge({}, props.style, { fill: "red" }),
235+
style: Object.assign({}, props.style, { fill: "red" }),
236236
};
237237
},
238238
},
@@ -344,7 +344,7 @@ class App extends React.Component {
344344

345345
<svg height={500} width={500}>
346346
<VictoryCandlestick
347-
style={merge({}, chartStyle, { data: { width: 10 } })}
347+
style={Object.assign({}, chartStyle, { data: { width: 10 } })}
348348
data={fromJS([
349349
{
350350
x: new Date(2016, 6, 1),
@@ -414,7 +414,7 @@ class App extends React.Component {
414414
{
415415
mutation: (props) => {
416416
return {
417-
style: merge({}, props.style.labels, {
417+
style: Object.assign({}, props.style.labels, {
418418
fill: "orange",
419419
}),
420420
};
@@ -432,7 +432,7 @@ class App extends React.Component {
432432
{
433433
mutation: (props) => {
434434
return {
435-
style: merge({}, props.style, { fill: "blue" }),
435+
style: Object.assign({}, props.style, { fill: "blue" }),
436436
};
437437
},
438438
},
@@ -468,7 +468,7 @@ class App extends React.Component {
468468
target: "data",
469469
mutation: (props) => {
470470
return {
471-
style: merge({}, props.style, { stroke: "lime" }),
471+
style: Object.assign({}, props.style, { stroke: "lime" }),
472472
};
473473
},
474474
},
@@ -477,7 +477,7 @@ class App extends React.Component {
477477
target: "labels",
478478
mutation: (props) => {
479479
return {
480-
style: merge({}, props.style, { fill: "green" }),
480+
style: Object.assign({}, props.style, { fill: "green" }),
481481
text: "waddup",
482482
};
483483
},
@@ -572,7 +572,7 @@ class App extends React.Component {
572572
</VictoryChart>
573573

574574
<VictoryVoronoi
575-
style={merge({}, chartStyle, {
575+
style={Object.assign({}, chartStyle, {
576576
data: {
577577
fill: "gray",
578578
opacity: 0.1,
@@ -631,7 +631,7 @@ class App extends React.Component {
631631
target: "data",
632632
mutation: (props) => {
633633
return {
634-
style: merge({}, props.style, { fill: "gold" }),
634+
style: Object.assign({}, props.style, { fill: "gold" }),
635635
};
636636
},
637637
},
@@ -640,7 +640,7 @@ class App extends React.Component {
640640
target: "data",
641641
mutation: (props) => {
642642
return {
643-
style: merge({}, props.style, { fill: "orange" }),
643+
style: Object.assign({}, props.style, { fill: "orange" }),
644644
};
645645
},
646646
},
@@ -649,7 +649,7 @@ class App extends React.Component {
649649
target: "data",
650650
mutation: (props) => {
651651
return {
652-
style: merge({}, props.style, { fill: "red" }),
652+
style: Object.assign({}, props.style, { fill: "red" }),
653653
};
654654
},
655655
},

demo/js/components/victory-area-demo.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-magic-numbers */
22
import React from "react";
3-
import { merge, random, range } from "lodash";
3+
import { random, range } from "lodash";
44
import { VictoryChart } from "victory-chart";
55
import { VictoryStack } from "victory-stack";
66
import { VictoryGroup } from "victory-group";
@@ -278,7 +278,7 @@ export default class App extends React.Component {
278278
target: "data",
279279
mutation: (props) => {
280280
return {
281-
style: merge({}, props.style, { fill: "orange" }),
281+
style: Object.assign({}, props.style, { fill: "orange" }),
282282
};
283283
},
284284
},

demo/js/components/victory-axis-demo.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
VictoryContainer,
77
VictoryTheme,
88
} from "victory-core";
9-
import { merge, random, range } from "lodash";
9+
import { random, range } from "lodash";
1010
import XYTheme from "../theme/victory-axis-differential-styling-theme";
1111

1212
export default class App extends React.Component {
@@ -122,7 +122,7 @@ export default class App extends React.Component {
122122
{
123123
mutation: (props) => {
124124
return {
125-
style: merge({}, props.style, { stroke: "orange" }),
125+
style: Object.assign({}, props.style, { stroke: "orange" }),
126126
};
127127
},
128128
},

demo/js/components/victory-bar-demo.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
VictoryTheme,
1313
VictoryLabel,
1414
} from "victory-core";
15-
import { assign, random, range, merge } from "lodash";
15+
import { random, range } from "lodash";
1616

1717
class Wrapper extends React.Component {
1818
static propTypes = {
@@ -25,7 +25,7 @@ class Wrapper extends React.Component {
2525
renderChildren(props) {
2626
const children = React.Children.toArray(props.children);
2727
return children.map((child) => {
28-
return React.cloneElement(child, assign({}, child.props, props));
28+
return React.cloneElement(child, Object.assign({}, child.props, props));
2929
});
3030
}
3131

@@ -262,7 +262,7 @@ export default class App extends React.Component {
262262
{
263263
mutation: (props) => {
264264
return {
265-
style: merge({}, props.style, { fill: "orange" }),
265+
style: Object.assign({}, props.style, { fill: "orange" }),
266266
};
267267
},
268268
},
@@ -399,7 +399,7 @@ export default class App extends React.Component {
399399
{
400400
mutation: (props) => {
401401
return {
402-
style: merge({}, props.style, { fill: "orange" }),
402+
style: Object.assign({}, props.style, { fill: "orange" }),
403403
};
404404
},
405405
},
@@ -425,7 +425,7 @@ export default class App extends React.Component {
425425
{
426426
mutation: (props) => {
427427
return {
428-
style: merge({}, props.style, { fill: "blue" }),
428+
style: Object.assign({}, props.style, { fill: "blue" }),
429429
};
430430
},
431431
},
@@ -449,7 +449,7 @@ export default class App extends React.Component {
449449
childName: "secondBar",
450450
mutation: (props) => {
451451
return {
452-
style: merge({}, props.style, { fill: "blue" }),
452+
style: Object.assign({}, props.style, { fill: "blue" }),
453453
};
454454
},
455455
};
@@ -469,14 +469,14 @@ export default class App extends React.Component {
469469
return props.style.fill === "cyan"
470470
? null
471471
: {
472-
style: merge({}, props.style, { fill: "cyan" }),
472+
style: Object.assign({}, props.style, { fill: "cyan" }),
473473
};
474474
},
475475
},
476476
{
477477
mutation: (props) => {
478478
return {
479-
style: merge({}, props.style, { fill: "orange" }),
479+
style: Object.assign({}, props.style, { fill: "orange" }),
480480
};
481481
},
482482
},

demo/js/components/victory-candlestick-demo.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-magic-numbers */
22
import React from "react";
33
import PropTypes from "prop-types";
4-
import { random, range, merge } from "lodash";
4+
import { random, range } from "lodash";
55
import { VictoryChart } from "victory-chart";
66
import { VictoryCandlestick } from "victory-candlestick";
77
import { VictoryTheme } from "victory-core";
@@ -98,7 +98,7 @@ export default class App extends React.Component {
9898
{
9999
mutation: (props) => {
100100
return {
101-
style: merge({}, props.style.labels, {
101+
style: Object.assign({}, props.style.labels, {
102102
fill: "orange",
103103
}),
104104
};
@@ -116,7 +116,7 @@ export default class App extends React.Component {
116116
{
117117
mutation: (props) => {
118118
return {
119-
style: merge({}, props.style, { fill: "blue" }),
119+
style: Object.assign({}, props.style, { fill: "blue" }),
120120
};
121121
},
122122
},
@@ -149,7 +149,7 @@ export default class App extends React.Component {
149149
{
150150
mutation: (props) => {
151151
return {
152-
style: merge({}, props.style.labels, {
152+
style: Object.assign({}, props.style.labels, {
153153
fill: "orange",
154154
}),
155155
};
@@ -167,7 +167,7 @@ export default class App extends React.Component {
167167
{
168168
mutation: (props) => {
169169
return {
170-
style: merge({}, props.style, { fill: "blue" }),
170+
style: Object.assign({}, props.style, { fill: "blue" }),
171171
};
172172
},
173173
},

0 commit comments

Comments
 (0)