Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Named fragment API #69

Open
timkendall opened this issue Sep 13, 2021 · 0 comments
Open

Named fragment API #69

timkendall opened this issue Sep 13, 2021 · 0 comments
Labels

Comments

@timkendall
Copy link
Owner

timkendall commented Sep 13, 2021

Possible API:

// or class-based API

const userName = new Fragment({
  name: 'UserDetails',
  on: 'User',
  selection: (t) => [ t.name(t => [ t.first(), t.last() ]) ]
})

// higher-level functional API
const userName = on('User', t => [ t.name(t => [ t.first(), t.last() ])).named('UserNameFields')
// or
const userName = user(t => [ t.name(t => [ t.first(), t.last() ])).toFragment('UserNameFields')
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant