Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 2x 2x 29x 11x 11x 6x 3x 2x | import { HandlebarsHelper, HelperConstructorBlock } from "./helper";
export const caseHelper: HelperConstructorBlock = ctx => {
return new HandlebarsHelper("case", (type, rawV1): string => {
const v1 = new String(rawV1).toString();
switch (type) {
case "upper":
return v1.toUpperCase();
case "lower":
return v1.toLowerCase();
default:
throw new Error(`Invalid case type used with case: ${type}`);
}
});
};
|