8000 Stack.map throws a TypeError · Issue #332 · immutable-js/immutable-js · GitHub
[go: up one dir, main page]

Skip to content
Stack.map throws a TypeError #332
Closed
Closed
@astorije

Description

@astorije

The documentation shows that Stack has a map method. However, calling the method throws a TypeError.

Here is a minimalist example run on the command line through Node.js:

$ node --version
v0.10.25
$ npm --version
2.3.0
$ npm list immutable
[...]
└── immutable@3.6.2 

$ node
> function double (x) { return 2 * x; }
> var Immutable = require('immutable');

> Immutable.List.of(1, 2, 3).map(double);
List [ 2, 4, 6 ]

> Immutable.Stack.of(1, 2, 3).map(double);
TypeError: Object function cacheResultThrough() {
    if (this._iter.cacheResult) {
      this._iter.cacheResult();
      this.size = this._iter.size;
      return this;
    } else {
      return Seq.prototype.cacheResult.call(this);
    }
  } has no method '__iterate'
    at Stack.__iterate ([...]/node_modules/immutable/dist/immutable.js:3421:41)
    at IndexedIterable.mappedSequence.__iterateUncached ([...]/node_modules/immutable/dist/immutable.js:1138:23)
    at seqIterate ([...]/node_modules/immutable/dist/immutable.js:601:16)
    at IndexedIterable.IndexedSeq.__iterate ([...]/node_modules/immutable/dist/immutable.js:315:14)
    at IndexedIterable.reversedSequence.__iterate ([...]/node_modules/immutable/dist/immutable.js:1183:23)
    at IndexedIterable.mixin.forEach ([...]/node_modules/immutable/dist/immutable.js:4265:19)
    at Stack.pushAll ([...]/node_modules/immutable/dist/immutable.js:3331:22)
    at Stack.unshiftAll ([...]/node_modules/immutable/dist/immutable.js:3357:19)
    at new Stack ([...]/node_modules/immutable/dist/immutable.js:3274:22)
    at reify ([...]/node_modules/immutable/dist/immutable.js:1673:37)

I haven't tried other methods of Stack or the map method on other data types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0