Skip to content
Myr

Added `%d` flash formatter

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 772c135 · Browse files · 2 files+7 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−0 removed

  • tests:+3 added−0 removed
  • other:+4 added−0 removed

2 files+7 added−0 removed

modified:lib/request.js+4 added
21 unmodified lines
2223var flashFormatters = exports.flashFormatters = {24 s: function(val){25 return String(val);26 },27 28 d: function(val){29 return val | 0;30 }31};3233/**
280 unmodified lines
modified:test/request.test.js+3 added
159 unmodified lines
160 161 req.flash('info', 'Welcome _%s_ to %s', 'TJ', 'something');162 req.flash('info').should.eql(['Welcome <em>TJ</em> to something']);163164 req.flash('info', 'TJ has %d pets', 5.12323);165 req.flash('info').should.eql(['TJ has 5 pets']);166167 req.flash('error', 'Foo %u', 'bar');168 req.flash('error').should.eql(['Foo BAR']);169170 res.send('ok');
171 unmodified lines