Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports.fix = ({path, promisified}) => {
const props = [];
for (const path of promisified) {
const [declarator] = path.node.declarations;
const {name} = declarator.id;
props.push(t.ObjectProperty(t.Identifier(name), t.Identifier(name), NOT_COMPUTED, SHORTHAND));
path.remove();
}
const {init} = path.node;
replaceWith(path.get('id'), t.ObjectPattern(props));
replaceWith(path.get('init'), t.MemberExpression(init, t.Identifier('promises')));
};
module.exports.fix = ({path, promisified}) => {
const props = [];
for (const path of promisified) {
const [declarator] = path.node.declarations;
const {name} = declarator.id;
props.push(t.ObjectProperty(t.Identifier(name), t.Identifier(name), NOT_COMPUTED, SHORTHAND));
path.remove();
}
const {init} = path.node;
replaceWith(path.get('id'), t.ObjectPattern(props));
replaceWith(path.get('init'), t.MemberExpression(init, t.Identifier('promises')));
};