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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

presence #654

Open
srghma opened this issue Aug 2, 2018 · 6 comments
Open

presence #654

srghma opened this issue Aug 2, 2018 · 6 comments
Assignees

Comments

@srghma
Copy link
Collaborator

srghma commented Aug 2, 2018

Is your feature request related to a problem? Please describe.
Like presence function in ruby: https://apidock.com/rails/Object/presence

Describe the solution you'd like

const presence = when(isEmpty, stubNull)

Describe alternatives you've considered

R.defaultTo

Additional context

like presence function in ruby

import * as R from 'ramda'

function presence(x) {
  return R.isEmpty(x) ? null : x
}

export default presence
@srghma srghma self-assigned this Aug 2, 2018
@char0n char0n added the feature label Aug 2, 2018
@char0n
Copy link
Owner

char0n commented Aug 2, 2018

yeah why not

const presence = when(isEmpty, stubNull)

Alternative implementation by specializing defaultWhen

const presence = RA.defaultWhen(R.isEmpty, null);

@char0n char0n changed the title feat: presence or nullIfEmpty presence Jan 21, 2020
@char0n char0n added the Hacktoberfest Hacktoberfest 2020 label Sep 13, 2020
@tauantcamargo
Copy link
Contributor

may i can get this one?

@char0n
Copy link
Owner

char0n commented Dec 20, 2021

@tauantcamargo sure

@tauantcamargo
Copy link
Contributor

so a few days ago i created this pull request #2123 😃 @char0n

@char0n
Copy link
Owner

char0n commented Jan 2, 2022

@tauantcamargo doing the code review just now.

@tauantcamargo
Copy link
Contributor

@char0n don't worry. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants