babel-object-restructuring
v1.0.1
Published
A Babel Plugin to create new objects that are a subset of an existing object
Downloads
8
Maintainers
Readme
Babel Object Restructuring
A Babel Plugin to create new objects with a subset of fields from an existing object
NPM: https://www.npmjs.com/package/babel-object-restructuring
Input
const oldObject = {
fieldA: 1,
fieldB: 2,
fieldC: 3,
fieldD: 4
};
const newObject = { fieldA, fieldB, fieldD } in oldObject;
Output
const oldObject = {
fieldA: 1,
fieldB: 2,
fieldC: 3,
fieldD: 4
};
const newObject = {
fieldA: oldObject.fieldA,
fieldB: oldObject.fieldB,
fieldD: oldObject.fieldD
};