How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • for (let token of acorn.tokenizer(str)) {
      // iterate over the tokens
    }
    
    // transform code to array of tokens:
    var tokens = [...acorn.tokenizer(str)];
    Docs
  • function rename(code, tokenTo, tokenFrom) {
    
      
    
      //...
    try {
        ast = acorn.parse(code, {
          ecmaVersion: 11,
          ranges: true,
          allowReturnOutsideFunction: true
        });
      } catch(err) {
        // this should probably log something and/or exit violently
        return code;
      }
    
      
    
      //...
    }
    
    
    /calvinmetcalf/derequire mit
  • const acornAst = recast.parse(source, {
      parser: {
        parse(source) {
          return require("acorn").parse(source, {
            // additional options
          });
        }
      }
    });
    Docs
  • let acorn = require("acorn");
    console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}));
    Docs
  • var acorn = require("acorn");
    var jsx = require("acorn-jsx");
    var JSXParser = acorn.Parser.extend(jsx());
    JSXParser.parse("foo(<bar/>)", {ecmaVersion: 2020});
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples