0.0.15 • Published 7 years ago

icepath v0.0.15

Weekly downloads
34
License
MIT
Repository
github
Last release
7 years ago

icepath Build Status via Travis CI NPM version Coverage Status

Utilities for treating frozen JavaScript objects as persistent immutable collections.

Motivation

icepath provides functions that allow you to "modify" a structure by returning a partial clone using structural sharing. Only collections in the structure that had a child change will be changed.

icepath uses structural sharing at the object or array level. icepath does not use tries to store objects or arrays, so updates will be less efficient. This is to maintain JavaScript interoperability at all times. Also, for smaller collections, the overhead of creating and managing a trie structure is slower than simply cloning the entire collection. However, using very large collections (e.g.collections with more than 1000 elements) with icepath could lead to performance problems.

Structural sharing is useful wherever you can avoid expensive computation if you can quickly detect if the source data has changed. For example, shouldComponentUpdate in a React component. If you are using a frozen hierarchical object to build a system of React components, you can be confident that a component doesn't need to update if its current props strictly equal the nextProps.

API

  • set
  • unset
  • assoc
  • get
  • update
  • chain
  • single
For Arrays:
  • push pushIn
  • unshift unshiftIn
  • pop popIn
  • shift shiftIn
  • reverse reverseIn
  • sort sortIn
  • splice spliceIn
  • slice sliceIn
  • map mapIn
  • filter filterIn
For Objects:
  • assign assignIn
  • map mapIn
  • filter filterIn

License

MIT

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago