RA.overWhen / RA.overUnless
See original GitHub issueSometimes, I add a helper like this to my codebase :
const R = require('ramda');
const overNonNil = curry((lens, f, state) => {
if (RA.isNotNil(R.view(lens, state))) {
return R.over(lens, f, state);
}
return state;
})
need opinions about this function.
According to #348, should we add RA.overNonNilProp
, RA.overNonNilPath
and RA.overNonNilIndex
?
Edit
(according to @Undistraction advices)
Implement a more generic RA.overWhen
instead of RA.overNonNil
RA.overWhen
const overWhen = R.curry((predicate, lens, f, state) => {
if (predicate(R.view(lens, state))) {
return R.over(lens, f, state);
}
return state;
})
and add RA.overPropWhen
, RA.overPathWhen
and RA.overIndexWhen
. (according to implementation below)
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
Why use output buffering in PHP? - Stack Overflow
In some cases, you may want control over when the web-server flushes its buffer, based on some criteria which your application knows best....
Read more >Internal Revenue Bulletin: 2004-7
It makes clear that a nonresident partner is subject to U.S. income tax on his share of income from the partnership to the...
Read more >CADASTRAL SURVEY TRAINING STAFF - BLM
gummy, but are seldom completely healed over. When dead and fallen they decay slowly. The recovery rate is reported to ... In the...
Read more >zcx.tl
Defy Let Ibearectotsface overIF R.a Afunction f WV. IF denoted fumes 14,44andsatisfies it tumblr.IT ii. Lau v. 2h44 iii lutv w. Luw t...
Read more >Universities to fear | Academic Jobs Wiki - Fandom
University of Iowa College of Education
Erasmus University Rotterdam (EUR) Media and Communication
Acadia University Arts
Monash University Arts
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
overWhen
is legitimate. Regarding the other derived functions…let’s hold until we clear it out in #348Why invent new constructs?