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'
});
 
// Somewhere in controller
const onEditComment = pipe(
    updateRequest,
    sendToBackend,
    formatResponse,
    dispatch
);

Testing

npm test

Package Sidebar

Install

npm i retransform

Weekly Downloads

2

Version

1.0.0

License

Apache-2.0

Last publish

Collaborators

  • machobearstudio