Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate instances of lodash.assign to object.assign #2757

Merged
merged 5 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .changeset/brave-cycles-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
"victory-area": patch
"victory-axis": patch
"victory-bar": patch
"victory-box-plot": patch
"victory-brush-container": patch
"victory-brush-line": patch
"victory-candlestick": patch
"victory-canvas": patch
"victory-chart": patch
"victory-core": patch
"victory-cursor-container": patch
"victory-errorbar": patch
"victory-group": patch
"victory-histogram": patch
"victory-legend": patch
"victory-line": patch
"victory-native": patch
"victory-pie": patch
"victory-polar-axis": patch
"victory-scatter": patch
"victory-selection-container": patch
"victory-shared-events": patch
"victory-stack": patch
"victory-tooltip": patch
"victory-voronoi": patch
"victory-voronoi-container": patch
"victory": patch
"victory-create-container": patch
"victory-vendor": patch
"victory-zoom-container": patch
---

Replace instances of lodash.assign with Object.assign
5 changes: 2 additions & 3 deletions demo/js/components/events-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { VictoryArea } from "victory-area";
import { VictoryBar } from "victory-bar";
import { VictoryLine } from "victory-line";
import { VictoryTheme, VictoryLabel } from "victory-core";
import { merge } from "lodash";

class App extends React.Component {
render() {
Expand Down Expand Up @@ -104,7 +103,7 @@ class App extends React.Component {
target: "data",
mutation: (props) => {
return {
style: merge({}, props.style, { stroke: "lime" }),
style: Object.assign({}, props.style, { stroke: "lime" }),
};
},
},
Expand All @@ -113,7 +112,7 @@ class App extends React.Component {
target: "labels",
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "green" }),
style: Object.assign({}, props.style, { fill: "green" }),
text: "waddup",
};
},
Expand Down
6 changes: 3 additions & 3 deletions demo/js/components/external-events-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { VictoryBar } from "victory-bar";
import { VictoryLine } from "victory-line";
import { VictoryZoomContainer } from "victory-zoom-container";
import { VictoryVoronoiContainer } from "victory-voronoi-container";
import { range, assign } from "lodash";
import { range } from "lodash";

class App extends React.Component {
constructor() {
Expand Down Expand Up @@ -52,8 +52,8 @@ class App extends React.Component {
mutation: (props) => {
const fill = props.style && props.style.fill;
return fill === "blue"
? { style: assign({}, props.style, { fill: "red" }) }
: { style: assign({}, props.style, { fill: "blue" }) };
? { style: Object.assign({}, props.style, { fill: "red" }) }
: { style: Object.assign({}, props.style, { fill: "blue" }) };
},
callback,
},
Expand Down
28 changes: 14 additions & 14 deletions demo/js/components/immutable-demo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-magic-numbers, react/no-multi-comp */
import React from "react";
import PropTypes from "prop-types";
import { assign, merge, keys, random, range, round } from "lodash";
import { keys, random, range, round } from "lodash";
import { fromJS } from "immutable";
import { VictoryClipContainer, VictoryLabel, VictoryTheme } from "victory-core";

Expand Down Expand Up @@ -36,7 +36,7 @@ class Wrapper extends React.Component {
renderChildren(props) {
const children = React.Children.toArray(props.children);
return children.map((child) => {
return React.cloneElement(child, assign({}, child.props, props));
return React.cloneElement(child, Object.assign({}, child.props, props));
});
}

Expand Down Expand Up @@ -214,7 +214,7 @@ class App extends React.Component {
target: "data",
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "gold" }),
style: Object.assign({}, props.style, { fill: "gold" }),
};
},
},
Expand All @@ -223,7 +223,7 @@ class App extends React.Component {
target: "data",
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "orange" }),
style: Object.assign({}, props.style, { fill: "orange" }),
};
},
},
Expand All @@ -232,7 +232,7 @@ class App extends React.Component {
target: "data",
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "red" }),
style: Object.assign({}, props.style, { fill: "red" }),
};
},
},
Expand Down Expand Up @@ -344,7 +344,7 @@ class App extends React.Component {

<svg height={500} width={500}>
<VictoryCandlestick
style={merge({}, chartStyle, { data: { width: 10 } })}
style={Object.assign({}, chartStyle, { data: { width: 10 } })}
data={fromJS([
{
x: new Date(2016, 6, 1),
Expand Down Expand Up @@ -414,7 +414,7 @@ class App extends React.Component {
{
mutation: (props) => {
return {
style: merge({}, props.style.labels, {
style: Object.assign({}, props.style.labels, {
fill: "orange",
}),
};
Expand All @@ -432,7 +432,7 @@ class App extends React.Component {
{
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "blue" }),
style: Object.assign({}, props.style, { fill: "blue" }),
};
},
},
Expand Down Expand Up @@ -468,7 +468,7 @@ class App extends React.Component {
target: "data",
mutation: (props) => {
return {
style: merge({}, props.style, { stroke: "lime" }),
style: Object.assign({}, props.style, { stroke: "lime" }),
};
},
},
Expand All @@ -477,7 +477,7 @@ class App extends React.Component {
target: "labels",
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "green" }),
style: Object.assign({}, props.style, { fill: "green" }),
text: "waddup",
};
},
Expand Down Expand Up @@ -572,7 +572,7 @@ class App extends React.Component {
</VictoryChart>

<VictoryVoronoi
style={merge({}, chartStyle, {
style={Object.assign({}, chartStyle, {
data: {
fill: "gray",
opacity: 0.1,
Expand Down Expand Up @@ -631,7 +631,7 @@ class App extends React.Component {
target: "data",
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "gold" }),
style: Object.assign({}, props.style, { fill: "gold" }),
};
},
},
Expand All @@ -640,7 +640,7 @@ class App extends React.Component {
target: "data",
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "orange" }),
style: Object.assign({}, props.style, { fill: "orange" }),
};
},
},
Expand All @@ -649,7 +649,7 @@ class App extends React.Component {
target: "data",
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "red" }),
style: Object.assign({}, props.style, { fill: "red" }),
};
},
},
Expand Down
4 changes: 2 additions & 2 deletions demo/js/components/victory-area-demo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-magic-numbers */
import React from "react";
import { merge, random, range } from "lodash";
import { random, range } from "lodash";
import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
import { VictoryGroup } from "victory-group";
Expand Down Expand Up @@ -278,7 +278,7 @@ export default class App extends React.Component {
target: "data",
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "orange" }),
style: Object.assign({}, props.style, { fill: "orange" }),
};
},
},
Expand Down
4 changes: 2 additions & 2 deletions demo/js/components/victory-axis-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
VictoryContainer,
VictoryTheme,
} from "victory-core";
import { merge, random, range } from "lodash";
import { random, range } from "lodash";
import XYTheme from "../theme/victory-axis-differential-styling-theme";

