Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

patronum

Package Overview
Dependencies
Maintainers
4
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

patronum - npm Package Compare versions

Comparing version 1.8.1 to 1.8.2

combine-events/index.cjs

65

combine-events/index.js

@@ -1,32 +0,34 @@

"use strict";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.combineEvents = combineEvents;
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var _effector = require("effector");
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function combineEvents({
events,
reset,
target = (0, _effector.createEvent)({
name: "target",
sid: "3pez5"
})
}) {
if (!_effector.is.unit(target)) throwError('target should be a unit');
if (reset && !_effector.is.unit(reset)) throwError('reset should be a unit');
(0, _effector.withRegion)(target, () => {
const keys = Object.keys(events);
const defaultShape = Array.isArray(events) ? [...keys].fill('') : {};
const $counter = (0, _effector.createStore)(keys.length, {
import { createEvent, createStore, guard, is, merge, sample, withRegion } from 'effector';
export function combineEvents(_ref) {
var {
events,
reset,
target = createEvent({
name: "target",
sid: "3pez5"
}, {
name: "target",
sid: "3pez5"
})
} = _ref;
if (!is.unit(target)) throwError('target should be a unit');
if (reset && !is.unit(reset)) throwError('reset should be a unit');
withRegion(target, () => {
var keys = Object.keys(events);
var defaultShape = Array.isArray(events) ? [...keys].fill('') : {};
var $counter = createStore(keys.length, {
name: "$counter",
sid: "-dszn9a"
});
const $results = (0, _effector.createStore)(defaultShape, {
var $results = createStore(defaultShape, {
name: "$results",
sid: "boz3x7"
});
$counter.reset((0, _effector.sample)({
$counter.reset(sample({
and: [target],

@@ -40,3 +42,3 @@ or: {

if (reset) {
$counter.reset((0, _effector.sample)({
$counter.reset(sample({
and: [reset],

@@ -50,4 +52,4 @@ or: {

for (const key of keys) {
const $isDone = (0, _effector.createStore)(false, {
var _loop = function _loop(key) {
var $isDone = createStore(false, {
name: "$isDone",

@@ -63,13 +65,16 @@ sid: "ucs7nc"

$results.on(events[key], (shape, payload) => {
const newShape = Array.isArray(shape) ? [...shape] : { ...shape
};
var newShape = Array.isArray(shape) ? [...shape] : _objectSpread({}, shape);
newShape[key] = payload;
return newShape;
});
};
for (var key of keys) {
_loop(key);
}
(0, _effector.guard)({
guard({
and: [{
source: (0, _effector.sample)({
and: [$results, (0, _effector.merge)(Object.values(events), {
source: sample({
and: [$results, merge(Object.values(events), {
name: "and",

@@ -76,0 +81,0 @@ sid: "-l8g4ey"

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,23 +0,19 @@

"use strict";
import { createEvent, guard, is } from 'effector';
export function condition(_ref) {
var {
if: test,
then: thenBranch,
else: elseBranch,
source = createEvent({
name: "source",
sid: "epke23"
}, {
name: "source",
sid: "epke23"
})
} = _ref;
var checker = is.unit(test) || isFunction(test) ? test : value => value === test;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.condition = condition;
var _effector = require("effector");
function condition({
if: test,
then: thenBranch,
else: elseBranch,
source = (0, _effector.createEvent)({
name: "source",
sid: "epke23"
})
}) {
const checker = _effector.is.unit(test) || isFunction(test) ? test : value => value === test;
if (thenBranch) {
(0, _effector.guard)({
guard({
and: [{

@@ -35,3 +31,3 @@ source,

if (elseBranch) {
(0, _effector.guard)({
guard({
and: [{

@@ -56,3 +52,3 @@ source,

function inverse(fnOrUnit) {
if (_effector.is.unit(fnOrUnit)) {
if (is.unit(fnOrUnit)) {
return fnOrUnit.map(value => !value);

@@ -59,0 +55,0 @@ }

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,27 +0,20 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.debounce = debounce;
var _effector = require("effector");
function debounce({
source,
timeout,
target
}) {
if (!_effector.is.unit(source)) throw new TypeError('source must be unit from effector');
if (_effector.is.domain(source, {
import { createEffect, createEvent, forward, is } from 'effector';
export function debounce(_ref) {
var {
source,
timeout,
target
} = _ref;
if (!is.unit(source)) throw new TypeError('source must be unit from effector');
if (is.domain(source, {
sid: "iu8yzo"
})) throw new TypeError('source cannot be domain');
if (typeof timeout !== 'number' || timeout < 0 || !Number.isFinite(timeout)) throw new Error(`timeout must be positive number or zero. Received: "${timeout}"`);
let rejectPromise;
let timeoutId;
const tick = target ?? (0, _effector.createEvent)({
if (typeof timeout !== 'number' || timeout < 0 || !Number.isFinite(timeout)) throw new Error("timeout must be positive number or zero. Received: \"".concat(timeout, "\""));
var rejectPromise;
var timeoutId;
var tick = target !== null && target !== void 0 ? target : createEvent({
name: "tick",
sid: "-xw52dh"
});
const timerFx = (0, _effector.createEffect)(parameter => {
var timerFx = createEffect(parameter => {
clearTimeout(timeoutId);

@@ -37,3 +30,3 @@ if (rejectPromise) rejectPromise();

});
(0, _effector.forward)({
forward({
and: {

@@ -47,7 +40,10 @@ from: source,

});
(0, _effector.forward)({
forward({
and: {
from: timerFx.done.map(({
result
}) => result),
from: timerFx.done.map(_ref2 => {
var {
result
} = _ref2;
return result;
}),
to: tick

@@ -54,0 +50,0 @@ },

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,19 +0,15 @@

"use strict";
import { is } from 'effector';
export function debug() {
for (var _len = arguments.length, units = new Array(_len), _key = 0; _key < _len; _key++) {
units[_key] = arguments[_key];
}
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.debug = debug;
for (var unit of units) {
var type = getType(unit);
var _effector = require("effector");
function debug(...units) {
for (const unit of units) {
const type = getType(unit);
if (_effector.is.store(unit, {
if (is.store(unit, {
sid: "8mdztw"
}) || _effector.is.effect(unit, {
}) || is.effect(unit, {
sid: "-gueih2"
}) || _effector.is.event(unit, {
}) || is.event(unit, {
sid: "-gueh0j"

@@ -24,3 +20,3 @@ })) {

if (_effector.is.effect(unit, {
if (is.effect(unit, {
sid: "-jlpzbv"

@@ -31,3 +27,3 @@ })) {

if (_effector.is.domain(unit, {
if (is.domain(unit, {
sid: "-jjisyf"

@@ -43,3 +39,3 @@ })) {

function getType(unit) {
if (_effector.is.store(unit, {
if (is.store(unit, {
sid: "-j30z7b"

@@ -50,3 +46,3 @@ })) {

if (_effector.is.effect(unit, {
if (is.effect(unit, {
sid: "-j1dlf8"

@@ -57,3 +53,3 @@ })) {

if (_effector.is.event(unit, {
if (is.event(unit, {
sid: "-io6j6k"

@@ -64,3 +60,3 @@ })) {

if (_effector.is.domain(unit, {
if (is.domain(unit, {
sid: "-imj5eh"

@@ -71,3 +67,3 @@ })) {

if (_effector.is.unit(unit)) {
if (is.unit(unit)) {
return 'unit';

@@ -79,6 +75,7 @@ }

function log(unit, type, prefix = '') {
const name = prefix + getName(unit);
function log(unit, type) {
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var name = prefix + getName(unit);
unit.watch(payload => {
console.info(`[${type}] ${name}`, payload);
console.info("[".concat(type, "] ").concat(name), payload);
});

@@ -85,0 +82,0 @@ }

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,35 +0,34 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.delay = delay;
var _effector = require("effector");
function delay({
source,
timeout,
target = (0, _effector.createEvent)({
name: "target",
sid: "-z2vw3w"
})
}) {
if (!_effector.is.unit(source)) throw new TypeError('source must be a unit from effector');
if (!_effector.is.unit(target)) throw new TypeError('target must be a unit from effector');
const ms = validateTimeout(timeout);
const timerFx = (0, _effector.createEffect)(({
payload,
milliseconds
}) => new Promise(resolve => {
setTimeout(resolve, milliseconds, payload);
}), {
import { createEffect, createEvent, forward, is, sample, combine } from 'effector';
export function delay(_ref) {
var {
source,
timeout,
target = createEvent({
name: "target",
sid: "-z2vw3w"
}, {
name: "target",
sid: "-z2vw3w"
})
} = _ref;
if (!is.unit(source)) throw new TypeError('source must be a unit from effector');
if (!is.unit(target)) throw new TypeError('target must be a unit from effector');
var ms = validateTimeout(timeout);
var timerFx = createEffect(_ref2 => {
var {
payload,
milliseconds
} = _ref2;
return new Promise(resolve => {
setTimeout(resolve, milliseconds, payload);
});
}, {
name: "timerFx",
sid: "-584o7j"
});
(0, _effector.sample)({
sample({
and: [{
// ms can be Store<number> | number
// converts object of stores or object of values to store
source: (0, _effector.combine)({
source: combine({
and: [{

@@ -44,8 +43,11 @@ milliseconds: ms

clock: source,
fn: ({
milliseconds
}, payload) => ({
payload,
milliseconds: typeof milliseconds === 'function' ? milliseconds(payload) : milliseconds
}),
fn: (_ref3, payload) => {
var {
milliseconds
} = _ref3;
return {
payload,
milliseconds: typeof milliseconds === 'function' ? milliseconds(payload) : milliseconds
};
},
target: timerFx

@@ -57,3 +59,3 @@ }],

});
(0, _effector.forward)({
forward({
and: {

@@ -71,3 +73,3 @@ from: timerFx.doneData,

function validateTimeout(timeout) {
if (_effector.is.store(timeout, {
if (is.store(timeout, {
sid: "-va560a"

@@ -78,3 +80,3 @@ }) || typeof timeout === 'function' || typeof timeout === 'number') {

throw new TypeError(`'timeout' argument must be a function, Store, or a number. Passed "${typeof timeout}"`);
throw new TypeError("'timeout' argument must be a function, Store, or a number. Passed \"".concat(typeof timeout, "\""));
}
{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,15 +0,7 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.every = every;
var _effector = require("effector");
/* eslint-disable @typescript-eslint/no-unused-vars */
function every(configOrStores, predicateOrNone) {
let stores = [];
import { combine, is } from 'effector';
export function every(configOrStores, predicateOrNone) {
var stores = [];
let predicate = () => false;
var predicate = () => false;

@@ -24,7 +16,7 @@ if (Array.isArray(configOrStores)) {

let checker;
var checker;
if (isFunction(predicate)) {
checker = predicate;
} else if (_effector.is.store(predicate, {
} else if (is.store(predicate, {
sid: "sid3ut"

@@ -37,3 +29,3 @@ })) {

const $values = (0, _effector.combine)({
var $values = combine({
and: [stores],

@@ -46,4 +38,4 @@ or: {

const $checker = checker;
return (0, _effector.combine)({
var $checker = checker;
return combine({
and: [$checker, $values, (checker, values) => values.every(checker)],

@@ -50,0 +42,0 @@ or: {

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,13 +0,9 @@

"use strict";
import { combine } from 'effector';
export function format(strings) {
for (var _len = arguments.length, stores = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
stores[_key - 1] = arguments[_key];
}
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.format = format;
var _effector = require("effector");
function format(strings, ...stores) {
return (0, _effector.combine)({
and: [stores, stores => strings.reduce((acc, value, index) => acc.concat(isLastElement(strings, index) ? value : `${value}${toString(stores[index])}`), '')],
return combine({
and: [stores, stores => strings.reduce((acc, value, index) => acc.concat(isLastElement(strings, index) ? value : "".concat(value).concat(toString(stores[index]))), '')],
or: {

@@ -14,0 +10,0 @@ sid: "-yrbthp"

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,16 +0,10 @@

"use strict";
import { combine } from 'effector';
export function inFlight(_ref) {
var {
effects,
domain
} = _ref;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.inFlight = inFlight;
var _effector = require("effector");
function inFlight({
effects,
domain
}) {
if (domain) {
const $inFlight = domain.createStore(0, {
var $inFlight = domain.createStore(0, {
name: "$inFlight",

@@ -25,3 +19,3 @@ sid: "-y7vg7t"

return (0, _effector.combine)({
return combine({
and: [effects.map(fx => fx.inFlight), inFlights => inFlights.reduce((all, current) => all + current, 0)],

@@ -28,0 +22,0 @@ or: {

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,19 +0,19 @@

module.exports.combineEvents = require('./combine-events').combineEvents;
module.exports.condition = require('./condition').condition;
module.exports.debounce = require('./debounce').debounce;
module.exports.debug = require('./debug').debug;
module.exports.delay = require('./delay').delay;
module.exports.every = require('./every').every;
module.exports.format = require('./format').format;
module.exports.inFlight = require('./in-flight').inFlight;
module.exports.interval = require('./interval').interval;
module.exports.pending = require('./pending').pending;
module.exports.reset = require('./reset').reset;
module.exports.reshape = require('./reshape').reshape;
module.exports.snapshot = require('./snapshot').snapshot;
module.exports.some = require('./some').some;
module.exports.splitMap = require('./split-map').splitMap;
module.exports.spread = require('./spread').spread;
module.exports.status = require('./status').status;
module.exports.throttle = require('./throttle').throttle;
module.exports.time = require('./time').time;
export { combineEvents } from './combine-events/index.js'
export { condition } from './condition/index.js'
export { debounce } from './debounce/index.js'
export { debug } from './debug/index.js'
export { delay } from './delay/index.js'
export { every } from './every/index.js'
export { format } from './format/index.js'
export { inFlight } from './in-flight/index.js'
export { interval } from './interval/index.js'
export { pending } from './pending/index.js'
export { reset } from './reset/index.js'
export { reshape } from './reshape/index.js'
export { snapshot } from './snapshot/index.js'
export { some } from './some/index.js'
export { splitMap } from './split-map/index.js'
export { spread } from './spread/index.js'
export { status } from './status/index.js'
export { throttle } from './throttle/index.js'
export { time } from './time/index.js'

@@ -1,36 +0,29 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.interval = interval;
var _effector = require("effector");
function interval({
timeout,
start,
stop,
leading = false,
trailing = false
}) {
const tick = (0, _effector.createEvent)({
import { createEvent, createEffect, createStore, guard, sample, attach, is } from 'effector';
export function interval(_ref) {
var {
timeout,
start,
stop,
leading = false,
trailing = false
} = _ref;
var tick = createEvent({
name: "tick",
sid: "uo9p3s"
});
const $isRunning = (0, _effector.createStore)(false, {
var $isRunning = createStore(false, {
name: "$isRunning",
sid: "-wxesi8"
});
const $timeout = toStoreNumber(timeout);
const $notRunning = $isRunning.map(running => !running);
const saveTimeout = (0, _effector.createEvent)({
var $timeout = toStoreNumber(timeout);
var $notRunning = $isRunning.map(running => !running);
var saveTimeout = createEvent({
name: "saveTimeout",
sid: "as5clk"
});
const $timeoutId = (0, _effector.createStore)(null, {
var $timeoutId = createStore(null, {
name: "$timeoutId",
sid: "-bh90bo"
}).on(saveTimeout, (_, id) => id);
const saveReject = (0, _effector.createEvent)({
var saveReject = createEvent({
name: "saveReject",

@@ -40,9 +33,9 @@ sid: "-64swis"

const $rejecter = (0, _effector.createStore)(() => {}, {
var $rejecter = createStore(() => {}, {
name: "$rejecter",
sid: "eabbu7"
}).on(saveReject, (_, rj) => rj);
const timeoutFx = (0, _effector.createEffect)(timeout => {
var timeoutFx = createEffect(timeout => {
return new Promise((resolve, reject) => {
const timeoutId = setTimeout(resolve, timeout);
var timeoutId = setTimeout(resolve, timeout);
saveTimeout(timeoutId);

@@ -55,6 +48,7 @@ saveReject(reject);

});
const cleanupFx = (0, _effector.attach)({
var cleanupFx = attach({
and: {
source: [$timeoutId, $rejecter],
effect: ([id, rj]) => {
effect: _ref2 => {
var [id, rj] = _ref2;
rj();

@@ -69,3 +63,3 @@ if (id) clearTimeout(id);

});
(0, _effector.guard)({
guard({
and: [{

@@ -83,3 +77,3 @@ clock: start,

if (leading) {
(0, _effector.guard)({
guard({
and: [{

@@ -96,3 +90,3 @@ clock: start,

(0, _effector.sample)({
sample({
and: [{

@@ -107,3 +101,3 @@ clock: start,

});
(0, _effector.guard)({
guard({
and: [{

@@ -119,3 +113,3 @@ clock: timeoutFx.done,

});
(0, _effector.sample)({
sample({
and: [{

@@ -135,3 +129,3 @@ clock: timeoutFx.done,

if (trailing) {
(0, _effector.sample)({
sample({
and: [{

@@ -148,3 +142,3 @@ clock: stop,

$isRunning.on(stop, () => false);
(0, _effector.sample)({
sample({
and: [{

@@ -167,3 +161,3 @@ clock: stop,

function toStoreNumber(value) {
if (_effector.is.store(value, {
if (is.store(value, {
sid: "6p7767"

@@ -173,3 +167,3 @@ })) return value;

if (typeof value === 'number') {
return (0, _effector.createStore)(value, {
return createStore(value, {
and: {

@@ -182,3 +176,3 @@ name: '$timeout'

throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof value}" was passed`);
throw new TypeError("timeout parameter in interval method should be number or Store. \"".concat(typeof value, "\" was passed"));
}
{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}
{
"name": "patronum",
"version": "1.8.1",
"version": "1.8.2",
"description": "☄️ Effector utility library delivering modularity and convenience",
"type": "module",
"main": "patronum.cjs.js",
"main": "patronum.cjs",
"types": "index.d.ts",
"module": "patronum.mjs",
"module": "patronum.js",
"browser": "patronum.umd.js",

@@ -36,5 +36,5 @@ "sideEffects": false,

".": {
"require": "./index.js",
"import": "./index.mjs",
"default": "./index.mjs"
"require": "./index.cjs",
"import": "./index.js",
"default": "./index.js"
},

@@ -49,96 +49,96 @@ "./babel-preset": {

"./combine-events": {
"require": "./combine-events/index.js",
"import": "./combine-events/index.mjs"
"require": "./combine-events/index.cjs",
"import": "./combine-events/index.js"
},
"./condition/package.json": "./condition/package.json",
"./condition": {
"require": "./condition/index.js",
"import": "./condition/index.mjs"
"require": "./condition/index.cjs",
"import": "./condition/index.js"
},
"./debounce/package.json": "./debounce/package.json",
"./debounce": {
"require": "./debounce/index.js",
"import": "./debounce/index.mjs"
"require": "./debounce/index.cjs",
"import": "./debounce/index.js"
},
"./debug/package.json": "./debug/package.json",
"./debug": {
"require": "./debug/index.js",
"import": "./debug/index.mjs"
"require": "./debug/index.cjs",
"import": "./debug/index.js"
},
"./delay/package.json": "./delay/package.json",
"./delay": {
"require": "./delay/index.js",
"import": "./delay/index.mjs"
"require": "./delay/index.cjs",
"import": "./delay/index.js"
},
"./every/package.json": "./every/package.json",
"./every": {
"require": "./every/index.js",
"import": "./every/index.mjs"
"require": "./every/index.cjs",
"import": "./every/index.js"
},
"./format/package.json": "./format/package.json",
"./format": {
"require": "./format/index.js",
"import": "./format/index.mjs"
"require": "./format/index.cjs",
"import": "./format/index.js"
},
"./in-flight/package.json": "./in-flight/package.json",
"./in-flight": {
"require": "./in-flight/index.js",
"import": "./in-flight/index.mjs"
"require": "./in-flight/index.cjs",
"import": "./in-flight/index.js"
},
"./interval/package.json": "./interval/package.json",
"./interval": {
"require": "./interval/index.js",
"import": "./interval/index.mjs"
"require": "./interval/index.cjs",
"import": "./interval/index.js"
},
"./pending/package.json": "./pending/package.json",
"./pending": {
"require": "./pending/index.js",
"import": "./pending/index.mjs"
"require": "./pending/index.cjs",
"import": "./pending/index.js"
},
"./reset/package.json": "./reset/package.json",
"./reset": {
"require": "./reset/index.js",
"import": "./reset/index.mjs"
"require": "./reset/index.cjs",
"import": "./reset/index.js"
},
"./reshape/package.json": "./reshape/package.json",
"./reshape": {
"require": "./reshape/index.js",
"import": "./reshape/index.mjs"
"require": "./reshape/index.cjs",
"import": "./reshape/index.js"
},
"./snapshot/package.json": "./snapshot/package.json",
"./snapshot": {
"require": "./snapshot/index.js",
"import": "./snapshot/index.mjs"
"require": "./snapshot/index.cjs",
"import": "./snapshot/index.js"
},
"./some/package.json": "./some/package.json",
"./some": {
"require": "./some/index.js",
"import": "./some/index.mjs"
"require": "./some/index.cjs",
"import": "./some/index.js"
},
"./split-map/package.json": "./split-map/package.json",
"./split-map": {
"require": "./split-map/index.js",
"import": "./split-map/index.mjs"
"require": "./split-map/index.cjs",
"import": "./split-map/index.js"
},
"./spread/package.json": "./spread/package.json",
"./spread": {
"require": "./spread/index.js",
"import": "./spread/index.mjs"
"require": "./spread/index.cjs",
"import": "./spread/index.js"
},
"./status/package.json": "./status/package.json",
"./status": {
"require": "./status/index.js",
"import": "./status/index.mjs"
"require": "./status/index.cjs",
"import": "./status/index.js"
},
"./throttle/package.json": "./throttle/package.json",
"./throttle": {
"require": "./throttle/index.js",
"import": "./throttle/index.mjs"
"require": "./throttle/index.cjs",
"import": "./throttle/index.js"
},
"./time/package.json": "./time/package.json",
"./time": {
"require": "./time/index.js",
"import": "./time/index.mjs"
"require": "./time/index.cjs",
"import": "./time/index.js"
}
}
}

@@ -1,2 +0,2 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("effector")):"function"==typeof define&&define.amd?define(["exports","effector"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).patronum={},e.effector)}(this,(function(e,r){"use strict";function t(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e){throw new Error(e)}function a(e){return r.is.unit(e)?e.map((e=>!e)):r=>!e(r)}var i={__proto__:null,condition:function(e){var{if:t,then:n,else:o,source:i=r.createEvent({name:"source",sid:"epke23"},{name:"source",sid:"epke23"})}=e,s=r.is.unit(t)||"function"==typeof t?t:e=>e===t;return n&&r.guard({and:[{source:i,filter:s,target:n}],or:{sid:"9tug3k"}}),o&&r.guard({and:[{source:i,filter:a(s),target:o}],or:{sid:"a9shb1"}}),i}};var s={__proto__:null,debounce:function(e){var t,n,{source:o,timeout:a,target:i}=e;if(!r.is.unit(o))throw new TypeError("source must be unit from effector");if(r.is.domain(o,{sid:"iu8yzo"}))throw new TypeError("source cannot be domain");if("number"!=typeof a||a<0||!Number.isFinite(a))throw new Error('timeout must be positive number or zero. Received: "'.concat(a,'"'));var s=null!=i?i:r.createEvent({name:"tick",sid:"-xw52dh"}),u=r.createEffect((e=>(clearTimeout(n),t&&t(),new Promise(((r,o)=>{t=o,n=setTimeout(r,a,e)})))),{name:"timerFx",sid:"m8kfsq"});return r.forward({and:{from:o,to:u},or:{sid:"k4foqk"}}),r.forward({and:{from:u.done.map((e=>{var{result:r}=e;return r})),to:s},or:{sid:"k76npd"}}),s}};function u(e){return r.is.store(e,{sid:"-j30z7b"})?"store":r.is.effect(e,{sid:"-j1dlf8"})?"effect":r.is.event(e,{sid:"-io6j6k"})?"event":r.is.domain(e,{sid:"-imj5eh"})?"domain":r.is.unit(e)?"unit":"unknown"}function c(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=t+f(e);e.watch((e=>{console.info("[".concat(r,"] ").concat(n),e)}))}function d(e){c(e.done,"effect",f(e)+"."),c(e.fail,"effect",f(e)+".")}function f(e){return e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:""}var l={__proto__:null,debug:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var o of t){var a=u(o);(r.is.store(o,{sid:"8mdztw"})||r.is.effect(o,{sid:"-gueih2"})||r.is.event(o,{sid:"-gueh0j"}))&&c(o,a),r.is.effect(o,{sid:"-jlpzbv"})&&d(o),r.is.domain(o,{sid:"-jjisyf"})&&(o.onCreateEvent((e=>c(e,"event"))),o.onCreateStore((e=>c(e,"store"))),o.onCreateEffect(d))}}};var m={__proto__:null,delay:function(e){var{source:t,timeout:n,target:o=r.createEvent({name:"target",sid:"-z2vw3w"},{name:"target",sid:"-z2vw3w"})}=e;if(!r.is.unit(t))throw new TypeError("source must be a unit from effector");if(!r.is.unit(o))throw new TypeError("target must be a unit from effector");var a=function(e){if(r.is.store(e,{sid:"-va560a"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError("'timeout' argument must be a function, Store, or a number. Passed \"".concat(typeof e,'"'))}(n),i=r.createEffect((e=>{var{payload:r,milliseconds:t}=e;return new Promise((e=>{setTimeout(e,t,r)}))}),{name:"timerFx",sid:"-584o7j"});return r.sample({and:[{source:r.combine({and:[{milliseconds:a}],or:{name:"source",sid:"9rbdjo"}}),clock:t,fn:(e,r)=>{var{milliseconds:t}=e;return{payload:r,milliseconds:"function"==typeof t?t(r):t}},target:i}],or:{sid:"-wmj29s"}}),r.forward({and:{from:i.doneData,to:o},or:{sid:"-vsadmx"}}),o}};var p={__proto__:null,every:function(e,t){var n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate),n="function"==typeof a?a:r.is.store(a,{sid:"sid3ut"})?a.map((e=>r=>e===r)):e=>e===a;var i=r.combine({and:[o],or:{name:"$values",sid:"h09uhg"}}),s=n;return r.combine({and:[s,i,(e,r)=>r.every(e)],or:{sid:"hfkdw9"}})}};function v(e){return Array.isArray(e)?e.map((e=>String(e))).join(", "):String(e)}function y(e,r){return r===e.length-1}var g={__proto__:null,format:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return r.combine({and:[n,r=>e.reduce(((t,n,o)=>t.concat(y(e,o)?n:"".concat(n).concat(v(r[o])))),"")],or:{sid:"-yrbthp"}})}};var b={__proto__:null,inFlight:function(e){var{effects:t,domain:n}=e;if(n){var o=n.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return n.onCreateEffect((e=>{o.on(e,(e=>e+1)).on(e.finally,(e=>e-1))})),o}return r.combine({and:[t.map((e=>e.inFlight)),e=>e.reduce(((e,r)=>e+r),0)],or:{sid:"ubqxa7"}})}};var _={__proto__:null,interval:function(e){var{timeout:t,start:n,stop:o,leading:a=!1,trailing:i=!1}=e,s=r.createEvent({name:"tick",sid:"uo9p3s"}),u=r.createStore(!1,{name:"$isRunning",sid:"-wxesi8"}),c=function(e){if(r.is.store(e,{sid:"6p7767"}))return e;if("number"==typeof e)return r.createStore(e,{and:{name:"$timeout"},sid:"5hw6se"});throw new TypeError('timeout parameter in interval method should be number or Store. "'.concat(typeof e,'" was passed'))}(t),d=u.map((e=>!e)),f=r.createEvent({name:"saveTimeout",sid:"as5clk"}),l=r.createStore(null,{name:"$timeoutId",sid:"-bh90bo"}).on(f,((e,r)=>r)),m=r.createEvent({name:"saveReject",sid:"-64swis"}),p=r.createStore((()=>{}),{name:"$rejecter",sid:"eabbu7"}).on(m,((e,r)=>r)),v=r.createEffect((e=>new Promise(((r,t)=>{var n=setTimeout(r,e);f(n),m(t)}))),{name:"timeoutFx",sid:"7lc3mj"}),y=r.attach({and:{source:[l,p],effect:e=>{var[r,t]=e;t(),r&&clearTimeout(r)}},or:{name:"cleanupFx",sid:"pcn5jq"}});return r.guard({and:[{clock:n,source:c,filter:d,target:v}],or:{sid:"-w5qmwp"}}),a&&r.guard({and:[{clock:n,filter:d,target:s}],or:{sid:"-vpslni"}}),r.sample({and:[{clock:n,fn:()=>!0,target:u}],or:{sid:"-vaed34"}}),r.guard({and:[{clock:v.done,source:c,filter:u,target:v}],or:{sid:"-v73liy"}}),r.sample({and:[{clock:v.done,fn:()=>{},target:s}],or:{sid:"-urpcwu"}}),o&&(i&&r.sample({and:[{clock:o,target:s}],or:{sid:"-uanqf7"}}),u.on(o,(()=>!1)),r.sample({and:[{clock:o,target:y}],or:{sid:"6lcmyy"}})),{tick:s,isRunning:u}}},h={some:e=>e.some(Boolean),every:e=>e.every(Boolean)};var w={__proto__:null,pending:function(e){var{effects:t,domain:n,of:o="some"}=e;if(!r.is.domain(n,{sid:"97b92c"})&&!t)throw new TypeError("domain or effects should be passed");if("some"!==o&&"every"!==o)throw new TypeError('strategy parameter "of" can be "every" or "some". Passed: "'.concat(o,'"'));var a=null!=t?t:[],i=h[o];return n&&(a=[],n.onCreateEffect((e=>a.push(e)))),r.combine({and:[a.map((e=>e.pending)),i],or:{sid:"a37bj0"}})}};var j={__proto__:null,reset:function(e){var{clock:r,target:t}=e,n=Array.isArray(t)?t:[t],o=Array.isArray(r)?r:[r];n.forEach((e=>{e.reset.call(e,o)}))}};var E={__proto__:null,reshape:function(e){var{source:r,shape:t}=e,n={};for(var o in t)o in t&&function(){var e=t[o];n[o]=r.map((r=>{var t=e(r);return void 0===t?null:t}))}();return n}};var k={__proto__:null,snapshot:function(e){var{source:t,clock:n,fn:o=(e=>e)}=e,a=o(t.defaultState),i=n?r.sample({and:[t,n,o],or:{name:"onSnapshot",sid:"-auitd0"}}):r.sample({and:[{source:t,fn:o}],or:{name:"onSnapshot",sid:"-auir6n"}}),s=r.createStore(a,{name:"$snapshot",sid:"-7zyoaf"});return s.on(i,((e,r)=>r)),s}};var O={__proto__:null,some:function(e,t){var n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate),n="function"==typeof a?a:r.is.store(a,{sid:"zbwu0l"})?a.map((e=>r=>e===r)):e=>e===a;var i=r.combine({and:[o],or:{name:"$values",sid:"-lv5do0"}}),s=n;return r.combine({and:[s,i,(e,r)=>r.some(e)],or:{sid:"-efc5w7"}})}};var A={__proto__:null,splitMap:function(e){var{source:t,cases:n}=e,o={},a=r.is.store(t,{name:"current",sid:"-htjkz7"})?t.updates:t;for(var i in n)i in n&&function(){var e=n[i];o[i]=a.filterMap(e),a=a.filter({fn:r=>!e(r)})}();return o.__=a,o}};var S={__proto__:null,spread:function(e){var{targets:t,source:n=r.createEvent({name:"source",sid:"-iel8gi"},{name:"source",sid:"-iel8gi"})}=e,o=function(e){if(e in t){var o=r.guard({and:[{source:n,filter:r=>"object"==typeof r&&null!==r&&e in r}],or:{name:"hasTargetKey",sid:"-gh83lo"}});r.is.store(t[e],{sid:"jliekw"})?t[e].on(o,((r,t)=>t[e])):r.sample({and:[{source:o,fn:r=>r[e],target:t[e]}],or:{sid:"lnzpe6"}})}};for(var a in t)o(a);return n}};var P={__proto__:null,status:function(e){var{effect:t,defaultValue:n="initial"}=e,o=r.createStore(n,{name:"$status",sid:"abrgim"});return o.on(t,(()=>"pending")).on(t.done,(()=>"done")).on(t.fail,(()=>"fail")),o}};var T={__proto__:null,throttle:function(e){var{source:t,timeout:n,target:o=r.createEvent({name:"target",sid:"cenyj5"},{name:"target",sid:"cenyj5"})}=e;if(!r.is.unit(t))throw new TypeError("source must be unit from effector");if("number"!=typeof n||n<0)throw new Error("timeout must be positive number or zero");var a=r.createEffect((()=>new Promise((e=>setTimeout(e,n)))),{name:"timerFx",sid:"uv7gwq"});return r.guard({and:[{source:t,filter:a.pending.map((e=>!e)),target:a}],or:{sid:"-iy4kn2"}}),r.sample({and:[{source:t,clock:a.done,target:o}],or:{sid:"-ija4mb"}}),o}},z=()=>Date.now();var x={__proto__:null,time:function(e){var{clock:t,getNow:n,initial:o}=e,a=null!=n?n:z,i=r.createEffect(a,{name:"readNowFx",sid:"459ysb"}),s=r.restore(i,null!=o?o:a(),{name:"$time",sid:"-ys9vce"});return r.forward({and:{from:t,to:i},or:{sid:"rdje9v"}}),s}};function F(e){if(e.__esModule)return e;var r=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var $=F({__proto__:null,combineEvents:function(e){var{events:a,reset:i,target:s=r.createEvent({name:"target",sid:"3pez5"},{name:"target",sid:"3pez5"})}=e;return r.is.unit(s)||o("target should be a unit"),i&&!r.is.unit(i)&&o("reset should be a unit"),r.withRegion(s,(()=>{var e=Object.keys(a),o=Array.isArray(a)?[...e].fill(""):{},u=r.createStore(e.length,{name:"$counter",sid:"-dszn9a"}),c=r.createStore(o,{name:"$results",sid:"boz3x7"});u.reset(r.sample({and:[s],or:{sid:"-8yzcn6"}})),c.reset(s),i&&(u.reset(r.sample({and:[i],or:{sid:"-72suil"}})),c.reset(i));var d=function(e){var o=r.createStore(!1,{name:"$isDone",sid:"ucs7nc"}).on(a[e],(()=>!0)).reset(s);i&&o.reset(i),u.on(o,(e=>e-1)),c.on(a[e],((r,o)=>{var a=Array.isArray(r)?[...r]:function(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(Object(o),!0).forEach((function(r){n(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}({},r);return a[e]=o,a}))};for(var f of e)d(f);r.guard({and:[{source:r.sample({and:[c,r.merge(Object.values(a),{name:"and",sid:"-l8g4ey"})],or:{name:"source",sid:"uf92v9"}}),filter:u.map((e=>0===e)),target:s}],or:{sid:"ciekm0"}})})),s}}),N=F(i),q=F(s),D=F(l),M=F(m),C=F(p),R=F(g),B=F(b),I=F(_),K=F(w),V=F(j),G=F(E),H=F(k),J=F(O),L=F(A),Q=F(S),U=F(P),W=F(T),X=F(x),Y=$.combineEvents,Z=N.condition,ee=q.debounce,re=D.debug,te=M.delay,ne=C.every,oe=R.format,ae=B.inFlight,ie=I.interval,se=K.pending,ue=V.reset,ce=G.reshape,de=H.snapshot,fe=J.some,le=L.splitMap,me=Q.spread,pe=U.status,ve=W.throttle,ye=X.time,ge={combineEvents:Y,condition:Z,debounce:ee,debug:re,delay:te,every:ne,format:oe,inFlight:ae,interval:ie,pending:se,reset:ue,reshape:ce,snapshot:de,some:fe,splitMap:le,spread:me,status:pe,throttle:ve,time:ye};e.combineEvents=Y,e.condition=Z,e.debounce=ee,e.debug=re,e.default=ge,e.delay=te,e.every=ne,e.format=oe,e.inFlight=ae,e.interval=ie,e.pending=se,e.reset=ue,e.reshape=ce,e.snapshot=de,e.some=fe,e.splitMap=le,e.spread=me,e.status=pe,e.throttle=ve,e.time=ye,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("effector")):"function"==typeof define&&define.amd?define(["exports","effector"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).patronum={},e.effector)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(t);function o(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var a=o((function(e,t){function n(e){throw new Error(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.combineEvents=function({events:e,reset:t,target:o=(0,r.default.createEvent)({name:"target",sid:"3pez5"})}){r.default.is.unit(o)||n("target should be a unit");t&&!r.default.is.unit(t)&&n("reset should be a unit");return(0,r.default.withRegion)(o,(()=>{const n=Object.keys(e),a=Array.isArray(e)?[...n].fill(""):{},i=(0,r.default.createStore)(n.length,{name:"$counter",sid:"-dszn9a"}),s=(0,r.default.createStore)(a,{name:"$results",sid:"boz3x7"});i.reset((0,r.default.sample)({and:[o],or:{sid:"-8yzcn6"}})),s.reset(o),t&&(i.reset((0,r.default.sample)({and:[t],or:{sid:"-72suil"}})),s.reset(t));for(const a of n){const n=(0,r.default.createStore)(!1,{name:"$isDone",sid:"ucs7nc"}).on(e[a],(()=>!0)).reset(o);t&&n.reset(t),i.on(n,(e=>e-1)),s.on(e[a],((e,t)=>{const n=Array.isArray(e)?[...e]:{...e};return n[a]=t,n}))}(0,r.default.guard)({and:[{source:(0,r.default.sample)({and:[s,(0,r.default.merge)(Object.values(e),{name:"and",sid:"-l8g4ey"})],or:{name:"source",sid:"uf92v9"}}),filter:i.map((e=>0===e)),target:o}],or:{sid:"ciekm0"}})})),o}})),i=o((function(e,t){function n(e){return r.default.is.unit(e)?e.map((e=>!e)):t=>!e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.condition=function({if:e,then:t,else:o,source:a=(0,r.default.createEvent)({name:"source",sid:"epke23"})}){const i=r.default.is.unit(e)||(s=e,"function"==typeof s)?e:t=>t===e;var s;t&&(0,r.default.guard)({and:[{source:a,filter:i,target:t}],or:{sid:"9tug3k"}});o&&(0,r.default.guard)({and:[{source:a,filter:n(i),target:o}],or:{sid:"a9shb1"}});return a}})),s=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function({source:e,timeout:t,target:n}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if(r.default.is.domain(e,{sid:"iu8yzo"}))throw new TypeError("source cannot be domain");if("number"!=typeof t||t<0||!Number.isFinite(t))throw new Error(`timeout must be positive number or zero. Received: "${t}"`);let o,a;const i=n??(0,r.default.createEvent)({name:"tick",sid:"-xw52dh"}),s=(0,r.default.createEffect)((e=>(clearTimeout(a),o&&o(),new Promise(((n,r)=>{o=r,a=setTimeout(n,t,e)})))),{name:"timerFx",sid:"m8kfsq"});return(0,r.default.forward)({and:{from:e,to:s},or:{sid:"k4foqk"}}),(0,r.default.forward)({and:{from:s.done.map((({result:e})=>e)),to:i},or:{sid:"k76npd"}}),i}})),u=o((function(e,t){function n(e){return r.default.is.store(e,{sid:"-j30z7b"})?"store":r.default.is.effect(e,{sid:"-j1dlf8"})?"effect":r.default.is.event(e,{sid:"-io6j6k"})?"event":r.default.is.domain(e,{sid:"-imj5eh"})?"domain":r.default.is.unit(e)?"unit":"unknown"}function o(e,t,n=""){const r=n+i(e);e.watch((e=>{console.info(`[${t}] ${r}`,e)}))}function a(e){o(e.done,"effect",i(e)+"."),o(e.fail,"effect",i(e)+".")}function i(e){return e.compositeName&&e.compositeName.fullName?e.compositeName.fullName:e.shortName?e.shortName:e.name?e.name:""}Object.defineProperty(t,"__esModule",{value:!0}),t.debug=function(...e){for(const t of e){const e=n(t);(r.default.is.store(t,{sid:"8mdztw"})||r.default.is.effect(t,{sid:"-gueih2"})||r.default.is.event(t,{sid:"-gueh0j"}))&&o(t,e),r.default.is.effect(t,{sid:"-jlpzbv"})&&a(t),r.default.is.domain(t,{sid:"-jjisyf"})&&(t.onCreateEvent((e=>o(e,"event"))),t.onCreateStore((e=>o(e,"store"))),t.onCreateEffect(a))}}})),d=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.delay=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"-z2vw3w"})}){if(!r.default.is.unit(e))throw new TypeError("source must be a unit from effector");if(!r.default.is.unit(n))throw new TypeError("target must be a unit from effector");const o=function(e){if(r.default.is.store(e,{sid:"-va560a"})||"function"==typeof e||"number"==typeof e)return e;throw new TypeError(`'timeout' argument must be a function, Store, or a number. Passed "${typeof e}"`)}(t),a=(0,r.default.createEffect)((({payload:e,milliseconds:t})=>new Promise((n=>{setTimeout(n,t,e)}))),{name:"timerFx",sid:"-584o7j"});return(0,r.default.sample)({and:[{source:(0,r.default.combine)({and:[{milliseconds:o}],or:{name:"source",sid:"9rbdjo"}}),clock:e,fn:({milliseconds:e},t)=>({payload:t,milliseconds:"function"==typeof e?e(t):e}),target:a}],or:{sid:"-wmj29s"}}),(0,r.default.forward)({and:{from:a.doneData,to:n},or:{sid:"-vsadmx"}}),n}})),f=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.every=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"sid3ut"})?a.map((e=>t=>e===t)):e=>e===a;var i;const s=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"h09uhg"}}),u=n;return(0,r.default.combine)({and:[u,s,(e,t)=>t.every(e)],or:{sid:"hfkdw9"}})}})),c=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.format=function(e,...t){return(0,r.default.combine)({and:[t,t=>e.reduce(((n,r,o)=>n.concat(function(e,t){return t===e.length-1}(e,o)?r:`${r}${function(e){if(Array.isArray(e))return e.map((e=>String(e))).join(", ");return String(e)}(t[o])}`)),"")],or:{sid:"-yrbthp"}})}})),l=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.inFlight=function({effects:e,domain:t}){if(t){const e=t.createStore(0,{name:"$inFlight",sid:"-y7vg7t"});return t.onCreateEffect((t=>{e.on(t,(e=>e+1)).on(t.finally,(e=>e-1))})),e}return(0,r.default.combine)({and:[e.map((e=>e.inFlight)),e=>e.reduce(((e,t)=>e+t),0)],or:{sid:"ubqxa7"}})}})),m=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.interval=function({timeout:e,start:t,stop:n,leading:o=!1,trailing:a=!1}){const i=(0,r.default.createEvent)({name:"tick",sid:"uo9p3s"}),s=(0,r.default.createStore)(!1,{name:"$isRunning",sid:"-wxesi8"}),u=function(e){if(r.default.is.store(e,{sid:"6p7767"}))return e;if("number"==typeof e)return(0,r.default.createStore)(e,{and:{name:"$timeout"},sid:"5hw6se"});throw new TypeError(`timeout parameter in interval method should be number or Store. "${typeof e}" was passed`)}(e),d=s.map((e=>!e)),f=(0,r.default.createEvent)({name:"saveTimeout",sid:"as5clk"}),c=(0,r.default.createStore)(null,{name:"$timeoutId",sid:"-bh90bo"}).on(f,((e,t)=>t)),l=(0,r.default.createEvent)({name:"saveReject",sid:"-64swis"}),m=(0,r.default.createStore)((()=>{}),{name:"$rejecter",sid:"eabbu7"}).on(l,((e,t)=>t)),p=(0,r.default.createEffect)((e=>new Promise(((t,n)=>{const r=setTimeout(t,e);f(r),l(n)}))),{name:"timeoutFx",sid:"7lc3mj"}),y=(0,r.default.attach)({and:{source:[c,m],effect:([e,t])=>{t(),e&&clearTimeout(e)}},or:{name:"cleanupFx",sid:"pcn5jq"}});(0,r.default.guard)({and:[{clock:t,source:u,filter:d,target:p}],or:{sid:"-w5qmwp"}}),o&&(0,r.default.guard)({and:[{clock:t,filter:d,target:i}],or:{sid:"-vpslni"}});(0,r.default.sample)({and:[{clock:t,fn:()=>!0,target:s}],or:{sid:"-vaed34"}}),(0,r.default.guard)({and:[{clock:p.done,source:u,filter:s,target:p}],or:{sid:"-v73liy"}}),(0,r.default.sample)({and:[{clock:p.done,fn:()=>{},target:i}],or:{sid:"-urpcwu"}}),n&&(a&&(0,r.default.sample)({and:[{clock:n,target:i}],or:{sid:"-uanqf7"}}),s.on(n,(()=>!1)),(0,r.default.sample)({and:[{clock:n,target:y}],or:{sid:"6lcmyy"}}));return{tick:i,isRunning:s}}})),p=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.pending=function({effects:e,domain:t,of:o="some"}){if(!r.default.is.domain(t,{sid:"97b92c"})&&!e)throw new TypeError("domain or effects should be passed");if("some"!==o&&"every"!==o)throw new TypeError(`strategy parameter "of" can be "every" or "some". Passed: "${o}"`);let a=e??[];const i=n[o];t&&(a=[],t.onCreateEffect((e=>a.push(e))));return(0,r.default.combine)({and:[a.map((e=>e.pending)),i],or:{sid:"a37bj0"}})};const n={some:e=>e.some(Boolean),every:e=>e.every(Boolean)}})),y=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reset=function({clock:e,target:t}){const n=Array.isArray(t)?t:[t],r=Array.isArray(e)?e:[e];n.forEach((e=>{e.reset.call(e,r)}))}})),b=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.reshape=function({source:e,shape:t}){const n={};for(const r in t)if(r in t){const o=t[r];n[r]=e.map((e=>{const t=o(e);return void 0===t?null:t}))}return n}})),v=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.snapshot=function({source:e,clock:t,fn:n=(e=>e)}){const o=n(e.defaultState),a=t?(0,r.default.sample)({and:[e,t,n],or:{name:"onSnapshot",sid:"-auitd0"}}):(0,r.default.sample)({and:[{source:e,fn:n}],or:{name:"onSnapshot",sid:"-auir6n"}}),i=(0,r.default.createStore)(o,{name:"$snapshot",sid:"-7zyoaf"});return i.on(a,((e,t)=>t)),i}})),g=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.some=function(e,t){let n,o=[],a=()=>!1;Array.isArray(e)?(o=e,a=t):Array.isArray(e.stores)&&(o=e.stores,a=e.predicate);i=a,n="function"==typeof i?a:r.default.is.store(a,{sid:"zbwu0l"})?a.map((e=>t=>e===t)):e=>e===a;var i;const s=(0,r.default.combine)({and:[o],or:{name:"$values",sid:"-lv5do0"}}),u=n;return(0,r.default.combine)({and:[u,s,(e,t)=>t.some(e)],or:{sid:"-efc5w7"}})}})),h=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.splitMap=function({source:e,cases:t}){const n={};let o=r.default.is.store(e,{name:"current",sid:"-htjkz7"})?e.updates:e;for(const e in t)if(e in t){const r=t[e];n[e]=o.filterMap(r),o=o.filter({fn:e=>!r(e)})}return n.__=o,n}})),w=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.spread=function({targets:e,source:t=(0,r.default.createEvent)({name:"source",sid:"-iel8gi"})}){for(const n in e)if(n in e){const o=(0,r.default.guard)({and:[{source:t,filter:e=>"object"==typeof e&&null!==e&&n in e}],or:{name:"hasTargetKey",sid:"-gh83lo"}});r.default.is.store(e[n],{sid:"jliekw"})?e[n].on(o,((e,t)=>t[n])):(0,r.default.sample)({and:[{source:o,fn:e=>e[n],target:e[n]}],or:{sid:"lnzpe6"}})}return t}})),j=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.status=function({effect:e,defaultValue:t="initial"}){const n=(0,r.default.createStore)(t,{name:"$status",sid:"abrgim"});return n.on(e,(()=>"pending")).on(e.done,(()=>"done")).on(e.fail,(()=>"fail")),n}})),_=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.throttle=function({source:e,timeout:t,target:n=(0,r.default.createEvent)({name:"target",sid:"cenyj5"})}){if(!r.default.is.unit(e))throw new TypeError("source must be unit from effector");if("number"!=typeof t||t<0)throw new Error("timeout must be positive number or zero");const o=(0,r.default.createEffect)((()=>new Promise((e=>setTimeout(e,t)))),{name:"timerFx",sid:"uv7gwq"});return(0,r.default.guard)({and:[{source:e,filter:o.pending.map((e=>!e)),target:o}],or:{sid:"-iy4kn2"}}),(0,r.default.sample)({and:[{source:e,clock:o.done,target:n}],or:{sid:"-ija4mb"}}),n}})),E=o((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.time=function({clock:e,getNow:t,initial:o}){const a=t??n,i=(0,r.default.createEffect)(a,{name:"readNowFx",sid:"459ysb"}),s=(0,r.default.restore)(i,o??a(),{name:"$time",sid:"-ys9vce"});return(0,r.default.forward)({and:{from:e,to:i},or:{sid:"rdje9v"}}),s};const n=()=>Date.now()})),k=a.combineEvents,P=i.condition,M=s.debounce,O=u.debug,$=d.delay,T=f.every,A=c.format,S=l.inFlight,x=m.interval,z=p.pending,F=y.reset,q=b.reshape,N=v.snapshot,C=g.some,R=h.splitMap,D=w.spread,B=j.status,I=_.throttle,K=E.time,V={combineEvents:k,condition:P,debounce:M,debug:O,delay:$,every:T,format:A,inFlight:S,interval:x,pending:z,reset:F,reshape:q,snapshot:N,some:C,splitMap:R,spread:D,status:B,throttle:I,time:K};e.combineEvents=k,e.condition=P,e.debounce=M,e.debug=O,e.default=V,e.delay=$,e.every=T,e.format=A,e.inFlight=S,e.interval=x,e.pending=z,e.reset=F,e.reshape=q,e.snapshot=N,e.some=C,e.splitMap=R,e.spread=D,e.status=B,e.throttle=I,e.time=K,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=patronum.umd.js.map

@@ -1,26 +0,18 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.pending = pending;
var _effector = require("effector");
const strategies = {
import { combine, is } from 'effector';
var strategies = {
some: list => list.some(Boolean),
every: list => list.every(Boolean)
};
function pending({
effects: rawEffects,
domain,
of = 'some'
}) {
if (!_effector.is.domain(domain, {
export function pending(_ref) {
var {
effects: rawEffects,
domain,
of = 'some'
} = _ref;
if (!is.domain(domain, {
sid: "97b92c"
}) && !rawEffects) throw new TypeError('domain or effects should be passed');
if (of !== 'some' && of !== 'every') throw new TypeError(`strategy parameter "of" can be "every" or "some". Passed: "${of}"`);
let effects = rawEffects ?? [];
const strategy = strategies[of];
if (of !== 'some' && of !== 'every') throw new TypeError("strategy parameter \"of\" can be \"every\" or \"some\". Passed: \"".concat(of, "\""));
var effects = rawEffects !== null && rawEffects !== void 0 ? rawEffects : [];
var strategy = strategies[of];

@@ -32,3 +24,3 @@ if (domain) {

return (0, _effector.combine)({
return combine({
and: [effects.map(fx => fx.pending), strategy],

@@ -35,0 +27,0 @@ or: {

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,14 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.reset = reset;
function reset({
clock,
target
}) {
const targets = Array.isArray(target) ? target : [target];
const clocks = Array.isArray(clock) ? clock : [clock];
export function reset(_ref) {
var {
clock,
target
} = _ref;
var targets = Array.isArray(target) ? target : [target];
var clocks = Array.isArray(clock) ? clock : [clock];
targets.forEach(target => {

@@ -15,0 +9,0 @@ target.reset.call(target, clocks);

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,21 +0,17 @@

"use strict";
export function reshape(_ref) {
var {
source,
shape
} = _ref;
var result = {};
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.reshape = reshape;
function reshape({
source,
shape
}) {
const result = {};
for (const key in shape) {
for (var key in shape) {
if (key in shape) {
const fn = shape[key];
result[key] = source.map(state => {
const result = fn(state);
return result === undefined ? null : result;
});
(function () {
var fn = shape[key];
result[key] = source.map(state => {
var result = fn(state);
return result === undefined ? null : result;
});
})();
}

@@ -22,0 +18,0 @@ }

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,17 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.snapshot = snapshot;
var _effector = require("effector");
function snapshot({
source,
clock,
fn = value => value
}) {
const defaultValue = fn(source.defaultState);
const onSnapshot = clock ? (0, _effector.sample)({
import { createStore, sample } from 'effector';
export function snapshot(_ref) {
var {
source,
clock,
fn = value => value
} = _ref;
var defaultValue = fn(source.defaultState);
var onSnapshot = clock ? sample({
and: [source, clock, fn],

@@ -22,3 +15,3 @@ or: {

}
}) : (0, _effector.sample)({
}) : sample({
and: [{

@@ -33,3 +26,3 @@ source,

});
const $snapshot = (0, _effector.createStore)(defaultValue, {
var $snapshot = createStore(defaultValue, {
name: "$snapshot",

@@ -36,0 +29,0 @@ sid: "-7zyoaf"

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,15 +0,7 @@

"use strict";
import { combine, is } from 'effector';
export function some(configOrStores, predicateOrNone) {
var stores = [];
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.some = some;
var predicate = () => false;
var _effector = require("effector");
function some(configOrStores, predicateOrNone) {
let stores = [];
let predicate = () => false;
if (Array.isArray(configOrStores)) {

@@ -23,7 +15,7 @@ stores = configOrStores;

let checker;
var checker;
if (isFunction(predicate)) {
checker = predicate;
} else if (_effector.is.store(predicate, {
} else if (is.store(predicate, {
sid: "zbwu0l"

@@ -36,3 +28,3 @@ })) {

const $values = (0, _effector.combine)({
var $values = combine({
and: [stores],

@@ -45,4 +37,4 @@ or: {

const $checker = checker;
return (0, _effector.combine)({
var $checker = checker;
return combine({
and: [$checker, $values, (checker, values) => values.some(checker)],

@@ -49,0 +41,0 @@ or: {

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,16 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.splitMap = splitMap;
var _effector = require("effector");
function splitMap({
source,
cases
}) {
const result = {};
let current = _effector.is.store(source, {
import { is } from 'effector';
export function splitMap(_ref) {
var {
source,
cases
} = _ref;
var result = {};
var current = is.store(source, {
name: "current",

@@ -20,9 +13,11 @@ sid: "-htjkz7"

for (const key in cases) {
for (var key in cases) {
if (key in cases) {
const fn = cases[key];
result[key] = current.filterMap(fn);
current = current.filter({
fn: data => !fn(data)
});
(function () {
var _fn = cases[key];
result[key] = current.filterMap(_fn);
current = current.filter({
fn: data => !_fn(data)
});
})();
}

@@ -29,0 +24,0 @@ } // eslint-disable-next-line no-underscore-dangle

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,10 +0,3 @@

"use strict";
import { is, createEvent, guard, sample } from 'effector';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.spread = spread;
var _effector = require("effector");
/**

@@ -17,12 +10,17 @@ * @example

*/
function spread({
targets,
source = (0, _effector.createEvent)({
name: "source",
sid: "-iel8gi"
})
}) {
for (const targetKey in targets) {
export function spread(_ref) {
var {
targets,
source = createEvent({
name: "source",
sid: "-iel8gi"
}, {
name: "source",
sid: "-iel8gi"
})
} = _ref;
var _loop = function _loop(targetKey) {
if (targetKey in targets) {
const hasTargetKey = (0, _effector.guard)({
var hasTargetKey = guard({
and: [{

@@ -38,3 +36,3 @@ source,

if (_effector.is.store(targets[targetKey], {
if (is.store(targets[targetKey], {
sid: "jliekw"

@@ -44,3 +42,3 @@ })) {

} else {
(0, _effector.sample)({
sample({
and: [{

@@ -57,2 +55,6 @@ source: hasTargetKey,

}
};
for (var targetKey in targets) {
_loop(targetKey);
}

@@ -59,0 +61,0 @@

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,15 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.status = status;
var _effector = require("effector");
function status({
effect,
defaultValue = 'initial'
}) {
const $status = (0, _effector.createStore)(defaultValue, {
import { createStore } from 'effector';
export function status(_ref) {
var {
effect,
defaultValue = 'initial'
} = _ref;
var $status = createStore(defaultValue, {
name: "$status",

@@ -16,0 +9,0 @@ sid: "abrgim"

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,25 +0,21 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.throttle = throttle;
var _effector = require("effector");
function throttle({
source,
timeout,
target = (0, _effector.createEvent)({
name: "target",
sid: "cenyj5"
})
}) {
if (!_effector.is.unit(source)) throw new TypeError('source must be unit from effector');
import { createEffect, createEvent, guard, is, sample } from 'effector';
export function throttle(_ref) {
var {
source,
timeout,
target = createEvent({
name: "target",
sid: "cenyj5"
}, {
name: "target",
sid: "cenyj5"
})
} = _ref;
if (!is.unit(source)) throw new TypeError('source must be unit from effector');
if (typeof timeout !== 'number' || timeout < 0) throw new Error('timeout must be positive number or zero');
const timerFx = (0, _effector.createEffect)(() => new Promise(resolve => setTimeout(resolve, timeout)), {
var timerFx = createEffect(() => new Promise(resolve => setTimeout(resolve, timeout)), {
name: "timerFx",
sid: "uv7gwq"
});
(0, _effector.guard)({
guard({
and: [{

@@ -34,3 +30,3 @@ source,

});
(0, _effector.sample)({
sample({
and: [{

@@ -37,0 +33,0 @@ source,

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

@@ -1,27 +0,21 @@

"use strict";
import { createEffect, forward, restore } from 'effector';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.time = time;
var defaultNow = () => Date.now();
var _effector = require("effector");
const defaultNow = () => Date.now();
function time({
clock,
getNow,
initial
}) {
const timeReader = getNow ?? defaultNow;
const readNowFx = (0, _effector.createEffect)(timeReader, {
export function time(_ref) {
var {
clock,
getNow,
initial
} = _ref;
var timeReader = getNow !== null && getNow !== void 0 ? getNow : defaultNow;
var readNowFx = createEffect(timeReader, {
name: "readNowFx",
sid: "459ysb"
});
const $time = (0, _effector.restore)(readNowFx, initial ?? timeReader(), {
var $time = restore(readNowFx, initial !== null && initial !== void 0 ? initial : timeReader(), {
name: "$time",
sid: "-ys9vce"
});
(0, _effector.forward)({
forward({
and: {

@@ -28,0 +22,0 @@ from: clock,

{
"type": "module",
"main": "index.js",
"module": "index.mjs",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc