Skip to content

Commit

Permalink
docs(notnull): document notNull function
Browse files Browse the repository at this point in the history
  • Loading branch information
djcsdy committed Apr 21, 2021
1 parent 590a5b2 commit 17e71e7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export function isNotNull<T>(value: T | null | undefined): value is T {
return value != null;
}

/** Asserts that the specified value is neither null nor undefined, and
* returns it.
*
* @throws TypeError if the value is null or undefined */
export function notNull<T>(value: T | null | undefined): T {
if (value == null) {
throw new TypeError(`value is ${String(value)}`);
Expand Down

0 comments on commit 17e71e7

Please sign in to comment.