Array_.chunk_.compact_.concat_.difference_.differenceBy_.differenceWith_.drop_.dropRight_.dropRightWhile_.dropWhile_.fill_.findIndex_.findLastIndex_.flatten_.flattenDeep_.flattenDepth_.fromPairs_.head_.indexOf_.initial_.intersection_.intersectionBy_.intersectionWith_.join_.last_.lastIndexOf_.nth_.pull_.pullAll_.pullAllBy_.pullAllWithCollectionDateFunctionLang_.castArray_.clone_.cloneDeep_.cloneDeepWith_.cloneWith_.conformsTo_.eq_.gt_.gte_.isArguments_.isArray_.isArrayBuffer_.isArrayLike_.isArrayLikeObject_.isBoolean_.isBuffer_.isDate_.isElement_.isEmpty_.isEqual_.isEqualWith_.isError_.isFinite_.isFunction_.isInteger_.isLength_.isMap_.isMatch_.isMatchWith_.isNaN_.isNative_.isNil_.isNull_.isNumberMathObjectSeqString_.camelCase_.capitalize_.deburr_.endsWith_.escape_.escapeRegExp_.kebabCase_.lowerCase_.lowerFirst_.pad_.padEnd_.padStart(string ='',length = 0,chars ='')_.parseInt_.repeat(string ='',n = 1)_.replace(string ='',pattern,replacement)_.snakeCase_.split_.startCase_.startsWith_.template_.toLower_.toUpper_.trim_.trimEnd(string ='',chars = whitespace)_.trimStart_.truncate_.unescape_.upperCase_.upperFirstUtil_.attempt_.bindAll_.cond_.conforms_.constant_.defaultTo_.flow_.flowRight_.identity_.iteratee_.matches_.matchesProperty_.method_.methodOf_.mixin_.noConflict_.noop_.nthArg_.over_.overEvery_.overSome_.property_.propertyOf_.range_.rangeRight_.runInContext_.stubArray()_.stubFalse_.stubObject_.stubString_.stubTrue_.times_.toPath_.uniqueIdMethods将字符“&”,“<”,“>”,“”和“'” string转换为其对应的HTML实体。
注意:没有其他字符被转义。为了逃避额外的角色,请使用像他这样的第三方库。
虽然“>”字符为了对称而被转义,但像“>”和“/”这样的字符不需要在HTML中转义,除非它们是标记或未加引号属性值的一部分,否则没有特殊含义。有关更多详细信息,请参阅Mathias Bynens的文章 (在“半相关趣味事实”下)。
使用HTML时,应始终引用属性值以减少XSS向量。
0.1.0
[string=''] (字符串):要转义的字符串。 (字符串):返回转义字符串。
_.escape('fred, barney, & pebbles');
// => 'fred, barney, & pebbles'