github immutable-js/immutable-js 2.2.0

latest releases: v5.0.0-beta.5, v4.3.5, v5.0.0-beta.4...
9 years ago

New

mapEntries() works like map and mapKeys, but accepts and returns [key, value] tuples, enabling mapping both keys and values simultaniously.

toKeyedSeq() converts an IndexedSequence into a Sequence where the indices are treated as keys. This is a lazy operation.

The whole IndexedSequence API has been reworked to remove the third maintainIndices argument from many methods. Using maintainIndices resulted in a sparse IndexedSequence, which no longer made sense in the context of dense IndexedSequences.

Example:

// Old: [0,,2,,4,,6,,8,,]
Range(0,10).filter(isEven, null, true) 

// New: { 0: 0, 2: 2, 4: 4, 6: 6, 8: 8 }
Range(0,10).toKeyedSeq().filter(isEven)

If you were using this argument, you will need to use toKeyedSeq() first to achieve similar behavior. This change warrants the minor-version bump.

Bugs:

  • Returning false from forEach() often resulted in an incorrect length iterated. Clarified the documentation describing this behavior and corrected any bad behavior.
  • Fixed some documentation which referenced sparse behavior.
  • Fixed some issues when using reverse() and take() or skip() in concert that resulted in incorrect indices.
  • Fixed incorrect behavior when take() or skip() are given negative values.
  • Fixed issue where iteration of valueSeq() didn't provide the correct collection as a third argument.
  • Fixed issue where flatten() and concat() behavior diverged.

Don't miss a new immutable-js release

NewReleases is sending notifications on new releases.