Merge pull request #2691 from Microsoft/isRegExpWeHardlyKnewYe

Remove 'Symbol.isRegExp' and introduce 'RegExp.prototype.flags'
This commit is contained in:
Daniel Rosenwasser
2015-04-10 01:51:59 -07:00
44 changed files with 156 additions and 140 deletions

2
src/lib/core.d.ts vendored
View File

@@ -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
View File

@@ -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.