-
Notifications
You must be signed in to change notification settings - Fork 761
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
Try to remove lodash? #2187
Comments
Hi, Using lodash over native JS and vice versa is highly debated topic lately. Some of the articles I read lately on the topic includes:
My take on this topic is: It depends on the context...If there is a native JS alternative in this code-base we should probably use it. Code in this code-base is highly imperative anyway, so converting a declarative approach of using utility function from lodash into imperative native JS counterparts wouldn't do any harm. Feel free to issue PRs. Note on predicates: I would still prefer the use of predicate function, such as
By using
|
@jimmywarting would you like to own this issue and implement the proposed changes? |
sure thing |
As part of this issue, |
- replace lodash.isArray for native Array.isArray - replace lodash.assign for native object destructuring or Object.assign Refs #2187
as part of trying to remove lodash/find i notice this IE11 comment nextPlugin() {
// Array.prototype.find doesn't work in IE 11 :(
return find(this.wrappedPlugins, (plugin) => { do you still support IE at all? or do you use something lite corejs that polyfills missing features or something like that? Object.assign got merged but it's not supported in ie11 |
We define that very precisely here: https://github.com/swagger-api/swagger-js#runtime. IE is not part of that list. Theoretically your change still might work in IE if IE 11 currently falls within this browserlist:
We do apply polyfills given above browserlist using babel-env and @babel/plugin-transform-runtime |
left:
The rest is kind of annoying... |
- startsWith - noop - isFunction - isString - find Refs #2187
(depends on the context) |
I found this package https://www.npmjs.com/package/is-empty, do you think we can replace lodash/isEmpty with it? |
@gabrielsimongianotti we have only one case of using the swagger-js/src/specmap/lib/all-of.js Line 38 in e5788a8
We're specifically asserting if the plain object is not an empty one. IMHO we can replace that |
Co-authored-by: Vladimir Gorej <[email protected]> Refs #2187
Anybody would want to take care of |
There is a regression in introduced in 067229e described in swagger-api/swagger-ui#7771 that manifests in SwaggerUI |
Is there a branch I can use, where this is implemented. I am running into the issue described here: |
@transfluxus nope there is not. We've working on this progressively. If you want to help, you can work directly on master. |
Lodash removed in #3137 |
🎉 This issue has been resolved in version 3.21.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
swagger-js/src/http/index.js
Lines 4 to 5 in 3937607
swagger-js/src/execute/oas3/build-request.js
Lines 3 to 4 in 22da4ad
The text was updated successfully, but these errors were encountered: