code: function compilePattern(pattern) {
    // pass estree syntax tree obj
    if (pattern && pattern.type) return pattern;
  
    if (typeof pattern !== 'string') {
      throw new Error('input pattern is neither a string nor an estree node.');
    }
  
    let exp = parser(pattern);
  
    if (exp.type !== 'Program' || !exp.body) {
      throw new Error(`Not a valid expression:  "${pattern}".`);
    }
  
    if (exp.body.length === 0) {
      throw new Error(`There is no statement in pattern "${pattern}".`);
    }
  
    if (exp.body.length > 1) {
      throw new Error(`Multiple statements is not supported "${pattern}".`);
    }
  
    exp = exp.body[0];
    // get the real expression underneath
    if (exp.type === 'ExpressionStatement') exp = exp.expression;
    return exp;
  }
docs: Compile a pattern into estree syntax tree
  @param pattern The pattern used on matching, can be a string or estree node
  @return Returns an estree node to be used as pattern in extract(pattern, part)