// ⭐️ import
const Iterator = require('./Iterator.js'); // extend (built-in) iterable iterators
const { fibonacci, F } = require('./fibonacci.js');
// log
[
// ✅ test extension
fibonacci() // generator: 1, 1, 2, 3, 5, 8, ...
.take(5) // generator: 1, 1, 2, 3, 5
.map(x => x * x) // generator: 1, 1, 4, 9, 25
.toArray(), // array: [ 1, 1, 4, 9, 25 ]
// ✅ nth terms
F(1), F(2), F(3), F(4), // 1, 1, 2, 3
F(-2), F(-1), F(0), // 0, 0, 0
F('foo'), // 0
].forEach(x => console.log(x));