Skip to content

Chaining takeWhile and last does not work #990

@niom

Description

@niom

When using chaining with takeWhile and last return undefined instead of the correct value.

example:

    _
    .chain([1, 2, 3])
    .takeWhile(function(item) {
        return item < 3
    })
    .last()
    .value()
    // ==> undefined

making the same thing without chaining works correctly

    _.last(
        _.takeWhile([1, 2, 3], function(item) {
            return item < 3
        })
    )
    // ==> 2

maybe some issue with lazy evaluation?

I created a jsfiddle from this issue with the latest lodash (3.3.0)
http://jsfiddle.net/zyx2rkfa/

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