Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Calling .map() on an instance of Record modifies the original Record #645

Closed
@bvaughn

Description

@bvaughn

Perhaps I'm missing something, but it seems like there is a problem with the map() function on records:

R = Immutable.Record({
  foo: undefined,
  bar: undefined
})
r0 = new R({
  foo: 'poo',
  bar: 'BAR'
})
r1 = new R({
  foo: 'FOO'
})
console.log(r1.toJS()) // Object {foo: "FOO", bar: undefined}
r2 = r1.map(function(value, key) {
  return value || r0.get(key)
})
console.log(r2) // undefined
console.log(r1.toJS()) // Object {foo: "FOO", bar: "BAR"}

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