push()

in packages/flow-dev-tools/src/comment/getPathToLoc.js [30:49]


  push(key: string, ast: Object, exclude?: Set<string>) {
    const todo = [];
    if (ast == null) {
      return false;
    } else if (Array.isArray(ast)) {
      for (let i = 0; i < ast.length; i++) {
        todo.push(String(i));
      }
    } else if (ast.type != null) {
      for (const prop in ast) {
        if (ast.hasOwnProperty(prop) && !(exclude && exclude.has(prop))) {
          todo.push(prop);
        }
      }
    } else {
      return false;
    }
    this.nodes.push({key, ast, todo});
    return true;
  }