Skip to content

Commit fbb096e

Browse files
author
Atlassian Bamboo
committed
deploy: update dist v2.0.0
1 parent 6351267 commit fbb096e

File tree

25,612 files changed

+3049121
-136478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

25,612 files changed

+3049121
-136478
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'use strict';
2+
3+
var testArray = function testArray(t, actual, expected, msg) {
4+
t.deepEqual(actual, expected, msg);
5+
t.equal(actual.length, expected.length, 'expected ' + expected.length + ', got ' + actual.length);
6+
};
7+
8+
module.exports = function (flat, t) {
9+
t.test('flattens', function (st) {
10+
testArray(st, flat([1, [2], [[3]], [[['four']]]]), [1, 2, [3], [['four']]], 'missing depth only flattens 1 deep');
11+
12+
testArray(st, flat([1, [2], [[3]], [[['four']]]], 1), [1, 2, [3], [['four']]], 'depth of 1 only flattens 1 deep');
13+
st.notDeepEqual(flat([1, [2], [[3]], [[['four']]]], 1), [1, 2, 3, ['four']], 'depth of 1 only flattens 1 deep: sanity check');
14+
15+
testArray(st, flat([1, [2], [[3]], [[['four']]]], 2), [1, 2, 3, ['four']], 'depth of 2 only flattens 2 deep');
16+
st.notDeepEqual(flat([1, [2], [[3]], [[['four']]]], 2), [1, 2, 3, 'four'], 'depth of 2 only flattens 2 deep: sanity check');
17+
18+
testArray(st, flat([1, [2], [[3]], [[['four']]]], 3), [1, 2, 3, 'four'], 'depth of 3 only flattens 3 deep');
19+
testArray(st, flat([1, [2], [[3]], [[['four']]]], Infinity), [1, 2, 3, 'four'], 'depth of Infinity flattens all the way');
20+
21+
st.end();
22+
});
23+
24+
t.test('sparse arrays', function (st) {
25+
// eslint-disable-next-line no-sparse-arrays
26+
st.deepEqual(flat([, [1]]), flat([[], [1]]), 'an array hole is treated the same as an empty array');
27+
28+
st.end();
29+
});
30+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
'use strict';
2+
var parent = require('../../actual/instance/repeat');
3+
4+
module.exports = parent;

0 commit comments

Comments
 (0)