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

replace.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 { replace } from './replace.js'
test('happy', () => { expect(replace( /\s/g, '|', 'foo bar baz' )).toBe('foo|bar|baz')})
test('with function as replacer input', () => { expect(replace( /\s/g, ( match, offset, str ) => { expect(match).toBe(' ') expect([ 3, 7 ].includes(offset)).toBeTrue() expect(str).toBe('foo bar baz')
return '|' }, 'foo bar baz' )).toBe('foo|bar|baz')})
rambda

Version Info

Tagged at
2 months ago