packages/babel-plugin-minify-dead-code-elimination/src/remove-use-strict.js
function removeUseStrict(block) {
  if (!block.isBlockStatement()) {
    throw new Error(
      `Received ${block.type}. Expected BlockStatement. ` +
        `Please report at ${newIssueUrl}`
    );
  }

  const useStricts = getUseStrictDirectives(block);

  // early exit
  if (useStricts.length < 1) return;

  // only keep the first use strict
  if (useStricts.length > 1) {
    for (let i = 1; i < useStricts.length; i++) {
      useStricts[i].remove();
    }
  }

  // check if parent has an use strict
  if (hasStrictParent(block)) {
    useStricts[0].remove();
  }
}
function removeUseStrict(block) {
  if (!block.isBlockStatement()) {
    throw new Error(
      `Received ${block.type}. Expected BlockStatement. ` +
        `Please report at ${newIssueUrl}`
    );
  }

  const useStricts = getUseStrictDirectives(block);

  // early exit
  if (useStricts.length < 1) return;

  // only keep the first use strict
  if (useStricts.length > 1) {
    for (let i = 1; i < useStricts.length; i++) {
      useStricts[i].remove();
    }
  }

  // check if parent has an use strict
  if (hasStrictParent(block)) {
    useStricts[0].remove();
  }
}
function removeUseStrict ( block ) { if ( ! block . isBlockStatement ( ) ) { throw new Error ( ` ${ block . type } ` + ` ${ newIssueUrl } ` ) ; } const useStricts = getUseStrictDirectives ( block ) ; // early exit if ( useStricts . length < 1 ) return ; // only keep the first use strict if ( useStricts . length > 1 ) { for ( let i = 1 ; i < useStricts . length ; i ++ ) { useStricts [ i ] . remove ( ) ; } } // check if parent has an use strict if ( hasStrictParent ( block ) ) { useStricts [ 0 ] . remove ( ) ; } }
Remove redundant use strict
If the parent has a "use strict" directive, it is not required in
the children

@param {NodePath} block BlockStatement
Remove redundant use strict If the parent has a use strict directive it is not required in the children