mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-05 01:09:31 +08:00
39 lines
801 B
Text
39 lines
801 B
Text
'use strict';
|
|
|
|
var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames();
|
|
|
|
var $Object = Object;
|
|
var $TypeError = TypeError;
|
|
|
|
module.exports = function flags() {
|
|
if (this != null && this !== $Object(this)) {
|
|
throw new $TypeError('RegExp.prototype.flags getter called on non-object');
|
|
}
|
|
var result = '';
|
|
if (this.hasIndices) {
|
|
result += 'd';
|
|
}
|
|
if (this.global) {
|
|
result += 'g';
|
|
}
|
|
if (this.ignoreCase) {
|
|
result += 'i';
|
|
}
|
|
if (this.multiline) {
|
|
result += 'm';
|
|
}
|
|
if (this.dotAll) {
|
|
result += 's';
|
|
}
|
|
if (this.unicode) {
|
|
result += 'u';
|
|
}
|
|
if (this.sticky) {
|
|
result += 'y';
|
|
}
|
|
return result;
|
|
};
|
|
|
|
if (functionsHaveConfigurableNames && Object.defineProperty) {
|
|
Object.defineProperty(module.exports, 'name', { value: 'get flags' });
|
|
}
|