@remy/muto
v1.0.0
Published
Transforms object structure to new structure based on simplistic formatting.
Readme
muto
Transforms object structure to new structure based on simplistic formatting.
Note that this module is only to simplify reoccurring use of something like o.map(({ a, b }) => ({ a, b })) where o contains many properties but the user only wants a and b.
Usage
const muto = require('@remy/muto');
const template = muto(`{ id: publicId, url }`);
const res = template({ private: 1234, publicId: 'p1', url: 'example.com' });
// res = { id: 'p1', url: 'example.com' }Limitations
This was a quick hack, so it only works on shallow objects.
Name
act of transforming.
Greek. Sounds neat too. ¯\(ツ)/¯
