Skip to content

New: lensIso#3465

Open
Harris-Miller wants to merge 5 commits into
ramda:masterfrom
Harris-Miller:isoLens
Open

New: lensIso#3465
Harris-Miller wants to merge 5 commits into
ramda:masterfrom
Harris-Miller:isoLens

Conversation

@Harris-Miller

@Harris-Miller Harris-Miller commented May 2, 2024

Copy link
Copy Markdown
Contributor

I found myself having to implement this on my own recently in a project at work. It's useful to have alongside lens and has a distinct implementation that isn't a simple composition of other functions. So figured it was worth adding to the core lib

TODO:

  • Unit tests

@github-actions

github-actions Bot commented May 2, 2024

Copy link
Copy Markdown
Coverage
> ramda@0.30.0 coverage:summary
> BABEL_ENV=cjs nyc --reporter=text-summary mocha -- --reporter=min --require @babel/register

�[2J�[1;3H
1190 passing (929ms)


=============================== Coverage summary ===============================
Statements   : 94.04% ( 2477/2634 )
Branches     : 85.73% ( 967/1128 )
Functions    : 93.25% ( 553/593 )
Lines        : 94.32% ( 2323/2463 )
================================================================================

@github-actions

github-actions Bot commented May 2, 2024

Copy link
Copy Markdown
Coverage
> ramda@0.30.0 coverage:summary
> BABEL_ENV=cjs nyc --reporter=text-summary mocha -- --reporter=min --require @babel/register

�[2J�[1;3H
1190 passing (943ms)


=============================== Coverage summary ===============================
Statements   : 94.04% ( 2477/2634 )
Branches     : 85.73% ( 967/1128 )
Functions    : 93.25% ( 553/593 )
Lines        : 94.32% ( 2323/2463 )
================================================================================

@Harris-Miller Harris-Miller changed the title Draf: New: lensIso Draft: New: lensIso May 2, 2024
@github-actions

github-actions Bot commented May 2, 2024

Copy link
Copy Markdown
Coverage
> ramda@0.30.0 coverage:summary
> BABEL_ENV=cjs nyc --reporter=text-summary mocha -- --reporter=min --require @babel/register

�[2J�[1;3H
1190 passing (870ms)


=============================== Coverage summary ===============================
Statements   : 94.04% ( 2477/2634 )
Branches     : 85.73% ( 967/1128 )
Functions    : 93.25% ( 553/593 )
Lines        : 94.32% ( 2323/2463 )
================================================================================

@github-actions

github-actions Bot commented May 2, 2024

Copy link
Copy Markdown
Coverage
> ramda@0.30.0 coverage:summary
> BABEL_ENV=cjs nyc --reporter=text-summary mocha -- --reporter=min --require @babel/register

�[2J�[1;3H
1190 passing (888ms)


=============================== Coverage summary ===============================
Statements   : 94.04% ( 2477/2634 )
Branches     : 85.73% ( 967/1128 )
Functions    : 93.25% ( 553/593 )
Lines        : 94.32% ( 2323/2463 )
================================================================================

@Harris-Miller

Copy link
Copy Markdown
Contributor Author

@kedashoe @CrossEye was hoping to get feedback on accepting the proposal to add this function before I put in the effort of writing unit tests. Thanks in advance

@kedashoe

Copy link
Copy Markdown
Contributor

Can achieve the same with lens(getter, unary(setter))? Do you have an example that works differently from lens? I think the example in the docstring works out to the same thing lens vs lensIso.

@Harris-Miller

Copy link
Copy Markdown
Contributor Author

I didn't think to use unary() when I did this at my job. And to my surprise, the typings worked out as you'd expect it to with lens(getter, unary(setter))

Ref: https://tsplay.dev/WP2BJN

The only reason I can see keeping this then would be for convenience and exposure. I can adjust the file to use lens(getter, unary(setter)) as well to cut down on duplicate code. Let me know

@kedashoe

Copy link
Copy Markdown
Contributor

We have https://github.com/ramda/ramda-lens which feels like where it belongs. But of course that hasn't been updated in many years. I reckon mull it over for a bit and if you want to bring it in or others chime that they'd like it we can work to get it in.

@github-actions

github-actions Bot commented Jul 25, 2024

Copy link
Copy Markdown
Coverage Summary
> ramda@0.30.1 coverage:summary
> BABEL_ENV=cjs nyc --reporter=text-summary mocha -- --reporter=min --require @babel/register

�[2J�[1;3H
1198 passing (1s)


=============================== Coverage summary ===============================
Statements   : 94.07% ( 2490/2647 )
Branches     : 85.75% ( 969/1130 )
Functions    : 93.28% ( 555/595 )
Lines        : 94.34% ( 2335/2475 )
================================================================================

@Harris-Miller

Copy link
Copy Markdown
Contributor Author

I decided to finish it. Seems like it could be useful

@Harris-Miller Harris-Miller changed the title Draft: New: lensIso New: lensIso Jul 25, 2024
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

Successfully merging this pull request may close these issues.

2 participants