Skip to content

Commit

Permalink
feat(src): switch to use lodash directly
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchentw committed May 30, 2016
1 parent 5db33f9 commit 304f465
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
7 changes: 3 additions & 4 deletions src/GoogleMapLoader.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from "lodash";

import {
default as React,
PropTypes,
Expand Down Expand Up @@ -30,10 +32,7 @@ export default class GoogleMapLoader extends Component {
if (this.state.map || domEl === null) {
return;
}
const {
children, // eslint-disable-line no-unused-vars
...restProps,
} = this.props.googleMapElement.props;
const restProps = _.omit(this.props.googleMapElement.props, [`children`]);
//
// Create google.maps.Map instance so that dom is initialized before
// React's children creators.
Expand Down
13 changes: 3 additions & 10 deletions src/async/ScriptjsLoader.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from "lodash";

import {
default as React,
Component,
Expand Down Expand Up @@ -101,16 +103,7 @@ Changed props: %s`,
render() {
if (this.state.isLoaded) {
if (this.shouldUseNewBehavior()) {
const nextProps = Object.keys(this.props).reduce((acc, key) => {
if (DELEGATE_PROPS_LIST.indexOf(key) !== -1) {
return acc;
} else {
return {
...acc,
[key]: this.props[key],
};
}
}, {});
const nextProps = _.omit(this.props, DELEGATE_PROPS_LIST);

return (
<GoogleMapLoader
Expand Down
8 changes: 3 additions & 5 deletions src/utils/makeUrl.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from "lodash";

import {
format as formatUrlObj,
} from "url";
Expand All @@ -6,10 +8,6 @@ import {
PropTypes,
} from "react";

import {
default as isEqual,
} from "lodash.isequal";

export default function makeUrl(urlObj) {
return formatUrlObj({
protocol: urlObj.protocol,
Expand All @@ -32,5 +30,5 @@ export const urlObjDefinition = {

export function getUrlObjChangedKeys(urlObj, nextUrlObj) {
return Object.keys(urlObjDefinition)
.filter(key => !isEqual(urlObj[key], nextUrlObj[key]));
.filter(key => !_.isEqual(urlObj[key], nextUrlObj[key]));
}

0 comments on commit 304f465

Please sign in to comment.