Skip to content

iassign does not work correctly with ES6 Map #12

Description

@martinbu

Hi, thanks for this great helper library.

Does this library support ES6 Map? For me the following example does not work correctly. 'm' is always empty in the setProp and therefore map3 (or mapX) contains always one element after adding further elements.

import * as iassign from 'immutable-assign';

iassign.setOption({useConstructor: true});

let map1 = new Map();

  let map2 = iassign(
    map1,
    m => {
      m.set(0, 'first'); return m;
    }
  );

  let map3 = iassign(
    map2,
    m => { m.set(1, 'second'); return m; }
  );

  console.log(map1.size) // size: 0
  console.log(map2.size) // size: 1
  console.log(map3.size) // size: 1

Additionally, I have to set the useConstructor Option in every file (after import), that the option is applied correctly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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