Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #589 from FormidableLabs/audit/lodash
Browse files Browse the repository at this point in the history
Audit/lodash
  • Loading branch information
boygirl authored Apr 20, 2018
2 parents 5b9cb3c + def28e7 commit 99b7d0f
Show file tree
Hide file tree
Showing 22 changed files with 548 additions and 559 deletions.
3 changes: 2 additions & 1 deletion demo/components/events-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class App extends React.Component {
}]}
>
<VictoryBar name="bar"
labels={() => null}
style={{ data: { width: 15, fill: "green" } }}
data={[
{ x: 1, y: 1 },
Expand Down Expand Up @@ -174,7 +175,7 @@ class App extends React.Component {
]}
>
<VictoryLabel text="Parent Events" y={50} x={150}/>
<VictoryBar name="bar"/>
<VictoryBar name="bar" labels={() => null}/>
</VictoryChart>

<VictoryChart style={chartStyle}
Expand Down
10 changes: 5 additions & 5 deletions src/components/containers/victory-cursor-container.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from "prop-types";
import React from "react";
import { VictoryContainer, VictoryLabel, Axis, Helpers } from "victory-core";
import { defaults, assign, isNumber, isUndefined, isObject } from "lodash";
import { defaults, assign, isObject } from "lodash";
import CursorHelpers from "./cursor-helpers";

export const cursorContainerMixin = (base) => class VictoryCursorContainer extends base {
Expand Down Expand Up @@ -62,7 +62,7 @@ export const cursorContainerMixin = (base) => class VictoryCursorContainer exten
const { cursorValue, defaultCursorValue, cursorDimension, domain } = props;
if (cursorValue) { return cursorValue; }

if (isNumber(defaultCursorValue)) {
if (typeof defaultCursorValue === "number") {
return {
x: (domain.x[0] + domain.x[1]) / 2,
y: (domain.y[0] + domain.y[1]) / 2,
Expand All @@ -76,7 +76,7 @@ export const cursorContainerMixin = (base) => class VictoryCursorContainer exten
getCursorLabelOffset(props) {
const { cursorLabelOffset } = props;

if (isNumber(cursorLabelOffset)) {
if (typeof cursorLabelOffset === "number") {
return {
x: cursorLabelOffset,
y: cursorLabelOffset
Expand All @@ -87,9 +87,9 @@ export const cursorContainerMixin = (base) => class VictoryCursorContainer exten
}

getPadding(props) {
if (isUndefined(props.padding)) {
if (props.padding === undefined) {
const child = props.children.find((c) => {
return isObject(c.props) && !isUndefined(c.props.padding);
return isObject(c.props) && c.props.padding !== undefined;
});
return Helpers.getPadding(child.props);
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/components/victory-area/victory-area.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { partialRight } from "lodash";
import PropTypes from "prop-types";
import React from "react";
import { getBaseProps } from "./helper-methods";
Expand Down Expand Up @@ -58,7 +57,7 @@ class VictoryArea extends React.Component {
static defaultPolarTransitions = DefaultTransitions.continuousPolarTransitions();
static getDomain = Domain.getDomainWithZero.bind(Domain);
static getData = Data.getData.bind(Data);
static getBaseProps = partialRight(getBaseProps, fallbackProps);
static getBaseProps = (props) => getBaseProps(props, fallbackProps);
static expectedComponents = [
"dataComponent", "labelComponent", "groupComponent", "containerComponent"
];
Expand Down
Loading

0 comments on commit 99b7d0f

Please sign in to comment.