Migration guide
v1.0.0
Removed support of effector v21. Now the minimum supported version is v22.1.2
.
No breaking changes in code.
v0.110
From v0.110.0
patronum removed support of effector v20. Now minimum supported version is v21.4
.
Please, before upgrade review release notes of effector v21
.
v0.100
From v0.100.0
patronum introduced object arguments form with BREAKING CHANGES.
npm install patronum@0.14.3
# or
yarn add patronum@0.14.3
throttle
import { throttle } from 'patronum/throttle';
Previous version v0.14.x
const throttled = throttle(source, timeout);
Current version v0.102.x
const throttled = throttle({ source, timeout });
// Also you can set target
const throttled2 = createEvent(); // or any unit
throttle({ source, timeout, target: throttled2 });
- Wrap
source
andtimeout
arguments to object - Optionally add
target
parameter
debounce
import { debounce } from 'patronum/debounce';
Previous version v0.14.x
const debounced = debounce(source, timeout);
Current version v0.102.x
const debounced = debounce({ source, timeout });
// Also you can set target
const debounced = createEvent(); // or any unit
debounce({ source, timeout, target: debounced });
- Wrap
source
andtimeout
arguments to object - Optionally add
target
parameter
splitMap
import { splitMap } from 'patronum/split-map';
Previous version v0.14.x
const received = splitMap(nameReceived, {
firstName: (string) => string.split(' ')[0], // string | undefined
lastName: (string) => string.split(' ')[1], // string | undefined
});
Current version v0.102.x
const received = splitMap({
source: nameReceived,
cases: {
firstName: (string) => string.split(' ')[0], // string | undefined
lastName: (string) => string.split(' ')[1], // string | undefined
},
});
- First argument should be
source
- Second argument should be
cases
some
import { some } from 'patronum/some';
Previous version v0.14.x
const $tooBig = some((size) => size > 800, [$width, $height]);
Current version v0.102.x
const $tooBig = some({
predicate: (size) => size > 800,
stores: [$width, $height],
});
- First argument should be
predicate
- Second argument should be
stores
every
import { every } from 'patronum/every';
Previous version v0.14.x
const $result = every(true, [$a, $b, $c]);
const $result = every(() => true, [$a, $b, $c]);
Current version v0.102.x
const $result = every({ predicate: true, stores: [$a, $b, $c] });
const $result = every({ predicate: () => true, stores: [$a, $b, $c] });
- First argument should be
predicate
- Second argument should be
stores
delay
import { delay } from 'patronum/delay';
Previous version v0.14.x
const delayed = delay(unit, 100);
const logDelayed = delay(unit, { time: (payload) => 100 });
Current version v0.102.x
const delayed = delay({
source: unit,
timeout: 100,
});
const delayed = delay({
source: unit,
timeout: (payload) => 100,
});
const delayed = delay({
source: unit,
timeout: $timeout,
});
- First argument should be
source
- Second argument should be
timeout
time
property from second argument should betimeout
timeout
can beStore<number>
status
reshape
import { reshape } from 'patronum/reshape';
Previous version v0.14.x
const parts = reshape($original, {
length: (string) => string.length,
first: (string) => string.split(' ')[0] || '',
second: (string) => string.split(' ')[1] || '',
});
Current version v0.102.x
const parts = reshape({
source: $original,
shape: {
length: (string) => string.length,
first: (string) => string.split(' ')[0] || '',
second: (string) => string.split(' ')[1] || '',
},
});
- First argument should be
source
- Second argument should be
shape
combineEvents
import { combineEvents } from 'patronum/combine-events';
Previous version v0.14.x
const target = combineEvents([first, second, third]);
const target = combineEvents({
key1: event1,
key2: event2,
});
Current version v0.102.x
const target = combineEvents({ events: [first, second, third] });
const target = combineEvents({
events: {
key1: event1,
key2: event2,
},
});
- Assign first argument to property
events
in object
spread
import { spread } from 'patronum/spread';
Previous version v0.14.x
spread(formReceived, {
first: $first,
last: $last,
});
const source = spread({
first: $first,
last: $last,
});
Current version v0.102.x
spread({
source: formReceived,
targets: {
first: $first,
last: $last,
},
});
const source = spread({
targets: {
first: $first,
last: $last,
},
});
- If you have two arguments:
- First argument should be
source
in object - Second argument should be
targets
- If only one argument:
- Wrap it to object and assign to
targets