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
Replace "lodash/is*" and "lodash/each" with native equivalents #5043
Conversation
Current coverage is 89.21% (diff: 100%)
|
if (isBoolean(val)) return arrayify([val], mapFn); | ||
if (isString(val)) return arrayify(list(val), mapFn); | ||
if (typeof val === "boolean") return arrayify([val], mapFn); | ||
if (typeof val === "string") return arrayify(list(val), mapFn); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer using
isBoolean(x)
rather than
typeof x === "boolean"
We can remove lodash but I would suggest keeping helper functions for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion on that, both seems fine to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's easier to stick with typeof
than helpers, so you end up with consistent code, and less nits on PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer typeof
personally.
@@ -1,7 +1,5 @@ | |||
import isPlainObject from "lodash/isPlainObject"; | |||
import isNumber from "lodash/isNumber"; | |||
import isRegExp from "lodash/isRegExp"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isRegExp
needs to be replaced as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isRegExp
doesn't have a typeof
equivalent - those are the ones I'm targeting here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those could be replaced with instanceof RegExp
in another PR
Hey @zertosh! It looks like one or more of your builds have failed. I've copied the relevant info below to save you some time. OS: linux OS: linux OS: linux |
I rebased this to fix the conflicts, but looks like it is also having issues because our build scripts aren't transpiled and this need to be Node-4 compatible (no destructuring). |
Thanks @loganfsmyth! Sorry about the destructuring, I had a local commit for that I never pushed :( |
No description provided.