You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
653 B
17 lines
653 B
![]()
1 week ago
|
'use strict';
|
||
|
var call = require('../internals/function-call');
|
||
|
var hasOwn = require('../internals/has-own-property');
|
||
|
var isPrototypeOf = require('../internals/object-is-prototype-of');
|
||
|
var regExpFlagsDetection = require('../internals/regexp-flags-detection');
|
||
|
var regExpFlagsGetterImplementation = require('../internals/regexp-flags');
|
||
|
|
||
|
var RegExpPrototype = RegExp.prototype;
|
||
|
|
||
|
module.exports = regExpFlagsDetection.correct ? function (it) {
|
||
|
return it.flags;
|
||
|
} : function (it) {
|
||
|
return (!regExpFlagsDetection.correct && isPrototypeOf(RegExpPrototype, it) && !hasOwn(it, 'flags'))
|
||
|
? call(regExpFlagsGetterImplementation, it)
|
||
|
: it.flags;
|
||
|
};
|