1.10.0 • Published 4 years ago
@httpie/utilities v1.10.0
Introduction
The @httpie/utilities package provides a handful of useful helper functions for Node.js and JavaScript, like an async tap function.
Installation
npm i @httpie/utilitiesDocs
Find all the details for @httpie/utilities in the extensive httpie docs.
API
Using @httpie/utilities is pretty straightforward. The package exports a handful of methods that you can reach for when requiring the package:
tap(value, callback)
Returns the value after running the callback. The callback receives the value as an argument.
const { tap } = require('@httpie/utilities')
return tap(await User.find(1), async (user) => {
await user.subscribeToNewsletter()
})
// returns the user with ID 1upon(value, callback)
Returns the result of the callback. The callback receives the value as an argument.
const { upon } = require('@httpie/utilities')
return upon(await User.find(1), async (user) => {
return user.email
})
// user@email.comContributing
Do you miss a goodie function? We very much appreciate your contribution! Please send in a pull request 😊
- Create a fork
- Create your feature branch:
git checkout -b my-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request 🚀
License
MIT © httpie
httpiejs.com · GitHub @httpie · Twitter @httpiejs
1.10.0
4 years ago