Skip to content

Commit

Permalink
Merge pull request #96 from plural/x-cost-in-card-list
Browse files Browse the repository at this point in the history
Set X cost for -1 as well as null values in maybe().
  • Loading branch information
plural authored Nov 25, 2023
2 parents 6c6fcba + a7ccde2 commit 8dc5a4c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/utils/template-operators.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export const and = (a, b) => a && b;
export const eq = (a, b) => a === b;
export const maybe = (val, def = 'X') => (val !== null ? val : def);
export const maybe = (val, def = 'X') => {
return val !== null && val != -1 ? val : def;
};
export const formatDate = (date) => Intl.DateTimeFormat().format(date);
export const replaceClassCardPageUrls = (t) =>
t.replaceAll(/\/en\/card\//g, '/page/card/');

0 comments on commit 8dc5a4c

Please sign in to comment.