lib/compiler/compiler.js
function PathExpression(path) {
  const iterPattern = /^(.*)\[(\d+)]$/;
  const paths = path.split('.').reduce((prev, key) => {
    const matches = key.match(iterPattern);
    if (matches) {
      const [, rest, index] = matches;
      return [...prev, t.stringLiteral(rest), c.KEY_I(index)];
    }
    return [...prev, t.stringLiteral(key)];
  }, []);

  return paths;
}
function PathExpression(path) {
  const iterPattern = /^(.*)\[(\d+)]$/;
  const paths = path.split('.').reduce((prev, key) => {
    const matches = key.match(iterPattern);
    if (matches) {
      const [, rest, index] = matches;
      return [...prev, t.stringLiteral(rest), c.KEY_I(index)];
    }
    return [...prev, t.stringLiteral(key)];
  }, []);

  return paths;
}
function PathExpression ( path ) { const iterPattern = / ^(.*)\[(\d+)]$ / ; const paths = path . split ( '.' ) . reduce ( ( prev , key ) => { const matches = key . match ( iterPattern ) ; if ( matches ) { const [ , rest , index ] = matches ; return [ ... prev , t . stringLiteral ( rest ) , c . KEY_I ( index ) ] ; } return [ ... prev , t . stringLiteral ( key ) ] ; } , [ ] ) ; return paths ; }
Helpers for constructing AST nodes
Helpers for constructing AST nodes