diff --git a/README.md b/README.md index 038ad6db9..8e2d48dfd 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Though being compatible with [Ruby Liquid](https://github.com/shopify/liquid) is * Dynamic file locating (enabled by default), which means layout/partial name can be an variable in liquidjs. See [#51](https://github.com/harttle/liquidjs/issues/51). * Truthy and Falsy. All values except `undefined`, `null`, `false` are truthy, whereas in Ruby Liquid all except `nil` and `false` are truthy. See [#26](https://github.com/harttle/liquidjs/pull/26). -* Number Rendering. Since JavaScript do not distinguish `float` and `integer`, we cannot either convert between them nor render regarding their type. See [#59](https://github.com/harttle/liquidjs/issues/59). +* Number Rendering. Since JavaScript do not distinguish `float` and `integer`, we cannot either convert between them nor render regarding to their type. See [#59](https://github.com/harttle/liquidjs/issues/59). ## TOC diff --git a/filters.js b/filters.js index 37ae413ad..d363160b9 100644 --- a/filters.js +++ b/filters.js @@ -33,7 +33,7 @@ var filters = { return isValidDate(date) ? strftime(date, arg) : v }, 'default': (v, arg) => isTruthy(v) ? v : arg, - 'divided_by': (v, arg) => Math.floor(v / arg), + 'divided_by': (v, arg) => v / arg, 'downcase': v => v.toLowerCase(), 'escape': escape, diff --git a/test/filters.js b/test/filters.js index 51d34a5bc..4a2fc1c38 100644 --- a/test/filters.js +++ b/test/filters.js @@ -110,8 +110,8 @@ describe('filters', function () { describe('divided_by', function () { it('should return 2 for 4,2', () => test('{{4 | divided_by: 2}}', '2')) it('should return 4 for 16,4', () => test('{{16 | divided_by: 4}}', '4')) - it('should return 1 for 5,3', () => test('{{5 | divided_by: 3}}', '1')) - it('should convert string to number', () => test('{{"5" | divided_by: "3"}}', '1')) + it('should return 1 for 5,3', () => test('{{5 | divided_by: 3}}', (5 / 3).toString())) + it('should convert string to number', () => test('{{"6" | divided_by: "3"}}', '2')) }) describe('downcase', function () {