UNPKG

luhn-generator

Version:

A generator of numbers that passes the validation of Luhn algorithm or Luhn formula, also known as the 'modulus 10' or 'mod 10' algorithm

19 lines (17 loc) 434 B
/** * Removes carriage returns, newline characters, tabs, non-breaking spaces, and trailing spaces from string * @method sanitize * @memberof axe.commons.text * @instance * @param {String} str String to be cleaned * @return {String} Sanitized string */ function sanitize(str) { 'use strict'; return str .replace(/\r\n/g, '\n') .replace(/\u00A0/g, ' ') .replace(/[\s]{2,}/g, ' ') .trim(); } export default sanitize;