lazy.js
lazy.js copied to clipboard
unshift return a Sequence instead of an ArrayLikeSequence
Code to reproduce
const Lazy = require('lazy.js');
const als = Lazy([1]);
console.log(als.unshift(3) instanceof Lazy.ArrayLikeSequence);
expected result: true
actual result: false
This is due to the use of concat
with an ArrayLikeSequence inside unshift
. One dirty way to fix it will be to use toArray()
before concat. Although I think it should be wiser to refactor IndexedConcatenatedSequence
in order to accept ArrayLikeSequence.