packages/okam-build/lib/processor/js/transform/helper.js
function removeComments(t, path, type) {
    let commentPaths = path.get(type);
    if (!commentPaths || !commentPaths.length) {
        return;
    }

    let isLeadingType = type === LEADING_COMMENT_TYPE;
    if (isLeadingType) {
        let parentPath = path.parentPath;
        let isParentProgram = parentPath && t.isProgram(parentPath.node);

        // move leading comments to program
        if (isParentProgram) {
            parentPath.addComments(
                'leading',
                commentPaths.map(item => item.node)
            );
        }
    }

    commentPaths.forEach(item => item.remove());
}
function removeComments(t, path, type) {
    let commentPaths = path.get(type);
    if (!commentPaths || !commentPaths.length) {
        return;
    }

    let isLeadingType = type === LEADING_COMMENT_TYPE;
    if (isLeadingType) {
        let parentPath = path.parentPath;
        let isParentProgram = parentPath && t.isProgram(parentPath.node);

        // move leading comments to program
        if (isParentProgram) {
            parentPath.addComments(
                'leading',
                commentPaths.map(item => item.node)
            );
        }
    }

    commentPaths.forEach(item => item.remove());
}
function removeComments ( t , path , type ) { let commentPaths = path . get ( type ) ; if ( ! commentPaths || ! commentPaths . length ) { return ; } let isLeadingType = type === LEADING_COMMENT_TYPE ; if ( isLeadingType ) { let parentPath = path . parentPath ; let isParentProgram = parentPath && t . isProgram ( parentPath . node ) ; // move leading comments to program if ( isParentProgram ) { parentPath . addComments ( 'leading' , commentPaths . map ( item => item . node ) ) ; } } commentPaths . forEach ( item => item . remove ( ) ) ; }
Remove node comments

@param {Object} t the babel type definition
@param {Object} path the node path
@param {string} type the comment type
Remove node comments