Skip to content

Unexpected behaviour of setIn/updateIn with List  #193

Closed
@pedroteixeira

Description

@pedroteixeira

Sometimes, I have complex paths with maps and lists when using updateIn, and noticed something weird if passing a string instead of a number for a List index:

Immutable.List([]).setIn(['a'], 2).toJS()

returns []

Immutable.List([]).setIn(['123'], 2).toJS()

returns Array of size [1231]

Not sure best solution, buy perhaps way to go would be to try coerce string to number or only accept number for the indices and throw an exception.

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