packages/okam-build/lib/processor/js/transform/component.js
function removeVariableDeclaration(t, bindVar, removeOpts) {
    let refPaths = bindVar.referencePaths || [];
    let removed;

    // try to remove the bind variable in multiple variable declarations
    refPaths.forEach(item => {
        let parentPath = item.getStatementParent();
        if (t.isVariableDeclaration(parentPath) && t.isIdentifier(item)) {
            removeNode(t, item.parentPath, removeOpts);
            removeComments(t, parentPath, 'leadingComments');
            removed = true;
        }
    });

    // if not multiple variable declarations,
    // remove the single variable declaration statement
    if (!removed) {
        removeNode(t, bindVar.path.getStatementParent(), removeOpts);
    }
}
function removeVariableDeclaration(t, bindVar, removeOpts) {
    let refPaths = bindVar.referencePaths || [];
    let removed;

    // try to remove the bind variable in multiple variable declarations
    refPaths.forEach(item => {
        let parentPath = item.getStatementParent();
        if (t.isVariableDeclaration(parentPath) && t.isIdentifier(item)) {
            removeNode(t, item.parentPath, removeOpts);
            removeComments(t, parentPath, 'leadingComments');
            removed = true;
        }
    });

    // if not multiple variable declarations,
    // remove the single variable declaration statement
    if (!removed) {
        removeNode(t, bindVar.path.getStatementParent(), removeOpts);
    }
}
function removeVariableDeclaration ( t , bindVar , removeOpts ) { let refPaths = bindVar . referencePaths || [ ] ; let removed ; // try to remove the bind variable in multiple variable declarations refPaths . forEach ( item => { let parentPath = item . getStatementParent ( ) ; if ( t . isVariableDeclaration ( parentPath ) && t . isIdentifier ( item ) ) { removeNode ( t , item . parentPath , removeOpts ) ; removeComments ( t , parentPath , 'leadingComments' ) ; removed = true ; } } ) ; // if not multiple variable declarations, // remove the single variable declaration statement if ( ! removed ) { removeNode ( t , bindVar . path . getStatementParent ( ) , removeOpts ) ; } }
Remove the bind variable declaration

@inner
@param {Object} t the babel type definition
@param {Object} bindVar the bind variable path information
@param {Object} removeOpts the remove options
Remove the bind variable declaration