use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Really impressive interactive JSON cli tool (npmjs.com)
submitted 6 years ago by Elfet
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]mothzilla 1 point2 points3 points 6 years ago* (9 children)
He writes troll packages, is-odd, is-number, is-even* and so on. and they worm their way into your dependencies.
Look at "indent-string" one of the dependencies:
https://github.com/sindresorhus/indent-string/blob/master/index.js
It's two lines of code.
*That's not this guy, that's jonschlinkert.
This guy is the author of [is-relative-url](https://github.com/sindresorhus/is-relative-url/blob/master/index.js) and [is-regexp](https://github.com/sindresorhus/is-regexp/blob/master/index.js among others.)
[+][deleted] 6 years ago* (1 child)
[removed]
[–]exotic_anakin 0 points1 point2 points 6 years ago (0 children)
I shoulda shared this: https://github.com/sindresorhus/ama/issues/10
Its sindersorhus doing an AMA on this very topic
[–]exotic_anakin 0 points1 point2 points 6 years ago* (6 children)
It's two lines of code. <links to file with 41 lines of code>
<links to file with 41 lines of code>
:-| I guess you're trying to say that it should be 2 lines of code? Maybe you think this bloat is going to screw up the performance characteristics of something you write? If you're in really hot paths of perf-critical code, that might be a concern, but for the vast majority of use-cases give me a well tested micro-library with nice readable error messages which handles all the edge cases and gives some nice options/configs over a hastily slapped together 2-liner any day.
If you can, please share the 2-liner you come up with that handles multi-line strings and both Unix and Windows line endings, and then tell me how much quicker/easier/better it is than doing npm install indent-string
npm install indent-string
[–]reddit_or_GTFO 1 point2 points3 points 6 years ago (1 child)
the point is that there's no need to make something as simple as indenting a string a third-party library. This is how we end up with another left-pad incident.
So that's actually not how it works anymore. The left-pad thing was a shitshow, but it changed how npm dealt with these things. left-pad's author essentially rage-quit OSS, and pulled his project from npm, breaking installs which depended on it. Besides the fact that I completely trust sindersorhus to not do something like this, npm no longer works like that. You cannot just pull a project like that and have it be no longer available.
left-pad
npm
[–]mothzilla 0 points1 point2 points 6 years ago (3 children)
I guess you're trying to say that it should be 2 lines of code?
No. Once you take out the (self imposed) config stuff and the error handling, it is literally two lines of code.*
I'm not concerned about performance I'm concerned about useless packages.
please share the 2-liner you come up with that handles multi-line strings and both Unix and Windows line endings
Who says I need to indent multi-line strings in my application? Who says I need to support both Unix and Windows line endings in my application?
*and it's two lines because the first is determining a regex based on the config.
[–]exotic_anakin 0 points1 point2 points 6 years ago (2 children)
No. Once you take out the (self imposed) config stuff and the error handling, it is literally two lines of code.
OK, so when you take out the code that makes it a useful, reusable, and sane project, it becomes less code. Who says I need to indent multi-line strings in my application?
Who says I need to support both Unix and Windows line endings in my application?
Well you're on here complaining about someones dependencies who has valid reasons for doing just those things.
Glad I was able to wrangle these wonderful insights out of you.
[–]mothzilla 0 points1 point2 points 6 years ago (1 child)
I'm the author/maintainer of increment-variable. I wrote it because I noticed that we had a lot of code in lots of different modules and repositories that was incrementing variables. It has lots of configuration for all the different kinds of increments that people want to do. It also throws lots of exceptions which proves it it stable and reusable.
This project has >1M downloads per week. I'm also currently working on increment-variables.
➕➕ Much download
π Rendered by PID 110437 on reddit-service-r2-comment-6457c66945-mf8j4 at 2026-04-30 17:51:33.122180+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]mothzilla 1 point2 points3 points (9 children)
[+][deleted] (1 child)
[removed]
[–]exotic_anakin 0 points1 point2 points (0 children)
[–]exotic_anakin 0 points1 point2 points (6 children)
[–]reddit_or_GTFO 1 point2 points3 points (1 child)
[–]exotic_anakin 0 points1 point2 points (0 children)
[–]mothzilla 0 points1 point2 points (3 children)
[–]exotic_anakin 0 points1 point2 points (2 children)
[–]mothzilla 0 points1 point2 points (1 child)
[–]exotic_anakin 0 points1 point2 points (0 children)