mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Move internal modules to “internal” folder.
This commit is contained in:
26
.internal/hasUnicode.js
Normal file
26
.internal/hasUnicode.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/** Used to compose unicode character classes. */
|
||||
const rsAstralRange = '\\ud800-\\udfff';
|
||||
const rsComboMarksRange = '\\u0300-\\u036f';
|
||||
const reComboHalfMarksRange = '\\ufe20-\\ufe2f';
|
||||
const rsComboSymbolsRange = '\\u20d0-\\u20ff';
|
||||
const rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
|
||||
const rsVarRange = '\\ufe0e\\ufe0f';
|
||||
|
||||
/** Used to compose unicode capture groups. */
|
||||
const rsZWJ = '\\u200d';
|
||||
|
||||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
||||
const reHasUnicode = RegExp(`[${ rsZWJ + rsAstralRange + rsComboRange + rsVarRange }]`);
|
||||
|
||||
/**
|
||||
* Checks if `string` contains Unicode symbols.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to inspect.
|
||||
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
||||
*/
|
||||
function hasUnicode(string) {
|
||||
return reHasUnicode.test(string);
|
||||
}
|
||||
|
||||
export default hasUnicode;
|
||||
Reference in New Issue
Block a user