format-number

Formats numbers with separators every 3 digits and currency etc. Highly configurable.

format-number

returns 512.

expect(format('512')).to.be('512');

returns 6,300.

expect(format('6300')).to.be('6,300');

returns 76,300.

expect(format('76300')).to.be('76,300');

returns 976,300.

expect(format('976300')).to.be('976,300');

returns 1,976,300.

expect(format('1976300')).to.be('1,976,300');

returns 56.43.

expect(format('56.43')).to.be('56.43');

returns 512.00.

expect(format('512')).to.be('512.00');

returns 512.40.

expect(format('512.4')).to.be('512.40');

returns 512.43.

expect(format('512.43')).to.be('512.43');

returns 512.435.

expect(format('512.435')).to.be('512.435');

returns 512.

expect(format('512')).to.be('512');

returns 512.4.

expect(format('512.4')).to.be('512.4');

returns 512.43.

expect(format('512.43')).to.be('512.43');

returns 512.43.

expect(format('512.435')).to.be('512.43');

returns £512.

expect(format('512')).to.be('£512');

returns -£512.

expect(format('-512')).to.be('-£512');

returns 512.

expect(format('512', false)).to.be('512');

returns -512.

expect(format('-512', false)).to.be('-512');

equals "£".

expect(format.prefix).to.be('£');

returns 512 items.

expect(format('512')).to.be('512 items');

returns -512 items.

expect(format('-512')).to.be('-512 items');

returns 512.

expect(format('512', false)).to.be('512');

returns -512.

expect(format('-512', false)).to.be('-512');

equals " items".

expect(format.suffix).to.be(' items');