export default class App extends React.Component {
Expand Down Expand Up @@ -122,7 +122,7 @@ export default class App extends React.Component {
{
mutation: (props) => {
return {
style: merge({}, props.style, { stroke: "orange" }),
style: Object.assign({}, props.style, { stroke: "orange" }),
};
},
},
Expand Down
16 changes: 8 additions & 8 deletions demo/js/components/victory-bar-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
VictoryTheme,
VictoryLabel,
} from "victory-core";
import { assign, random, range, merge } from "lodash";
import { random, range } from "lodash";

class Wrapper extends React.Component {
static propTypes = {
Expand All @@ -25,7 +25,7 @@ class Wrapper extends React.Component {
renderChildren(props) {
const children = React.Children.toArray(props.children);
return children.map((child) => {
return React.cloneElement(child, assign({}, child.props, props));
return React.cloneElement(child, Object.assign({}, child.props, props));
});
}

Expand Down Expand Up @@ -262,7 +262,7 @@ export default class App extends React.Component {
{
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "orange" }),
style: Object.assign({}, props.style, { fill: "orange" }),
};
},
},
Expand Down Expand Up @@ -399,7 +399,7 @@ export default class App extends React.Component {
{
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "orange" }),
style: Object.assign({}, props.style, { fill: "orange" }),
};
},
},
Expand All @@ -425,7 +425,7 @@ export default class App extends React.Component {
{
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "blue" }),
style: Object.assign({}, props.style, { fill: "blue" }),
};
},
},
Expand All @@ -449,7 +449,7 @@ export default class App extends React.Component {
childName: "secondBar",
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "blue" }),
style: Object.assign({}, props.style, { fill: "blue" }),
};
},
};
Expand All @@ -469,14 +469,14 @@ export default class App extends React.Component {
return props.style.fill === "cyan"
? null
: {
style: merge({}, props.style, { fill: "cyan" }),
style: Object.assign({}, props.style, { fill: "cyan" }),
};
},
},
{
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "orange" }),
style: Object.assign({}, props.style, { fill: "orange" }),
};
},
},
Expand Down
10 changes: 5 additions & 5 deletions demo/js/components/victory-candlestick-demo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-magic-numbers */
import React from "react";
import PropTypes from "prop-types";
import { random, range, merge } from "lodash";
import { random, range } from "lodash";
import { VictoryChart } from "victory-chart";
import { VictoryCandlestick } from "victory-candlestick";
import { VictoryTheme } from "victory-core";
Expand Down Expand Up @@ -98,7 +98,7 @@ export default class App extends React.Component {
{
mutation: (props) => {
return {
style: merge({}, props.style.labels, {
style: Object.assign({}, props.style.labels, {
fill: "orange",
}),
};
Expand All @@ -116,7 +116,7 @@ export default class App extends React.Component {
{
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "blue" }),
style: Object.assign({}, props.style, { fill: "blue" }),
};
},
},
Expand Down Expand Up @@ -149,7 +149,7 @@ export default class App extends React.Component {
{
mutation: (props) => {
return {
style: merge({}, props.style.labels, {
style: Object.assign({}, props.style.labels, {
fill: "orange",
}),
};
Expand All @@ -167,7 +167,7 @@ export default class App extends React.Component {
{
mutation: (props) => {
return {
style: merge({}, props.style, { fill: "blue" }),
style: Object.assign({}, props.style, { fill: "blue" }),
};
},
},
Expand Down
Loading
Loading