UNPKG

@n3okill/utils

Version:
15 lines 513 B
import { _checkTransform } from "../_internal"; /** * Clone RegExp * @param {RegExp} arg RegExp to clone * @returns {RegExp} New cloned RegExp */ export function cloneRegExp(arg, transform) { // eslint-disable-next-line security/detect-non-literal-regexp const reg = new RegExp(arg.source, arg.flags || /[gimuy]*$/.exec(arg.toString())[0]); if ("lastIndex" in arg) { reg.lastIndex = arg.lastIndex; } return _checkTransform(reg, transform); } //# sourceMappingURL=cloneRegExp.js.map