retransform
1.0.0 • Public • Published retransform
Functional-style object transformation tool.
Features
- Curried
- Recursive: supports nested objects and arrays
Installation
npm install retransform
Usage
var updateRequest = retransform({
url: x => `http://mydomain.com/comments/${x.id}`
method: 'PUT'
body: {
author: x => x.user,
data: x => x.comment
}
});
var formatResponse = retransform({
comments: data => data,
status: 'ok'
});
const onEditComment = pipe(
updateRequest,
sendToBackend,
formatResponse,
dispatch
);
Testing
npm test
Package Sidebar
Install
Weekly Downloads