Skip to content

Commit

Permalink
Switch to lodash.get for theme import matches
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-rogerson committed Feb 26, 2021
1 parent f912664 commit 7a849f0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"color": "^3.1.3",
"dset": "^2.0.1",
"lodash.flatmap": "^4.5.0",
"lodash.get": "^4.4.2",
"lodash.merge": "^4.6.2",
"postcss": "^8.1.8",
"string-similarity": "^4.0.3",
Expand Down
16 changes: 1 addition & 15 deletions src/utils/misc.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
import { MacroError } from 'babel-plugin-macros'

// Get function from lodash
const get = (object, path, defaultValue) => {
const travel = regexp =>
String.prototype.split
.call(path, regexp)
.filter(Boolean)
.reduce(
(result, key) =>
result !== null && result !== undefined ? result[key] : result,
object
)
const result = travel(/[,[\]]+?/) || travel(/[,.[\]]+?/)
return result === undefined || result === object ? defaultValue : result
}
import get from 'lodash.get'

const throwIf = (expression, callBack) => {
if (!expression) return
Expand Down

0 comments on commit 7a849f0

Please sign in to comment.