diff --git a/CHANGELOG.md b/CHANGELOG.md index 804cbb9..51ca8cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## [unreleased] +## [0.2.0] +* Freeze objects returned by default. It doesn't actually make sense to return + unfrozen objects, as the original object could be mutated and it would + affect the new object. Object freezing is disabled if `NODE_ENV` is + `"production'`. +* Update README with example for `reject`. + ## [0.1.3] * Update README @@ -14,7 +21,8 @@ ## 0.1.0 * Initial release -[unreleased]: https://github.com/aaronjensen/updeep/compare/v0.1.3...HEAD +[unreleased]: https://github.com/aaronjensen/updeep/compare/v0.2.0...HEAD +[0.2.0]: https://github.com/aaronjensen/updeep/compare/v0.1.3...v0.2.0 [0.1.3]: https://github.com/aaronjensen/updeep/compare/v0.1.2...v0.1.3 [0.1.2]: https://github.com/aaronjensen/updeep/compare/v0.1.1...v0.1.2 [0.1.1]: https://github.com/aaronjensen/updeep/compare/v0.1.0...v0.1.1 diff --git a/README.md b/README.md index 45be631..a07e2e3 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ u({ x: { b: 3 }, y: { 1: 4 } }, { x: { a: 0, b: 0 }, y: [0, 0] }); ### Use a function ```js -var inc = function(i) { return i + 1; } +function inc(i) { return i + 1; } u({ x: { b: inc } }, { x: { a: 0, b: 0 } }); // => { x: { a: 0, b: 1 } } ``` @@ -94,6 +94,14 @@ u({ x: u.omit('b') }, { x: { a: 0, b: 0 } }); // => { x: { a: 0 } } ``` +### Reject an item from an array + +```js +function even(i) { return i % 2 === 0 }; +u({ x: u.reject(even) }, { x: [1, 2, 3, 4] }); +// => { x: [1, 3] } +``` + ### With a default ```js @@ -120,6 +128,11 @@ $ npm install --save updeep Requires [lodash] as a peer dependency, so make sure you have it installed as well. +## Configuration + +If `NODE_ENV` is `"production"`, updeep will not attempt to freeze objects. +This may yield a slight performance gain. + ## Motivation While creating reducers for use with [redux], I wanted something that made it @@ -128,6 +141,10 @@ advantages over things like [Immutable.js][immutablejs] such as debugging and destructuring. I wanted something more powerful than [icepick] and more composable than [React.addons.update]. +If you're manipulating massive amounts of data frequently, you may want to +benchmark, as [Immutable.js][immutablejs] should be more efficient in that +case. + ## Contributing 1. Fork it.