How to use the putout.types.Identifier function in putout

To help you get started, we’ve selected a few putout examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coderaiser / putout / codemods / convert-fs-to-promises / lib / convert-fs-to-promises.js View on Github external
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')));
};
github coderaiser / putout / codemods / convert-fs-to-promises / lib / convert-fs-to-promises.js View on Github external
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')));
};