Skip to content

filter + rest + map => trouble #1026

@j0tunn

Description

@j0tunn

Hi, I have some problem using filter, rest and map in chain. After filter and rest applied map still can iterate over elements of the array even though there are no elements already.
Here is minimal case in interactive mode:

> require('lodash')([1]).rest().map(function(v) { console.log(v); }).value();
[] # OK
> require('lodash')([1]).filter(function(v) { return v; }).rest().map(function(v) { console.log(v); }).value();
1 # WTF?!
[]
> 

I think the problem is in the lazy evaluation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions