Closed dsherret closed 1 year ago
If this API is added, many of the use-cases I would have for functions to add via the extras
(helpers
? plugins
? worth bikeshedding over the name? :smile: ) object would want to have access to the constructed instance of $
in the function, i.e.:
const $ = build$({
extras: {
ghReleaseInfo(org, repo) {
return $.request(`https://api.github.com/repos/${org}/${repo}/releases/latest`).json()
},
},
});
That should work with this "add extras during $
construction" API right? I'm pretty sure it will, but just wanted to put it on the radar for this enhancement request.
@andrewbrey yeah, you can just do what you showed there. I added a test for it in the PR too.
For example: