main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
725 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var ArraySpeciesCreate = require('es-abstract/2023/ArraySpeciesCreate');
|
---|
4 | var FlattenIntoArray = require('es-abstract/2023/FlattenIntoArray');
|
---|
5 | var Get = require('es-abstract/2023/Get');
|
---|
6 | var ToIntegerOrInfinity = require('es-abstract/2023/ToIntegerOrInfinity');
|
---|
7 | var ToLength = require('es-abstract/2023/ToLength');
|
---|
8 | var ToObject = require('es-abstract/2023/ToObject');
|
---|
9 |
|
---|
10 | module.exports = function flat() {
|
---|
11 | var O = ToObject(this);
|
---|
12 | var sourceLen = ToLength(Get(O, 'length'));
|
---|
13 |
|
---|
14 | var depthNum = 1;
|
---|
15 | if (arguments.length > 0 && typeof arguments[0] !== 'undefined') {
|
---|
16 | depthNum = ToIntegerOrInfinity(arguments[0]);
|
---|
17 | }
|
---|
18 |
|
---|
19 | var A = ArraySpeciesCreate(O, 0);
|
---|
20 | FlattenIntoArray(A, O, sourceLen, 0, depthNum);
|
---|
21 | return A;
|
---|
22 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.