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

fork accepts non-function values #214

Open
richytong opened this issue Apr 14, 2022 · 0 comments
Open

fork accepts non-function values #214

richytong opened this issue Apr 14, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@richytong
Copy link
Collaborator

richytong commented Apr 14, 2022

fork([1, 2, get('a')])({ a: 3 }) // [1, 2, 3]

fork({
  a: 1,
  b: 2,
  c: get('hello'),
})({ hello: 'world' }) // { a: 1, b: 2, c: 'world' }

if all items of the argument object or array to fork are values, fork returns a value (non function)

fork({
  a: Promise.resolve(1),
  b: 2,
  c: 'hello',
}).then(console.log) // { a: 1, b: 2, c: 'hello' }

fork([
  Promise.resolve(1),
  2,
  'hello',
]).then(console.log) // [1, 2, 'hello']
@richytong richytong added the enhancement New feature or request label Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant