@ -1,7 +1,7 @@
/ * *
* @ license
* Lodash ( Custom Build ) < https : //lodash.com/>
* Build : ` lodash core plus="debounce,throttle,get,set,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy,before,after" `
* Build : ` lodash core plus="debounce,throttle,get,set,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy,before,after,unescape " `
* Copyright JS Foundation and other contributors < https : //js.foundation/>
* Released under MIT license < https : //lodash.com/license>
* Based on Underscore . js 1.8 . 3 < http : //underscorejs.org/LICENSE>
@ -117,7 +117,9 @@
uint32Tag = '[object Uint32Array]' ;
/** Used to match HTML entities and HTML characters. */
var reUnescapedHtml = /[&<>"']/g ,
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g ,
reUnescapedHtml = /[&<>"']/g ,
reHasEscapedHtml = RegExp ( reEscapedHtml . source ) ,
reHasUnescapedHtml = RegExp ( reUnescapedHtml . source ) ;
/** Used to match property names within property paths. */
@ -232,6 +234,15 @@
"'" : '''
} ;
/** Used to map HTML entities to characters. */
var htmlUnescapes = {
'&' : '&' ,
'<' : '<' ,
'>' : '>' ,
'"' : '"' ,
''' : "'"
} ;
/** Built-in method references without a dependency on `root`. */
var freeParseFloat = parseFloat ,
freeParseInt = parseInt ;
@ -958,6 +969,15 @@
: asciiToArray ( string ) ;
}
/ * *
* Used by ` _.unescape ` to convert HTML entities to characters .
*
* @ private
* @ param { string } chr The matched character to unescape .
* @ returns { string } Returns the unescaped character .
* /
var unescapeHtmlChar = basePropertyOf ( htmlUnescapes ) ;
/ * *
* Gets the size of a Unicode ` string ` .
*
@ -9444,6 +9464,32 @@
return castSlice ( strSymbols , start , end ) . join ( '' ) ;
}
/ * *
* 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 _
* @ since 0.6 . 0
* @ 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 = toString ( string ) ;
return ( string && reHasEscapedHtml . test ( string ) )
? string . replace ( reEscapedHtml , unescapeHtmlChar )
: string ;
}
/*------------------------------------------------------------------------*/
/ * *
@ -9969,6 +10015,7 @@
lodash . size = size ;
lodash . some = some ;
lodash . trim = trim ;
lodash . unescape = unescape ;
lodash . uniqueId = uniqueId ;
// Add aliases.