mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
663 B
29 lines
663 B
/**
|
|
* @author Titus Wormer
|
|
* @copyright 2015 Titus Wormer
|
|
* @license MIT
|
|
* @module remark:parse:util:normalize
|
|
* @fileoverview Normalize an identifier.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
/* Dependencies. */
|
|
var collapseWhiteSpace = require('collapse-white-space');
|
|
|
|
/* Expose. */
|
|
module.exports = normalize;
|
|
|
|
/**
|
|
* Normalize an identifier. Collapses multiple white space
|
|
* characters into a single space, and removes casing.
|
|
*
|
|
* @example
|
|
* normalizeIdentifier('FOO\t bar'); // 'foo bar'
|
|
*
|
|
* @param {string} value - Content to normalize.
|
|
* @return {string} - Normalized content.
|
|
*/
|
|
function normalize(value) {
|
|
return collapseWhiteSpace(value).toLowerCase();
|
|
}
|
|
|