-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Atlassian Bamboo
committed
Nov 12, 2024
1 parent
6351267
commit fbb096e
Showing
25,612 changed files
with
3,049,121 additions
and
136,478 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...db43bc05d667ada3fcd8e4bbece2847684cfea95a01e30db9c3868cc3c106c118513973c630b7a64aeec274c7
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,30 @@ | ||
'use strict'; | ||
|
||
var testArray = function testArray(t, actual, expected, msg) { | ||
t.deepEqual(actual, expected, msg); | ||
t.equal(actual.length, expected.length, 'expected ' + expected.length + ', got ' + actual.length); | ||
}; | ||
|
||
module.exports = function (flat, t) { | ||
t.test('flattens', function (st) { | ||
testArray(st, flat([1, [2], [[3]], [[['four']]]]), [1, 2, [3], [['four']]], 'missing depth only flattens 1 deep'); | ||
|
||
testArray(st, flat([1, [2], [[3]], [[['four']]]], 1), [1, 2, [3], [['four']]], 'depth of 1 only flattens 1 deep'); | ||
st.notDeepEqual(flat([1, [2], [[3]], [[['four']]]], 1), [1, 2, 3, ['four']], 'depth of 1 only flattens 1 deep: sanity check'); | ||
|
||
testArray(st, flat([1, [2], [[3]], [[['four']]]], 2), [1, 2, 3, ['four']], 'depth of 2 only flattens 2 deep'); | ||
st.notDeepEqual(flat([1, [2], [[3]], [[['four']]]], 2), [1, 2, 3, 'four'], 'depth of 2 only flattens 2 deep: sanity check'); | ||
|
||
testArray(st, flat([1, [2], [[3]], [[['four']]]], 3), [1, 2, 3, 'four'], 'depth of 3 only flattens 3 deep'); | ||
testArray(st, flat([1, [2], [[3]], [[['four']]]], Infinity), [1, 2, 3, 'four'], 'depth of Infinity flattens all the way'); | ||
|
||
st.end(); | ||
}); | ||
|
||
t.test('sparse arrays', function (st) { | ||
// eslint-disable-next-line no-sparse-arrays | ||
st.deepEqual(flat([, [1]]), flat([[], [1]]), 'an array hole is treated the same as an empty array'); | ||
|
||
st.end(); | ||
}); | ||
}; |
4 changes: 4 additions & 0 deletions
4
...4f78ba6c17c432f369b4309add1b422f945cd15f55c2df1a0112064e0c84419c25996010da0ce3931f932a9a7
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,4 @@ | ||
'use strict'; | ||
var parent = require('../../actual/instance/repeat'); | ||
|
||
module.exports = parent; |
Oops, something went wrong.