justificationTemplate.js 386 B

123456789101112131415
  1. export function applyArgumentTemplate(template, args) {
  2. if (!template) {
  3. return ''
  4. }
  5. return template.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g, (_, name) => args[name] ?? '')
  6. }
  7. export function actionRequiresJustification(justification) {
  8. return (justification ?? '').length > 0
  9. }
  10. export function actionJustificationTemplate(justification) {
  11. return justification ?? ''
  12. }