Skip to content

Map shouldn't accept a value. Move that to value() #404

@buchanae

Description

@buchanae

I can see the idea behind allowing map to accept a value, and it's probably useful, but it's also confusing and breaks a long standing contract (the signature of a map function). The reason I'm here is because of this:

class Index {
  lookupValue { ...pretend code... }

  getValueAtTime(time) {
    return this.lookupValue(time);
  }
}

var index = new Index();
var stream = someOtherStream.map(index.getValueForTime);

This returns a stream of undefined.
How long did it take you to see the error there? Took me hours.

Highland.value(val) (there's maybe a better name) would clear this up and save me some sanity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions