Releases: 92green/unmutable
Releases · 92green/unmutable
Unmutable Compatible filter, filterNot, map, reduce
- Feat: make filter, filterNot, map and reduce able to be called on unmutable compatible data, and remove record specific implementations
- You'll need to define
entries()
,set()
anddelete()
on your unmutable compatible data type
- You'll need to define
- Fixed shallowToJS, internal name was wrong
- Refactor: restore previous shallowToJS logic that can cope with non array non object types
- Refactor: make keys and values use entries internally
- Add unmutable compatible tests to identify base functions for UnmutableCompatible types
- Test: allow unmutable compatible tests to check clear, clone and delete
- No breaking changes
Add move, rotate, takeUntil, takeWhile, skipUntil, skipWhile, toJSON, chunk, chunkBy, deal, isWriteable
- Add move #81
- Add rotate #69
- Add takeUntil
- Add takeWhile
- Add skipUntil
- Add skipWhile
- Add toJSON
- Add chunk #75
- Add chunkBy #75
- Add deal #70
- Add isWriteable
- Add treeshakeable ES6 named exports #82
- Add
util
files tosrc
directory for standardised importing - Add immutablility test for immutable.js compatible functions
- Fix findIndex on array was not passing
iter
- No breaking changes
Add experimental support for "unmutable compatible" data types
- Experimental support has been added for custom data types, such as classes that you may write yourself. For a class instance to be unmutable compatible, it must have a key of
__UNMUTABLE_COMPATIBLE__
and set this totrue
. When unmutable finds this key on avalue
, it will try to call a method on thatvalue
and pass all arguments through. It is up to you to write the behaviour of each of the methods that unmutable may call on your class, and to ensure these behave immutably. If a method cannot be found on thevalue
, and if a type-agnostic execution for the current function already exists in unmutable (this is a function called "all" in the unmutable source code), then unmutable will use the type-agnostic function instead. This means that by implementing a few basic methods likehas
,get
,set
,delete
,entries
etc, you should also be able to use unmutable functions such asgetIn
,update
,find
etc. - No breaking changes
Perf: Speed up get, set, has, update
v0.35.1 0.35.1
Add mergeDeep, mergeDeepIn, mergeDeepWith, mergeIn, mergeWith
- Add mergeDeep
- Add mergeDeepIn
- Add mergeDeepWith
- Add mergeIn
- Add mergeWith
- Fix view-coverage command
- No breaking changes
Fix: Make has() work on getters on class instances and inherited properties
- Fix: Make has() work on getters on class instances and inherited properties
- No breaking changes
Add splice, indexOf, lastIndexOf, flatten, setSize, max, maxBy, min, minBy
- Add
splice
- Add
indexOf
- Add
lastIndexOf
- Add
flatten
- Add
setSize
(courtesy of @mriccid) - Add
max
- Add
maxBy
- Add
min
- Add
minBy
- No breaking changes
Add forEach(), groupBy(), hashCode(), includes(), notEquals(), unique(), uniqueBy()
Add util/range(), change util/overload()
- Add
util/range
, a re-export of lodash.range - BREAKING CHANGE
util/overload
no longer has a concept ofinnerArgs
. It now only accepts a single argument, and each function on theoverloads
object needs to be(...args) => result
, rather than(...innerArgs) => (...args) => result
Support for class instances and functions as values, added isObject()
Experimental support for class instances and functions being passed as values has been added. They are treated in the same way as plain objects are. Currently these should work with methods that don't make changes to the data structure (get
, getIn
, find
etc.) There are plans for a standard API that unmutable
can use with methods that make data changes.
Behaviour change is exemplified by these two tests:
test('get() on class instance should work', (t: *) => {
class A {
foo = 'bar';
}
t.is(get('foo')(new A()), 'bar');
});
test('get() on function should work', (t: *) => {
let fn = () => {};
fn.foo = 'bar';
t.is(get('foo')(fn), 'bar');
});
Also added unmutable/lib/util/isObject
, which returns true for all non-primitives including arrays.