js-written-number icon indicating copy to clipboard operation
js-written-number copied to clipboard

use Webpack instead of Grunt; add a standalone version without locales;

Open mtkcs opened this issue 4 years ago • 5 comments

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 and dist/written-number.standalone.min.js
  • Copied the i18n folder to the dist 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'

mtkcs avatar Oct 04 '19 07:10 mtkcs

Coverage Status

Coverage increased (+0.2%) to 99.213% when pulling 0013769b43237bb67eb4b61354c116ecb1918f28 on mtkcs:modular-locales into aec43a36437e523b7ad0c002d0523a1b60ded124 on yamadapc:master.

coveralls avatar Oct 04 '19 07:10 coveralls

Coverage Status

Coverage increased (+0.2%) to 99.213% when pulling 2845cee5c9d38ad03015977c656d47f6f776595f on mtkcs:modular-locales into aec43a36437e523b7ad0c002d0523a1b60ded124 on yamadapc:master.

coveralls avatar Oct 04 '19 07:10 coveralls

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.~~

TylerVigario avatar Mar 02 '20 17:03 TylerVigario

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.

forzagreen avatar Mar 02 '20 20:03 forzagreen

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 :(

p3x-robot avatar Oct 27 '20 20:10 p3x-robot