Repository navigation
pakdatakit 2.6.0 · Package · Docs · Playground
Minor release: one new feature. Every port gives the same results on the
shared test vectors (812 new ones).
Added
parseAmount()andformatAmountInput()(pakdatakit/format).parseAmount
reads a rupee amount as people type it in Pakistan and returns
{ value, raw }in rupees, rounded half-up to the paisa, ornull. It
accepts150,000and1,50,000grouping with decimals, Urdu and
Arabic-Indic digits,Rs/Rs./PKR/₨and a trailing/-, and the
shorthandk,thousand,hazar,ہزار,lakh,lac,لاکھ,crore,
crandکروڑ(also1.5 lakh,2.25cr). It rejects negatives, ranges,
more than one number, leftover letters, ambiguous grouping and amounts over
Rs. 50 trillion. The arithmetic is done on the digits, so1.005is 1.01
in every language.formatAmountInputwrites the amount back
("Rs. 150,000") for showing next to a field. It never throws.pk.amount()in the Zod, Valibot, Yup, Joi and Superstruct adapters, and
IsPakAmountfor class-validator: passes whenparseAmount()reads the
value.