summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/remark-parse/lib/util/normalize.js
blob: 3602a18f7883178adee1317fa28d18728d2fe939 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * @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();
}