当前位置

网站首页> 程序设计 > 程序资讯 > 软件更新资讯 > 浏览文章

Immutable.js 3.7.0 发布,不可变数据集合

作者:小梦 来源: 网络 时间: 2024-06-22 阅读:

阿里百川,开启移动应用开发的新篇章

Immutable 是 Facebook 开发的不可变数据集合。不可变数据一旦创建就不能被修改,是的应用开发更简单,允许使用函数式编程技术,比如惰性评估。Immutable JS 提供一个惰性 Sequence,允许高效的队列方法链,类似 map 和 filter ,不用创建中间代表。

immutable 通过惰性队列和哈希映射提供 Sequence, Range, Repeat, Map, OrderedMap, Set 和一个稀疏 Vector。

Immutable.js 3.7.0 发布,现已提供下载:https://github.com/facebook/immutable-js/archive/3.7.0.zip。

新增功能:

  • merge() family of functions now get the currently merging key as a 3rd argument, in case merge strategy should alter based on key.

  • IndexedCursor now has push(), pop(), unshift() and shift() to more closely mirror List.

  • Records initialize lazily. Creating a new Record type with Record({foo:"bar"}) involves a small bit of work. For applications with a large amount of Records, lazy initialization should help startup times.

  • Maps can now be constructed by a List of Lists instead of only a List of Arrays.

  • toString() prints Map string keys in quotes.

修复内容:

  • is() allows usage of valueOf to return primitives without recursing or encountering a reference error.

  • merge()/union() work inside withMutations when initial collection is empty. #405

  • Producing subcursors using cursor.cursor() now returns a proper typed cursor. #381

  • When a Record is passed to the same Record creation function, it's now returned directly.

  • Ensure Records toString() correctly. #383

  • Iterating over a sliced Seq can no longer cause an infinite recursion. #394

  • Ensure we don't throw when hashing non-extensible object in a modern environment.

  • Fix issue where non-existent function could be called if a collection doesn't have a size.

热点阅读

网友最爱