Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fromNullable constructor in Optional module #133

Closed
VincentQuillien opened this issue Jul 13, 2020 · 0 comments
Closed

Add fromNullable constructor in Optional module #133

VincentQuillien opened this issue Jul 13, 2020 · 0 comments
Assignees

Comments

@VincentQuillien
Copy link

馃殌 Feature request

Current Behavior

The fromNullable constructor is missing from the Optional module.

Desired Behavior

import * as L from 'monocle-ts/lib/Lens';
import * as O from 'monocle-ts/lib/Optional';

type Test = {
    a?: { b?: { c: number } };
};

const optionalC = pipe(L.id<Test>(), L.prop('a'), L.fromNullable, O.prop('b'), O.fromNullable, O.prop('c'));
// optionalC: O.Optional<Test, number>
@gcanti gcanti self-assigned this Jul 13, 2020
@gcanti gcanti closed this as completed in 28868ea Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants