Skip to content

Releases: immutable-js/immutable-js

2.6.0

24 Oct 00:40
Compare
Choose a tag to compare

New:

  • max, maxBy, min, minBy - find the largest or smallest item in any sequence.
  • filterNot - filters by the complement of the predicate, e.g. where the filter function returns false, the values will be kept.
  • setIn and removeIn for altering deep immutable structures.

Fixes:

  • Object Hash will no longer be overridden if shared between multiple global contexts.
  • Immutable sequences from different requires in the same environment interact correctly for toJS and equals.

2.5.1

22 Oct 00:10
Compare
Choose a tag to compare

Fixes:

  • updateIn could fail to set a value if it matched the default value, or if it looked like an empty collection.
  • base Sequences no longer have unsafe specialized toArray and toObject functions which could cause accidental mutation of the immutable Sequences.
  • hashing uses WeakMap if available, resulting in a best possible case of not touching JS objects used as keys.
  • Distribution files are now lowercase.js, matching the package name to aleviate any confusion or case-sensitive file system woes.

2.5.0

17 Oct 23:59
Compare
Choose a tag to compare

New:

  • seq.toStack() as alias for Stack(seq)
  • flatten now accepts a depth number or shallow boolean to describe how deep it should flatten, by default it now flattens deeply.

Fixed:

  • Cursors can now represent Indexed sequences #97
  • Readme updates: explain CDN, update examples.
  • record.clear() no longer mysteriously vanishes.
  • Unsafe get and has optimizations removed from ValuesSeq.
  • last on a sequence with unknown length no longer returns undefined #141
  • seq.reverse().get(i) no longer returns incorrect values for indexed sequences.
  • seq.filter().get(i) no longer returns incorrect values for indexed sequences.
  • flatten no longer flattens sequencible values (string, array, object), but only Sequence instances, leading to more predictable flattening.

2.3.2

13 Oct 22:22
Compare
Choose a tag to compare

New:

  • Stack! a linked-list style structure with efficient addition and removal from the front of the list.

Fixes:

  • indexedSeq.skip(n).get(i) now returns the correct value.
  • skip(n).get(-i) and take(n).get(-i) return correct values for negative indices.
  • IE8 issue with Record
  • Throw when trying to set an invalid key on Record.

2.3.0

12 Oct 07:09
Compare
Choose a tag to compare

Iterators!

All Sequences, including both concrete collections (Map, Vector, Set) and lazy Sequences (mapped, filtered) can be iterated.

API:

values() returns an iterator object where each call to next() provides the next value.

keys() returns an iterator object where each call to next() provides the next key.

entries() returns an iterator object where each call to next() provides the next entry as a [key, value] tuple.

Example:

var myMap = Immutable.Map([['A', 1], ['B', 2], ['C', 3]]);
var entries = myMap.entries();
entries.next() // { value: ['A', 1], done: false }
entries.next() // { value: ['B', 2], done: false }
entries.next() // { value: ['C', 3], done: false }
entries.next() // { value: undefined, done: true }

All Sequences also support iteration via the @@iterator and Symbol.iterator methods, so they can be used in ES6 for-of comprehensions.

New

  • interpose()
  • Sequence documentation is easier to follow now that methods are categorized and alphabetized.
  • A number of lazy sequence optimizations. For example, seq.flip().reverse().flip() becomes seq.reverse().
  • Optimizations that allow get() and has() to be O(1) on lazy sequences.

Bugs

  • Equality checking via Immutable.is or seq.equals() could throw or incorrectly return false.

2.2.3

11 Oct 08:01
Compare
Choose a tag to compare

Fixed: Immutable.is() could throw for some Sequences

2.2.2

10 Oct 23:23
Compare
Choose a tag to compare
  • Improved using arbitrary Objects as keys or as members of a Set for IE8.
  • Fixed: collections did not always return correct length iterated from forEach()
  • Sequences (and Maps, Vectors, and Sets) can now be constructed from Iterables and Iterators. This enables Map and Set construction similar to ES6 spec.
var m = new Map([['A', 1], ['B', 2], ['C', 3]]);
// Map {"A" => 1, "B" => 2, "C" => 3}
var im = Immutable.Map(m);
// Map { A: 1, B: 2, C: 3 }
m = new Map(im);
// Map {"A" => 1, "B" => 2, "C" => 3}
  • Fixed: some Sequences did not properly provide themselves as the 3rd argument in iteration.
  • Fixed: take() could iterate one step too far.
  • Fixed: getIn() could throw if one of the intermediate keys does not exist.

2.2.1

08 Oct 19:48
Compare
Choose a tag to compare

New:

  • groupBy and countBy now return Sequence instead of Map.

Bugs:

  • Fix issue where seq.flip().reverse() can result in incorrect value.

2.2.0

08 Oct 19:12
Compare
Choose a tag to compare

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.

2.1.0

06 Oct 19:56
Compare
Choose a tag to compare

New:

  • Indexed Sequences are now always treated densely, including Vector and ArraySequence. This means iterators, forEach, and Sequence methods visit unset indices, and has returns true for unset indicies within length. This warrants a minor-version bump.
  • flatten turns a Sequence of Sequences into a single Sequence.
  • flatMap maps over a Sequence, flattening the result. The alias chain is provided to begin to adhere to the Fantasy Land spec.
  • Indexed Sequences can now be accessed by negative indicies, which index from the end of the Sequence.

Bugs:

  • ensure 3rd argument in sequence functions is always parent sequence.
  • reduce behavior matches Array#reduce.
  • join behavior matches Array#join
  • Fix type definition error for mergeDeep
  • Fix equality checking for Sets.
  • Fix issue where Safari/JSC incorrectly JITs hash creation, resulting in "missing values" or exceptions.