Typescript adapted Java Optional class.
The library barebone is generated with typescript-library-starter.
npm i @itfobos/ts-optional
Documentation is available here.
Optional.ofNullable(someValue)
Optional.of(nonNullableValue)
Optional.empty()
const entityUuid = Optional.of(response)
.filter(resp => resp.isPresent)
.map(responseToEntity)
.map(entity => entity.uuid)
.filter(isNotNullOrEmpty)
.orElseGet(() => route.snapshot.queryParamMap.get('uuid') as string);
Automatically tested with Node versions:
To integrate with the CI:
Generated using TypeDoc