-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add number format filter and update readme
- Loading branch information
1 parent
6a453ad
commit 1a29f34
Showing
4 changed files
with
25 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
'number_with_delimiter': (x: string) => x.toLocaleString() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { test } from '../../../stub/render' | ||
|
||
describe('braze/filters/number', function () { | ||
describe('number_with_delimiter', function () { | ||
it('should return a number formatted with commas', () => test('{{123456 | number_with_delimiter}}', '123,456')) | ||
it('should return a number formatted with commas', () => test('{{1234 | number_with_delimiter}}', '1,234')) | ||
it('should return a number with no commas', () => test('{{123 | number_with_delimiter}}', '123')) | ||
it('should return a float formatted with commas', () => test('{{123456.78 | number_with_delimiter}}', '123,456.78')) | ||
it('should return a float with 3 decimal places formatted with commas', () => test('{{123456.789 | number_with_delimiter}}', '123,456.789')) | ||
}) | ||
}) |