How to use the @babel/plugin-syntax-do-expressions.default function in @babel/plugin-syntax-do-expressions

To help you get started, we’ve selected a few @babel/plugin-syntax-do-expressions 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 pfgray / babel-plugin-monadic-do / src / index.js View on Github external
module.exports = function({types: t}){
  return {
    inherits: syntaxDoExpressions.default,
    visitor: {
      DoExpression: function(path) {
        // count the expressions that are '<<'
        const bindCount = path.node.body.body.filter(isBind).length;

        // todo: fail if first expr is not bind expr
        path.replaceWith((formatChain(t, bindCount, path.node.body.body))[0]);
      }
    }
  };
}

@babel/plugin-syntax-do-expressions

Allow parsing of do expressions

MIT
Latest version published 23 days ago

Package Health Score

95 / 100
Full package analysis

Popular @babel/plugin-syntax-do-expressions functions