fcs
2025-04-10 0163870d662dc5b7d69ceff977490ede594f7d82
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
/**
 * Module dependencies.
 */
 
var humanize = require('..');
 
describe('humanize(n, options)', function(){
  it('should delimit thousandths', function(){
    humanize(1000).should.equal('1,000');
    humanize(1000000).should.equal('1,000,000');
    humanize(10500).should.equal('10,500');
  })
 
  it('should retain fractions', function(){
    humanize(15.99).should.equal('15.99');
    humanize(1500.99).should.equal('1,500.99');
  })
 
  describe('"delimiter" option', function(){
    it('should change the delimiter', function(){
      humanize(1500, { delimiter: '.' }).should.equal('1.500');
    })
  })
 
  describe('"separator" option', function(){
    it('should change the separator', function(){
      humanize(15.99, { separator: ',' }).should.equal('15,99');
    })
  })
})