deno.land / x / rambda@v9.1.1 / source / dropEmpty-spec.ts

dropEmpty-spec.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import {Dictionary, filter} from 'rambda'
function dropEmpty<T>(input: T[] | Dictionary<T>) { if (input instanceof Array) { // <-- this check is necessary to calm down the TS compiler ... @_@ return filter<T>(Boolean, input) // <-- notice the same } else { return filter<T>(Boolean, input) // <-- code... } // return filter<T>(Boolean, input)}
describe('R.dropEmpty', () => { it('happy', () => { const list = [1, 2, 3, ''] const result: any = dropEmpty(list)
result // $ExpectType any })})
rambda

Version Info

Tagged at
2 months ago