API Smith in JavaScript
A lightweight library for object transformations in JavaScript. Inspired by the API Smith Ruby library.
Synopsis
const apiSmith = ; // apiSmith.smash transforms objectconst transformation = foo: 'foo' baz: from: 'bar' 'quxx' x + 1 ;const from = foo: 123 bar: quxx: 99 ;apiSmith foo: 123 baz: 100 // apiSmith.unset and apiSmith.unsetEmptyProperties unsets properties in object by mutationlet before = foo: null bar: {} quxx: deep: undefined more: deeper: another: {};apiSmith; // apiSmith.delegate defines delegation methods on target objectsconst provider = num: 123 { return thisnum; };let consumer = {};;consumer; 123
Install
$ npm install js-api-smith