UNPKG

require-node-example

Version:

An example for how to use npm package: require-node & require-node-loader

1,480 lines (1,415 loc) 224 kB
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.XRegExp = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /*! * XRegExp.build 4.0.0 * <xregexp.com> * Steven Levithan (c) 2012-2017 MIT License */ exports.default = function (XRegExp) { var REGEX_DATA = 'xregexp'; var subParts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*\]/g; var parts = XRegExp.union([/\({{([\w$]+)}}\)|{{([\w$]+)}}/, subParts], 'g', { conjunction: 'or' }); /** * Strips a leading `^` and trailing unescaped `$`, if both are present. * * @private * @param {String} pattern Pattern to process. * @returns {String} Pattern with edge anchors removed. */ function deanchor(pattern) { // Allow any number of empty noncapturing groups before/after anchors, because regexes // built/generated by XRegExp sometimes include them var leadingAnchor = /^(?:\(\?:\))*\^/; var trailingAnchor = /\$(?:\(\?:\))*$/; if (leadingAnchor.test(pattern) && trailingAnchor.test(pattern) && // Ensure that the trailing `$` isn't escaped trailingAnchor.test(pattern.replace(/\\[\s\S]/g, ''))) { return pattern.replace(leadingAnchor, '').replace(trailingAnchor, ''); } return pattern; } /** * Converts the provided value to an XRegExp. Native RegExp flags are not preserved. * * @private * @param {String|RegExp} value Value to convert. * @param {Boolean} [addFlagX] Whether to apply the `x` flag in cases when `value` is not * already a regex generated by XRegExp * @returns {RegExp} XRegExp object with XRegExp syntax applied. */ function asXRegExp(value, addFlagX) { var flags = addFlagX ? 'x' : ''; return XRegExp.isRegExp(value) ? value[REGEX_DATA] && value[REGEX_DATA].captureNames ? // Don't recompile, to preserve capture names value : // Recompile as XRegExp XRegExp(value.source, flags) : // Compile string as XRegExp XRegExp(value, flags); } function interpolate(substitution) { return substitution instanceof RegExp ? substitution : XRegExp.escape(substitution); } function reduceToSubpatternsObject(subpatterns, interpolated, subpatternIndex) { subpatterns['subpattern' + subpatternIndex] = interpolated; return subpatterns; } function embedSubpatternAfter(raw, subpatternIndex, rawLiterals) { var hasSubpattern = subpatternIndex < rawLiterals.length - 1; return raw + (hasSubpattern ? '{{subpattern' + subpatternIndex + '}}' : ''); } /** * Provides tagged template literals that create regexes with XRegExp syntax and flags. The * provided pattern is handled as a raw string, so backslashes don't need to be escaped. * * Interpolation of strings and regexes shares the features of `XRegExp.build`. Interpolated * patterns are treated as atomic units when quantified, interpolated strings have their special * characters escaped, a leading `^` and trailing unescaped `$` are stripped from interpolated * regexes if both are present, and any backreferences within an interpolated regex are * rewritten to work within the overall pattern. * * @memberOf XRegExp * @param {String} [flags] Any combination of XRegExp flags. * @returns {Function} Handler for template literals that construct regexes with XRegExp syntax. * @example * * const h12 = /1[0-2]|0?[1-9]/; * const h24 = /2[0-3]|[01][0-9]/; * const hours = XRegExp.tag('x')`${h12} : | ${h24}`; * const minutes = /^[0-5][0-9]$/; * // Note that explicitly naming the 'minutes' group is required for named backreferences * const time = XRegExp.tag('x')`^ ${hours} (?<minutes>${minutes}) $`; * time.test('10:59'); // -> true * XRegExp.exec('10:59', time).minutes; // -> '59' */ XRegExp.tag = function (flags) { return function (literals) { for (var _len = arguments.length, substitutions = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { substitutions[_key - 1] = arguments[_key]; } var subpatterns = substitutions.map(interpolate).reduce(reduceToSubpatternsObject, {}); var pattern = literals.raw.map(embedSubpatternAfter).join(''); return XRegExp.build(pattern, subpatterns, flags); }; }; /** * Builds regexes using named subpatterns, for readability and pattern reuse. Backreferences in * the outer pattern and provided subpatterns are automatically renumbered to work correctly. * Native flags used by provided subpatterns are ignored in favor of the `flags` argument. * * @memberOf XRegExp * @param {String} pattern XRegExp pattern using `{{name}}` for embedded subpatterns. Allows * `({{name}})` as shorthand for `(?<name>{{name}})`. Patterns cannot be embedded within * character classes. * @param {Object} subs Lookup object for named subpatterns. Values can be strings or regexes. A * leading `^` and trailing unescaped `$` are stripped from subpatterns, if both are present. * @param {String} [flags] Any combination of XRegExp flags. * @returns {RegExp} Regex with interpolated subpatterns. * @example * * const time = XRegExp.build('(?x)^ {{hours}} ({{minutes}}) $', { * hours: XRegExp.build('{{h12}} : | {{h24}}', { * h12: /1[0-2]|0?[1-9]/, * h24: /2[0-3]|[01][0-9]/ * }, 'x'), * minutes: /^[0-5][0-9]$/ * }); * time.test('10:59'); // -> true * XRegExp.exec('10:59', time).minutes; // -> '59' */ XRegExp.build = function (pattern, subs, flags) { flags = flags || ''; // Used with `asXRegExp` calls for `pattern` and subpatterns in `subs`, to work around how // some browsers convert `RegExp('\n')` to a regex that contains the literal characters `\` // and `n`. See more details at <https://github.com/slevithan/xregexp/pull/163>. var addFlagX = flags.indexOf('x') !== -1; var inlineFlags = /^\(\?([\w$]+)\)/.exec(pattern); // Add flags within a leading mode modifier to the overall pattern's flags if (inlineFlags) { flags = XRegExp._clipDuplicates(flags + inlineFlags[1]); } var data = {}; for (var p in subs) { if (subs.hasOwnProperty(p)) { // Passing to XRegExp enables extended syntax and ensures independent validity, // lest an unescaped `(`, `)`, `[`, or trailing `\` breaks the `(?:)` wrapper. For // subpatterns provided as native regexes, it dies on octals and adds the property // used to hold extended regex instance data, for simplicity. var sub = asXRegExp(subs[p], addFlagX); data[p] = { // Deanchoring allows embedding independently useful anchored regexes. If you // really need to keep your anchors, double them (i.e., `^^...$$`). pattern: deanchor(sub.source), names: sub[REGEX_DATA].captureNames || [] }; } } // Passing to XRegExp dies on octals and ensures the outer pattern is independently valid; // helps keep this simple. Named captures will be put back. var patternAsRegex = asXRegExp(pattern, addFlagX); // 'Caps' is short for 'captures' var numCaps = 0; var numPriorCaps = void 0; var numOuterCaps = 0; var outerCapsMap = [0]; var outerCapNames = patternAsRegex[REGEX_DATA].captureNames || []; var output = patternAsRegex.source.replace(parts, function ($0, $1, $2, $3, $4) { var subName = $1 || $2; var capName = void 0; var intro = void 0; var localCapIndex = void 0; // Named subpattern if (subName) { if (!data.hasOwnProperty(subName)) { throw new ReferenceError('Undefined property ' + $0); } // Named subpattern was wrapped in a capturing group if ($1) { capName = outerCapNames[numOuterCaps]; outerCapsMap[++numOuterCaps] = ++numCaps; // If it's a named group, preserve the name. Otherwise, use the subpattern name // as the capture name intro = '(?<' + (capName || subName) + '>'; } else { intro = '(?:'; } numPriorCaps = numCaps; var rewrittenSubpattern = data[subName].pattern.replace(subParts, function (match, paren, backref) { // Capturing group if (paren) { capName = data[subName].names[numCaps - numPriorCaps]; ++numCaps; // If the current capture has a name, preserve the name if (capName) { return '(?<' + capName + '>'; } // Backreference } else if (backref) { localCapIndex = +backref - 1; // Rewrite the backreference return data[subName].names[localCapIndex] ? // Need to preserve the backreference name in case using flag `n` '\\k<' + data[subName].names[localCapIndex] + '>' : '\\' + (+backref + numPriorCaps); } return match; }); return '' + intro + rewrittenSubpattern + ')'; } // Capturing group if ($3) { capName = outerCapNames[numOuterCaps]; outerCapsMap[++numOuterCaps] = ++numCaps; // If the current capture has a name, preserve the name if (capName) { return '(?<' + capName + '>'; } // Backreference } else if ($4) { localCapIndex = +$4 - 1; // Rewrite the backreference return outerCapNames[localCapIndex] ? // Need to preserve the backreference name in case using flag `n` '\\k<' + outerCapNames[localCapIndex] + '>' : '\\' + outerCapsMap[+$4]; } return $0; }); return XRegExp(output, flags); }; }; module.exports = exports['default']; },{}],2:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /*! * XRegExp.matchRecursive 4.0.0 * <xregexp.com> * Steven Levithan (c) 2009-2017 MIT License */ exports.default = function (XRegExp) { /** * Returns a match detail object composed of the provided values. * * @private */ function row(name, value, start, end) { return { name: name, value: value, start: start, end: end }; } /** * Returns an array of match strings between outermost left and right delimiters, or an array of * objects with detailed match parts and position data. An error is thrown if delimiters are * unbalanced within the data. * * @memberOf XRegExp * @param {String} str String to search. * @param {String} left Left delimiter as an XRegExp pattern. * @param {String} right Right delimiter as an XRegExp pattern. * @param {String} [flags] Any native or XRegExp flags, used for the left and right delimiters. * @param {Object} [options] Lets you specify `valueNames` and `escapeChar` options. * @returns {Array} Array of matches, or an empty array. * @example * * // Basic usage * let str = '(t((e))s)t()(ing)'; * XRegExp.matchRecursive(str, '\\(', '\\)', 'g'); * // -> ['t((e))s', '', 'ing'] * * // Extended information mode with valueNames * str = 'Here is <div> <div>an</div></div> example'; * XRegExp.matchRecursive(str, '<div\\s*>', '</div>', 'gi', { * valueNames: ['between', 'left', 'match', 'right'] * }); * // -> [ * // {name: 'between', value: 'Here is ', start: 0, end: 8}, * // {name: 'left', value: '<div>', start: 8, end: 13}, * // {name: 'match', value: ' <div>an</div>', start: 13, end: 27}, * // {name: 'right', value: '</div>', start: 27, end: 33}, * // {name: 'between', value: ' example', start: 33, end: 41} * // ] * * // Omitting unneeded parts with null valueNames, and using escapeChar * str = '...{1}.\\{{function(x,y){return {y:x}}}'; * XRegExp.matchRecursive(str, '{', '}', 'g', { * valueNames: ['literal', null, 'value', null], * escapeChar: '\\' * }); * // -> [ * // {name: 'literal', value: '...', start: 0, end: 3}, * // {name: 'value', value: '1', start: 4, end: 5}, * // {name: 'literal', value: '.\\{', start: 6, end: 9}, * // {name: 'value', value: 'function(x,y){return {y:x}}', start: 10, end: 37} * // ] * * // Sticky mode via flag y * str = '<1><<<2>>><3>4<5>'; * XRegExp.matchRecursive(str, '<', '>', 'gy'); * // -> ['1', '<<2>>', '3'] */ XRegExp.matchRecursive = function (str, left, right, flags, options) { flags = flags || ''; options = options || {}; var global = flags.indexOf('g') !== -1; var sticky = flags.indexOf('y') !== -1; // Flag `y` is controlled internally var basicFlags = flags.replace(/y/g, ''); var escapeChar = options.escapeChar; var vN = options.valueNames; var output = []; var openTokens = 0; var delimStart = 0; var delimEnd = 0; var lastOuterEnd = 0; var outerStart = void 0; var innerStart = void 0; var leftMatch = void 0; var rightMatch = void 0; var esc = void 0; left = XRegExp(left, basicFlags); right = XRegExp(right, basicFlags); if (escapeChar) { if (escapeChar.length > 1) { throw new Error('Cannot use more than one escape character'); } escapeChar = XRegExp.escape(escapeChar); // Example of concatenated `esc` regex: // `escapeChar`: '%' // `left`: '<' // `right`: '>' // Regex is: /(?:%[\S\s]|(?:(?!<|>)[^%])+)+/ esc = new RegExp('(?:' + escapeChar + '[\\S\\s]|(?:(?!' + // Using `XRegExp.union` safely rewrites backreferences in `left` and `right`. // Intentionally not passing `basicFlags` to `XRegExp.union` since any syntax // transformation resulting from those flags was already applied to `left` and // `right` when they were passed through the XRegExp constructor above. XRegExp.union([left, right], '', { conjunction: 'or' }).source + ')[^' + escapeChar + '])+)+', // Flags `gy` not needed here flags.replace(/[^imu]+/g, '')); } while (true) { // If using an escape character, advance to the delimiter's next starting position, // skipping any escaped characters in between if (escapeChar) { delimEnd += (XRegExp.exec(str, esc, delimEnd, 'sticky') || [''])[0].length; } leftMatch = XRegExp.exec(str, left, delimEnd); rightMatch = XRegExp.exec(str, right, delimEnd); // Keep the leftmost match only if (leftMatch && rightMatch) { if (leftMatch.index <= rightMatch.index) { rightMatch = null; } else { leftMatch = null; } } // Paths (LM: leftMatch, RM: rightMatch, OT: openTokens): // LM | RM | OT | Result // 1 | 0 | 1 | loop // 1 | 0 | 0 | loop // 0 | 1 | 1 | loop // 0 | 1 | 0 | throw // 0 | 0 | 1 | throw // 0 | 0 | 0 | break // The paths above don't include the sticky mode special case. The loop ends after the // first completed match if not `global`. if (leftMatch || rightMatch) { delimStart = (leftMatch || rightMatch).index; delimEnd = delimStart + (leftMatch || rightMatch)[0].length; } else if (!openTokens) { break; } if (sticky && !openTokens && delimStart > lastOuterEnd) { break; } if (leftMatch) { if (!openTokens) { outerStart = delimStart; innerStart = delimEnd; } ++openTokens; } else if (rightMatch && openTokens) { if (! --openTokens) { if (vN) { if (vN[0] && outerStart > lastOuterEnd) { output.push(row(vN[0], str.slice(lastOuterEnd, outerStart), lastOuterEnd, outerStart)); } if (vN[1]) { output.push(row(vN[1], str.slice(outerStart, innerStart), outerStart, innerStart)); } if (vN[2]) { output.push(row(vN[2], str.slice(innerStart, delimStart), innerStart, delimStart)); } if (vN[3]) { output.push(row(vN[3], str.slice(delimStart, delimEnd), delimStart, delimEnd)); } } else { output.push(str.slice(innerStart, delimStart)); } lastOuterEnd = delimEnd; if (!global) { break; } } } else { throw new Error('Unbalanced delimiter found in string'); } // If the delimiter matched an empty string, avoid an infinite loop if (delimStart === delimEnd) { ++delimEnd; } } if (global && !sticky && vN && vN[0] && str.length > lastOuterEnd) { output.push(row(vN[0], str.slice(lastOuterEnd), lastOuterEnd, str.length)); } return output; }; }; module.exports = exports['default']; },{}],3:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /*! * XRegExp Unicode Base 4.0.0 * <xregexp.com> * Steven Levithan (c) 2008-2017 MIT License */ exports.default = function (XRegExp) { /** * Adds base support for Unicode matching: * - Adds syntax `\p{..}` for matching Unicode tokens. Tokens can be inverted using `\P{..}` or * `\p{^..}`. Token names ignore case, spaces, hyphens, and underscores. You can omit the * braces for token names that are a single letter (e.g. `\pL` or `PL`). * - Adds flag A (astral), which enables 21-bit Unicode support. * - Adds the `XRegExp.addUnicodeData` method used by other addons to provide character data. * * Unicode Base relies on externally provided Unicode character data. Official addons are * available to provide data for Unicode categories, scripts, blocks, and properties. * * @requires XRegExp */ // ==--------------------------== // Private stuff // ==--------------------------== // Storage for Unicode data var unicode = {}; // Reuse utils var dec = XRegExp._dec; var hex = XRegExp._hex; var pad4 = XRegExp._pad4; // Generates a token lookup name: lowercase, with hyphens, spaces, and underscores removed function normalize(name) { return name.replace(/[- _]+/g, '').toLowerCase(); } // Gets the decimal code of a literal code unit, \xHH, \uHHHH, or a backslash-escaped literal function charCode(chr) { var esc = /^\\[xu](.+)/.exec(chr); return esc ? dec(esc[1]) : chr.charCodeAt(chr[0] === '\\' ? 1 : 0); } // Inverts a list of ordered BMP characters and ranges function invertBmp(range) { var output = ''; var lastEnd = -1; XRegExp.forEach(range, /(\\x..|\\u....|\\?[\s\S])(?:-(\\x..|\\u....|\\?[\s\S]))?/, function (m) { var start = charCode(m[1]); if (start > lastEnd + 1) { output += '\\u' + pad4(hex(lastEnd + 1)); if (start > lastEnd + 2) { output += '-\\u' + pad4(hex(start - 1)); } } lastEnd = charCode(m[2] || m[1]); }); if (lastEnd < 0xFFFF) { output += '\\u' + pad4(hex(lastEnd + 1)); if (lastEnd < 0xFFFE) { output += '-\\uFFFF'; } } return output; } // Generates an inverted BMP range on first use function cacheInvertedBmp(slug) { var prop = 'b!'; return unicode[slug][prop] || (unicode[slug][prop] = invertBmp(unicode[slug].bmp)); } // Combines and optionally negates BMP and astral data function buildAstral(slug, isNegated) { var item = unicode[slug]; var combined = ''; if (item.bmp && !item.isBmpLast) { combined = '[' + item.bmp + ']' + (item.astral ? '|' : ''); } if (item.astral) { combined += item.astral; } if (item.isBmpLast && item.bmp) { combined += (item.astral ? '|' : '') + '[' + item.bmp + ']'; } // Astral Unicode tokens always match a code point, never a code unit return isNegated ? '(?:(?!' + combined + ')(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[\0-\uFFFF]))' : '(?:' + combined + ')'; } // Builds a complete astral pattern on first use function cacheAstral(slug, isNegated) { var prop = isNegated ? 'a!' : 'a='; return unicode[slug][prop] || (unicode[slug][prop] = buildAstral(slug, isNegated)); } // ==--------------------------== // Core functionality // ==--------------------------== /* * Add astral mode (flag A) and Unicode token syntax: `\p{..}`, `\P{..}`, `\p{^..}`, `\pC`. */ XRegExp.addToken( // Use `*` instead of `+` to avoid capturing `^` as the token name in `\p{^}` /\\([pP])(?:{(\^?)([^}]*)}|([A-Za-z]))/, function (match, scope, flags) { var ERR_DOUBLE_NEG = 'Invalid double negation '; var ERR_UNKNOWN_NAME = 'Unknown Unicode token '; var ERR_UNKNOWN_REF = 'Unicode token missing data '; var ERR_ASTRAL_ONLY = 'Astral mode required for Unicode token '; var ERR_ASTRAL_IN_CLASS = 'Astral mode does not support Unicode tokens within character classes'; // Negated via \P{..} or \p{^..} var isNegated = match[1] === 'P' || !!match[2]; // Switch from BMP (0-FFFF) to astral (0-10FFFF) mode via flag A var isAstralMode = flags.indexOf('A') !== -1; // Token lookup name. Check `[4]` first to avoid passing `undefined` via `\p{}` var slug = normalize(match[4] || match[3]); // Token data object var item = unicode[slug]; if (match[1] === 'P' && match[2]) { throw new SyntaxError(ERR_DOUBLE_NEG + match[0]); } if (!unicode.hasOwnProperty(slug)) { throw new SyntaxError(ERR_UNKNOWN_NAME + match[0]); } // Switch to the negated form of the referenced Unicode token if (item.inverseOf) { slug = normalize(item.inverseOf); if (!unicode.hasOwnProperty(slug)) { throw new ReferenceError(ERR_UNKNOWN_REF + match[0] + ' -> ' + item.inverseOf); } item = unicode[slug]; isNegated = !isNegated; } if (!(item.bmp || isAstralMode)) { throw new SyntaxError(ERR_ASTRAL_ONLY + match[0]); } if (isAstralMode) { if (scope === 'class') { throw new SyntaxError(ERR_ASTRAL_IN_CLASS); } return cacheAstral(slug, isNegated); } return scope === 'class' ? isNegated ? cacheInvertedBmp(slug) : item.bmp : (isNegated ? '[^' : '[') + item.bmp + ']'; }, { scope: 'all', optionalFlags: 'A', leadChar: '\\' }); /** * Adds to the list of Unicode tokens that XRegExp regexes can match via `\p` or `\P`. * * @memberOf XRegExp * @param {Array} data Objects with named character ranges. Each object may have properties * `name`, `alias`, `isBmpLast`, `inverseOf`, `bmp`, and `astral`. All but `name` are * optional, although one of `bmp` or `astral` is required (unless `inverseOf` is set). If * `astral` is absent, the `bmp` data is used for BMP and astral modes. If `bmp` is absent, * the name errors in BMP mode but works in astral mode. If both `bmp` and `astral` are * provided, the `bmp` data only is used in BMP mode, and the combination of `bmp` and * `astral` data is used in astral mode. `isBmpLast` is needed when a token matches orphan * high surrogates *and* uses surrogate pairs to match astral code points. The `bmp` and * `astral` data should be a combination of literal characters and `\xHH` or `\uHHHH` escape * sequences, with hyphens to create ranges. Any regex metacharacters in the data should be * escaped, apart from range-creating hyphens. The `astral` data can additionally use * character classes and alternation, and should use surrogate pairs to represent astral code * points. `inverseOf` can be used to avoid duplicating character data if a Unicode token is * defined as the exact inverse of another token. * @example * * // Basic use * XRegExp.addUnicodeData([{ * name: 'XDigit', * alias: 'Hexadecimal', * bmp: '0-9A-Fa-f' * }]); * XRegExp('\\p{XDigit}:\\p{Hexadecimal}+').test('0:3D'); // -> true */ XRegExp.addUnicodeData = function (data) { var ERR_NO_NAME = 'Unicode token requires name'; var ERR_NO_DATA = 'Unicode token has no character data '; var item = void 0; for (var i = 0; i < data.length; ++i) { item = data[i]; if (!item.name) { throw new Error(ERR_NO_NAME); } if (!(item.inverseOf || item.bmp || item.astral)) { throw new Error(ERR_NO_DATA + item.name); } unicode[normalize(item.name)] = item; if (item.alias) { unicode[normalize(item.alias)] = item; } } // Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and // flags might now produce different results XRegExp.cache.flush('patterns'); }; /** * @ignore * * Return a reference to the internal Unicode definition structure for the given Unicode * Property if the given name is a legal Unicode Property for use in XRegExp `\p` or `\P` regex * constructs. * * @memberOf XRegExp * @param {String} name Name by which the Unicode Property may be recognized (case-insensitive), * e.g. `'N'` or `'Number'`. The given name is matched against all registered Unicode * Properties and Property Aliases. * @returns {Object} Reference to definition structure when the name matches a Unicode Property. * * @note * For more info on Unicode Properties, see also http://unicode.org/reports/tr18/#Categories. * * @note * This method is *not* part of the officially documented API and may change or be removed in * the future. It is meant for userland code that wishes to reuse the (large) internal Unicode * structures set up by XRegExp. */ XRegExp._getUnicodeProperty = function (name) { var slug = normalize(name); return unicode[slug]; }; }; module.exports = exports['default']; },{}],4:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /*! * XRegExp Unicode Blocks 4.0.0 * <xregexp.com> * Steven Levithan (c) 2010-2017 MIT License * Unicode data by Mathias Bynens <mathiasbynens.be> */ exports.default = function (XRegExp) { /** * Adds support for all Unicode blocks. Block names use the prefix 'In'. E.g., * `\p{InBasicLatin}`. Token names are case insensitive, and any spaces, hyphens, and * underscores are ignored. * * Uses Unicode 9.0.0. * * @requires XRegExp, Unicode Base */ if (!XRegExp.addUnicodeData) { throw new ReferenceError('Unicode Base must be loaded before Unicode Blocks'); } XRegExp.addUnicodeData([{ name: 'InAdlam', astral: '\uD83A[\uDD00-\uDD5F]' }, { name: 'InAegean_Numbers', astral: '\uD800[\uDD00-\uDD3F]' }, { name: 'InAhom', astral: '\uD805[\uDF00-\uDF3F]' }, { name: 'InAlchemical_Symbols', astral: '\uD83D[\uDF00-\uDF7F]' }, { name: 'InAlphabetic_Presentation_Forms', bmp: '\uFB00-\uFB4F' }, { name: 'InAnatolian_Hieroglyphs', astral: '\uD811[\uDC00-\uDE7F]' }, { name: 'InAncient_Greek_Musical_Notation', astral: '\uD834[\uDE00-\uDE4F]' }, { name: 'InAncient_Greek_Numbers', astral: '\uD800[\uDD40-\uDD8F]' }, { name: 'InAncient_Symbols', astral: '\uD800[\uDD90-\uDDCF]' }, { name: 'InArabic', bmp: '\u0600-\u06FF' }, { name: 'InArabic_Extended_A', bmp: '\u08A0-\u08FF' }, { name: 'InArabic_Mathematical_Alphabetic_Symbols', astral: '\uD83B[\uDE00-\uDEFF]' }, { name: 'InArabic_Presentation_Forms_A', bmp: '\uFB50-\uFDFF' }, { name: 'InArabic_Presentation_Forms_B', bmp: '\uFE70-\uFEFF' }, { name: 'InArabic_Supplement', bmp: '\u0750-\u077F' }, { name: 'InArmenian', bmp: '\u0530-\u058F' }, { name: 'InArrows', bmp: '\u2190-\u21FF' }, { name: 'InAvestan', astral: '\uD802[\uDF00-\uDF3F]' }, { name: 'InBalinese', bmp: '\u1B00-\u1B7F' }, { name: 'InBamum', bmp: '\uA6A0-\uA6FF' }, { name: 'InBamum_Supplement', astral: '\uD81A[\uDC00-\uDE3F]' }, { name: 'InBasic_Latin', bmp: '\0-\x7F' }, { name: 'InBassa_Vah', astral: '\uD81A[\uDED0-\uDEFF]' }, { name: 'InBatak', bmp: '\u1BC0-\u1BFF' }, { name: 'InBengali', bmp: '\u0980-\u09FF' }, { name: 'InBhaiksuki', astral: '\uD807[\uDC00-\uDC6F]' }, { name: 'InBlock_Elements', bmp: '\u2580-\u259F' }, { name: 'InBopomofo', bmp: '\u3100-\u312F' }, { name: 'InBopomofo_Extended', bmp: '\u31A0-\u31BF' }, { name: 'InBox_Drawing', bmp: '\u2500-\u257F' }, { name: 'InBrahmi', astral: '\uD804[\uDC00-\uDC7F]' }, { name: 'InBraille_Patterns', bmp: '\u2800-\u28FF' }, { name: 'InBuginese', bmp: '\u1A00-\u1A1F' }, { name: 'InBuhid', bmp: '\u1740-\u175F' }, { name: 'InByzantine_Musical_Symbols', astral: '\uD834[\uDC00-\uDCFF]' }, { name: 'InCJK_Compatibility', bmp: '\u3300-\u33FF' }, { name: 'InCJK_Compatibility_Forms', bmp: '\uFE30-\uFE4F' }, { name: 'InCJK_Compatibility_Ideographs', bmp: '\uF900-\uFAFF' }, { name: 'InCJK_Compatibility_Ideographs_Supplement', astral: '\uD87E[\uDC00-\uDE1F]' }, { name: 'InCJK_Radicals_Supplement', bmp: '\u2E80-\u2EFF' }, { name: 'InCJK_Strokes', bmp: '\u31C0-\u31EF' }, { name: 'InCJK_Symbols_and_Punctuation', bmp: '\u3000-\u303F' }, { name: 'InCJK_Unified_Ideographs', bmp: '\u4E00-\u9FFF' }, { name: 'InCJK_Unified_Ideographs_Extension_A', bmp: '\u3400-\u4DBF' }, { name: 'InCJK_Unified_Ideographs_Extension_B', astral: '[\uD840-\uD868][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF]' }, { name: 'InCJK_Unified_Ideographs_Extension_C', astral: '\uD869[\uDF00-\uDFFF]|[\uD86A-\uD86C][\uDC00-\uDFFF]|\uD86D[\uDC00-\uDF3F]' }, { name: 'InCJK_Unified_Ideographs_Extension_D', astral: '\uD86D[\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1F]' }, { name: 'InCJK_Unified_Ideographs_Extension_E', astral: '\uD86E[\uDC20-\uDFFF]|[\uD86F-\uD872][\uDC00-\uDFFF]|\uD873[\uDC00-\uDEAF]' }, { name: 'InCarian', astral: '\uD800[\uDEA0-\uDEDF]' }, { name: 'InCaucasian_Albanian', astral: '\uD801[\uDD30-\uDD6F]' }, { name: 'InChakma', astral: '\uD804[\uDD00-\uDD4F]' }, { name: 'InCham', bmp: '\uAA00-\uAA5F' }, { name: 'InCherokee', bmp: '\u13A0-\u13FF' }, { name: 'InCherokee_Supplement', bmp: '\uAB70-\uABBF' }, { name: 'InCombining_Diacritical_Marks', bmp: '\u0300-\u036F' }, { name: 'InCombining_Diacritical_Marks_Extended', bmp: '\u1AB0-\u1AFF' }, { name: 'InCombining_Diacritical_Marks_Supplement', bmp: '\u1DC0-\u1DFF' }, { name: 'InCombining_Diacritical_Marks_for_Symbols', bmp: '\u20D0-\u20FF' }, { name: 'InCombining_Half_Marks', bmp: '\uFE20-\uFE2F' }, { name: 'InCommon_Indic_Number_Forms', bmp: '\uA830-\uA83F' }, { name: 'InControl_Pictures', bmp: '\u2400-\u243F' }, { name: 'InCoptic', bmp: '\u2C80-\u2CFF' }, { name: 'InCoptic_Epact_Numbers', astral: '\uD800[\uDEE0-\uDEFF]' }, { name: 'InCounting_Rod_Numerals', astral: '\uD834[\uDF60-\uDF7F]' }, { name: 'InCuneiform', astral: '\uD808[\uDC00-\uDFFF]' }, { name: 'InCuneiform_Numbers_and_Punctuation', astral: '\uD809[\uDC00-\uDC7F]' }, { name: 'InCurrency_Symbols', bmp: '\u20A0-\u20CF' }, { name: 'InCypriot_Syllabary', astral: '\uD802[\uDC00-\uDC3F]' }, { name: 'InCyrillic', bmp: '\u0400-\u04FF' }, { name: 'InCyrillic_Extended_A', bmp: '\u2DE0-\u2DFF' }, { name: 'InCyrillic_Extended_B', bmp: '\uA640-\uA69F' }, { name: 'InCyrillic_Extended_C', bmp: '\u1C80-\u1C8F' }, { name: 'InCyrillic_Supplement', bmp: '\u0500-\u052F' }, { name: 'InDeseret', astral: '\uD801[\uDC00-\uDC4F]' }, { name: 'InDevanagari', bmp: '\u0900-\u097F' }, { name: 'InDevanagari_Extended', bmp: '\uA8E0-\uA8FF' }, { name: 'InDingbats', bmp: '\u2700-\u27BF' }, { name: 'InDomino_Tiles', astral: '\uD83C[\uDC30-\uDC9F]' }, { name: 'InDuployan', astral: '\uD82F[\uDC00-\uDC9F]' }, { name: 'InEarly_Dynastic_Cuneiform', astral: '\uD809[\uDC80-\uDD4F]' }, { name: 'InEgyptian_Hieroglyphs', astral: '\uD80C[\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F]' }, { name: 'InElbasan', astral: '\uD801[\uDD00-\uDD2F]' }, { name: 'InEmoticons', astral: '\uD83D[\uDE00-\uDE4F]' }, { name: 'InEnclosed_Alphanumeric_Supplement', astral: '\uD83C[\uDD00-\uDDFF]' }, { name: 'InEnclosed_Alphanumerics', bmp: '\u2460-\u24FF' }, { name: 'InEnclosed_CJK_Letters_and_Months', bmp: '\u3200-\u32FF' }, { name: 'InEnclosed_Ideographic_Supplement', astral: '\uD83C[\uDE00-\uDEFF]' }, { name: 'InEthiopic', bmp: '\u1200-\u137F' }, { name: 'InEthiopic_Extended', bmp: '\u2D80-\u2DDF' }, { name: 'InEthiopic_Extended_A', bmp: '\uAB00-\uAB2F' }, { name: 'InEthiopic_Supplement', bmp: '\u1380-\u139F' }, { name: 'InGeneral_Punctuation', bmp: '\u2000-\u206F' }, { name: 'InGeometric_Shapes', bmp: '\u25A0-\u25FF' }, { name: 'InGeometric_Shapes_Extended', astral: '\uD83D[\uDF80-\uDFFF]' }, { name: 'InGeorgian', bmp: '\u10A0-\u10FF' }, { name: 'InGeorgian_Supplement', bmp: '\u2D00-\u2D2F' }, { name: 'InGlagolitic', bmp: '\u2C00-\u2C5F' }, { name: 'InGlagolitic_Supplement', astral: '\uD838[\uDC00-\uDC2F]' }, { name: 'InGothic', astral: '\uD800[\uDF30-\uDF4F]' }, { name: 'InGrantha', astral: '\uD804[\uDF00-\uDF7F]' }, { name: 'InGreek_Extended', bmp: '\u1F00-\u1FFF' }, { name: 'InGreek_and_Coptic', bmp: '\u0370-\u03FF' }, { name: 'InGujarati', bmp: '\u0A80-\u0AFF' }, { name: 'InGurmukhi', bmp: '\u0A00-\u0A7F' }, { name: 'InHalfwidth_and_Fullwidth_Forms', bmp: '\uFF00-\uFFEF' }, { name: 'InHangul_Compatibility_Jamo', bmp: '\u3130-\u318F' }, { name: 'InHangul_Jamo', bmp: '\u1100-\u11FF' }, { name: 'InHangul_Jamo_Extended_A', bmp: '\uA960-\uA97F' }, { name: 'InHangul_Jamo_Extended_B', bmp: '\uD7B0-\uD7FF' }, { name: 'InHangul_Syllables', bmp: '\uAC00-\uD7AF' }, { name: 'InHanunoo', bmp: '\u1720-\u173F' }, { name: 'InHatran', astral: '\uD802[\uDCE0-\uDCFF]' }, { name: 'InHebrew', bmp: '\u0590-\u05FF' }, { name: 'InHigh_Private_Use_Surrogates', bmp: '\uDB80-\uDBFF' }, { name: 'InHigh_Surrogates', bmp: '\uD800-\uDB7F' }, { name: 'InHiragana', bmp: '\u3040-\u309F' }, { name: 'InIPA_Extensions', bmp: '\u0250-\u02AF' }, { name: 'InIdeographic_Description_Characters', bmp: '\u2FF0-\u2FFF' }, { name: 'InIdeographic_Symbols_and_Punctuation', astral: '\uD81B[\uDFE0-\uDFFF]' }, { name: 'InImperial_Aramaic', astral: '\uD802[\uDC40-\uDC5F]' }, { name: 'InInscriptional_Pahlavi', astral: '\uD802[\uDF60-\uDF7F]' }, { name: 'InInscriptional_Parthian', astral: '\uD802[\uDF40-\uDF5F]' }, { name: 'InJavanese', bmp: '\uA980-\uA9DF' }, { name: 'InKaithi', astral: '\uD804[\uDC80-\uDCCF]' }, { name: 'InKana_Supplement', astral: '\uD82C[\uDC00-\uDCFF]' }, { name: 'InKanbun', bmp: '\u3190-\u319F' }, { name: 'InKangxi_Radicals', bmp: '\u2F00-\u2FDF' }, { name: 'InKannada', bmp: '\u0C80-\u0CFF' }, { name: 'InKatakana', bmp: '\u30A0-\u30FF' }, { name: 'InKatakana_Phonetic_Extensions', bmp: '\u31F0-\u31FF' }, { name: 'InKayah_Li', bmp: '\uA900-\uA92F' }, { name: 'InKharoshthi', astral: '\uD802[\uDE00-\uDE5F]' }, { name: 'InKhmer', bmp: '\u1780-\u17FF' }, { name: 'InKhmer_Symbols', bmp: '\u19E0-\u19FF' }, { name: 'InKhojki', astral: '\uD804[\uDE00-\uDE4F]' }, { name: 'InKhudawadi', astral: '\uD804[\uDEB0-\uDEFF]' }, { name: 'InLao', bmp: '\u0E80-\u0EFF' }, { name: 'InLatin_Extended_Additional', bmp: '\u1E00-\u1EFF' }, { name: 'InLatin_Extended_A', bmp: '\u0100-\u017F' }, { name: 'InLatin_Extended_B', bmp: '\u0180-\u024F' }, { name: 'InLatin_Extended_C', bmp: '\u2C60-\u2C7F' }, { name: 'InLatin_Extended_D', bmp: '\uA720-\uA7FF' }, { name: 'InLatin_Extended_E', bmp: '\uAB30-\uAB6F' }, { name: 'InLatin_1_Supplement', bmp: '\x80-\xFF' }, { name: 'InLepcha', bmp: '\u1C00-\u1C4F' }, { name: 'InLetterlike_Symbols', bmp: '\u2100-\u214F' }, { name: 'InLimbu', bmp: '\u1900-\u194F' }, { name: 'InLinear_A', astral: '\uD801[\uDE00-\uDF7F]' }, { name: 'InLinear_B_Ideograms', astral: '\uD800[\uDC80-\uDCFF]' }, { name: 'InLinear_B_Syllabary', astral: '\uD800[\uDC00-\uDC7F]' }, { name: 'InLisu', bmp: '\uA4D0-\uA4FF' }, { name: 'InLow_Surrogates', bmp: '\uDC00-\uDFFF' }, { name: 'InLycian', astral: '\uD800[\uDE80-\uDE9F]' }, { name: 'InLydian', astral: '\uD802[\uDD20-\uDD3F]' }, { name: 'InMahajani', astral: '\uD804[\uDD50-\uDD7F]' }, { name: 'InMahjong_Tiles', astral: '\uD83C[\uDC00-\uDC2F]' }, { name: 'InMalayalam', bmp: '\u0D00-\u0D7F' }, { name: 'InMandaic', bmp: '\u0840-\u085F' }, { name: 'InManichaean', astral: '\uD802[\uDEC0-\uDEFF]' }, { name: 'InMarchen', astral: '\uD807[\uDC70-\uDCBF]' }, { name: 'InMathematical_Alphanumeric_Symbols', astral: '\uD835[\uDC00-\uDFFF]' }, { name: 'InMathematical_Operators', bmp: '\u2200-\u22FF' }, { name: 'InMeetei_Mayek', bmp: '\uABC0-\uABFF' }, { name: 'InMeetei_Mayek_Extensions', bmp: '\uAAE0-\uAAFF' }, { name: 'InMende_Kikakui', astral: '\uD83A[\uDC00-\uDCDF]' }, { name: 'InMeroitic_Cursive', astral: '\uD802[\uDDA0-\uDDFF]' }, { name: 'InMeroitic_Hieroglyphs', astral: '\uD802[\uDD80-\uDD9F]' }, { name: 'InMiao', astral: '\uD81B[\uDF00-\uDF9F]' }, { name: 'InMiscellaneous_Mathematical_Symbols_A', bmp: '\u27C0-\u27EF' }, { name: 'InMiscellaneous_Mathematical_Symbols_B', bmp: '\u2980-\u29FF' }, { name: 'InMiscellaneous_Symbols', bmp: '\u2600-\u26FF' }, { name: 'InMiscellaneous_Symbols_and_Arrows', bmp: '\u2B00-\u2BFF' }, { name: 'InMiscellaneous_Symbols_and_Pictographs', astral: '\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF]' }, { name: 'InMiscellaneous_Technical', bmp: '\u2300-\u23FF' }, { name: 'InModi', astral: '\uD805[\uDE00-\uDE5F]' }, { name: 'InModifier_Tone_Letters', bmp: '\uA700-\uA71F' }, { name: 'InMongolian', bmp: '\u1800-\u18AF' }, { name: 'InMongolian_Supplement', astral: '\uD805[\uDE60-\uDE7F]' }, { name: 'InMro', astral: '\uD81A[\uDE40-\uDE6F]' }, { name: 'InMultani', astral: '\uD804[\uDE80-\uDEAF]' }, { name: 'InMusical_Symbols', astral: '\uD834[\uDD00-\uDDFF]' }, { name: 'InMyanmar', bmp: '\u1000-\u109F' }, { name: 'InMyanmar_Extended_A', bmp: '\uAA60-\uAA7F' }, { name: 'InMyanmar_Extended_B', bmp: '\uA9E0-\uA9FF' }, { name: 'InNKo', bmp: '\u07C0-\u07FF' }, { name: 'InNabataean', astral: '\uD802[\uDC80-\uDCAF]' }, { name: 'InNew_Tai_Lue', bmp: '\u1980-\u19DF' }, { name: 'InNewa', astral: '\uD805[\uDC00-\uDC7F]' }, { name: 'InNumber_Forms', bmp: '\u2150-\u218F' }, { name: 'InOgham', bmp: '\u1680-\u169F' }, { name: 'InOl_Chiki', bmp: '\u1C50-\u1C7F' }, { name: 'InOld_Hungarian', astral: '\uD803[\uDC80-\uDCFF]' }, { name: 'InOld_Italic', astral: '\uD800[\uDF00-\uDF2F]' }, { name: 'InOld_North_Arabian', astral: '\uD802[\uDE80-\uDE9F]' }, { name: 'InOld_Permic', astral: '\uD800[\uDF50-\uDF7F]' }, { name: 'InOld_Persian', astral: '\uD800[\uDFA0-\uDFDF]' }, { name: 'InOld_South_Arabian', astral: '\uD802[\uDE60-\uDE7F]' }, { name: 'InOld_Turkic', astral: '\uD803[\uDC00-\uDC4F]' }, { name: 'InOptical_Character_Recognition', bmp: '\u2440-\u245F' }, { name: 'InOriya', bmp: '\u0B00-\u0B7F' }, { name: 'InOrnamental_Dingbats', astral: '\uD83D[\uDE50-\uDE7F]' }, { name: 'InOsage', astral: '\uD801[\uDCB0-\uDCFF]' }, { name: 'InOsmanya', astral: '\uD801[\uDC80-\uDCAF]' }, { name: 'InPahawh_Hmong', astral: '\uD81A[\uDF00-\uDF8F]' }, { name: 'InPalmyrene', astral: '\uD802[\uDC60-\uDC7F]' }, { name: 'InPau_Cin_Hau', astral: '\uD806[\uDEC0-\uDEFF]' }, { name: 'InPhags_pa', bmp: '\uA840-\uA87F' }, { name: 'InPhaistos_Disc', astral: '\uD800[\uDDD0-\uDDFF]' }, { name: 'InPhoenician', astral: '\uD802[\uDD00-\uDD1F]' }, { name: 'InPhonetic_Extensions', bmp: '\u1D00-\u1D7F' }, { name: 'InPhonetic_Extensions_Supplement', bmp: '\u1D80-\u1DBF' }, { name: 'InPlaying_Cards', astral: '\uD83C[\uDCA0-\uDCFF]' }, { name: 'InPrivate_Use_Area', bmp: '\uE000-\uF8FF' }, { name: 'InPsalter_Pahlavi', astral: '\uD802[\uDF80-\uDFAF]' }, { name: 'InRejang', bmp: '\uA930-\uA95F' }, { name: 'InRumi_Numeral_Symbols', astral: '\uD803[\uDE60-\uDE7F]' }, { name: 'InRunic', bmp: '\u16A0-\u16FF' }, { name: 'InSamaritan', bmp: '\u0800-\u083F' }, { name: 'InSaurashtra', bmp: '\uA880-\uA8DF' }, { name: 'InSharada', astral: '\uD804[\uDD80-\uDDDF]' }, { name: 'InShavian', astral: '\uD801[\uDC50-\uDC7F]' }, { name: 'InShorthand_Format_Controls', astral: '\uD82F[\uDCA0-\uDCAF]' }, { name: 'InSiddham', astral: '\uD805[\uDD80-\uDDFF]' }, { name: 'InSinhala', bmp: '\u0D80-\u0DFF' }, { name: 'InSinhala_Archaic_Numbers', astral: '\uD804[\uDDE0-\uDDFF]' }, { name: 'InSmall_Form_Variants', bmp: '\uFE50-\uFE6F' }, { name: 'InSora_Sompeng', astral: '\uD804[\uDCD0-\uDCFF]' }, { name: 'InSpacing_Modifier_Letters', bmp: '\u02B0-\u02FF' }, { name: 'InSpecials', bmp: '\uFFF0-\uFFFF' }, { name: 'InSundanese', bmp: '\u1B80-\u1BBF' }, { name: 'InSundanese_Supplement', bmp: '\u1CC0-\u1CCF' }, { name: 'InSuperscripts_and_Subscripts', bmp: '\u2070-\u209F' }, { name: 'InSupplemental_Arrows_A', bmp: '\u27F0-\u27FF' }, { name: 'InSupplemental_Arrows_B', bmp: '\u2900-\u297F' }, { name: 'InSupplemental_Arrows_C', astral: '\uD83E[\uDC00-\uDCFF]' }, { name: 'InSupplemental_Mathematical_Operators', bmp: '\u2A00-\u2AFF' }, { name: 'InSupplemental_Punctuation', bmp: '\u2E00-\u2E7F' }, { name: 'InSupplemental_Symbols_and_Pictographs', astral: '\uD83E[\uDD00-\uDDFF]' }, { name: 'InSupplementary_Private_Use_Area_A', astral: '[\uDB80-\uDBBF][\uDC00-\uDFFF]' }, { name: 'InSupplementary_Private_Use_Area_B', astral: '[\uDBC0-\uDBFF][\uDC00-\uDFFF]' }, { name: 'InSutton_SignWriting', astral: '\uD836[\uDC00-\uDEAF]' }, { name: 'InSyloti_Nagri', bmp: '\uA800-\uA82F' }, { name: 'InSyriac', bmp: '\u0700-\u074F' }, { name: 'InTagalog', bmp: '\u1700-\u171F' }, { name: 'InTagbanwa', bmp: '\u1760-\u177F' }, { name: 'InTags', astral: '\uDB40[\uDC00-\uDC7F]' }, { name: 'InTai_Le', bmp: '\u1950-\u197F' }, { name: 'InTai_Tham', bmp: '\u1A20-\u1AAF' }, { name: 'InTai_Viet', bmp: '\uAA80-\uAADF' }, { name: 'InTai_Xuan_Jing_Symbols', astral: '\uD834[\uDF00-\uDF5F]' }, { name: 'InTakri', astral: '\uD805[\uDE80-\uDECF]' }, { name: 'InTamil', bmp: '\u0B80-\u0BFF'