Developer replaces padStart() with an AI model call to left-pad strings
Jev-Leftpad
Fatih Kadir Akın's jev-leftpad is a JavaScript package that left-pads a value by asking TypeSafe AI's Jev model which option to pick, with criteria named space_0 through space_10. It needs a TYPESAFE_API_KEY, Node.js 20+, and one API request per call with retries disabled. The README admits padStart() could do it in one line and warns against using it in production — or anything important.
Could this be one line with padStart()? Yes. Does it need a model call? No. Anyway:
- sethaurus
I have to be honest. While this is obviously a smart and useful idea, it misses one of the core features of Jev: its confidence scores. Partial confidence could easily be mapped to fractional spaces, using unicode characters like U+2009: THIN SPACE. As it stands, this package is not harnessing the full power of Jev.
- ckastner
Can't believe it's already been 10 years...
- hanspagel
This is funny, because I just implemented the same feature, but mine is calling OpenAI’s Astra on High (very capable for this kind of feature).
It works great, but maybe your implementation could save me some money. I’ll test it and report back.
- fwlr
The tests mock Jev.
10/10 no notes
- throwa356262
I think some people are missing the joke here