Sha256: 1877177237280540f8028bfa3268e62e2d3825e3d492fa2bfc1e8f4583aed27a

Contents?: true

Size: 1.06 KB

Versions: 167

Compression:

Stored size: 1.06 KB

Contents

var baseToString = require('../internal/baseToString'),
    unescapeHtmlChar = require('../internal/unescapeHtmlChar');

/** Used to match HTML entities and HTML characters. */
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
    reHasEscapedHtml = RegExp(reEscapedHtml.source);

/**
 * The inverse of `_.escape`; this method converts the HTML entities
 * `&`, `<`, `>`, `"`, `'`, and ``` in `string` to their
 * corresponding characters.
 *
 * **Note:** No other HTML entities are unescaped. To unescape additional HTML
 * entities use a third-party library like [_he_](https://mths.be/he).
 *
 * @static
 * @memberOf _
 * @category String
 * @param {string} [string=''] The string to unescape.
 * @returns {string} Returns the unescaped string.
 * @example
 *
 * _.unescape('fred, barney, & pebbles');
 * // => 'fred, barney, & pebbles'
 */
function unescape(string) {
  string = baseToString(string);
  return (string && reHasEscapedHtml.test(string))
    ? string.replace(reEscapedHtml, unescapeHtmlChar)
    : string;
}

module.exports = unescape;

Version data entries

167 entries across 87 versions & 9 rubygems

Version Path
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js