Skip to content

Commit 13bc8cb

Browse files
committed
Change Lodash map Methods to forOwn
1 parent 8f69d06 commit 13bc8cb

5 files changed

Lines changed: 14 additions & 12 deletions

File tree

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
"es2015",
44
"stage-0",
55
"react"
6+
],
7+
"plugins": [
8+
"lodash"
69
]
710
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
"devDependencies": {
1919
"@case/eslint-config": "^0.1.4",
2020
"babel": "^6.0.15",
21+
"babel-cli": "^6.23.0",
2122
"babel-core": "^6.1.2",
2223
"babel-eslint": "^6.1.2",
2324
"babel-loader": "^6.0.1",
25+
"babel-plugin-lodash": "^3.2.11",
2426
"babel-preset-es2015": "^6.1.18",
2527
"babel-preset-react": "^6.1.18",
2628
"babel-preset-stage-0": "^6.1.18",

src/autoprefix.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import map from 'lodash/map'
1+
import _ from 'lodash'
22

33
const transforms = {
44
borderRadius: (value) => {
@@ -94,9 +94,9 @@ const transforms = {
9494

9595
export const autoprefix = (elements) => {
9696
const prefixed = {}
97-
map(elements, (styles, element) => {
97+
_.forOwn(elements, (styles, element) => {
9898
let expanded = {}
99-
map(styles, (value, key) => {
99+
_.forOwn(styles, (value, key) => {
100100
const transform = transforms[key]
101101
if (transform) {
102102
expanded = { ...expanded, ...transform(value) }

src/flattenNames.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import map from 'lodash/map'
2-
import isPlainObject from 'lodash/isPlainObject'
3-
import isString from 'lodash/isString'
1+
import _ from 'lodash'
42

53
export const flattenNames = (things) => {
64
const names = []
75

86
things.map((thing) => {
97
Array.isArray(thing) && flattenNames(thing).map(name => names.push(name))
10-
isPlainObject(thing) && map(thing, (value, key) => {
8+
_.isPlainObject(thing) && _.forOwn(thing, (value, key) => {
119
value === true && names.push(key)
1210
names.push(`${ key }-${ value }`)
1311
})
14-
isString(thing) && names.push(thing)
12+
_.isString(thing) && names.push(thing)
1513
return thing
1614
})
1715

src/mergeClasses.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import map from 'lodash/map'
2-
import cloneDeep from 'lodash/cloneDeep'
1+
import _ from 'lodash'
32

43
export const mergeClasses = (classes, activeNames = []) => {
5-
const styles = (classes.default && cloneDeep(classes.default)) || {}
4+
const styles = (classes.default && _.cloneDeep(classes.default)) || {}
65
activeNames.map((name) => {
76
const toMerge = classes[name]
87
if (toMerge) {
9-
map(toMerge, (value, key) => {
8+
_.forOwn(toMerge, (value, key) => {
109
if (!styles[key]) {
1110
styles[key] = {}
1211
}

0 commit comments

Comments
 (0)