-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tc39/proposal-flatMap@093eacc7fe0906e70f7626bf 6c7d6e9dfc53cce9
- Loading branch information
Showing
16 changed files
with
94 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/core-js/features/array/flatten.js → packages/core-js/features/array/flat.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
require('../../modules/esnext.array.flatten'); | ||
require('../../modules/esnext.array.flat'); | ||
|
||
module.exports = require('../../internals/entry-unbind')('Array', 'flatten'); | ||
module.exports = require('../../internals/entry-unbind')('Array', 'flat'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...core-js/features/array/virtual/flatten.js → ...es/core-js/features/array/virtual/flat.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
require('../../../modules/esnext.array.flatten'); | ||
require('../../../modules/esnext.array.flat'); | ||
|
||
module.exports = require('../../../internals/entry-virtual')('Array').flatten; | ||
module.exports = require('../../../internals/entry-virtual')('Array').flat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { DESCRIPTORS, STRICT } from '../helpers/constants'; | ||
|
||
import flat from 'core-js-pure/features/array/flat'; | ||
import defineProperty from 'core-js-pure/features/object/define-property'; | ||
|
||
QUnit.test('Array#flat', assert => { | ||
assert.isFunction(flat); | ||
assert.deepEqual(flat([]), []); | ||
const array = [1, [2, 3], [4, [5, 6]]]; | ||
assert.deepEqual(flat(array, 0), array); | ||
assert.deepEqual(flat(array, 1), [1, 2, 3, 4, [5, 6]]); | ||
assert.deepEqual(flat(array), [1, 2, 3, 4, [5, 6]]); | ||
assert.deepEqual(flat(array, 2), [1, 2, 3, 4, 5, 6]); | ||
assert.deepEqual(flat(array, 3), [1, 2, 3, 4, 5, 6]); | ||
assert.deepEqual(flat(array, -1), array); | ||
assert.deepEqual(flat(array, Infinity), [1, 2, 3, 4, 5, 6]); | ||
if (STRICT) { | ||
assert.throws(() => flat(null), TypeError); | ||
assert.throws(() => flat(undefined), TypeError); | ||
} | ||
if (DESCRIPTORS) { | ||
assert.notThrows(() => flat(defineProperty({ length: -1 }, 0, { | ||
get() { | ||
throw new Error(); | ||
}, | ||
})).length === 0, 'uses ToLength'); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { DESCRIPTORS, STRICT } from '../helpers/constants'; | ||
|
||
QUnit.test('Array#flat', assert => { | ||
const { flat } = Array.prototype; | ||
const { defineProperty } = Object; | ||
assert.isFunction(flat); | ||
assert.name(flat, 'flat'); | ||
assert.arity(flat, 0); | ||
assert.looksNative(flat); | ||
assert.nonEnumerable(Array.prototype, 'flat'); | ||
assert.deepEqual([].flat(), []); | ||
const array = [1, [2, 3], [4, [5, 6]]]; | ||
assert.deepEqual(array.flat(0), array); | ||
assert.deepEqual(array.flat(1), [1, 2, 3, 4, [5, 6]]); | ||
assert.deepEqual(array.flat(), [1, 2, 3, 4, [5, 6]]); | ||
assert.deepEqual(array.flat(2), [1, 2, 3, 4, 5, 6]); | ||
assert.deepEqual(array.flat(3), [1, 2, 3, 4, 5, 6]); | ||
assert.deepEqual(array.flat(-1), array); | ||
assert.deepEqual(array.flat(Infinity), [1, 2, 3, 4, 5, 6]); | ||
if (STRICT) { | ||
assert.throws(() => flat.call(null), TypeError); | ||
assert.throws(() => flat.call(undefined), TypeError); | ||
} | ||
if (DESCRIPTORS) { | ||
assert.notThrows(() => flat.call(defineProperty({ length: -1 }, 0, { | ||
get() { | ||
throw new Error(); | ||
}, | ||
})).length === 0, 'uses ToLength'); | ||
} | ||
assert.ok('flat' in Array.prototype[Symbol.unscopables], 'In Array#@@unscopables'); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters