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
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/string/unescape.js
ilog-0.4.1 node_modules/contents/node_modules/lodash/string/unescape.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/string/unescape.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/string/unescape.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/string/unescape.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/string/unescape.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/string/unescape.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/string/unescape.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/string/unescape.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/string/unescape.js