Menu

Post image 1
Post image 2
Post image 3
Post image 4
Post image 5
Post image 6
Post image 7
Post image 8
Post image 9
1 / 9
0

I built kenya-utils so you can stop copy-pasting the same regexes between projects

DEV Community·Collins Mbathi·21 days ago
#bHnRPgMD
Reading 0:00
15s threshold

Every Kenyan dev I know has the same folder on their laptop: a half-finished utils/ directory with validatePhone.ts , kraPin.ts , counties.json , and a M-PESA SMS parser that mostly works. We've all written it. We've all copied it into the next project. Then the regex breaks because Safaricom released a new prefix, and we patch it in one project and forget the other two. I got tired of doing this. So I packaged it. kenya-utils is a free, MIT-licensed TypeScript library with the Kenya-specific helpers you actually use: phones, KRA PINs, national IDs (including Maisha cards), the 47 counties, M-PESA, and shilling formatting. Zero dependencies. Works everywhere modern JavaScript runs. npm install kenya-utils Enter fullscreen mode Exit fullscreen mode This article walks through what's inside, where each piece is useful, and the design choices that should make it boring to adopt.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More