lazy.js icon indicating copy to clipboard operation
lazy.js copied to clipboard

unshift return a Sequence instead of an ArrayLikeSequence

Open b4nst opened this issue 5 years ago • 0 comments

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.

b4nst avatar Oct 08 '18 14:10 b4nst