1.0.0 • Published 6 years ago

@remy/muto v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

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. ¯\(ツ)

1.0.0

6 years ago