Page Not Found
We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
From eaa09a88d385d19cc93bc9b26597caad239eead8 Mon Sep 17 00:00:00 2001 From: sergeysova <5620073+sergeysova@users.noreply.github.com> Date: Fri, 15 Dec 2023 12:04:15 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20effector?= =?UTF-8?q?/patronum@d74cbd961e3c46fb4e13d6e1e362a49a6d6c970a=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 404.html | 18 ++++++------ assets/css/styles.163bd5ee.css | 1 + assets/css/styles.9614547d.css | 1 - assets/js/08154ee9.011f7e3f.js | 1 + assets/js/08154ee9.20f2322d.js | 1 - assets/js/08f30e7d.ad0ac244.js | 1 + assets/js/08f30e7d.b55ffd9c.js | 1 - assets/js/1178bc06.2ff96855.js | 1 - assets/js/1178bc06.b61c1d3d.js | 1 + assets/js/17896441.091b0213.js | 1 - assets/js/17896441.98c8b99a.js | 1 + assets/js/1a4e3797.67205d40.js | 2 ++ assets/js/1a4e3797.67205d40.js.LICENSE.txt | 1 + assets/js/1a4e3797.bbf5a46b.js | 2 -- assets/js/1a4e3797.bbf5a46b.js.LICENSE.txt | 1 - assets/js/1ae5d93b.85fac64d.js | 1 + assets/js/1ae5d93b.cbd18f44.js | 1 - assets/js/1be78505.51b45561.js | 1 + assets/js/1be78505.a3fef0ca.js | 1 - ...93b7f.37dfdc4a.js => 1df93b7f.52a1d67f.js} | 2 +- assets/js/1f391b9e.48bd894a.js | 1 + assets/js/1f391b9e.d7a93e55.js | 1 - assets/js/2b95ca9d.9f76bd77.js | 1 - assets/js/2b95ca9d.d3b76552.js | 1 + assets/js/308aca62.59e32b7c.js | 1 - assets/js/308aca62.b045aa80.js | 1 + assets/js/33c22581.0eb23410.js | 1 - assets/js/33c22581.de5322e1.js | 1 + assets/js/391.9664fa7c.js | 1 - assets/js/4af54caf.0b1ea9c3.js | 1 + assets/js/4af54caf.ceab87e8.js | 1 - assets/js/4d9d995f.4ead4532.js | 1 - assets/js/4d9d995f.aa00eebb.js | 1 + assets/js/530.f5cc4ef9.js | 1 + assets/js/5b0e0e08.975d4ae9.js | 1 + assets/js/5b0e0e08.ffc5f899.js | 1 - assets/js/6256d5c3.49478c67.js | 1 + assets/js/6256d5c3.8607788e.js | 1 - assets/js/638.b54116d7.js | 1 + .../js/{183.fbf1cbae.js => 654.d636b64d.js} | 2 +- assets/js/67c026b6.3a469de0.js | 1 - assets/js/67c026b6.8e6669d1.js | 1 + assets/js/7921cf10.f96dc439.js | 1 + assets/js/84071e39.321abdbd.js | 1 + assets/js/84071e39.c7a34779.js | 1 - assets/js/8d76850e.662cf357.js | 1 + assets/js/8d76850e.ac0fc698.js | 1 - .../js/{803.7f7c270e.js => 901.5fd7132c.js} | 2 +- assets/js/93.a2b79ba7.js | 1 - assets/js/935f2afb.95e49b9c.js | 1 + assets/js/935f2afb.bcb89381.js | 1 - .../js/{874.519a8f23.js => 967.d43ac743.js} | 2 +- ...828ab.e1fb4f64.js => 978828ab.1ad8f25b.js} | 2 +- assets/js/97ffe59f.983e3cb0.js | 1 + assets/js/97ffe59f.e6e36e03.js | 1 - assets/js/9dc53199.034d793b.js | 1 - assets/js/9dc53199.13b40e3c.js | 1 + assets/js/a765e1a2.4454540d.js | 1 - assets/js/a765e1a2.b6852205.js | 1 + assets/js/a7fdbc71.624c5cce.js | 1 - assets/js/a7fdbc71.8c5cb0f4.js | 1 + assets/js/a9298e25.a535df35.js | 1 + assets/js/a9298e25.d4bdbfaa.js | 1 - assets/js/ad512b16.2de7ded0.js | 1 + assets/js/ad512b16.823efa27.js | 1 - assets/js/b41febc4.c1f4a408.js | 1 - assets/js/b41febc4.fb3c65a7.js | 1 + assets/js/c7a80478.c92878af.js | 1 - assets/js/c7a80478.e20ccc9f.js | 1 + assets/js/c9ae8b2d.e7ae4f05.js | 1 - assets/js/c9ae8b2d.e7e15d92.js | 1 + assets/js/deda2cf3.6f2a713d.js | 1 + assets/js/deda2cf3.7cf3a9b3.js | 1 - assets/js/e09d216d.1cad6e0f.js | 1 - assets/js/e09d216d.5c109b9d.js | 1 + assets/js/e55f1e0e.0eeec080.js | 1 - assets/js/e55f1e0e.1e3aaf8e.js | 1 + assets/js/e9221267.5d0d64ec.js | 1 - assets/js/e9221267.8faa3552.js | 1 + assets/js/f304a758.6729241d.js | 1 - assets/js/f304a758.756c8e8b.js | 1 + assets/js/f6536843.20f6a121.js | 1 + assets/js/f6536843.7e6a94bf.js | 1 - assets/js/main.535b577d.js | 2 -- assets/js/main.849a2d8c.js | 2 ++ ...CENSE.txt => main.849a2d8c.js.LICENSE.txt} | 10 +++++++ assets/js/runtime~main.c0401702.js | 1 - assets/js/runtime~main.c83f3d46.js | 1 + docs/installation/index.html | 18 ++++++------ docs/migration-guide/index.html | 20 ++++++------- index.html | 18 ++++++------ methods/and/index.html | 20 ++++++------- methods/combine-events/index.html | 19 ++++++------ methods/condition/index.html | 18 ++++++------ methods/debounce/index.html | 23 ++++++++------- methods/debug/index.html | 24 +++++++-------- methods/delay/index.html | 27 ++++++++++------- methods/either/index.html | 20 ++++++------- methods/empty/index.html | 20 ++++++------- methods/equals/index.html | 18 ++++++------ methods/every/index.html | 24 +++++++-------- methods/format/index.html | 20 ++++++------- methods/in-flight/index.html | 23 ++++++++------- methods/index.html | 18 ++++++------ methods/interval/index.html | 24 +++++++-------- methods/not/index.html | 20 ++++++------- methods/once/index.html | 22 +++++++------- methods/or/index.html | 20 ++++++------- methods/pending/index.html | 29 ++++++++++--------- methods/previous/index.html | 16 ++++++++++ methods/reset/index.html | 18 ++++++------ methods/reshape/index.html | 20 ++++++------- methods/snapshot/index.html | 20 ++++++------- methods/some/index.html | 24 +++++++-------- methods/split-map/index.html | 20 ++++++------- methods/spread/index.html | 23 ++++++++------- methods/status/index.html | 21 +++++++------- methods/throttle/index.html | 23 ++++++++------- methods/time/index.html | 22 +++++++------- search/index.html | 18 ++++++------ sitemap.xml | 2 +- 121 files changed, 418 insertions(+), 377 deletions(-) create mode 100644 assets/css/styles.163bd5ee.css delete mode 100644 assets/css/styles.9614547d.css create mode 100644 assets/js/08154ee9.011f7e3f.js delete mode 100644 assets/js/08154ee9.20f2322d.js create mode 100644 assets/js/08f30e7d.ad0ac244.js delete mode 100644 assets/js/08f30e7d.b55ffd9c.js delete mode 100644 assets/js/1178bc06.2ff96855.js create mode 100644 assets/js/1178bc06.b61c1d3d.js delete mode 100644 assets/js/17896441.091b0213.js create mode 100644 assets/js/17896441.98c8b99a.js create mode 100644 assets/js/1a4e3797.67205d40.js create mode 100644 assets/js/1a4e3797.67205d40.js.LICENSE.txt delete mode 100644 assets/js/1a4e3797.bbf5a46b.js delete mode 100644 assets/js/1a4e3797.bbf5a46b.js.LICENSE.txt create mode 100644 assets/js/1ae5d93b.85fac64d.js delete mode 100644 assets/js/1ae5d93b.cbd18f44.js create mode 100644 assets/js/1be78505.51b45561.js delete mode 100644 assets/js/1be78505.a3fef0ca.js rename assets/js/{1df93b7f.37dfdc4a.js => 1df93b7f.52a1d67f.js} (99%) create mode 100644 assets/js/1f391b9e.48bd894a.js delete mode 100644 assets/js/1f391b9e.d7a93e55.js delete mode 100644 assets/js/2b95ca9d.9f76bd77.js create mode 100644 assets/js/2b95ca9d.d3b76552.js delete mode 100644 assets/js/308aca62.59e32b7c.js create mode 100644 assets/js/308aca62.b045aa80.js delete mode 100644 assets/js/33c22581.0eb23410.js create mode 100644 assets/js/33c22581.de5322e1.js delete mode 100644 assets/js/391.9664fa7c.js create mode 100644 assets/js/4af54caf.0b1ea9c3.js delete mode 100644 assets/js/4af54caf.ceab87e8.js delete mode 100644 assets/js/4d9d995f.4ead4532.js create mode 100644 assets/js/4d9d995f.aa00eebb.js create mode 100644 assets/js/530.f5cc4ef9.js create mode 100644 assets/js/5b0e0e08.975d4ae9.js delete mode 100644 assets/js/5b0e0e08.ffc5f899.js create mode 100644 assets/js/6256d5c3.49478c67.js delete mode 100644 assets/js/6256d5c3.8607788e.js create mode 100644 assets/js/638.b54116d7.js rename assets/js/{183.fbf1cbae.js => 654.d636b64d.js} (59%) delete mode 100644 assets/js/67c026b6.3a469de0.js create mode 100644 assets/js/67c026b6.8e6669d1.js create mode 100644 assets/js/7921cf10.f96dc439.js create mode 100644 assets/js/84071e39.321abdbd.js delete mode 100644 assets/js/84071e39.c7a34779.js create mode 100644 assets/js/8d76850e.662cf357.js delete mode 100644 assets/js/8d76850e.ac0fc698.js rename assets/js/{803.7f7c270e.js => 901.5fd7132c.js} (59%) delete mode 100644 assets/js/93.a2b79ba7.js create mode 100644 assets/js/935f2afb.95e49b9c.js delete mode 100644 assets/js/935f2afb.bcb89381.js rename assets/js/{874.519a8f23.js => 967.d43ac743.js} (88%) rename assets/js/{978828ab.e1fb4f64.js => 978828ab.1ad8f25b.js} (63%) create mode 100644 assets/js/97ffe59f.983e3cb0.js delete mode 100644 assets/js/97ffe59f.e6e36e03.js delete mode 100644 assets/js/9dc53199.034d793b.js create mode 100644 assets/js/9dc53199.13b40e3c.js delete mode 100644 assets/js/a765e1a2.4454540d.js create mode 100644 assets/js/a765e1a2.b6852205.js delete mode 100644 assets/js/a7fdbc71.624c5cce.js create mode 100644 assets/js/a7fdbc71.8c5cb0f4.js create mode 100644 assets/js/a9298e25.a535df35.js delete mode 100644 assets/js/a9298e25.d4bdbfaa.js create mode 100644 assets/js/ad512b16.2de7ded0.js delete mode 100644 assets/js/ad512b16.823efa27.js delete mode 100644 assets/js/b41febc4.c1f4a408.js create mode 100644 assets/js/b41febc4.fb3c65a7.js delete mode 100644 assets/js/c7a80478.c92878af.js create mode 100644 assets/js/c7a80478.e20ccc9f.js delete mode 100644 assets/js/c9ae8b2d.e7ae4f05.js create mode 100644 assets/js/c9ae8b2d.e7e15d92.js create mode 100644 assets/js/deda2cf3.6f2a713d.js delete mode 100644 assets/js/deda2cf3.7cf3a9b3.js delete mode 100644 assets/js/e09d216d.1cad6e0f.js create mode 100644 assets/js/e09d216d.5c109b9d.js delete mode 100644 assets/js/e55f1e0e.0eeec080.js create mode 100644 assets/js/e55f1e0e.1e3aaf8e.js delete mode 100644 assets/js/e9221267.5d0d64ec.js create mode 100644 assets/js/e9221267.8faa3552.js delete mode 100644 assets/js/f304a758.6729241d.js create mode 100644 assets/js/f304a758.756c8e8b.js create mode 100644 assets/js/f6536843.20f6a121.js delete mode 100644 assets/js/f6536843.7e6a94bf.js delete mode 100644 assets/js/main.535b577d.js create mode 100644 assets/js/main.849a2d8c.js rename assets/js/{main.535b577d.js.LICENSE.txt => main.849a2d8c.js.LICENSE.txt} (83%) delete mode 100644 assets/js/runtime~main.c0401702.js create mode 100644 assets/js/runtime~main.c83f3d46.js create mode 100644 methods/previous/index.html diff --git a/404.html b/404.html index 91cd5a9d..21ee1b42 100644 --- a/404.html +++ b/404.html @@ -1,16 +1,16 @@ - +
- -We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
target = throttle(source, timeout)
",id:"target--throttlesource-timeout",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Returns",id:"returns",level:3},{value:"Usage",id:"usage",level:3},{value:"throttle({ source, timeout, target })
",id:"throttle-source-timeout-target-",level:2},{value:"Motivation",id:"motivation-1",level:3},{value:"Formulae",id:"formulae-1",level:3},{value:"Arguments",id:"arguments-1",level:3},{value:"Returns",id:"returns-1",level:3},{value:"Usage",id:"usage-1",level:3},{value:"Example with timeout as store",id:"example-with-timeout-as-store",level:3},{value:"target = throttle({ source, timeout })
",id:"target--throttle-source-timeout-",level:2},{value:"Motivation",id:"motivation-2",level:3},{value:"Formulae",id:"formulae-2",level:3},{value:"Arguments",id:"arguments-2",level:3},{value:"Returns",id:"returns-2",level:3},{value:"Usage",id:"usage-2",level:3}],s={toc:p},u="wrapper";function c(e){let{components:t,...n}=e;return(0,a.kt)(u,(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"throttle"},"throttle"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { throttle } from 'patronum';\n// or\nimport { throttle } from 'patronum/throttle';\n")),(0,a.kt)("h2",{id:"target--throttlesource-timeout"},(0,a.kt)("inlineCode",{parentName:"h2"},"target = throttle(source, timeout)")),(0,a.kt)("h3",{id:"motivation"},"Motivation"),(0,a.kt)("p",null,"This method allows to trigger ",(0,a.kt)("inlineCode",{parentName:"p"},"target")," in equal timeouts regardless of source trigger frequency.\nIt is useful in live search in UI."),(0,a.kt)("admonition",{title:"since",type:"note"},(0,a.kt)("p",{parentName:"admonition"},"patronum 2.1.0\nUse ",(0,a.kt)("inlineCode",{parentName:"p"},"throttle({ source, timeout })")," with patronum < 2.1.0")),(0,a.kt)("h3",{id:"formulae"},"Formulae"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"target = throttle(source, timeout);\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Triggers ",(0,a.kt)("inlineCode",{parentName:"li"},"target")," at most once per ",(0,a.kt)("inlineCode",{parentName:"li"},"timeout")," after triggering ",(0,a.kt)("inlineCode",{parentName:"li"},"source"))),(0,a.kt)("h3",{id:"arguments"},"Arguments"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"source")," (",(0,a.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/event"},(0,a.kt)("em",{parentName:"a"},(0,a.kt)("inlineCode",{parentName:"em"},"Event")))," | ",(0,a.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/store"},(0,a.kt)("em",{parentName:"a"},(0,a.kt)("inlineCode",{parentName:"em"},"Store")))," | ",(0,a.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/effect"},(0,a.kt)("em",{parentName:"a"},(0,a.kt)("inlineCode",{parentName:"em"},"Effect"))),") \u2014 Source unit, data from this unit used by the ",(0,a.kt)("inlineCode",{parentName:"li"},"target")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"timeout")," (",(0,a.kt)("a",{parentName:"li",href:"https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Number"},(0,a.kt)("em",{parentName:"a"},(0,a.kt)("inlineCode",{parentName:"em"},"number")))," | ",(0,a.kt)("inlineCode",{parentName:"li"},"Storetarget = throttle({ source, timeout })
",id:"target--throttle-source-timeout-",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Returns",id:"returns",level:3},{value:"Usage",id:"usage",level:3},{value:"throttle({ source, timeout, target })
",id:"throttle-source-timeout-target-",level:2},{value:"Motivation",id:"motivation-1",level:3},{value:"Formulae",id:"formulae-1",level:3},{value:"Arguments",id:"arguments-1",level:3},{value:"Returns",id:"returns-1",level:3},{value:"Usage",id:"usage-1",level:3},{value:"Example with timeout as store",id:"example-with-timeout-as-store",level:3}],s={toc:p};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"throttle"},"throttle"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { throttle } from 'patronum';\n// or\nimport { throttle } from 'patronum/throttle';\n")),(0,a.kt)("h2",{id:"target--throttle-source-timeout-"},(0,a.kt)("inlineCode",{parentName:"h2"},"target = throttle({ source, timeout })")),(0,a.kt)("h3",{id:"motivation"},"Motivation"),(0,a.kt)("p",null,"This method allows to trigger ",(0,a.kt)("inlineCode",{parentName:"p"},"target")," in equal timeouts regardless of source trigger frequency.\nIt is useful in live search in UI."),(0,a.kt)("h3",{id:"formulae"},"Formulae"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"target = throttle({ source, timeout });\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Triggers ",(0,a.kt)("inlineCode",{parentName:"li"},"target")," at most once per ",(0,a.kt)("inlineCode",{parentName:"li"},"timeout")," after triggering ",(0,a.kt)("inlineCode",{parentName:"li"},"source"))),(0,a.kt)("h3",{id:"arguments"},"Arguments"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"source")," (",(0,a.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/event"},(0,a.kt)("em",{parentName:"a"},(0,a.kt)("inlineCode",{parentName:"em"},"Event")))," | ",(0,a.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/store"},(0,a.kt)("em",{parentName:"a"},(0,a.kt)("inlineCode",{parentName:"em"},"Store")))," | ",(0,a.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/effect"},(0,a.kt)("em",{parentName:"a"},(0,a.kt)("inlineCode",{parentName:"em"},"Effect"))),") \u2014 Source unit, data from this unit used by the ",(0,a.kt)("inlineCode",{parentName:"li"},"target")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"timeout")," (",(0,a.kt)("a",{parentName:"li",href:"https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Number"},(0,a.kt)("em",{parentName:"a"},(0,a.kt)("inlineCode",{parentName:"em"},"number")))," | ",(0,a.kt)("inlineCode",{parentName:"li"},"Storeevery({ predicate: Function, stores })
",id:"every-predicate-function-stores-",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Return",id:"return",level:3},{value:"Example",id:"example",level:3},{value:"every({ predicate: value, stores })
",id:"every-predicate-value-stores-",level:2},{value:"Motivation",id:"motivation-1",level:3},{value:"Formulae",id:"formulae-1",level:3},{value:"Arguments",id:"arguments-1",level:3},{value:"Return",id:"return-1",level:3},{value:"Example",id:"example-1",level:3},{value:"every({ predicate: Store, stores })
",id:"every-predicate-store-stores-",level:2},{value:"Motivation",id:"motivation-2",level:3},{value:"Formulae",id:"formulae-2",level:3},{value:"Arguments",id:"arguments-2",level:3},{value:"Return",id:"return-2",level:3},{value:"Example",id:"example-2",level:3},{value:"Shorthands",id:"shorthands",level:2},{value:"Arguments",id:"arguments-3",level:3}],p={toc:u},m="wrapper";function d(e){let{components:t,...r}=e;return(0,a.kt)(m,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"every"},"every"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { every } from 'patronum';\n// or\nimport { every } from 'patronum/every';\n")),(0,a.kt)("h2",{id:"every-predicate-function-stores-"},(0,a.kt)("inlineCode",{parentName:"h2"},"every({ predicate: Function, stores })")),(0,a.kt)("h3",{id:"motivation"},"Motivation"),(0,a.kt)("p",null,"The method calculates boolean value if each store satisfies the condition in ",(0,a.kt)("inlineCode",{parentName:"p"},"predicate"),".\nIt is useful to check that user has correct values in each state."),(0,a.kt)("h3",{id:"formulae"},"Formulae"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"$result = every({ predicate: fn, stores });\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"$result")," will be ",(0,a.kt)("inlineCode",{parentName:"li"},"true")," if each call ",(0,a.kt)("inlineCode",{parentName:"li"},"predicate")," on each store value from ",(0,a.kt)("inlineCode",{parentName:"li"},"values")," returns ",(0,a.kt)("inlineCode",{parentName:"li"},"true"),", otherwise it will be ",(0,a.kt)("inlineCode",{parentName:"li"},"false"))),(0,a.kt)("h3",{id:"arguments"},"Arguments"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"predicate: (value: T) => boolean")," \u2014 Function to check store value"),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"stores: Arrayevery({ predicate: Function, stores })
",id:"every-predicate-function-stores-",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Return",id:"return",level:3},{value:"Example",id:"example",level:3},{value:"every({ predicate: value, stores })
",id:"every-predicate-value-stores-",level:2},{value:"Motivation",id:"motivation-1",level:3},{value:"Formulae",id:"formulae-1",level:3},{value:"Arguments",id:"arguments-1",level:3},{value:"Return",id:"return-1",level:3},{value:"Example",id:"example-1",level:3},{value:"every({ predicate: Store, stores })
",id:"every-predicate-store-stores-",level:2},{value:"Motivation",id:"motivation-2",level:3},{value:"Formulae",id:"formulae-2",level:3},{value:"Arguments",id:"arguments-2",level:3},{value:"Return",id:"return-2",level:3},{value:"Example",id:"example-2",level:3},{value:"Shorthands",id:"shorthands",level:2},{value:"Arguments",id:"arguments-3",level:3}],p={toc:u};function m(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"every"},"every"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { every } from 'patronum';\n// or\nimport { every } from 'patronum/every';\n")),(0,a.kt)("h2",{id:"every-predicate-function-stores-"},(0,a.kt)("inlineCode",{parentName:"h2"},"every({ predicate: Function, stores })")),(0,a.kt)("h3",{id:"motivation"},"Motivation"),(0,a.kt)("p",null,"The method calculates boolean value if each store satisfies the condition in ",(0,a.kt)("inlineCode",{parentName:"p"},"predicate"),".\nIt is useful to check that user has correct values in each state."),(0,a.kt)("h3",{id:"formulae"},"Formulae"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"$result = every({ predicate: fn, stores });\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"$result")," will be ",(0,a.kt)("inlineCode",{parentName:"li"},"true")," if each call ",(0,a.kt)("inlineCode",{parentName:"li"},"predicate")," on each store value from ",(0,a.kt)("inlineCode",{parentName:"li"},"values")," returns ",(0,a.kt)("inlineCode",{parentName:"li"},"true"),", otherwise it will be ",(0,a.kt)("inlineCode",{parentName:"li"},"false"))),(0,a.kt)("h3",{id:"arguments"},"Arguments"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"predicate: (value: T) => boolean")," \u2014 Function to check store value"),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"stores: Arrayspread({ source, targets })
",id:"spread-source-targets-",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Example",id:"example",level:3},{value:"Save fields of payload to different stores",id:"save-fields-of-payload-to-different-stores",level:4},{value:"Call events on store changes",id:"call-events-on-store-changes",level:4},{value:"source = spread({ targets })
",id:"source--spread-targets-",level:2},{value:"Motivation",id:"motivation-1",level:3},{value:"Formulae",id:"formulae-1",level:3},{value:"Arguments",id:"arguments-1",level:3},{value:"Returns",id:"returns",level:3},{value:"Example",id:"example-1",level:3},{value:"Conditionally save value to stores",id:"conditionally-save-value-to-stores",level:4},{value:"Nested spreading",id:"nested-spreading",level:4}],p={toc:d};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"spread"},"spread"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { spread } from 'patronum';\n// or\nimport { spread } from 'patronum/spread';\n")),(0,a.kt)("h2",{id:"spread-source-targets-"},(0,a.kt)("inlineCode",{parentName:"h2"},"spread({ source, targets })")),(0,a.kt)("h3",{id:"motivation"},"Motivation"),(0,a.kt)("p",null,"This method allows to trigger many target at once, if they match the source structure.\nIt is useful when you need to destructure object and save values to different stores."),(0,a.kt)("h3",{id:"formulae"},"Formulae"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"spread({ source, targets: { field: target, ... } })\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"When ",(0,a.kt)("inlineCode",{parentName:"li"},"source")," is triggered with ",(0,a.kt)("strong",{parentName:"li"},"object"),", extract ",(0,a.kt)("inlineCode",{parentName:"li"},"field")," from data, and trigger ",(0,a.kt)("inlineCode",{parentName:"li"},"target")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"targets")," can have multiple properties"),(0,a.kt)("li",{parentName:"ul"},"If the ",(0,a.kt)("inlineCode",{parentName:"li"},"source")," was triggered with non-object, nothing would be happening"),(0,a.kt)("li",{parentName:"ul"},"If ",(0,a.kt)("inlineCode",{parentName:"li"},"source")," is triggered with object but without propertpy ",(0,a.kt)("inlineCode",{parentName:"li"},"field"),", target for this ",(0,a.kt)("inlineCode",{parentName:"li"},"field")," will not be triggered")),(0,a.kt)("h3",{id:"arguments"},"Arguments"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"source")," ",(0,a.kt)("inlineCode",{parentName:"li"},"(Eventsource = spread(targets)
",id:"source--spreadtargets",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Returns",id:"returns",level:3},{value:"Example",id:"example",level:3},{value:"Conditionally save value to stores",id:"conditionally-save-value-to-stores",level:4},{value:"Nested spreading",id:"nested-spreading",level:4},{value:"spread({ source, targets })
",id:"spread-source-targets-",level:2},{value:"Motivation",id:"motivation-1",level:3},{value:"Formulae",id:"formulae-1",level:3},{value:"Arguments",id:"arguments-1",level:3},{value:"Example",id:"example-1",level:3},{value:"Save fields of payload to different stores",id:"save-fields-of-payload-to-different-stores",level:4},{value:"Call events on store changes",id:"call-events-on-store-changes",level:4},{value:"source = spread({ targets })
",id:"source--spread-targets-",level:2},{value:"Motivation",id:"motivation-2",level:3},{value:"Formulae",id:"formulae-2",level:3},{value:"Arguments",id:"arguments-2",level:3},{value:"Returns",id:"returns-1",level:3}],p={toc:d},u="wrapper";function c(e){let{components:t,...r}=e;return(0,n.kt)(u,(0,a.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"spread"},"spread"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},"import { spread } from 'patronum';\n// or\nimport { spread } from 'patronum/spread';\n")),(0,n.kt)("h2",{id:"source--spreadtargets"},(0,n.kt)("inlineCode",{parentName:"h2"},"source = spread(targets)")),(0,n.kt)("admonition",{title:"since",type:"note"},(0,n.kt)("p",{parentName:"admonition"},"patronum 2.1.0\nUse ",(0,n.kt)("inlineCode",{parentName:"p"},"spread({ targets })")," with patronum < 2.1.0")),(0,n.kt)("h3",{id:"motivation"},"Motivation"),(0,n.kt)("p",null,"This method allows to trigger many target at once, if they match the source structure.\nIt is useful when you need to destructure object and save values to different stores."),(0,n.kt)("h3",{id:"formulae"},"Formulae"),(0,n.kt)("pre",null,(0,n.kt)("code",{parentName:"pre",className:"language-ts"},"source = spread({ field: target, ... })\n")),(0,n.kt)("ul",null,(0,n.kt)("li",{parentName:"ul"},"When ",(0,n.kt)("inlineCode",{parentName:"li"},"source")," is triggered with ",(0,n.kt)("strong",{parentName:"li"},"object"),", extract ",(0,n.kt)("inlineCode",{parentName:"li"},"field")," from data, and trigger ",(0,n.kt)("inlineCode",{parentName:"li"},"target")),(0,n.kt)("li",{parentName:"ul"},(0,n.kt)("inlineCode",{parentName:"li"},"targets")," can have multiple properties"),(0,n.kt)("li",{parentName:"ul"},"If the ",(0,n.kt)("inlineCode",{parentName:"li"},"source")," was triggered with non-object, nothing would be happening"),(0,n.kt)("li",{parentName:"ul"},"If ",(0,n.kt)("inlineCode",{parentName:"li"},"source")," is triggered with object but without propertpy ",(0,n.kt)("inlineCode",{parentName:"li"},"field"),", target for this ",(0,n.kt)("inlineCode",{parentName:"li"},"field")," will not be triggered")),(0,n.kt)("h3",{id:"arguments"},"Arguments"),(0,n.kt)("ol",null,(0,n.kt)("li",{parentName:"ol"},(0,n.kt)("inlineCode",{parentName:"li"},"targets")," ",(0,n.kt)("inlineCode",{parentName:"li"},"(Recordresult = snapshot({ source, clock, fn })
",id:"result--snapshot-source-clock-fn-",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Returns",id:"returns",level:3},{value:"Examples",id:"examples",level:3},{value:"Exact copy of store",id:"exact-copy-of-store",level:4},{value:"Exact copy on trigger",id:"exact-copy-on-trigger",level:4},{value:"Copy on trigger with transformation",id:"copy-on-trigger-with-transformation",level:4}],c={toc:p};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"snapshot"},"snapshot"),(0,o.kt)("admonition",{title:"since",type:"note"},(0,o.kt)("p",{parentName:"admonition"},"patronum 1.7.0")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import { snapshot } from 'patronum';\n// or\nimport { snapshot } from 'patronum/snapshot';\n")),(0,o.kt)("h2",{id:"result--snapshot-source-clock-fn-"},(0,o.kt)("inlineCode",{parentName:"h2"},"result = snapshot({ source, clock, fn })")),(0,o.kt)("h3",{id:"motivation"},"Motivation"),(0,o.kt)("p",null,"This method allows to copy any store on optional trigger unit.\nIt useful when you want to save previous state of store before some actions."),(0,o.kt)("h3",{id:"formulae"},"Formulae"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"result = snapshot({ source, clock, fn });\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Call ",(0,o.kt)("inlineCode",{parentName:"li"},"fn")," with data from ",(0,o.kt)("inlineCode",{parentName:"li"},"source")," while ",(0,o.kt)("inlineCode",{parentName:"li"},"clock")," triggered, and create store with the value"),(0,o.kt)("li",{parentName:"ul"},"If ",(0,o.kt)("inlineCode",{parentName:"li"},"fn")," returns ",(0,o.kt)("inlineCode",{parentName:"li"},"undefined"),", the update will be skipped.")),(0,o.kt)("h3",{id:"arguments"},"Arguments"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"source")," (",(0,o.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/store"},(0,o.kt)("em",{parentName:"a"},(0,o.kt)("inlineCode",{parentName:"em"},"Store"))),") \u2014 Source store, data from this unit passed to ",(0,o.kt)("inlineCode",{parentName:"li"},"fn")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"clock")," (",(0,o.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/event"},(0,o.kt)("em",{parentName:"a"},(0,o.kt)("inlineCode",{parentName:"em"},"Event"))),", ",(0,o.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/effect"},(0,o.kt)("em",{parentName:"a"},(0,o.kt)("inlineCode",{parentName:"em"},"Effect"))),", ",(0,o.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/store"},(0,o.kt)("em",{parentName:"a"},(0,o.kt)("inlineCode",{parentName:"em"},"Store"))),") \u2014 Trigger unit"),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"fn")," ",(0,o.kt)("inlineCode",{parentName:"li"},"((value: T) => U)")," \u2014 Transformation function")),(0,o.kt)("h3",{id:"returns"},"Returns"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"result")," (",(0,o.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/store"},(0,o.kt)("em",{parentName:"a"},(0,o.kt)("inlineCode",{parentName:"em"},"Store"))),") \u2014 Copied store")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("h4",{id:"exact-copy-of-store"},"Exact copy of store"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import { createStore } from 'effector';\nimport { snapshot } from 'patronum/snapshot';\n\nconst $original = createStoreresult = snapshot({ source, clock, fn })
",id:"result--snapshot-source-clock-fn-",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Returns",id:"returns",level:3},{value:"Examples",id:"examples",level:3},{value:"Exact copy of store",id:"exact-copy-of-store",level:4},{value:"Exact copy on trigger",id:"exact-copy-on-trigger",level:4},{value:"Copy on trigger with transformation",id:"copy-on-trigger-with-transformation",level:4}],c={toc:p},m="wrapper";function u(e){let{components:t,...n}=e;return(0,o.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"snapshot"},"snapshot"),(0,o.kt)("admonition",{title:"since",type:"note"},(0,o.kt)("p",{parentName:"admonition"},"patronum 1.7.0")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import { snapshot } from 'patronum';\n// or\nimport { snapshot } from 'patronum/snapshot';\n")),(0,o.kt)("h2",{id:"result--snapshot-source-clock-fn-"},(0,o.kt)("inlineCode",{parentName:"h2"},"result = snapshot({ source, clock, fn })")),(0,o.kt)("h3",{id:"motivation"},"Motivation"),(0,o.kt)("p",null,"This method allows to copy any store on optional trigger unit.\nIt useful when you want to save previous state of store before some actions."),(0,o.kt)("h3",{id:"formulae"},"Formulae"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"result = snapshot({ source, clock, fn });\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Call ",(0,o.kt)("inlineCode",{parentName:"li"},"fn")," with data from ",(0,o.kt)("inlineCode",{parentName:"li"},"source")," while ",(0,o.kt)("inlineCode",{parentName:"li"},"clock")," triggered, and create store with the value"),(0,o.kt)("li",{parentName:"ul"},"If ",(0,o.kt)("inlineCode",{parentName:"li"},"fn")," returns ",(0,o.kt)("inlineCode",{parentName:"li"},"undefined"),", the update will be skipped.")),(0,o.kt)("h3",{id:"arguments"},"Arguments"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"source")," (",(0,o.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/store"},(0,o.kt)("em",{parentName:"a"},(0,o.kt)("inlineCode",{parentName:"em"},"Store"))),") \u2014 Source store, data from this unit passed to ",(0,o.kt)("inlineCode",{parentName:"li"},"fn")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"clock")," (",(0,o.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/event"},(0,o.kt)("em",{parentName:"a"},(0,o.kt)("inlineCode",{parentName:"em"},"Event"))),", ",(0,o.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/effect"},(0,o.kt)("em",{parentName:"a"},(0,o.kt)("inlineCode",{parentName:"em"},"Effect"))),", ",(0,o.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/store"},(0,o.kt)("em",{parentName:"a"},(0,o.kt)("inlineCode",{parentName:"em"},"Store"))),") \u2014 Trigger unit"),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"fn")," ",(0,o.kt)("inlineCode",{parentName:"li"},"((value: T) => U)")," \u2014 Transformation function")),(0,o.kt)("h3",{id:"returns"},"Returns"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"result")," (",(0,o.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/store"},(0,o.kt)("em",{parentName:"a"},(0,o.kt)("inlineCode",{parentName:"em"},"Store"))),") \u2014 Copied store")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("h4",{id:"exact-copy-of-store"},"Exact copy of store"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import { createStore } from 'effector';\nimport { snapshot } from 'patronum/snapshot';\n\nconst $original = createStoresome({ predicate: Function, stores })
",id:"some-predicate-function-stores-",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Return",id:"return",level:3},{value:"Example",id:"example",level:3},{value:"some({ predicate: value, stores })
",id:"some-predicate-value-stores-",level:2},{value:"Motivation",id:"motivation-1",level:3},{value:"Formulae",id:"formulae-1",level:3},{value:"Arguments",id:"arguments-1",level:3},{value:"Return",id:"return-1",level:3},{value:"Example",id:"example-1",level:3},{value:"some({ predicate: Store, stores })
",id:"some-predicate-store-stores-",level:2},{value:"Motivation",id:"motivation-2",level:3},{value:"Formulae",id:"formulae-2",level:3},{value:"Arguments",id:"arguments-2",level:3},{value:"Return",id:"return-2",level:3},{value:"Example",id:"example-2",level:3},{value:"Shorthands",id:"shorthands",level:2},{value:"Arguments",id:"arguments-3",level:3}],p={toc:m};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"some"},"some"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { some } from 'patronum';\n// or\nimport { some } from 'patronum/some';\n")),(0,r.kt)("h2",{id:"some-predicate-function-stores-"},(0,r.kt)("inlineCode",{parentName:"h2"},"some({ predicate: Function, stores })")),(0,r.kt)("h3",{id:"motivation"},"Motivation"),(0,r.kt)("p",null,"Method calculates boolean value if at least one state of the store satisfies the condition in ",(0,r.kt)("inlineCode",{parentName:"p"},"predicate"),".\nIt is useful to check that user filled at least a single field."),(0,r.kt)("h3",{id:"formulae"},"Formulae"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"$result = some({ predicate: (value) => true, stores });\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"read it as: has some predicate at at least one store"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"$result")," will be ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," if each at least ",(0,r.kt)("inlineCode",{parentName:"li"},"predicate")," on each store value from ",(0,r.kt)("inlineCode",{parentName:"li"},"values")," returns ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", otherwise it will be ",(0,r.kt)("inlineCode",{parentName:"li"},"false"))),(0,r.kt)("h3",{id:"arguments"},"Arguments"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"predicate")," ",(0,r.kt)("inlineCode",{parentName:"li"},"((value: T) => boolean)")," \u2014 Function to check store value"),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"stores")," ",(0,r.kt)("inlineCode",{parentName:"li"},"(Arraysome({ predicate: Function, stores })
",id:"some-predicate-function-stores-",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Return",id:"return",level:3},{value:"Example",id:"example",level:3},{value:"some({ predicate: value, stores })
",id:"some-predicate-value-stores-",level:2},{value:"Motivation",id:"motivation-1",level:3},{value:"Formulae",id:"formulae-1",level:3},{value:"Arguments",id:"arguments-1",level:3},{value:"Return",id:"return-1",level:3},{value:"Example",id:"example-1",level:3},{value:"some({ predicate: Store, stores })
",id:"some-predicate-store-stores-",level:2},{value:"Motivation",id:"motivation-2",level:3},{value:"Formulae",id:"formulae-2",level:3},{value:"Arguments",id:"arguments-2",level:3},{value:"Return",id:"return-2",level:3},{value:"Example",id:"example-2",level:3},{value:"Shorthands",id:"shorthands",level:2},{value:"Arguments",id:"arguments-3",level:3}],p={toc:m},u="wrapper";function d(e){let{components:t,...a}=e;return(0,r.kt)(u,(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"some"},"some"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { some } from 'patronum';\n// or\nimport { some } from 'patronum/some';\n")),(0,r.kt)("h2",{id:"some-predicate-function-stores-"},(0,r.kt)("inlineCode",{parentName:"h2"},"some({ predicate: Function, stores })")),(0,r.kt)("h3",{id:"motivation"},"Motivation"),(0,r.kt)("p",null,"Method calculates boolean value if at least one state of the store satisfies the condition in ",(0,r.kt)("inlineCode",{parentName:"p"},"predicate"),".\nIt is useful to check that user filled at least a single field."),(0,r.kt)("h3",{id:"formulae"},"Formulae"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"$result = some({ predicate: (value) => true, stores });\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"read it as: has some predicate at at least one store"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"$result")," will be ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," if each at least ",(0,r.kt)("inlineCode",{parentName:"li"},"predicate")," on each store value from ",(0,r.kt)("inlineCode",{parentName:"li"},"values")," returns ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),", otherwise it will be ",(0,r.kt)("inlineCode",{parentName:"li"},"false"))),(0,r.kt)("h3",{id:"arguments"},"Arguments"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"predicate")," ",(0,r.kt)("inlineCode",{parentName:"li"},"((value: T) => boolean)")," \u2014 Function to check store value"),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"stores")," ",(0,r.kt)("inlineCode",{parentName:"li"},"(Arrayresult = reshape({ source, shape })
",id:"result--reshape-source-shape-",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Returns",id:"returns",level:3},{value:"Examples",id:"examples",level:3},{value:"Creates much stores from single string",id:"creates-much-stores-from-single-string",level:4},{value:"Destructure object",id:"destructure-object",level:4}],u={toc:p};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"reshape"},"reshape"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { reshape } from 'patronum';\n// or\nimport { reshape } from 'patronum/reshape';\n")),(0,a.kt)("h2",{id:"result--reshape-source-shape-"},(0,a.kt)("inlineCode",{parentName:"h2"},"result = reshape({ source, shape })")),(0,a.kt)("h3",{id:"motivation"},"Motivation"),(0,a.kt)("p",null,"This method allows to create many stores from single store at once.\nIt useful when you want to read many properties from object to different stores."),(0,a.kt)("h3",{id:"formulae"},"Formulae"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"result = reshape({ source, shape });\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Call each function in ",(0,a.kt)("inlineCode",{parentName:"li"},"shape")," object with data from ",(0,a.kt)("inlineCode",{parentName:"li"},"source"),", and create store with the same name as key in ",(0,a.kt)("inlineCode",{parentName:"li"},"shape")),(0,a.kt)("li",{parentName:"ul"},"If function in ",(0,a.kt)("inlineCode",{parentName:"li"},"shape")," returns ",(0,a.kt)("inlineCode",{parentName:"li"},"undefined"),", the same store will contain ",(0,a.kt)("inlineCode",{parentName:"li"},"null"),", because store cannot contain ",(0,a.kt)("inlineCode",{parentName:"li"},"undefined"),".")),(0,a.kt)("h3",{id:"arguments"},"Arguments"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"source")," (",(0,a.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/store"},(0,a.kt)("em",{parentName:"a"},(0,a.kt)("inlineCode",{parentName:"em"},"Store"))),") \u2014 Source store, data from this unit passed to each function in ",(0,a.kt)("inlineCode",{parentName:"li"},"shape")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"shape")," (",(0,a.kt)("inlineCode",{parentName:"li"},"{ [key: string]: (payload: T) => any }"),") \u2014 Object of functions. Function receives payload of ",(0,a.kt)("inlineCode",{parentName:"li"},"source")," as single argument, should return any value.")),(0,a.kt)("h3",{id:"returns"},"Returns"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"result")," (",(0,a.kt)("inlineCode",{parentName:"li"},"{ [key: string]: Storeresult = reshape({ source, shape })
",id:"result--reshape-source-shape-",level:2},{value:"Motivation",id:"motivation",level:3},{value:"Formulae",id:"formulae",level:3},{value:"Arguments",id:"arguments",level:3},{value:"Returns",id:"returns",level:3},{value:"Examples",id:"examples",level:3},{value:"Creates much stores from single string",id:"creates-much-stores-from-single-string",level:4},{value:"Destructure object",id:"destructure-object",level:4}],u={toc:p},c="wrapper";function m(e){let{components:t,...r}=e;return(0,a.kt)(c,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"reshape"},"reshape"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { reshape } from 'patronum';\n// or\nimport { reshape } from 'patronum/reshape';\n")),(0,a.kt)("h2",{id:"result--reshape-source-shape-"},(0,a.kt)("inlineCode",{parentName:"h2"},"result = reshape({ source, shape })")),(0,a.kt)("h3",{id:"motivation"},"Motivation"),(0,a.kt)("p",null,"This method allows to create many stores from single store at once.\nIt useful when you want to read many properties from object to different stores."),(0,a.kt)("h3",{id:"formulae"},"Formulae"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"result = reshape({ source, shape });\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Call each function in ",(0,a.kt)("inlineCode",{parentName:"li"},"shape")," object with data from ",(0,a.kt)("inlineCode",{parentName:"li"},"source"),", and create store with the same name as key in ",(0,a.kt)("inlineCode",{parentName:"li"},"shape")),(0,a.kt)("li",{parentName:"ul"},"If function in ",(0,a.kt)("inlineCode",{parentName:"li"},"shape")," returns ",(0,a.kt)("inlineCode",{parentName:"li"},"undefined"),", the same store will contain ",(0,a.kt)("inlineCode",{parentName:"li"},"null"),", because store cannot contain ",(0,a.kt)("inlineCode",{parentName:"li"},"undefined"),".")),(0,a.kt)("h3",{id:"arguments"},"Arguments"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"source")," (",(0,a.kt)("a",{parentName:"li",href:"https://effector.dev/docs/api/effector/store"},(0,a.kt)("em",{parentName:"a"},(0,a.kt)("inlineCode",{parentName:"em"},"Store"))),") \u2014 Source store, data from this unit passed to each function in ",(0,a.kt)("inlineCode",{parentName:"li"},"shape")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("inlineCode",{parentName:"li"},"shape")," (",(0,a.kt)("inlineCode",{parentName:"li"},"{ [key: string]: (payload: T) => any }"),") \u2014 Object of functions. Function receives payload of ",(0,a.kt)("inlineCode",{parentName:"li"},"source")," as single argument, should return any value.")),(0,a.kt)("h3",{id:"returns"},"Returns"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"result")," (",(0,a.kt)("inlineCode",{parentName:"li"},"{ [key: string]: Store