4 ms·
I’ve made a library for that! https://codeberg.org/prettyid https://codeberg.org/prettyid
by notpushkin 2y ago
I’ve made a library for that! https://codeberg.org/prettyid https://codeberg.org/prettyid
- dewey 2y agoWhy should anyone vendor a dependency in a critical functionality for three lines of code (https://codeberg.org/prettyid/js/src/branch/master/lib/index.ts https://codeberg.org/prettyid/js/src/branch/master/lib/index...)?
- verdverm 2y agoonly if I can leftpad it first?
- HideousKojima 2y agoThat'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.
- notpushkin 2y agoTo 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 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 :-)
- fusspawn 2y agomultiple dependencies, Also requires two other packages to run its 3 lines of code. "dependencies": { "@scure/base": "^1.1.7", "uuidv7": "^1.0.1" }
- kqr 2y ago...but you'll have those dependencies anyway!
- xdennis 2y agoThere's a similar proposal called TypeID: https://github.com/jetify-com/typeid https://github.com/jetify-com/typeid E.g.: user_2x4y6z8a0b1c2d3e4f5g6h7j8k
- notpushkin 2y agoThis is actually pretty good! And it seems to be compatible with my implementation (it’s also UUIDv7 and base32 alphabet is the same, but without mapping from OIL to 01).