update destination list with entries

Issue #1 resolved
David Rundle created an issue

given

destination = [ 
 { id: 1, name = "dave", isEnabled = false },
 { id: 2, name = "bob", isEnabled = false }
]

source = [
 { id: 1, name = "dave", isEnabled = true },
 { id: 3, name = "leeloo", isEnabled = false }
]

mapper.mapTo(source, destination);

//results in

destination == [ 
 { id: 1, name = "dave", isEnabled = true },
 { id: 3, name = "leeloo", isEnabled = false }
]

the main thing to note

  • entries have an id
  • entry 1, is not replaced, it is updated, thus any object reference is up held.
  • entry 2, is removed
  • entry 3, is a new instance added to destination
  • the list itself also retains the same instance

Comments (3)

  1. Log in to comment