Skip to content

Latest commit

 

History

History
64 lines (38 loc) · 1.88 KB

env.md

File metadata and controls

64 lines (38 loc) · 1.88 KB

dastal - v5.0.0 / env

Namespace: env

Table of contents

Variables

Functions

Variables

MAX_ARRAY_LENGTH

Const MAX_ARRAY_LENGTH: number

The maximum length of an array.

At the time of implementation, the ECMA-262 defines the maximum as: 0 <= array.length <= 2**32 - 1

The actual maximum may change over time and/or unique environments. For that reason, the value is calculated on first import.

Defined in

src/env/index.ts:41

Functions

maxArgumentsLength

Const maxArgumentsLength(): number

Get the maximum number of arguments allowed for a function.

According to the ECMA-262, there is no maximum. In practice, different environments impose their own limit. Some limits (like in Google Chrome v91.0.4472.114) are dynamic and depend on available stack memory (among other factors). Other limits (like in Firefox v89.0.1 and Safari v14.1.1) appear to be static (500,000 and 65,536, respectively).

In environments where the maximum is dynamic:

  • The output should be used as soon as possible and in its original context. It should not be stored for future use. If context changes, such as stack usage, the output should be recalculated.

  • Using the output directly as the number of arguments to a function may still throw an error. A factor of safety should be used to adjust the output, such as multiplying it by a margin of safety. For example: 0.625*output.

Returns

number

Defined in

src/env/index.ts:30