{"size": 804, "ext": "js", "max_stars_repo_path": "src/generator/05_generator.js", "max_stars_repo_name": "joyjoe/es6Book", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/generator/05_generator.js", "max_issues_repo_name": "joyjoe/es6Book", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/generator/05_generator.js", "max_forks_repo_name": "joyjoe/es6Book", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.1428571429, "max_line_length": 48, "alphanum_fraction": 0.5634328358}
// Array.from
// ...
// for...of

function* number() {
  yield 1;
  yield 2;
  yield 3;
  return 4;
  // eslint-disable-next-line
  yield 5;
}

for (var n of number()) {
  console.log(n);
}
console.log("-----");
console.log([...number()]);
console.log("-----");
let [x, y, z] = number();
console.log(`x = ${x},y = ${y},z = ${z}`);
console.log("-----");
const arr = Array.from(number());
console.log(arr);
console.log("-----");

const jane = { "first": "jane", "last": "Doe" };
// jane对象默认是没有实现遍历接口的
/* for (let p of jane) {
  console.log(p);
} */
function* objectEntries(obj) {
  let propKeys = Reflect.ownKeys(obj);
  for (let propKey of propKeys) {
    yield { prop: propKey, val: obj[propKey] };
  }
}

for (let { prop: key, val: name }
  of objectEntries(jane)) {
  console.log(`${key} = ${name}`);
}