.
This commit is contained in:
		
							
								
								
									
										2282
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/ast-utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2282
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/ast-utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										114
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/fix-tracker.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/fix-tracker.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,114 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @fileoverview Helper class to aid in constructing fix commands.
 | 
			
		||||
 * @author Alan Pierce
 | 
			
		||||
 */
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
// Requirements
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
const astUtils = require("./ast-utils");
 | 
			
		||||
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
// Public Interface
 | 
			
		||||
//------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A helper class to combine fix options into a fix command. Currently, it
 | 
			
		||||
 * exposes some "retain" methods that extend the range of the text being
 | 
			
		||||
 * replaced so that other fixes won't touch that region in the same pass.
 | 
			
		||||
 */
 | 
			
		||||
class FixTracker {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a new FixTracker.
 | 
			
		||||
     * @param {ruleFixer} fixer A ruleFixer instance.
 | 
			
		||||
     * @param {SourceCode} sourceCode A SourceCode object for the current code.
 | 
			
		||||
     */
 | 
			
		||||
    constructor(fixer, sourceCode) {
 | 
			
		||||
        this.fixer = fixer;
 | 
			
		||||
        this.sourceCode = sourceCode;
 | 
			
		||||
        this.retainedRange = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Mark the given range as "retained", meaning that other fixes may not
 | 
			
		||||
     * may not modify this region in the same pass.
 | 
			
		||||
     * @param {int[]} range The range to retain.
 | 
			
		||||
     * @returns {FixTracker} The same RuleFixer, for chained calls.
 | 
			
		||||
     */
 | 
			
		||||
    retainRange(range) {
 | 
			
		||||
        this.retainedRange = range;
 | 
			
		||||
        return this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Given a node, find the function containing it (or the entire program) and
 | 
			
		||||
     * mark it as retained, meaning that other fixes may not modify it in this
 | 
			
		||||
     * pass. This is useful for avoiding conflicts in fixes that modify control
 | 
			
		||||
     * flow.
 | 
			
		||||
     * @param {ASTNode} node The node to use as a starting point.
 | 
			
		||||
     * @returns {FixTracker} The same RuleFixer, for chained calls.
 | 
			
		||||
     */
 | 
			
		||||
    retainEnclosingFunction(node) {
 | 
			
		||||
        const functionNode = astUtils.getUpperFunction(node);
 | 
			
		||||
 | 
			
		||||
        return this.retainRange(functionNode ? functionNode.range : this.sourceCode.ast.range);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Given a node or token, find the token before and afterward, and mark that
 | 
			
		||||
     * range as retained, meaning that other fixes may not modify it in this
 | 
			
		||||
     * pass. This is useful for avoiding conflicts in fixes that make a small
 | 
			
		||||
     * change to the code where the AST should not be changed.
 | 
			
		||||
     * @param {ASTNode|Token} nodeOrToken The node or token to use as a starting
 | 
			
		||||
     *      point. The token to the left and right are use in the range.
 | 
			
		||||
     * @returns {FixTracker} The same RuleFixer, for chained calls.
 | 
			
		||||
     */
 | 
			
		||||
    retainSurroundingTokens(nodeOrToken) {
 | 
			
		||||
        const tokenBefore = this.sourceCode.getTokenBefore(nodeOrToken) || nodeOrToken;
 | 
			
		||||
        const tokenAfter = this.sourceCode.getTokenAfter(nodeOrToken) || nodeOrToken;
 | 
			
		||||
 | 
			
		||||
        return this.retainRange([tokenBefore.range[0], tokenAfter.range[1]]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a fix command that replaces the given range with the given text,
 | 
			
		||||
     * accounting for any retained ranges.
 | 
			
		||||
     * @param {int[]} range The range to remove in the fix.
 | 
			
		||||
     * @param {string} text The text to insert in place of the range.
 | 
			
		||||
     * @returns {Object} The fix command.
 | 
			
		||||
     */
 | 
			
		||||
    replaceTextRange(range, text) {
 | 
			
		||||
        let actualRange;
 | 
			
		||||
 | 
			
		||||
        if (this.retainedRange) {
 | 
			
		||||
            actualRange = [
 | 
			
		||||
                Math.min(this.retainedRange[0], range[0]),
 | 
			
		||||
                Math.max(this.retainedRange[1], range[1])
 | 
			
		||||
            ];
 | 
			
		||||
        } else {
 | 
			
		||||
            actualRange = range;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return this.fixer.replaceTextRange(
 | 
			
		||||
            actualRange,
 | 
			
		||||
            this.sourceCode.text.slice(actualRange[0], range[0]) +
 | 
			
		||||
                text +
 | 
			
		||||
                this.sourceCode.text.slice(range[1], actualRange[1])
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a fix command that removes the given node or token, accounting for
 | 
			
		||||
     * any retained ranges.
 | 
			
		||||
     * @param {ASTNode|Token} nodeOrToken The node or token to remove.
 | 
			
		||||
     * @returns {Object} The fix command.
 | 
			
		||||
     */
 | 
			
		||||
    remove(nodeOrToken) {
 | 
			
		||||
        return this.replaceTextRange(nodeOrToken.range, "");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = FixTracker;
 | 
			
		||||
							
								
								
									
										67
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/keywords.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/keywords.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @fileoverview A shared list of ES3 keywords.
 | 
			
		||||
 * @author Josh Perez
 | 
			
		||||
 */
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
module.exports = [
 | 
			
		||||
    "abstract",
 | 
			
		||||
    "boolean",
 | 
			
		||||
    "break",
 | 
			
		||||
    "byte",
 | 
			
		||||
    "case",
 | 
			
		||||
    "catch",
 | 
			
		||||
    "char",
 | 
			
		||||
    "class",
 | 
			
		||||
    "const",
 | 
			
		||||
    "continue",
 | 
			
		||||
    "debugger",
 | 
			
		||||
    "default",
 | 
			
		||||
    "delete",
 | 
			
		||||
    "do",
 | 
			
		||||
    "double",
 | 
			
		||||
    "else",
 | 
			
		||||
    "enum",
 | 
			
		||||
    "export",
 | 
			
		||||
    "extends",
 | 
			
		||||
    "false",
 | 
			
		||||
    "final",
 | 
			
		||||
    "finally",
 | 
			
		||||
    "float",
 | 
			
		||||
    "for",
 | 
			
		||||
    "function",
 | 
			
		||||
    "goto",
 | 
			
		||||
    "if",
 | 
			
		||||
    "implements",
 | 
			
		||||
    "import",
 | 
			
		||||
    "in",
 | 
			
		||||
    "instanceof",
 | 
			
		||||
    "int",
 | 
			
		||||
    "interface",
 | 
			
		||||
    "long",
 | 
			
		||||
    "native",
 | 
			
		||||
    "new",
 | 
			
		||||
    "null",
 | 
			
		||||
    "package",
 | 
			
		||||
    "private",
 | 
			
		||||
    "protected",
 | 
			
		||||
    "public",
 | 
			
		||||
    "return",
 | 
			
		||||
    "short",
 | 
			
		||||
    "static",
 | 
			
		||||
    "super",
 | 
			
		||||
    "switch",
 | 
			
		||||
    "synchronized",
 | 
			
		||||
    "this",
 | 
			
		||||
    "throw",
 | 
			
		||||
    "throws",
 | 
			
		||||
    "transient",
 | 
			
		||||
    "true",
 | 
			
		||||
    "try",
 | 
			
		||||
    "typeof",
 | 
			
		||||
    "var",
 | 
			
		||||
    "void",
 | 
			
		||||
    "volatile",
 | 
			
		||||
    "while",
 | 
			
		||||
    "with"
 | 
			
		||||
];
 | 
			
		||||
							
								
								
									
										115
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,115 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @fileoverview `Map` to load rules lazily.
 | 
			
		||||
 * @author Toru Nagashima <https://github.com/mysticatea>
 | 
			
		||||
 */
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
const debug = require("debug")("eslint:rules");
 | 
			
		||||
 | 
			
		||||
/** @typedef {import("./types").Rule} Rule */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * The `Map` object that loads each rule when it's accessed.
 | 
			
		||||
 * @example
 | 
			
		||||
 * const rules = new LazyLoadingRuleMap([
 | 
			
		||||
 *     ["eqeqeq", () => require("eqeqeq")],
 | 
			
		||||
 *     ["semi", () => require("semi")],
 | 
			
		||||
 *     ["no-unused-vars", () => require("no-unused-vars")]
 | 
			
		||||
 * ]);
 | 
			
		||||
 *
 | 
			
		||||
 * rules.get("semi"); // call `() => require("semi")` here.
 | 
			
		||||
 *
 | 
			
		||||
 * @extends {Map<string, () => Rule>}
 | 
			
		||||
 */
 | 
			
		||||
class LazyLoadingRuleMap extends Map {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialize this map.
 | 
			
		||||
     * @param {Array<[string, function(): Rule]>} loaders The rule loaders.
 | 
			
		||||
     */
 | 
			
		||||
    constructor(loaders) {
 | 
			
		||||
        let remaining = loaders.length;
 | 
			
		||||
 | 
			
		||||
        super(
 | 
			
		||||
            debug.enabled
 | 
			
		||||
                ? loaders.map(([ruleId, load]) => {
 | 
			
		||||
                    let cache = null;
 | 
			
		||||
 | 
			
		||||
                    return [
 | 
			
		||||
                        ruleId,
 | 
			
		||||
                        () => {
 | 
			
		||||
                            if (!cache) {
 | 
			
		||||
                                debug("Loading rule %o (remaining=%d)", ruleId, --remaining);
 | 
			
		||||
                                cache = load();
 | 
			
		||||
                            }
 | 
			
		||||
                            return cache;
 | 
			
		||||
                        }
 | 
			
		||||
                    ];
 | 
			
		||||
                })
 | 
			
		||||
                : loaders
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        // `super(...iterable)` uses `this.set()`, so disable it here.
 | 
			
		||||
        Object.defineProperty(LazyLoadingRuleMap.prototype, "set", {
 | 
			
		||||
            configurable: true,
 | 
			
		||||
            value: void 0
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get a rule.
 | 
			
		||||
     * Each rule will be loaded on the first access.
 | 
			
		||||
     * @param {string} ruleId The rule ID to get.
 | 
			
		||||
     * @returns {Rule|undefined} The rule.
 | 
			
		||||
     */
 | 
			
		||||
    get(ruleId) {
 | 
			
		||||
        const load = super.get(ruleId);
 | 
			
		||||
 | 
			
		||||
        return load && load();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Iterate rules.
 | 
			
		||||
     * @returns {IterableIterator<Rule>} Rules.
 | 
			
		||||
     */
 | 
			
		||||
    *values() {
 | 
			
		||||
        for (const load of super.values()) {
 | 
			
		||||
            yield load();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Iterate rules.
 | 
			
		||||
     * @returns {IterableIterator<[string, Rule]>} Rules.
 | 
			
		||||
     */
 | 
			
		||||
    *entries() {
 | 
			
		||||
        for (const [ruleId, load] of super.entries()) {
 | 
			
		||||
            yield [ruleId, load()];
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Call a function with each rule.
 | 
			
		||||
     * @param {Function} callbackFn The callback function.
 | 
			
		||||
     * @param {any} [thisArg] The object to pass to `this` of the callback function.
 | 
			
		||||
     * @returns {void}
 | 
			
		||||
     */
 | 
			
		||||
    forEach(callbackFn, thisArg) {
 | 
			
		||||
        for (const [ruleId, load] of super.entries()) {
 | 
			
		||||
            callbackFn.call(thisArg, load(), ruleId, this);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Forbid mutation.
 | 
			
		||||
Object.defineProperties(LazyLoadingRuleMap.prototype, {
 | 
			
		||||
    clear: { configurable: true, value: void 0 },
 | 
			
		||||
    delete: { configurable: true, value: void 0 },
 | 
			
		||||
    [Symbol.iterator]: {
 | 
			
		||||
        configurable: true,
 | 
			
		||||
        writable: true,
 | 
			
		||||
        value: LazyLoadingRuleMap.prototype.entries
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
module.exports = { LazyLoadingRuleMap };
 | 
			
		||||
							
								
								
									
										36
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/patterns/letters.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/patterns/letters.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										42
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/regular-expressions.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/regular-expressions.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @fileoverview Common utils for regular expressions.
 | 
			
		||||
 * @author Josh Goldberg
 | 
			
		||||
 * @author Toru Nagashima
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
const { RegExpValidator } = require("@eslint-community/regexpp");
 | 
			
		||||
 | 
			
		||||
const REGEXPP_LATEST_ECMA_VERSION = 2024;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Checks if the given regular expression pattern would be valid with the `u` flag.
 | 
			
		||||
 * @param {number} ecmaVersion ECMAScript version to parse in.
 | 
			
		||||
 * @param {string} pattern The regular expression pattern to verify.
 | 
			
		||||
 * @returns {boolean} `true` if the pattern would be valid with the `u` flag.
 | 
			
		||||
 * `false` if the pattern would be invalid with the `u` flag or the configured
 | 
			
		||||
 * ecmaVersion doesn't support the `u` flag.
 | 
			
		||||
 */
 | 
			
		||||
function isValidWithUnicodeFlag(ecmaVersion, pattern) {
 | 
			
		||||
    if (ecmaVersion <= 5) { // ecmaVersion <= 5 doesn't support the 'u' flag
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const validator = new RegExpValidator({
 | 
			
		||||
        ecmaVersion: Math.min(ecmaVersion, REGEXPP_LATEST_ECMA_VERSION)
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
        validator.validatePattern(pattern, void 0, void 0, { unicode: /* uFlag = */ true });
 | 
			
		||||
    } catch {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
    isValidWithUnicodeFlag,
 | 
			
		||||
    REGEXPP_LATEST_ECMA_VERSION
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										11
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/unicode/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/unicode/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @author Toru Nagashima <https://github.com/mysticatea>
 | 
			
		||||
 */
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
    isCombiningCharacter: require("./is-combining-character"),
 | 
			
		||||
    isEmojiModifier: require("./is-emoji-modifier"),
 | 
			
		||||
    isRegionalIndicatorSymbol: require("./is-regional-indicator-symbol"),
 | 
			
		||||
    isSurrogatePair: require("./is-surrogate-pair")
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										13
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @author Toru Nagashima <https://github.com/mysticatea>
 | 
			
		||||
 */
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Check whether a given character is a combining mark or not.
 | 
			
		||||
 * @param {number} codePoint The character code to check.
 | 
			
		||||
 * @returns {boolean} `true` if the character belongs to the category, any of `Mc`, `Me`, and `Mn`.
 | 
			
		||||
 */
 | 
			
		||||
module.exports = function isCombiningCharacter(codePoint) {
 | 
			
		||||
    return /^[\p{Mc}\p{Me}\p{Mn}]$/u.test(String.fromCodePoint(codePoint));
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										13
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @author Toru Nagashima <https://github.com/mysticatea>
 | 
			
		||||
 */
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Check whether a given character is an emoji modifier.
 | 
			
		||||
 * @param {number} code The character code to check.
 | 
			
		||||
 * @returns {boolean} `true` if the character is an emoji modifier.
 | 
			
		||||
 */
 | 
			
		||||
module.exports = function isEmojiModifier(code) {
 | 
			
		||||
    return code >= 0x1F3FB && code <= 0x1F3FF;
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										13
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @author Toru Nagashima <https://github.com/mysticatea>
 | 
			
		||||
 */
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Check whether a given character is a regional indicator symbol.
 | 
			
		||||
 * @param {number} code The character code to check.
 | 
			
		||||
 * @returns {boolean} `true` if the character is a regional indicator symbol.
 | 
			
		||||
 */
 | 
			
		||||
module.exports = function isRegionalIndicatorSymbol(code) {
 | 
			
		||||
    return code >= 0x1F1E6 && code <= 0x1F1FF;
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										14
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								qwen/nodejs/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @author Toru Nagashima <https://github.com/mysticatea>
 | 
			
		||||
 */
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Check whether given two characters are a surrogate pair.
 | 
			
		||||
 * @param {number} lead The code of the lead character.
 | 
			
		||||
 * @param {number} tail The code of the tail character.
 | 
			
		||||
 * @returns {boolean} `true` if the character pair is a surrogate pair.
 | 
			
		||||
 */
 | 
			
		||||
module.exports = function isSurrogatePair(lead, tail) {
 | 
			
		||||
    return lead >= 0xD800 && lead < 0xDC00 && tail >= 0xDC00 && tail < 0xE000;
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user