Skip to content

Numeral.js

agershun edited this page Jan 11, 2015 · 3 revisions

Formatting Numbers with Numeral.js

You can use Numeral.js library to format numbers in Alasql expressions:

    var data = [{a:120000003.456},{a:567234.12}];
    // Pass numeral() function into alasql
    alasql.fn.numeral = numeral;
    // Use numeral() function
    alasql('SELECT numeral(a)->format("0,0") FROM ?',[data]);

See the example in jsFiddle](http://jsfiddle.net/agershun/drvga85x/1/).

Clone this wiki locally