JavaScript Constants
Enums and constant values for JavaScript types.
JSErrorName
JSErrorName()An enum of the possible .name values of JavaScript Errors.
Attributes
| Name | Description |
|---|---|
| Error | |
| EvalError | |
| RangeError | |
| ReferenceError | |
| SyntaxError | |
| TypeError | |
| UriError | |
| error_tag | The SerializationErrorTag that corresponds to this JSErrorName. |
Methods
| Name | Description |
|---|---|
| for_error_name | Get the name that will be deserialized when a given name is serialized. |
| for_error_tag | Get the JSErrorName that corresponds to a SerializationErrorTag value. |
for_error_name
JSErrorName.for_error_name(error_name: str)Get the name that will be deserialized when a given name is serialized.
V8 will ignore unknown error names and substitute "Error". Only the members of the JSErrorName
Returns
| Name | Type | Description |
|---|---|---|
| JSErrorName | The JSErrorName enum member equal to error_name, or JSErrorName.Error if none match. |
for_error_tag
JSErrorName.for_error_tag(error_tag: SerializationErrorTag)Get the JSErrorName that corresponds to a SerializationErrorTag value.
JSRegExpFlag
JSRegExpFlag()The bit flags for V8’s representation of JavaScript RegExp flags.
This is a an IntFlag enum.
Notes
Defined at src/regexp/regexp-flags.h in the V8 source code.
Attributes
| Name | Description |
|---|---|
| DotAll | |
| Global | |
| HasIndices | |
| IgnoreCase | |
| Linear | |
| Multiline | |
| NoFlag | |
| Sticky | |
| Unicode | |
| UnicodeSets | |
| canonical | The flag’s value without any meaningless bits set. |
Methods
| Name | Description |
|---|---|
| as_python_flags | Get the Python re module flags that correspond to this value’s active flags. |
| from_python_flags | Get the JavaScript flags equivalent to Python re module flags. |
as_python_flags
JSRegExpFlag.as_python_flags(throw: bool = True)Get the Python re module flags that correspond to this value’s active flags.
Some flags don’t have a direct equivalent, such as Linear. These result in there being no Python equivalent, so the result is None.
Some flag don’t affect Python because they adjust the JavaScript matching API which isn’t used in Python. For example, HasIndices. These are ignored.
from_python_flags
JSRegExpFlag.from_python_flags(python_flags: RegexFlag)Get the JavaScript flags equivalent to Python re module flags.
constants.FLOAT64_SAFE_INT_RANGE
constants.FLOAT64_SAFE_INT_RANGE
The range of integers which a JavaScript number (64-bit float) can represent without loss.
Same as Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER JavaScript constants.
constants.MAX_ARRAY_LENGTH
constants.MAX_ARRAY_LENGTH
1 larger than the maximum integer index of a JavaScript array.
Note that JavaScript Arrays will still accept properties for integers beyond this limit, but they will be stored as string name properties, not integer array indexes.