mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Merge pull request #2691 from Microsoft/isRegExpWeHardlyKnewYe
Remove 'Symbol.isRegExp' and introduce 'RegExp.prototype.flags'
This commit is contained in:
2
src/lib/core.d.ts
vendored
2
src/lib/core.d.ts
vendored
@@ -823,7 +823,7 @@ interface RegExp {
|
||||
*/
|
||||
test(string: string): boolean;
|
||||
|
||||
/** Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal. */
|
||||
/** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */
|
||||
source: string;
|
||||
|
||||
/** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */
|
||||
|
||||
31
src/lib/es6.d.ts
vendored
31
src/lib/es6.d.ts
vendored
@@ -50,26 +50,21 @@ interface SymbolConstructor {
|
||||
*/
|
||||
isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A Boolean value that if true indicates that an object may be used as a regular expression.
|
||||
*/
|
||||
isRegExp: symbol;
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object.Called by the semantics of the
|
||||
* for-of statement.
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
* abstract operation.
|
||||
*/
|
||||
toPrimitive: symbol;
|
||||
|
||||
/**
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built- in method Object.prototype.toString.
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built-in method Object.prototype.toString.
|
||||
*/
|
||||
toStringTag: symbol;
|
||||
|
||||
@@ -111,7 +106,7 @@ interface ObjectConstructor {
|
||||
getOwnPropertySymbols(o: any): symbol[];
|
||||
|
||||
/**
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* @param value1 The first value.
|
||||
* @param value2 The second value.
|
||||
*/
|
||||
@@ -598,8 +593,6 @@ interface Math {
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
[Symbol.isRegExp]: boolean;
|
||||
|
||||
/**
|
||||
* Matches a string with a regular expression, and returns an array containing the results of
|
||||
* that search.
|
||||
@@ -631,6 +624,20 @@ interface RegExp {
|
||||
*/
|
||||
split(string: string, limit?: number): string[];
|
||||
|
||||
/**
|
||||
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
|
||||
* The characters in this string are sequenced and concatenated in the following order:
|
||||
*
|
||||
* - "g" for global
|
||||
* - "i" for ignoreCase
|
||||
* - "m" for multiline
|
||||
* - "u" for unicode
|
||||
* - "y" for sticky
|
||||
*
|
||||
* If no flags are set, the value is the empty string.
|
||||
*/
|
||||
flags: string;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value indicating the state of the sticky flag (y) used with a regular
|
||||
* expression. Default is false. Read-only.
|
||||
|
||||
Reference in New Issue
Block a user