mirror of https://github.com/01-edu/public.git
14 lines
469 B
JavaScript
14 lines
469 B
JavaScript
Array.prototype.flat = undefined
|
|
// /*/ // ⚡
|
|
export const tests = []
|
|
const t = (f) => tests.push(f)
|
|
|
|
t(({ eq }) => eq(flat([1]), [1]))
|
|
t(({ eq }) => eq(flat([1, [2]]), [1, 2]))
|
|
t(({ eq }) => eq(flat([1, [2, [3]]]), [1, 2, [3]]))
|
|
t(({ eq }) => eq(flat([1, [2, [3], [4, [5]]]], 2), [1, 2, 3, 4, [5]]))
|
|
t(({ eq }) => eq(flat([1, [2, [3], [4, [5]]]], 3), [1, 2, 3, 4, 5]))
|
|
t(({ eq }) => eq(flat([1, [2, [3], [4, [5]]]], Infinity), [1, 2, 3, 4, 5]))
|
|
|
|
Object.freeze(tests)
|