DEV: Use named parameters for dir-span helper (PR #14195)

Follow up to: e50a5c0c73d8f983286b50ac45e10ce52924269e

In order to improve code clarity this change introduces named parameters for the dir-span helper. This is specifically for the new htmlSafe parameter which you can use instead of just passing in a boolean if the strings you are passing in have already been escaped.

Before: {{dir-span category.description false}} After: {{dir-span category.description htmlSafe=true}}

GitHub

export default registerUnbound("dir-span", function (str, params = {}) {
  let isHtmlSafe = false;
  if (params.htmlSafe) {
    isHtmlSafe = params.htmlSafe;
  }

I agree with @eviltrout that this makes the API much clearer. Awesome change and thank you for pushing this true :+1:

1 Like

Very nice! Thank you @oblakeerickson

1 Like