Skip to content

unshift return a Sequence instead of an ArrayLikeSequence #222

@b4nst

Description

@b4nst

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions