News for hackers. Stuff that matters.
Re:Making Beautiful API Keys by dewey on Friday January 10, 2025 @09:34AM (#42655867)
Why should anyone vendor a dependency in a critical functionality for three lines of code (https://codeberg.org/prettyid/js/src/branch/master/lib/index...)?
Re:Making Beautiful API Keys by notpushkin on Friday January 10, 2025 @09:46AM (#42655989)
To be honest that’s because I didn’t flesh out JS counterpart yet. My plan was to have something similar to the Python version: https://codeberg.org/prettyid/python

Of course, if you like the idea but don’t want to add another dependency, you can copy-paste the three-liner as it is! (And I’m sure it’s not even copyrightable right now :-)

Re:Making Beautiful API Keys by verdverm on Friday January 10, 2025 @11:50AM (#42657330)
only if I can leftpad it first?
Re:Making Beautiful API Keys by fusspawn on Friday January 10, 2025 @09:52AM (#42656061)
multiple dependencies,

Also requires two other packages to run its 3 lines of code.

"dependencies": { "@scure/base": "^1.1.7", "uuidv7": "^1.0.1" }

Re:Making Beautiful API Keys by kqr on Friday January 10, 2025 @09:57AM (#42656112)
...but you'll have those dependencies anyway!
Re:Making Beautiful API Keys by HideousKojima on Friday January 10, 2025 @09:40AM (#42655924)
That's the JavaScript/Node ecosystem in a nutshell. See the LeftPad fiasco and the mere existence of the IsOdd and IsEven packages for more poor judgement.