UNPKG

@qit.tools/number-to-words

Version:

This tiny library (🪶 1.4 KB) converts numbers to English words, supporting both general numeric values and monetary values with customizable currency and minor units.

1 lines • 2.22 kB
{"version":3,"file":"latest.min.js","sources":["../../src/index.ts"],"sourcesContent":[null],"names":["num","options","isNaN","Error","singleDigits","teens","tens","thousands","convertHundreds","result","Math","floor","convertNumberToWords","thousandCounter","chunk","chunkStr","undefined","money","integerPart","decimalPart","round","integerWords","currencyWord","currency","concat","decimalWords","minor","_a","_b","formatMoney","toString","split","parseInt","map","digit","join","formatDecimalPart"],"mappings":"6DAS6B,SAACA,EAAaC,GACzC,QADyC,IAAAA,IAAAA,EAAqB,CAAA,GAC1DC,MAAMF,GACR,MAAM,IAAIG,MAAM,+BAElB,IAAMC,EAAe,CACnB,OACA,MACA,MACA,QACA,OACA,OACA,MACA,QACA,QACA,QAEIC,EAAQ,CACZ,MACA,SACA,SACA,WACA,WACA,UACA,UACA,YACA,WACA,YAEIC,EAAO,CACX,GACA,GACA,SACA,SACA,QACA,QACA,QACA,UACA,SACA,UAEIC,EAAY,CAAC,GAAI,WAAY,UAAW,UAAW,YAEnDC,EAAkB,SAACR,GACvB,IAAIS,EAAS,GAiBb,OAhBIT,EAAM,KACRS,GAAUL,EAAaM,KAAKC,MAAMX,EAAM,MAAQ,YAChDA,GAAO,KACG,IAAGS,GAAU,MAErBT,EAAM,IACRS,GAAUH,EAAKI,KAAKC,MAAMX,EAAM,MAChCA,GAAO,IACG,IAAGS,GAAU,IAAML,EAAaJ,KACjCA,EAAM,EACfS,GAAUJ,EAAML,EAAM,IACbA,EAAM,EACfS,GAAUL,EAAaJ,GACH,KAAXS,IACTA,EAASL,EAAa,IAEjBK,CACT,EAEMG,EAAuB,SAACZ,GAC5B,GAAY,IAARA,EAAW,OAAOI,EAAa,GACnC,GAAIJ,EAAM,EAAG,MAAO,SAAWY,GAAsBZ,GAKrD,IAHA,IAAIS,EAAS,GACTI,EAAkB,EAEfb,EAAM,GAAG,CACd,IAAMc,E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