MCPcopy Create free account
hub / github.com/microsoft/SandDance / getNativeFlags

Function getNativeFlags

docs/tests/v2/es6/js/sanddance.js:139212–139218  ·  view source on GitHub ↗

* Returns native `RegExp` flags used by a regex object. * * @private * @param {RegExp} regex Regex to check. * @returns {String} Native flags in use.

(regex)

Source from the content-addressed store, hash-verified

139210 * @returns {String} Native flags in use.
139211 */
139212function getNativeFlags(regex) {
139213 return hasFlagsProp ? regex.flags :
139214 // Explicitly using `RegExp.prototype.toString` (rather than e.g. `String` or concatenation
139215 // with an empty string) allows this to continue working predictably when
139216 // `XRegExp.proptotype.toString` is overridden
139217 nativ.exec.call(/\/([a-z]*)$/i, RegExp.prototype.toString.call(regex))[1];
139218}
139219
139220/**
139221 * Determines whether a regex has extended instance data used to track capture names.

Callers 1

copyRegexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected