Skip to content

Should OrderedMap#setIn create a new OrderedMap (rather than Map) if a key does not exist? #304

@tomduncalf

Description

@tomduncalf

I'm new to Immutable JS and not an expert on immutable programming by any means so I may be confused here, but I would expect calling OrderedMap#setIn to create a new OrderedMap at the given keyPath if a key does not exist - however, according to the documentation and my testing, it instead creates a plain Map.

(From the docs: "Returns a new Map having set value at this keyPath. If any keys in keyPath do not exist, a new immutable Map will be created at that key.")

My concern here is that the order of key/value pairs within these child Maps (that are created when calling setIn with a non-existent key path) will not be preserved in all cases, which is important for my use case - or is this a non-issue as the top level data structure is an OrderedMap?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions