Comments (11)
I disagree. I'd prefer to not have needless regex in my code.
from you-dont-need-lodash-underscore.
This repo is not forcing anyone to follow all the native alternatives presented.
I agree to this ( and PR welcome 😃 )
from you-dont-need-lodash-underscore.
For me the real benefit of this project, including its eslint configuration, is to remove unnecessary code from my bundles when I can go by with a lighter alternative. If you take a look at trimEnd
's implementation you'll see that it's not at all a one liner or anything like that. It even depends on a few other lodash internal stuff (the same goes for trimStart
).
However, for the most common use case where the second parameter is not provided, because you want to trim whitespace, the alternative solution involves a lot less code, a simple one-liner using a native javascript method, and a relatively simple regex. I think it's worth to show users the simpler alternative in this case. I'd even go as far as to say that it should be recommended, if we ever have a recommended
preset. For users that do not want to write the regex, as is your case, the rule can always be turned off in the eslintrc file.
from you-dont-need-lodash-underscore.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimEnd
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim
from you-dont-need-lodash-underscore.
Thanks @gnapse
PR welcome
from you-dont-need-lodash-underscore.
Isn't this repo about recommendations to users of lodash of when they could go by with a relatively simple native alternative? I understand that some users may still prefer lodash's way of doing some particular task, and that's fine. This repo is not forcing anyone to follow all the native alternatives presented.
from you-dont-need-lodash-underscore.
I guess, but it's going to cause a detailed initial configuration or annoying future changes when the "all" preset is too restrictive. Perhaps we need a "recommended" preset.
from you-dont-need-lodash-underscore.
I guess, but it's going to cause a detailed initial configuration or annoying future changes when the "all" preset is too restrictive. Perhaps we need a "recommended" preset.
I think you are talking about the eslint config?
from you-dont-need-lodash-underscore.
I think you are talking about the eslint config?
Isn't that the function of this project? But, yes, and this specifically: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore/blob/master/configuring.md#now-configure-your-plugin
from you-dont-need-lodash-underscore.
Isn't that the function of this project?
The eslint doesn't really include things like these. Only the simple ones like concat()
or map()
(the ones you can easily replace lodash with the corresponding native methods without thinking too much). However, the readme can go a bit future as per @gnapse mentioned above.
from you-dont-need-lodash-underscore.
I see the readme as a good support for the eslint config. The primary goal is to be told "you don't need this".
from you-dont-need-lodash-underscore.
Related Issues (20)
- How to wirite lodash.merge by myself
- Replacing lodash string functions with native one requires special care for Unicode strings with non-BMP symbols HOT 1
- How do you replace lodash to sort an array of objects by object key? HOT 2
- Lodash/Underscore are partially still simpler and easier to read
- The provided debounce function doesn't provide cancel and flush options like lodash's version
- zip/unzip missing
- Why don't you use `instanceof` for `isDate`? HOT 4
- Add entry for _.shuffle HOT 6
- Is the _.keyBy collectionKeyBy function correct?
- Warning for isEmpty in WebStorm HOT 4
- `debounce` function is wrong implementation HOT 1
- Suggest structuredClone as a replacement for cloneDeep
- Package it and publish to NPM. HOT 2
- _.truncate ??? HOT 1
- Purpose of this repo HOT 2
- Array.prototype.at() was introduced in Node.js v16 HOT 1
- Add entry for _.isPlainObject HOT 1
- Guide: Creating Valid Substitutions for Lodash Functions HOT 1
- missing `_.merge` ?
- Add `findLast` and `findLastIndex` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from you-dont-need-lodash-underscore.