jev-leftpad is an npm package that left-pads a string by calling TypeSafe AI’s Jev model instead of using String.prototype.padStart. Installation and usage are straightforward: npm install jev-leftpad, import leftPad from 'jev-leftpad', set TYPESAFE_API_KEY, and call await leftPad(value, targetLength). The package uses jev-latest via @typesafe-ai/sdk and requires Node.js 20+. An example leftPad('jev', 8) should return five leading spaces plus "jev". The README acknowledges that padStart could do this in one line but intentionally routes the task through a model call.
The implementation and limits are explicit: the API function accepts a non-negative safe integer targetLength; Jev receives a set of prewritten choices named space_0 through space_10, so the package can add between 0 and 10 spaces only. Each call issues one TypeSafe API request with retries disabled, so requests can fail, return the wrong choice, and are more expensive than a local method; the README warns against production use. Tests mock Jev and do not require an API key or TypeSafe credits. The project includes npm test/dev instructions and is published under the MIT license.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.