deno.land / x / rambda@v9.1.1 / source / insert.spec.js

insert.spec.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { insert } from './insert';
it('inserts an element into the given list', () => { const list = ['a', 'b', 'c', 'd', 'e']; expect(insert(2, 'x', list)).toEqual(['a', 'b', 'x', 'c', 'd', 'e']);});
it('inserts another list as an element', () => { const list = ['a', 'b', 'c', 'd', 'e']; expect(insert(2, ['s', 't'], list)).toEqual([ 'a', 'b', ['s', 't'], 'c', 'd', 'e', ]);});
it('appends to the end of the list if the index is too large', () => { const list = ['a', 'b', 'c', 'd', 'e']; expect(insert(8, 'z', list)).toEqual(['a', 'b', 'c', 'd', 'e', 'z']);});
rambda

Version Info

Tagged at
2 months ago