depth-always-one.js |
|
349 |
flatMap.js |
8.2.3.17 Tuple.prototype.flatMap ( mapperFunction [ , thisArg ] )
When the flatMap method is called with one or two arguments, the following steps are taken:
1. Let T be ? thisTupleValue(this value).
2. Let list be T.[[Sequence]].
3. If ! IsCallable(mapperFunction) is false, throw a TypeError exception.
4. Let flat be a new empty List.
5. Perform ? FlattenIntoTuple(flat, list, 1, mapperFunction, thisArg).
6. Return a new Tuple value whose [[Sequence]] is flat.
8.2.3.16.1 FlattenIntoTuple ( target, source, depth [ , mapperFunction, thisArg ] )
The abstract operation FlattenIntoTuple takes arguments target, source, and depth and optional arguments mapperFunction and thisArg. It performs the following steps when called:
1. Assert: target is a List.
2. Assert: source is a List.
3. Assert: ! IsInteger(depth) is true, or depth is either +∞ or -∞.
4. Assert: If mapperFunction is present, then ! IsCallable(mapperFunction) is true, thisArg is present, and depth is 1.
5. Let sourceIndex be 0.
6. For each element of source,
a. If mapperFunction is present, then
i. Set element to ? Call(mapperFunction, thisArg, « element, sourceIndex, source »).
ii. If Type(element) is Object, throw a TypeError exception.
b. If depth > 0 and Type(element) is Tuple, then
i. Perform ? FlattenIntoTuple(target, element, depth - 1).
c. Else,
i. Let len be the length of target.
ii. If len ≥ 253 - 1, throw a TypeError exception.
iii. Append element to target.
d. Set sourceIndex to sourceIndex + 1.
|
4163 |
length.js |
|
849 |