Sha256: e4a5dc1a81e31aa4830192a90a09dc8f760405f760f03d4280980cf6af4e8c75

Contents?: true

Size: 435 Bytes

Versions: 375

Compression:

Stored size: 435 Bytes

Contents

/* global text */

/**
 * 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
 */
text.sanitize = function(str) {
	'use strict';
	return str
		.replace(/\r\n/g, '\n')
		.replace(/\u00A0/g, ' ')
		.replace(/[\s]{2,}/g, ' ')
		.trim();
};

Version data entries

375 entries across 375 versions & 1 rubygems

Version Path
govuk_publishing_components-17.4.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-17.3.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-17.2.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-17.1.1 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-17.1.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-17.0.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.29.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.28.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.27.1 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.27.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.26.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.25.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.24.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.23.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.22.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.21.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.20.1 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.20.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.19.0 node_modules/axe-core/lib/commons/text/sanitize.js
govuk_publishing_components-16.18.0 node_modules/axe-core/lib/commons/text/sanitize.js