How to use the @govuk-pay/pay-js-commons.slugify function in @govuk-pay/pay-js-commons

To help you get started, we’ve selected a few @govuk-pay/pay-js-commons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alphagov / pay-selfservice / app / browsered / input-confirm.js View on Github external
function confirmInput (e) {
    const input = e.target
    // using slugify and also stripping out the (in)definite article (the/a/an)
    let value = input.dataset.confirmationFilter === 'slugify' ? slugify(removeIndefiniteArticles(input.value)) : input.value
    const confirmationId = `${input.id}-confirmation`
    const confirmationPrepend = input.dataset.confirmationPrepend || ''
    let confirmation = document.getElementById(confirmationId)

    if (!confirmation) {
      confirmation = document.createElement('div')
      confirmation.innerHTML = `
      <div class="govuk-inset-text input-confirm" id="${confirmationId}">
        <h3 class="govuk-heading-s govuk-!-margin-bottom-2">${input.dataset.confirmationTitle}</h3>
        <p class="govuk-body">
          ${input.dataset.confirmationLabel}<span class="input-confirmation"></span>
        </p>
      </div>`
      input.closest('.govuk-form-group').after(confirmation)
    }
github alphagov / pay-selfservice / app / controllers / payment-links / post-web-address-controller.js View on Github external
const makeNiceURL = string => {
  return slugify(removeIndefiniteArticles(string))
}
github alphagov / pay-selfservice / app / controllers / payment-links / post-information-controller.js View on Github external
const makeNiceURL = string => {
  return slugify(removeIndefiniteArticles(string))
}