UNPKG

@gvray/eskit

Version:

A rich and colorful toolkit about typescript and javascript.

31 lines 1.04 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var isType_1 = __importDefault(require("./isType")); /** * Checks if a value is a regular expression. * 检查值是否为正则表达式。 * * @param value - The value to check / 要检查的值 * @returns True if the value is a regular expression / 如果值是正则表达式则返回true * * @example * ```typescript * isRegExp(/ab+c/i) // true * isRegExp(new RegExp('pattern')) // true * isRegExp(new RegExp('\\d+', 'g')) // true * isRegExp(/^[a-z]+$/gi) // true * isRegExp('hello') // false * isRegExp('/pattern/') // false (string, not regex) * isRegExp({}) // false * isRegExp(null) // false * isRegExp(undefined) // false * ``` * * @since 1.0.0 */ var isRegExp = function (value) { return (0, isType_1.default)('RegExp', value); }; exports.default = isRegExp; //# sourceMappingURL=isRegExp.js.map