Skip to content

Commit 9d0a203

Browse files
committed
add notEmpty
1 parent 659d8a3 commit 9d0a203

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export {processIfPresent, ifPresent, apply} from './util.js'
1+
export {processIfPresent, ifPresent, apply, notEmpty} from './util.js'

src/util.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ export const apply = <T, R>
99
(v: T, callback: (v: T) => R)
1010
: R =>
1111
callback(v)
12+
13+
export function notEmpty<TValue>(value: TValue | null | undefined): value is TValue {
14+
return value !== null && value !== undefined;
15+
}

0 commit comments

Comments
 (0)