@mepkg/mtwig 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -16,5 +16,5 @@
16
16
  "dependencies": {
17
17
  "twig": "^3.0.0"
18
18
  },
19
- "version": "2.0.0"
19
+ "version": "2.1.0"
20
20
  }
@@ -1 +1,3 @@
1
- export const filters = [];
1
+ import int from "./int.js";
2
+
3
+ export const filters = [int];
@@ -0,0 +1,6 @@
1
+ export default (twig) => {
2
+ twig.extendFilter("int", (value) => {
3
+ const parsed = parseInt(value, 10);
4
+ return Number.isNaN(parsed) ? 0 : parsed;
5
+ });
6
+ }