js-written-number
js-written-number copied to clipboard
use Webpack instead of Grunt; add a standalone version without locales;
This PR fixes issue #43, no breaking changes were introduced.
The changes
- Replaced Grunt with Webpack
- Extracted the main logic into
core.js
file - Created a new file
lib/standalone.js
that exposes the main functionality of the library without including all the locale files - For the standalone version no locales were added, so the user have to import/create a locale object ( even for english ).
- Generated
dist/written-number.standalone.js
anddist/written-number.standalone.min.js
- Copied the
i18n
folder to thedist
folder at build time - Example usage:
import fr from 'lib/i18n/fr.json';
import writtenNumber from 'lib/standalone.js';
writtenNumber(1234, {lang: 'fr'}); // => 'mille deux cent trente-quatre'
// or
writtenNumber.defaults.lang = fr;
writtenNumber(1234); // => 'mille deux cent trente-quatre'
Coverage increased (+0.2%) to 99.213% when pulling 0013769b43237bb67eb4b61354c116ecb1918f28 on mtkcs:modular-locales into aec43a36437e523b7ad0c002d0523a1b60ded124 on yamadapc:master.
Coverage increased (+0.2%) to 99.213% when pulling 2845cee5c9d38ad03015977c656d47f6f776595f on mtkcs:modular-locales into aec43a36437e523b7ad0c002d0523a1b60ded124 on yamadapc:master.
Why hasn't this been merged yet? This can drastically optimize the size of this library. ~~I use this library in a library I have made (Mass.js) and would love to reduce the cost of including it.~~
Hi @MeekLogic , I am working on a new library for converting numbers to letters: https://github.com/forzagreen/n2words It's supporting 15 languages and still growing. Feel free to contribute.
Hi @MeekLogic , I am working on a new library for converting numbers to letters: https://github.com/forzagreen/n2words It's supporting 15 languages and still growing. Feel free to contribute.
no support for hungarian :(