diff --git a/404.html b/404.html index 742a9da6..dcd64e5e 100644 --- a/404.html +++ b/404.html @@ -12,7 +12,7 @@ - + diff --git a/assets/js/0058a559.5addc267.js b/assets/js/0058a559.7f5bdfa5.js similarity index 69% rename from assets/js/0058a559.5addc267.js rename to assets/js/0058a559.7f5bdfa5.js index 3f685b36..2c192134 100644 --- a/assets/js/0058a559.5addc267.js +++ b/assets/js/0058a559.7f5bdfa5.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[108],{1865:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>c,toc:()=>i});var t=r(4848),o=r(8453);const a={id:"every"},s=void 0,c={id:"every",title:"every",description:"every() function",source:"@site/docs/every.md",sourceDirName:".",slug:"/every",permalink:"/docs/every",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"every"},sidebar:"api",previous:{title:"each",permalink:"/docs/each"},next:{title:"evolve",permalink:"/docs/evolve"}},l={},i=[{value:"every() function",id:"every-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"every-function",children:"every() function"}),"\n",(0,t.jsxs)(n.p,{children:["Returns true if all of the values in Iterable/AsyncIterable pass the ",(0,t.jsx)(n.code,{children:"f"})," truth test."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function every(f: Arrow, iterable: A): true;\n\ndeclare function every(f: (a: A) => B, iterable: Iterable): boolean;\n\ndeclare function every(f: (a: A) => B, iterable: AsyncIterable): Promise;\n\ndeclare function every | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B): (a: A) => ReturnValueType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"every((a) => a % 2 === 0, [2, 4, 6, 8, 10]);\r\n// true\r\n\r\nevery((a) => a % 2 === 0, [2, 4, 6, 7, 10]);\r\n// false\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-every-g91dh",children:"Try It"})})]})}function d(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>c});var t=r(6540);const o={},a=t.createContext(o);function s(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[108],{1865:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>i});var t=r(4848),o=r(8453);const a={id:"every"},s=void 0,c={id:"every",title:"every",description:"every() function",source:"@site/docs/every.md",sourceDirName:".",slug:"/every",permalink:"/docs/every",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"every"},sidebar:"api",previous:{title:"each",permalink:"/docs/each"},next:{title:"evolve",permalink:"/docs/evolve"}},l={},i=[{value:"every() function",id:"every-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"every-function",children:"every() function"}),"\n",(0,t.jsxs)(n.p,{children:["Returns true if all of the values in Iterable/AsyncIterable pass the ",(0,t.jsx)(n.code,{children:"f"})," truth test."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function every(f: Arrow, iterable: A): true;\n\ndeclare function every(f: (a: A) => B, iterable: Iterable): boolean;\n\ndeclare function every(f: (a: A) => B, iterable: AsyncIterable): Promise;\n\ndeclare function every | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B): (a: A) => ReturnValueType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"every((a) => a % 2 === 0, [2, 4, 6, 8, 10]);\r\n// true\r\n\r\nevery((a) => a % 2 === 0, [2, 4, 6, 7, 10]);\r\n// false\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-every-g91dh",children:"Try It"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/every.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>c});var t=r(6540);const o={},a=t.createContext(o);function s(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/02ee0895.fa6bd938.js b/assets/js/02ee0895.e7a821f2.js similarity index 81% rename from assets/js/02ee0895.fa6bd938.js rename to assets/js/02ee0895.e7a821f2.js index ac16b368..4283bb5f 100644 --- a/assets/js/02ee0895.fa6bd938.js +++ b/assets/js/02ee0895.e7a821f2.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[925],{3855:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var t=r(4848),o=r(8453);const s={id:"peek"},a=void 0,i={id:"peek",title:"peek",description:"peek() function",source:"@site/docs/peek.md",sourceDirName:".",slug:"/peek",permalink:"/docs/peek",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"peek"},sidebar:"api",previous:{title:"map",permalink:"/docs/map"},next:{title:"pipeLazy",permalink:"/docs/pipeLazy"}},l={},c=[{value:"peek() function",id:"peek-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"peek-function",children:"peek() function"}),"\n",(0,t.jsxs)(n.p,{children:["Iterate over an input list, calling a provided ",(0,t.jsx)(n.code,{children:"f"})," for each element in the Iterable/AsyncIterable. Use it when you want to create an effect inside ",(0,t.jsx)(n.code,{children:"pipe"}),"."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function peek(f: (a: T) => unknown, iterable: Iterable): IterableIterator;\n\ndeclare function peek(f: (a: T) => unknown, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function peek | AsyncIterable>(f: (a: Awaited>) => unknown): (iterable: T) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = peek(a => console.log(a), [1, 2, 3, 4]);\r\niter.next() // {done:false, value: 1} // log 1\r\niter.next() // {done:false, value: 2} // log 2\r\niter.next() // {done:false, value: 3} // log 3\r\niter.next() // {done:false, value: 4} // log 4\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n peek(a => console.log(a)),\r\n toArray,\r\n); // [1, 2, 3, 4] // log 1,2,3,4\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n peek(a => console.log(a)),\r\n toArray,\r\n); // [1, 2, 3, 4] // log 1,2,3,4\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n toAsync,\r\n peek(async (a) => console.log(a)),\r\n toArray,\r\n); // [1, 2, 3, 4] // log 1,2,3,4\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n peek(a => console.log(a)),\r\n toArray,\r\n); // [1, 2, 3, 4] // log 1,2,3,4\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-peek-xm1jh",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function d(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(p,{...e})}):p(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>a,x:()=>i});var t=r(6540);const o={},s=t.createContext(o);function a(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[925],{3855:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var t=r(4848),o=r(8453);const s={id:"peek"},a=void 0,i={id:"peek",title:"peek",description:"peek() function",source:"@site/docs/peek.md",sourceDirName:".",slug:"/peek",permalink:"/docs/peek",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"peek"},sidebar:"api",previous:{title:"map",permalink:"/docs/map"},next:{title:"pipeLazy",permalink:"/docs/pipeLazy"}},l={},c=[{value:"peek() function",id:"peek-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"peek-function",children:"peek() function"}),"\n",(0,t.jsxs)(n.p,{children:["Iterate over an input list, calling a provided ",(0,t.jsx)(n.code,{children:"f"})," for each element in the Iterable/AsyncIterable. Use it when you want to create an effect inside ",(0,t.jsx)(n.code,{children:"pipe"}),"."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function peek(f: (a: T) => unknown, iterable: Iterable): IterableIterator;\n\ndeclare function peek(f: (a: T) => unknown, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function peek | AsyncIterable>(f: (a: Awaited>) => unknown): (iterable: T) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = peek(a => console.log(a), [1, 2, 3, 4]);\r\niter.next() // {done:false, value: 1} // log 1\r\niter.next() // {done:false, value: 2} // log 2\r\niter.next() // {done:false, value: 3} // log 3\r\niter.next() // {done:false, value: 4} // log 4\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n peek(a => console.log(a)),\r\n toArray,\r\n); // [1, 2, 3, 4] // log 1,2,3,4\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n peek(a => console.log(a)),\r\n toArray,\r\n); // [1, 2, 3, 4] // log 1,2,3,4\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n toAsync,\r\n peek(async (a) => console.log(a)),\r\n toArray,\r\n); // [1, 2, 3, 4] // log 1,2,3,4\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n peek(a => console.log(a)),\r\n toArray,\r\n); // [1, 2, 3, 4] // log 1,2,3,4\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-peek-xm1jh",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/peek.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(p,{...e})}):p(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>a,x:()=>i});var t=r(6540);const o={},s=t.createContext(o);function a(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/04d88e6b.81169ff7.js b/assets/js/04d88e6b.81169ff7.js new file mode 100644 index 00000000..5ad40e0c --- /dev/null +++ b/assets/js/04d88e6b.81169ff7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5090],{653:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>u,frontMatter:()=>c,metadata:()=>o,toc:()=>l});var r=t(4848),i=t(8453);const c={id:"intersection"},s=void 0,o={id:"intersection",title:"intersection",description:"intersection() function",source:"@site/docs/intersection.md",sourceDirName:".",slug:"/intersection",permalink:"/docs/intersection",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"intersection"},sidebar:"api",previous:{title:"fx",permalink:"/docs/fx"},next:{title:"intersectionBy",permalink:"/docs/intersectionBy"}},a={},l=[{value:"intersection() function",id:"intersection-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"intersection-function",children:"intersection() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable of all elements in the ",(0,r.jsx)(n.code,{children:"iterable2"})," contained in the ",(0,r.jsx)(n.code,{children:"iterable1"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function intersection(iterable1: Iterable, iterable2: Iterable): IterableIterator;\n\ndeclare function intersection(iterable1: AsyncIterable, iterable2: Iterable): AsyncIterableIterator;\n\ndeclare function intersection(iterable1: Iterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function intersection(iterable1: AsyncIterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function intersection | AsyncIterable, B extends Iterable | AsyncIterable>(iterable1: A): (iterable2: B) => A extends AsyncIterable ? AsyncIterableIterator> : B extends AsyncIterable ? AsyncIterableIterator> : IterableIterator>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = intersection([2, 1], [2, 3, 4]);\r\niter.next(); // {value: 2, done:false}\r\niter.next(); // {value: undefined, done: true}\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/intersection.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>o});var r=t(6540);const i={},c=r.createContext(i);function s(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/04d88e6b.8c612788.js b/assets/js/04d88e6b.8c612788.js deleted file mode 100644 index 998ed4d1..00000000 --- a/assets/js/04d88e6b.8c612788.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5090],{653:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>u,frontMatter:()=>c,metadata:()=>o,toc:()=>l});var r=t(4848),i=t(8453);const c={id:"intersection"},s=void 0,o={id:"intersection",title:"intersection",description:"intersection() function",source:"@site/docs/intersection.md",sourceDirName:".",slug:"/intersection",permalink:"/docs/intersection",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"intersection"},sidebar:"api",previous:{title:"fx",permalink:"/docs/fx"},next:{title:"intersectionBy",permalink:"/docs/intersectionBy"}},a={},l=[{value:"intersection() function",id:"intersection-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"intersection-function",children:"intersection() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable of all elements in the ",(0,r.jsx)(n.code,{children:"iterable2"})," contained in the ",(0,r.jsx)(n.code,{children:"iterable1"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function intersection(iterable1: Iterable, iterable2: Iterable): IterableIterator;\n\ndeclare function intersection(iterable1: AsyncIterable, iterable2: Iterable): AsyncIterableIterator;\n\ndeclare function intersection(iterable1: Iterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function intersection(iterable1: AsyncIterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function intersection | AsyncIterable, B extends Iterable | AsyncIterable>(iterable1: A): (iterable2: B) => A extends AsyncIterable ? AsyncIterableIterator> : B extends AsyncIterable ? AsyncIterableIterator> : IterableIterator>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = intersection([2, 1], [2, 3, 4]);\r\niter.next(); // {value: 2, done:false}\r\niter.next(); // {value: undefined, done: true}\n"})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>o});var r=t(6540);const i={},c=r.createContext(i);function s(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/06388b3b.637e88f3.js b/assets/js/06388b3b.637e88f3.js new file mode 100644 index 00000000..1166751d --- /dev/null +++ b/assets/js/06388b3b.637e88f3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4541],{6390:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>p,metadata:()=>c,toc:()=>o});var a=t(4848),r=t(8453);const p={id:"apply"},s=void 0,c={id:"apply",title:"apply",description:"apply() function",source:"@site/docs/apply.md",sourceDirName:".",slug:"/apply",permalink:"/docs/apply",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"apply"},sidebar:"api",previous:{title:"always",permalink:"/docs/always"},next:{title:"average",permalink:"/docs/average"}},l={},o=[{value:"apply() function",id:"apply-function",level:2},{value:"Example",id:"example",level:2}];function i(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h2,{id:"apply-function",children:"apply() function"}),"\n",(0,a.jsxs)(n.p,{children:["Applies function ",(0,a.jsx)(n.code,{children:"f"})," to the argument list ",(0,a.jsx)(n.code,{children:"args"}),"."]}),"\n",(0,a.jsx)("b",{children:"Signature:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-typescript",children:"declare function apply>(f: F, args: T): ReturnType;\n\ndeclare function apply>(f: F): (args: T) => ReturnType;\n"})}),"\n",(0,a.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-ts",children:"apply(Math.max, [1, 2, 3, 4, 5]); // 5\r\n\r\npipe(\r\n repeat(10),\r\n map(a => a * Math.random())\r\n take(5),\r\n apply(max)\r\n);\n"})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/apply.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(i,{...e})}):i(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var a=t(6540);const r={},p=a.createContext(r);function s(e){const n=a.useContext(p);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),a.createElement(p.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/06388b3b.75efeec7.js b/assets/js/06388b3b.75efeec7.js deleted file mode 100644 index a249fbf4..00000000 --- a/assets/js/06388b3b.75efeec7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4541],{6390:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>p,metadata:()=>c,toc:()=>o});var a=t(4848),r=t(8453);const p={id:"apply"},s=void 0,c={id:"apply",title:"apply",description:"apply() function",source:"@site/docs/apply.md",sourceDirName:".",slug:"/apply",permalink:"/docs/apply",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"apply"},sidebar:"api",previous:{title:"always",permalink:"/docs/always"},next:{title:"average",permalink:"/docs/average"}},l={},o=[{value:"apply() function",id:"apply-function",level:2},{value:"Example",id:"example",level:2}];function i(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h2,{id:"apply-function",children:"apply() function"}),"\n",(0,a.jsxs)(n.p,{children:["Applies function ",(0,a.jsx)(n.code,{children:"f"})," to the argument list ",(0,a.jsx)(n.code,{children:"args"}),"."]}),"\n",(0,a.jsx)("b",{children:"Signature:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-typescript",children:"declare function apply>(f: F, args: T): ReturnType;\n\ndeclare function apply>(f: F): (args: T) => ReturnType;\n"})}),"\n",(0,a.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-ts",children:"apply(Math.max, [1, 2, 3, 4, 5]); // 5\r\n\r\npipe(\r\n repeat(10),\r\n map(a => a * Math.random())\r\n take(5),\r\n apply(max)\r\n);\n"})})]})}function d(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(i,{...e})}):i(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var a=t(6540);const r={},p=a.createContext(r);function s(e){const n=a.useContext(p);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),a.createElement(p.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/0762c7f6.e66e4904.js b/assets/js/0762c7f6.4a1f34f7.js similarity index 72% rename from assets/js/0762c7f6.e66e4904.js rename to assets/js/0762c7f6.4a1f34f7.js index 3b28e403..e9535c00 100644 --- a/assets/js/0762c7f6.e66e4904.js +++ b/assets/js/0762c7f6.4a1f34f7.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9786],{1805:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var c=t(4848),a=t(8453);const r={id:"each"},o=void 0,s={id:"each",title:"each",description:"each() function",source:"@site/docs/each.md",sourceDirName:".",slug:"/each",permalink:"/docs/each",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"each"},sidebar:"api",previous:{title:"delay",permalink:"/docs/delay"},next:{title:"every",permalink:"/docs/every"}},i={},l=[{value:"each() function",id:"each-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h2,{id:"each-function",children:"each() function"}),"\n",(0,c.jsxs)(n.p,{children:["Iterates over Iterable/AsyncIterable, applying each in turn to ",(0,c.jsx)(n.code,{children:"f"}),"."]}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-typescript",children:"declare function each(f: (a: A) => B, iterable: Iterable): void;\n\ndeclare function each(f: (a: A) => B, iterable: AsyncIterable): Promise;\n\ndeclare function each | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B): (iterable: A) => ReturnValueType;\n"})}),"\n",(0,c.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"each(console.log, [1, 2, 3]); // log 1, 2, 3\n"})}),"\n",(0,c.jsx)(n.p,{children:(0,c.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-each-kvz6w",children:"Try It"})})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>s});var c=t(6540);const a={},r=c.createContext(a);function o(e){const n=c.useContext(r);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),c.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9786],{1805:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var c=t(4848),a=t(8453);const r={id:"each"},o=void 0,s={id:"each",title:"each",description:"each() function",source:"@site/docs/each.md",sourceDirName:".",slug:"/each",permalink:"/docs/each",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"each"},sidebar:"api",previous:{title:"delay",permalink:"/docs/delay"},next:{title:"every",permalink:"/docs/every"}},i={},l=[{value:"each() function",id:"each-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h2,{id:"each-function",children:"each() function"}),"\n",(0,c.jsxs)(n.p,{children:["Iterates over Iterable/AsyncIterable, applying each in turn to ",(0,c.jsx)(n.code,{children:"f"}),"."]}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-typescript",children:"declare function each(f: (a: A) => B, iterable: Iterable): void;\n\ndeclare function each(f: (a: A) => B, iterable: AsyncIterable): Promise;\n\ndeclare function each | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B): (iterable: A) => ReturnValueType;\n"})}),"\n",(0,c.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"each(console.log, [1, 2, 3]); // log 1, 2, 3\n"})}),"\n",(0,c.jsx)(n.p,{children:(0,c.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-each-kvz6w",children:"Try It"})}),"\n",(0,c.jsx)(n.p,{children:(0,c.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/each.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>s});var c=t(6540);const a={},r=c.createContext(a);function o(e){const n=c.useContext(r);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),c.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/120a4791.0cac6f19.js b/assets/js/120a4791.0cac6f19.js new file mode 100644 index 00000000..a0caa7fb --- /dev/null +++ b/assets/js/120a4791.0cac6f19.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5750],{9232:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>c,metadata:()=>i,toc:()=>l});var r=n(4848),a=n(8453);const c={id:"gte"},o=void 0,i={id:"gte",title:"gte",description:"gte() function",source:"@site/docs/gte.md",sourceDirName:".",slug:"/gte",permalink:"/docs/gte",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"gte"},sidebar:"api",previous:{title:"gt",permalink:"/docs/gt"},next:{title:"head",permalink:"/docs/head"}},s={},l=[{value:"gte() function",id:"gte-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"gte-function",children:"gte() function"}),"\n",(0,r.jsx)(t.p,{children:"Returns true if the first argument is greater or equal than the second; false otherwise."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function gte(a: Date, b: Date): boolean;\n\ndeclare function gte(a: Date): (b: Date) => boolean;\n\ndeclare function gte(a: string, b: string): boolean;\n\ndeclare function gte(a: number, b: number): boolean;\n\ndeclare function gte(a: string): (b: string) => boolean;\n\ndeclare function gte(a: number): (b: number) => boolean;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:'gte(5, 1) // expected true\r\ngte(1, 1) // expected true\r\ngte(1, 5) // expected false\r\ngte("a", "b") // expected false\r\ngte("b", "a") // expected true\r\n\r\nfilter(gte(5), [1, 2, 4, 5, 8, 9]) // Iterable<[1, 2, 4, 5]>\r\nfilter(gte(1), [2, 3, 4]) // Iterable<[]>\r\nfilter(gte("b"), ["a", "b", "c"]) // Iterable<["a", "b"]>\r\nfilter(gte("a"), ["b"]) // Itreable<[]>\n'})}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/gte.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>i});var r=n(6540);const a={},c=r.createContext(a);function o(e){const t=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),r.createElement(c.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/120a4791.7e0ed2a4.js b/assets/js/120a4791.7e0ed2a4.js deleted file mode 100644 index 04159d76..00000000 --- a/assets/js/120a4791.7e0ed2a4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5750],{9232:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>c,metadata:()=>i,toc:()=>l});var r=n(4848),a=n(8453);const c={id:"gte"},o=void 0,i={id:"gte",title:"gte",description:"gte() function",source:"@site/docs/gte.md",sourceDirName:".",slug:"/gte",permalink:"/docs/gte",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"gte"},sidebar:"api",previous:{title:"gt",permalink:"/docs/gt"},next:{title:"head",permalink:"/docs/head"}},s={},l=[{value:"gte() function",id:"gte-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"gte-function",children:"gte() function"}),"\n",(0,r.jsx)(t.p,{children:"Returns true if the first argument is greater or equal than the second; false otherwise."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function gte(a: Date, b: Date): boolean;\n\ndeclare function gte(a: Date): (b: Date) => boolean;\n\ndeclare function gte(a: string, b: string): boolean;\n\ndeclare function gte(a: number, b: number): boolean;\n\ndeclare function gte(a: string): (b: string) => boolean;\n\ndeclare function gte(a: number): (b: number) => boolean;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:'gte(5, 1) // expected true\r\ngte(1, 1) // expected true\r\ngte(1, 5) // expected false\r\ngte("a", "b") // expected false\r\ngte("b", "a") // expected true\r\n\r\nfilter(gte(5), [1, 2, 4, 5, 8, 9]) // Iterable<[1, 2, 4, 5]>\r\nfilter(gte(1), [2, 3, 4]) // Iterable<[]>\r\nfilter(gte("b"), ["a", "b", "c"]) // Iterable<["a", "b"]>\r\nfilter(gte("a"), ["b"]) // Itreable<[]>\n'})})]})}function d(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>i});var r=n(6540);const a={},c=r.createContext(a);function o(e){const t=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),r.createElement(c.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1211b948.d2aa9c42.js b/assets/js/1211b948.d2aa9c42.js new file mode 100644 index 00000000..e60b19a5 --- /dev/null +++ b/assets/js/1211b948.d2aa9c42.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5211],{6659:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>l,frontMatter:()=>c,metadata:()=>a,toc:()=>d});var o=r(4848),t=r(8453);const c={id:"unicodeToArray"},i=void 0,a={id:"unicodeToArray",title:"unicodeToArray",description:"unicodeToArray() function",source:"@site/docs/unicodeToArray.md",sourceDirName:".",slug:"/unicodeToArray",permalink:"/docs/unicodeToArray",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"unicodeToArray"},sidebar:"api",previous:{title:"toArray",permalink:"/docs/toArray"},next:{title:"unless",permalink:"/docs/unless"}},s={},d=[{value:"unicodeToArray() function",id:"unicodetoarray-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"unicodetoarray-function",children:"unicodeToArray() function"}),"\n",(0,o.jsxs)(n.p,{children:["Converts a Unicode ",(0,o.jsx)(n.code,{children:"string"})," to an array."]}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function unicodeToArray(string: string): [] | RegExpMatchArray;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:" unicodeToArray('\ud83d\ude47\u200d\u2642\ufe0f\ud83e\udd29\ud83d\ude2d'); // ['\ud83d\ude47\u200d\u2642\ufe0f','\ud83e\udd29','\ud83d\ude2d'];\n"})}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/unicodeToArray.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(u,{...e})}):u(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>i,x:()=>a});var o=r(6540);const t={},c=o.createContext(t);function i(e){const n=o.useContext(c);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),o.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1211b948.e03c30cd.js b/assets/js/1211b948.e03c30cd.js deleted file mode 100644 index c47d3191..00000000 --- a/assets/js/1211b948.e03c30cd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5211],{6659:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>l,frontMatter:()=>c,metadata:()=>a,toc:()=>d});var o=r(4848),t=r(8453);const c={id:"unicodeToArray"},i=void 0,a={id:"unicodeToArray",title:"unicodeToArray",description:"unicodeToArray() function",source:"@site/docs/unicodeToArray.md",sourceDirName:".",slug:"/unicodeToArray",permalink:"/docs/unicodeToArray",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"unicodeToArray"},sidebar:"api",previous:{title:"toArray",permalink:"/docs/toArray"},next:{title:"unless",permalink:"/docs/unless"}},s={},d=[{value:"unicodeToArray() function",id:"unicodetoarray-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"unicodetoarray-function",children:"unicodeToArray() function"}),"\n",(0,o.jsxs)(n.p,{children:["Converts a Unicode ",(0,o.jsx)(n.code,{children:"string"})," to an array."]}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function unicodeToArray(string: string): [] | RegExpMatchArray;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:" unicodeToArray('\ud83d\ude47\u200d\u2642\ufe0f\ud83e\udd29\ud83d\ude2d'); // ['\ud83d\ude47\u200d\u2642\ufe0f','\ud83e\udd29','\ud83d\ude2d'];\n"})})]})}function l(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(u,{...e})}):u(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>i,x:()=>a});var o=r(6540);const t={},c=o.createContext(t);function i(e){const n=o.useContext(c);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),o.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/158706f2.1bc950e1.js b/assets/js/158706f2.ab7b413b.js similarity index 70% rename from assets/js/158706f2.1bc950e1.js rename to assets/js/158706f2.ab7b413b.js index 500fbe12..1eabcec1 100644 --- a/assets/js/158706f2.1bc950e1.js +++ b/assets/js/158706f2.ab7b413b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2392],{5632:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>s,default:()=>d,frontMatter:()=>c,metadata:()=>a,toc:()=>i});var r=t(4848),o=t(8453);const c={id:"countBy"},s=void 0,a={id:"countBy",title:"countBy",description:"countBy() function",source:"@site/docs/countBy.md",sourceDirName:".",slug:"/countBy",permalink:"/docs/countBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"countBy"},sidebar:"api",previous:{title:"consume",permalink:"/docs/consume"},next:{title:"curry",permalink:"/docs/curry"}},u={},i=[{value:"countBy() function",id:"countby-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"countby-function",children:"countBy() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns a count for the number of objects in each group. Similar to groupBy, but instead of returning a list of values, it returns a count for the number of values in that group."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function countBy(f: (a: A) => B, iterable: Iterable): {\n [K in B]: number;\n};\n\ndeclare function countBy(f: (a: A) => B | Promise, iterable: AsyncIterable): Promise<{\n [K in B]: number;\n}>;\n\ndeclare function countBy | AsyncIterable, B extends Key>(f: (a: IterableInfer) => B | Promise): (iterable: A) => ReturnValueType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'const given = [\r\n { category: "clothes", desc: "good" },\r\n { category: "pants", desc: "bad" },\r\n { category: "shoes", desc: "not bad" },\r\n { category: "shoes", desc: "great" },\r\n { category: "pants", desc: "good" },\r\n];\r\n\r\ncountBy((a) => a.category, given);\r\n//{\r\n// clothes: 1,\r\n// pants: 2,\r\n// shoes: 2,\r\n// };\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-countby-09t7z",children:"Try It"})})]})}function d(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var r=t(6540);const o={},c=r.createContext(o);function s(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2392],{5632:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>d,frontMatter:()=>c,metadata:()=>a,toc:()=>u});var r=t(4848),o=t(8453);const c={id:"countBy"},s=void 0,a={id:"countBy",title:"countBy",description:"countBy() function",source:"@site/docs/countBy.md",sourceDirName:".",slug:"/countBy",permalink:"/docs/countBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"countBy"},sidebar:"api",previous:{title:"consume",permalink:"/docs/consume"},next:{title:"curry",permalink:"/docs/curry"}},i={},u=[{value:"countBy() function",id:"countby-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"countby-function",children:"countBy() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns a count for the number of objects in each group. Similar to groupBy, but instead of returning a list of values, it returns a count for the number of values in that group."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function countBy(f: (a: A) => B, iterable: Iterable): {\n [K in B]: number;\n};\n\ndeclare function countBy(f: (a: A) => B | Promise, iterable: AsyncIterable): Promise<{\n [K in B]: number;\n}>;\n\ndeclare function countBy | AsyncIterable, B extends Key>(f: (a: IterableInfer) => B | Promise): (iterable: A) => ReturnValueType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'const given = [\r\n { category: "clothes", desc: "good" },\r\n { category: "pants", desc: "bad" },\r\n { category: "shoes", desc: "not bad" },\r\n { category: "shoes", desc: "great" },\r\n { category: "pants", desc: "good" },\r\n];\r\n\r\ncountBy((a) => a.category, given);\r\n//{\r\n// clothes: 1,\r\n// pants: 2,\r\n// shoes: 2,\r\n// };\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-countby-09t7z",children:"Try It"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/countBy.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var r=t(6540);const o={},c=r.createContext(o);function s(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/16369154.af5c9fa7.js b/assets/js/16369154.af5c9fa7.js new file mode 100644 index 00000000..609e1764 --- /dev/null +++ b/assets/js/16369154.af5c9fa7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6156],{8296:(r,e,n)=>{n.r(e),n.d(e,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var t=n(4848),a=n(8453);const o={id:"toArray"},s=void 0,i={id:"toArray",title:"toArray",description:"toArray() function",source:"@site/docs/toArray.md",sourceDirName:".",slug:"/toArray",permalink:"/docs/toArray",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"toArray"},sidebar:"api",previous:{title:"throwIf",permalink:"/docs/throwIf"},next:{title:"unicodeToArray",permalink:"/docs/unicodeToArray"}},c={},l=[{value:"toArray() function",id:"toarray-function",level:2},{value:"Example",id:"example",level:2}];function d(r){const e={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...r.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e.h2,{id:"toarray-function",children:"toArray() function"}),"\n",(0,t.jsxs)(e.p,{children:["Takes item from Iterable/AsyncIterable and returns an array. It is recommended to use ",(0,t.jsx)(e.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"})," together."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(e.pre,{children:(0,t.jsx)(e.code,{className:"language-typescript",children:"declare function toArray | AsyncIterable>(iter: A): ReturnArrayType;\n"})}),"\n",(0,t.jsx)(e.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(e.pre,{children:(0,t.jsx)(e.code,{className:"language-ts",children:"pipe(\r\n [1, 2, 3, 4, 5],\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n toAsync,\r\n map(async (a) => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [\r\n Promise.resolve(1),\r\n Promise.resolve(2),\r\n Promise.resolve(3),\r\n Promise.resolve(4),\r\n Promise.resolve(5)\r\n ],\r\n toAsync,\r\n map((a) => a + 10),\r\n filter((a) => a % 2 === 0),\r\n toArray\r\n);\n"})}),"\n",(0,t.jsx)(e.p,{children:(0,t.jsx)(e.a,{href:"https://codesandbox.io/s/fxts-toarray-fy84i",children:"Try It"})}),"\n",(0,t.jsxs)(e.p,{children:["see ",(0,t.jsx)(e.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(e.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(e.a,{href:"https://fxts.dev/docs/map",children:"map"}),", ",(0,t.jsx)(e.a,{href:"https://fxts.dev/docs/filter",children:"filter"})]}),"\n",(0,t.jsx)(e.p,{children:(0,t.jsx)(e.a,{href:"https://github.com/marpple/FxTS/blob/main/src/toArray.ts",children:"Open Source Code"})})]})}function p(r={}){const{wrapper:e}={...(0,a.R)(),...r.components};return e?(0,t.jsx)(e,{...r,children:(0,t.jsx)(d,{...r})}):d(r)}},8453:(r,e,n)=>{n.d(e,{R:()=>s,x:()=>i});var t=n(6540);const a={},o=t.createContext(a);function s(r){const e=t.useContext(o);return t.useMemo((function(){return"function"==typeof r?r(e):{...e,...r}}),[e,r])}function i(r){let e;return e=r.disableParentContext?"function"==typeof r.components?r.components(a):r.components||a:s(r.components),t.createElement(o.Provider,{value:e},r.children)}}}]); \ No newline at end of file diff --git a/assets/js/16369154.efede7a5.js b/assets/js/16369154.efede7a5.js deleted file mode 100644 index 24ae3fa0..00000000 --- a/assets/js/16369154.efede7a5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6156],{8296:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var t=n(4848),a=n(8453);const o={id:"toArray"},s=void 0,i={id:"toArray",title:"toArray",description:"toArray() function",source:"@site/docs/toArray.md",sourceDirName:".",slug:"/toArray",permalink:"/docs/toArray",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"toArray"},sidebar:"api",previous:{title:"throwIf",permalink:"/docs/throwIf"},next:{title:"unicodeToArray",permalink:"/docs/unicodeToArray"}},c={},l=[{value:"toArray() function",id:"toarray-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h2,{id:"toarray-function",children:"toArray() function"}),"\n",(0,t.jsxs)(r.p,{children:["Takes item from Iterable/AsyncIterable and returns an array. It is recommended to use ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"})," together."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"declare function toArray | AsyncIterable>(iter: A): ReturnArrayType;\n"})}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"pipe(\r\n [1, 2, 3, 4, 5],\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n toAsync,\r\n map(async (a) => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [\r\n Promise.resolve(1),\r\n Promise.resolve(2),\r\n Promise.resolve(3),\r\n Promise.resolve(4),\r\n Promise.resolve(5)\r\n ],\r\n toAsync,\r\n map((a) => a + 10),\r\n filter((a) => a % 2 === 0),\r\n toArray\r\n);\n"})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://codesandbox.io/s/fxts-toarray-fy84i",children:"Try It"})}),"\n",(0,t.jsxs)(r.p,{children:["see ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/map",children:"map"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/filter",children:"filter"})]})]})}function p(e={}){const{wrapper:r}={...(0,a.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>s,x:()=>i});var t=n(6540);const a={},o=t.createContext(a);function s(e){const r=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function i(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),t.createElement(o.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/17853b1a.04c750e8.js b/assets/js/17853b1a.04c750e8.js new file mode 100644 index 00000000..ecbe5c13 --- /dev/null +++ b/assets/js/17853b1a.04c750e8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6407],{9047:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(4848),a=n(8453);const o={id:"gt"},c=void 0,i={id:"gt",title:"gt",description:"gt() function",source:"@site/docs/gt.md",sourceDirName:".",slug:"/gt",permalink:"/docs/gt",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"gt"},sidebar:"api",previous:{title:"groupBy",permalink:"/docs/groupBy"},next:{title:"gte",permalink:"/docs/gte"}},s={},l=[{value:"gt() function",id:"gt-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"gt-function",children:"gt() function"}),"\n",(0,r.jsx)(t.p,{children:"Returns true if the first argument is greater than the second; false otherwise."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function gt(a: Date, b: Date): boolean;\n\ndeclare function gt(a: Date): (b: Date) => boolean;\n\ndeclare function gt(a: string, b: string): boolean;\n\ndeclare function gt(a: number, b: number): boolean;\n\ndeclare function gt(a: string): (b: string) => boolean;\n\ndeclare function gt(a: number): (b: number) => boolean;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:'gt(5, 1) // expected true\r\ngt(1, 5) // expected false\r\ngt("a", "b") // expected false\r\ngt("b", "a") // expected true\r\n\r\nfilter(gt(5), [1, 2, 4, 5, 8, 9]) // Iterable<[1, 2, 4]>\r\nfilter(gt(1), [1, 2, 3, 4, 5]) // Iterable<[]>\r\nfilter(gt("b"), ["a", "b", "c"]) // Iterable<["a"]>\r\nfilter(gt("a"), ["a", "b"]) // Itreable<[]>\n'})}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/gt.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>i});var r=n(6540);const a={},o=r.createContext(a);function c(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:c(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/17853b1a.d1bacbb7.js b/assets/js/17853b1a.d1bacbb7.js deleted file mode 100644 index 81606128..00000000 --- a/assets/js/17853b1a.d1bacbb7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6407],{9047:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(4848),a=n(8453);const o={id:"gt"},c=void 0,i={id:"gt",title:"gt",description:"gt() function",source:"@site/docs/gt.md",sourceDirName:".",slug:"/gt",permalink:"/docs/gt",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"gt"},sidebar:"api",previous:{title:"groupBy",permalink:"/docs/groupBy"},next:{title:"gte",permalink:"/docs/gte"}},s={},l=[{value:"gt() function",id:"gt-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"gt-function",children:"gt() function"}),"\n",(0,r.jsx)(t.p,{children:"Returns true if the first argument is greater than the second; false otherwise."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function gt(a: Date, b: Date): boolean;\n\ndeclare function gt(a: Date): (b: Date) => boolean;\n\ndeclare function gt(a: string, b: string): boolean;\n\ndeclare function gt(a: number, b: number): boolean;\n\ndeclare function gt(a: string): (b: string) => boolean;\n\ndeclare function gt(a: number): (b: number) => boolean;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:'gt(5, 1) // expected true\r\ngt(1, 5) // expected false\r\ngt("a", "b") // expected false\r\ngt("b", "a") // expected true\r\n\r\nfilter(gt(5), [1, 2, 4, 5, 8, 9]) // Iterable<[1, 2, 4]>\r\nfilter(gt(1), [1, 2, 3, 4, 5]) // Iterable<[]>\r\nfilter(gt("b"), ["a", "b", "c"]) // Iterable<["a"]>\r\nfilter(gt("a"), ["a", "b"]) // Itreable<[]>\n'})})]})}function d(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>i});var r=n(6540);const a={},o=r.createContext(a);function c(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:c(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/19a99a72.2551b7ea.js b/assets/js/19a99a72.2551b7ea.js deleted file mode 100644 index 01ee5829..00000000 --- a/assets/js/19a99a72.2551b7ea.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7902],{81:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>o,contentTitle:()=>i,default:()=>l,frontMatter:()=>s,metadata:()=>a,toc:()=>c});var t=r(4848),d=r(8453);const s={id:"add"},i=void 0,a={id:"add",title:"add",description:"add() function",source:"@site/docs/add.md",sourceDirName:".",slug:"/add",permalink:"/docs/add",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"add"},sidebar:"api",previous:{title:"zipWithIndex",permalink:"/docs/zipWithIndex"},next:{title:"always",permalink:"/docs/always"}},o={},c=[{value:"add() function",id:"add-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,d.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"add-function",children:"add() function"}),"\n",(0,t.jsx)(n.p,{children:"Adds two values."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function add, B extends number | Promise>(a: A, b: B): ReturnAddType, A, B>;\n\ndeclare function add, B extends string | Promise>(a: A, b: B): ReturnAddType, A, B>;\n\ndeclare function add, B extends number | Promise>(a: A): (b: B) => ReturnAddType, A, B>;\n\ndeclare function add, B extends string | Promise>(a: A): (b: B) => ReturnAddType, A, B>;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"add(1, 2); // 3\r\nawait add(1, Promise.resolve(2)); // 3\r\nawait add(Promise.resolve(1), 2); // 3\r\nawait add(Promise.resolve(1), Promise.resolve(2)); // 3\r\n\r\nadd('a', 'b'); // 'ab'\r\nawait add('a', Promise.resolve('b')); // 'ab'\r\nawait add(Promise.resolve('a'), 'b'); // 'ab'\r\nawait add(Promise.resolve('a'), Promise.resolve('b')); // 'ab'\n"})})]})}function l(e={}){const{wrapper:n}={...(0,d.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>i,x:()=>a});var t=r(6540);const d={},s=t.createContext(d);function i(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:i(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/19a99a72.29454dec.js b/assets/js/19a99a72.29454dec.js new file mode 100644 index 00000000..13dd7f0a --- /dev/null +++ b/assets/js/19a99a72.29454dec.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7902],{81:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var t=r(4848),d=r(8453);const s={id:"add"},a=void 0,i={id:"add",title:"add",description:"add() function",source:"@site/docs/add.md",sourceDirName:".",slug:"/add",permalink:"/docs/add",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"add"},sidebar:"api",previous:{title:"zipWithIndex",permalink:"/docs/zipWithIndex"},next:{title:"always",permalink:"/docs/always"}},o={},c=[{value:"add() function",id:"add-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,d.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"add-function",children:"add() function"}),"\n",(0,t.jsx)(n.p,{children:"Adds two values."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function add, B extends number | Promise>(a: A, b: B): ReturnAddType, A, B>;\n\ndeclare function add, B extends string | Promise>(a: A, b: B): ReturnAddType, A, B>;\n\ndeclare function add, B extends number | Promise>(a: A): (b: B) => ReturnAddType, A, B>;\n\ndeclare function add, B extends string | Promise>(a: A): (b: B) => ReturnAddType, A, B>;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"add(1, 2); // 3\r\nawait add(1, Promise.resolve(2)); // 3\r\nawait add(Promise.resolve(1), 2); // 3\r\nawait add(Promise.resolve(1), Promise.resolve(2)); // 3\r\n\r\nadd('a', 'b'); // 'ab'\r\nawait add('a', Promise.resolve('b')); // 'ab'\r\nawait add(Promise.resolve('a'), 'b'); // 'ab'\r\nawait add(Promise.resolve('a'), Promise.resolve('b')); // 'ab'\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/add.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,d.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>a,x:()=>i});var t=r(6540);const d={},s=t.createContext(d);function a(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:a(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1afe06e6.1bb211d7.js b/assets/js/1afe06e6.8c29c435.js similarity index 57% rename from assets/js/1afe06e6.1bb211d7.js rename to assets/js/1afe06e6.8c29c435.js index 29dc9324..f2bf00b6 100644 --- a/assets/js/1afe06e6.1bb211d7.js +++ b/assets/js/1afe06e6.8c29c435.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[289],{4344:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var t=r(4848),o=r(8453);const i={id:"dropWhile"},s=void 0,l={id:"dropWhile",title:"dropWhile",description:"dropWhile() function",source:"@site/docs/dropWhile.md",sourceDirName:".",slug:"/dropWhile",permalink:"/docs/dropWhile",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"dropWhile"},sidebar:"api",previous:{title:"dropUntil",permalink:"/docs/dropUntil"},next:{title:"entries",permalink:"/docs/entries"}},a={},c=[{value:"dropWhile() function",id:"dropwhile-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"dropwhile-function",children:"dropWhile() function"}),"\n",(0,t.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable excluding elements dropped from the beginning. Elements are dropped until the value applied to ",(0,t.jsx)(n.code,{children:"f"})," returns falsey."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function dropWhile(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function dropWhile(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function dropWhile | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = dropWhile((a) => a < 3, [1, 2, 3, 4, 5]);\r\niter.next(); // {done:false, value: 3}\r\niter.next(); // {done:false, value: 4}\r\niter.next(); // {done:false, value: 5}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n dropWhile((a) => a < 3),\r\n toArray,\r\n); // [3, 4, 5]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n dropWhile((a) => a < 3),\r\n toArray,\r\n); // [3, 4, 5]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n toAsync,\r\n dropWhile(async (a) => a < 3),\r\n toArray,\r\n); // [3, 4, 5]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)],\r\n toAsync,\r\n dropWhile((a) => a < 3),\r\n toArray,\r\n); // [3, 4, 5]\r\n\n"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>l});var t=r(6540);const o={},i=t.createContext(o);function s(e){const n=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[289],{4344:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>a,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var t=n(4848),o=n(8453);const i={id:"dropWhile"},s=void 0,l={id:"dropWhile",title:"dropWhile",description:"dropWhile() function",source:"@site/docs/dropWhile.md",sourceDirName:".",slug:"/dropWhile",permalink:"/docs/dropWhile",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"dropWhile"},sidebar:"api",previous:{title:"dropUntil",permalink:"/docs/dropUntil"},next:{title:"entries",permalink:"/docs/entries"}},a={},c=[{value:"dropWhile() function",id:"dropwhile-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h2,{id:"dropwhile-function",children:"dropWhile() function"}),"\n",(0,t.jsxs)(r.p,{children:["Returns Iterable/AsyncIterable excluding elements dropped from the beginning. Elements are dropped until the value applied to ",(0,t.jsx)(r.code,{children:"f"})," returns falsey."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"declare function dropWhile(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function dropWhile(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function dropWhile | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"const iter = dropWhile((a) => a < 3, [1, 2, 3, 4, 5]);\r\niter.next(); // {done:false, value: 3}\r\niter.next(); // {done:false, value: 4}\r\niter.next(); // {done:false, value: 5}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n dropWhile((a) => a < 3),\r\n toArray,\r\n); // [3, 4, 5]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n dropWhile((a) => a < 3),\r\n toArray,\r\n); // [3, 4, 5]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n toAsync,\r\n dropWhile(async (a) => a < 3),\r\n toArray,\r\n); // [3, 4, 5]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)],\r\n toAsync,\r\n dropWhile((a) => a < 3),\r\n toArray,\r\n); // [3, 4, 5]\r\n\n"})}),"\n",(0,t.jsxs)(r.p,{children:["see ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/dropWhile.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:r}={...(0,o.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>s,x:()=>l});var t=n(6540);const o={},i=t.createContext(o);function s(e){const r=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function l(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),t.createElement(i.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1d08bea3.050f02ca.js b/assets/js/1d08bea3.050f02ca.js deleted file mode 100644 index 5eb88ac0..00000000 --- a/assets/js/1d08bea3.050f02ca.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1795],{7829:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>c,default:()=>u,frontMatter:()=>r,metadata:()=>i,toc:()=>s});var l=t(4848),a=t(8453);const r={id:"delay"},c=void 0,i={id:"delay",title:"delay",description:"delay() function",source:"@site/docs/delay.md",sourceDirName:".",slug:"/delay",permalink:"/docs/delay",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"delay"},sidebar:"api",previous:{title:"curry",permalink:"/docs/curry"},next:{title:"each",permalink:"/docs/each"}},o={},s=[{value:"delay() function",id:"delay-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.h2,{id:"delay-function",children:"delay() function"}),"\n",(0,l.jsxs)(n.p,{children:["Delays the value by given ",(0,l.jsx)(n.code,{children:"wait"})," time"]}),"\n",(0,l.jsx)("b",{children:"Signature:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-typescript",children:"declare function delay(wait: number): Promise;\n\ndeclare function delay(wait: number, value: T): Promise;\n"})}),"\n",(0,l.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"await delay(1000);\r\nconsole.log('hello'); // after 1000 milliseconds log hello\n"})})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>i});var l=t(6540);const a={},r=l.createContext(a);function c(e){const n=l.useContext(r);return l.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:c(e.components),l.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/1d08bea3.a9b74722.js b/assets/js/1d08bea3.a9b74722.js new file mode 100644 index 00000000..42a7086c --- /dev/null +++ b/assets/js/1d08bea3.a9b74722.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1795],{7829:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>c,default:()=>u,frontMatter:()=>r,metadata:()=>i,toc:()=>s});var l=t(4848),a=t(8453);const r={id:"delay"},c=void 0,i={id:"delay",title:"delay",description:"delay() function",source:"@site/docs/delay.md",sourceDirName:".",slug:"/delay",permalink:"/docs/delay",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"delay"},sidebar:"api",previous:{title:"curry",permalink:"/docs/curry"},next:{title:"each",permalink:"/docs/each"}},o={},s=[{value:"delay() function",id:"delay-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.h2,{id:"delay-function",children:"delay() function"}),"\n",(0,l.jsxs)(n.p,{children:["Delays the value by given ",(0,l.jsx)(n.code,{children:"wait"})," time"]}),"\n",(0,l.jsx)("b",{children:"Signature:"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-typescript",children:"declare function delay(wait: number): Promise;\n\ndeclare function delay(wait: number, value: T): Promise;\n"})}),"\n",(0,l.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-ts",children:"await delay(1000);\r\nconsole.log('hello'); // after 1000 milliseconds log hello\n"})}),"\n",(0,l.jsx)(n.p,{children:(0,l.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/delay.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>i});var l=t(6540);const a={},r=l.createContext(a);function c(e){const n=l.useContext(r);return l.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:c(e.components),l.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/210bf649.2d11665b.js b/assets/js/210bf649.100b94cb.js similarity index 78% rename from assets/js/210bf649.2d11665b.js rename to assets/js/210bf649.100b94cb.js index 9e72fe47..0c25f526 100644 --- a/assets/js/210bf649.2d11665b.js +++ b/assets/js/210bf649.100b94cb.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2287],{5114:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>l,frontMatter:()=>p,metadata:()=>i,toc:()=>c});var t=r(4848),s=r(8453);const p={id:"prepend"},o=void 0,i={id:"prepend",title:"prepend",description:"prepend() function",source:"@site/docs/prepend.md",sourceDirName:".",slug:"/prepend",permalink:"/docs/prepend",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"prepend"},sidebar:"api",previous:{title:"pluck",permalink:"/docs/pluck"},next:{title:"range",permalink:"/docs/range"}},a={},c=[{value:"prepend() function",id:"prepend-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"prepend-function",children:"prepend() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns Iterable/AsyncIterable with the given element at the front, followed by the contents of iterable."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function prepend(a: A, iterable: Iterable): IterableIterator;\n\ndeclare function prepend(a: A | Promise, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function prepend | AsyncIterable>>(a: A): (iterable: B) => ReturnPrependType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = prepend(4, [1, 2, 3]);\r\niter.next() // {done:false, value: 4}\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 3}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3],\r\n prepend(4),\r\n toArray,\r\n); // [4, 1, 2, 3]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3]),\r\n prepend(4),\r\n toArray,\r\n); // [4, 1, 2, 3]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],\r\n toAsync,\r\n prepend(4),\r\n toArray,\r\n); // [4, 1, 2, 3]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-prepend-70ymx",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function l(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>i});var t=r(6540);const s={},p=t.createContext(s);function o(e){const n=t.useContext(p);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),t.createElement(p.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2287],{5114:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>l,frontMatter:()=>p,metadata:()=>i,toc:()=>c});var t=r(4848),s=r(8453);const p={id:"prepend"},o=void 0,i={id:"prepend",title:"prepend",description:"prepend() function",source:"@site/docs/prepend.md",sourceDirName:".",slug:"/prepend",permalink:"/docs/prepend",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"prepend"},sidebar:"api",previous:{title:"pluck",permalink:"/docs/pluck"},next:{title:"range",permalink:"/docs/range"}},a={},c=[{value:"prepend() function",id:"prepend-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"prepend-function",children:"prepend() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns Iterable/AsyncIterable with the given element at the front, followed by the contents of iterable."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function prepend(a: A, iterable: Iterable): IterableIterator;\n\ndeclare function prepend(a: A | Promise, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function prepend | AsyncIterable>>(a: A): (iterable: B) => ReturnPrependType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = prepend(4, [1, 2, 3]);\r\niter.next() // {done:false, value: 4}\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 3}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3],\r\n prepend(4),\r\n toArray,\r\n); // [4, 1, 2, 3]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3]),\r\n prepend(4),\r\n toArray,\r\n); // [4, 1, 2, 3]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],\r\n toAsync,\r\n prepend(4),\r\n toArray,\r\n); // [4, 1, 2, 3]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-prepend-70ymx",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/prepend.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>i});var t=r(6540);const s={},p=t.createContext(s);function o(e){const n=t.useContext(p);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),t.createElement(p.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/248f8a93.4588a0cc.js b/assets/js/248f8a93.2b5ad1b9.js similarity index 72% rename from assets/js/248f8a93.4588a0cc.js rename to assets/js/248f8a93.2b5ad1b9.js index 46b4378d..174600f8 100644 --- a/assets/js/248f8a93.4588a0cc.js +++ b/assets/js/248f8a93.2b5ad1b9.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4834],{4174:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var r=t(4848),s=t(8453);const i={id:"head"},a=void 0,o={id:"head",title:"head",description:"head() function",source:"@site/docs/head.md",sourceDirName:".",slug:"/head",permalink:"/docs/head",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"head"},sidebar:"api",previous:{title:"gte",permalink:"/docs/gte"},next:{title:"identity",permalink:"/docs/identity"}},c={},d=[{value:"head() function",id:"head-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"head-function",children:"head() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns the first element of Iterable/AsyncIterable."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function head | AsyncIterable>(iterable: T): HeadReturnType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"head([1, 2, 3, 4, 5]); // 1\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n head,\r\n); // 1\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n head,\r\n); // 1\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],\r\n toAsync,\r\n head,\r\n); // 1\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-head-4sh8u",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"})]})]})}function h(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>o});var r=t(6540);const s={},i=r.createContext(s);function a(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4834],{4174:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>h,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var r=t(4848),s=t(8453);const i={id:"head"},a=void 0,o={id:"head",title:"head",description:"head() function",source:"@site/docs/head.md",sourceDirName:".",slug:"/head",permalink:"/docs/head",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"head"},sidebar:"api",previous:{title:"gte",permalink:"/docs/gte"},next:{title:"identity",permalink:"/docs/identity"}},c={},d=[{value:"head() function",id:"head-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"head-function",children:"head() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns the first element of Iterable/AsyncIterable."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function head | AsyncIterable>(iterable: T): HeadReturnType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"head([1, 2, 3, 4, 5]); // 1\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n head,\r\n); // 1\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n head,\r\n); // 1\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],\r\n toAsync,\r\n head,\r\n); // 1\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-head-4sh8u",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/head.ts",children:"Open Source Code"})})]})}function h(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>o});var r=t(6540);const s={},i=r.createContext(s);function a(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/264024be.5b62c829.js b/assets/js/264024be.5b62c829.js deleted file mode 100644 index 9370207e..00000000 --- a/assets/js/264024be.5b62c829.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9446],{2269:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>c,metadata:()=>l,toc:()=>o});var t=r(4848),a=r(8453);const c={id:"scan"},s=void 0,l={id:"scan",title:"scan",description:"scan() function",source:"@site/docs/scan.md",sourceDirName:".",slug:"/scan",permalink:"/docs/scan",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"scan"},sidebar:"api",previous:{title:"reverse",permalink:"/docs/reverse"},next:{title:"slice",permalink:"/docs/slice"}},i={},o=[{value:"scan() function",id:"scan-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"scan-function",children:"scan() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns a Iterable/AsyncIterable of successively reduced values from the left. It's similar to reduce"}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function scan(f: (a: A, b: A) => A, iterable: Iterable): IterableIterator;\n\ndeclare function scan(f: Arrow, iterable: A): IterableIterator;\n\ndeclare function scan(f: (a: B, b: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function scan(f: Arrow, seed: B, iterable: A): IterableIterator;\n\ndeclare function scan(f: (a: B, b: A) => B, seed: B, iterable: Iterable): IterableIterator;\n\ndeclare function scan(f: (a: A, b: A) => A | Promise, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function scan(f: (a: Awaited, b: A) => B | Promise, iterable: AsyncIterable): AsyncIterableIterator>;\n\ndeclare function scan(f: (a: Awaited, b: A) => B | Promise, seed: B | Promise, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function scan | AsyncIterable, B>(f: (a: B, b: IterableInfer) => B | Promise): (iterable: A) => ReturnIterableIteratorType;\n\ndeclare function scan | AsyncIterable>(f: (a: IterableInfer, b: IterableInfer) => IterableInfer | Promise>): (iterable: A) => ReturnIterableIteratorType>;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = scan((acc, cur) => acc * cur, 1, [1, 2, 3, 4 ]);\r\niter.next(); // {value: 1, done:false}\r\niter.next(); // {value: 1, done:false}\r\niter.next(); // {value: 2, done:false}\r\niter.next(); // {value: 6, done:false}\r\niter.next(); // {value: 24, done:false}\r\niter.next(); // {value: undefined, done: true}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n scan((acc, cur) => acc * cur),\r\n toArray,\r\n); // [1, 2, 6, 24]\n"})})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>l});var t=r(6540);const a={},c=t.createContext(a);function s(e){const n=t.useContext(c);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),t.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/264024be.ee21b5b0.js b/assets/js/264024be.ee21b5b0.js new file mode 100644 index 00000000..6dd21687 --- /dev/null +++ b/assets/js/264024be.ee21b5b0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9446],{2269:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>c,metadata:()=>l,toc:()=>o});var t=r(4848),a=r(8453);const c={id:"scan"},s=void 0,l={id:"scan",title:"scan",description:"scan() function",source:"@site/docs/scan.md",sourceDirName:".",slug:"/scan",permalink:"/docs/scan",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"scan"},sidebar:"api",previous:{title:"reverse",permalink:"/docs/reverse"},next:{title:"slice",permalink:"/docs/slice"}},i={},o=[{value:"scan() function",id:"scan-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"scan-function",children:"scan() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns a Iterable/AsyncIterable of successively reduced values from the left. It's similar to reduce"}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function scan(f: (a: A, b: A) => A, iterable: Iterable): IterableIterator;\n\ndeclare function scan(f: Arrow, iterable: A): IterableIterator;\n\ndeclare function scan(f: (a: B, b: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function scan(f: Arrow, seed: B, iterable: A): IterableIterator;\n\ndeclare function scan(f: (a: B, b: A) => B, seed: B, iterable: Iterable): IterableIterator;\n\ndeclare function scan(f: (a: A, b: A) => A | Promise, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function scan(f: (a: Awaited, b: A) => B | Promise, iterable: AsyncIterable): AsyncIterableIterator>;\n\ndeclare function scan(f: (a: Awaited, b: A) => B | Promise, seed: B | Promise, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function scan | AsyncIterable, B>(f: (a: B, b: IterableInfer) => B | Promise): (iterable: A) => ReturnIterableIteratorType;\n\ndeclare function scan | AsyncIterable>(f: (a: IterableInfer, b: IterableInfer) => IterableInfer | Promise>): (iterable: A) => ReturnIterableIteratorType>;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = scan((acc, cur) => acc * cur, 1, [1, 2, 3, 4 ]);\r\niter.next(); // {value: 1, done:false}\r\niter.next(); // {value: 1, done:false}\r\niter.next(); // {value: 2, done:false}\r\niter.next(); // {value: 6, done:false}\r\niter.next(); // {value: 24, done:false}\r\niter.next(); // {value: undefined, done: true}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n scan((acc, cur) => acc * cur),\r\n toArray,\r\n); // [1, 2, 6, 24]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/scan.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>l});var t=r(6540);const a={},c=t.createContext(a);function s(e){const n=t.useContext(c);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),t.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/2860049b.ad41c2d2.js b/assets/js/2860049b.25d4ab3e.js similarity index 80% rename from assets/js/2860049b.ad41c2d2.js rename to assets/js/2860049b.25d4ab3e.js index c8019d68..e19a16c8 100644 --- a/assets/js/2860049b.ad41c2d2.js +++ b/assets/js/2860049b.25d4ab3e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9806],{3527:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>y,frontMatter:()=>a,metadata:()=>o,toc:()=>d});var r=t(4848),i=t(8453);const a={id:"indexBy"},s=void 0,o={id:"indexBy",title:"indexBy",description:"indexBy() function",source:"@site/docs/indexBy.md",sourceDirName:".",slug:"/indexBy",permalink:"/docs/indexBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"indexBy"},sidebar:"api",previous:{title:"includes",permalink:"/docs/includes"},next:{title:"isArray",permalink:"/docs/isArray"}},c={},d=[{value:"indexBy() function",id:"indexby-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"indexby-function",children:"indexBy() function"}),"\n",(0,r.jsxs)(n.p,{children:["Given ",(0,r.jsx)(n.code,{children:"f"})," that generates a key, turns a list of objects into an object indexing the objects by the given key. Note that if multiple objects generate the same value for the indexing key only the last value will be included in the generated object."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function indexBy(f: (a: A) => A, iterable: Iterable): {\n [K in A]: K;\n};\n\ndeclare function indexBy(f: (a: A) => B, iterable: Iterable): {\n [K in B]: A;\n};\n\ndeclare function indexBy(f: (a: A) => A | Promise, iterable: AsyncIterable): Promise<{\n [K in A]: K;\n}>;\n\ndeclare function indexBy(f: (a: A) => B | Promise, iterable: AsyncIterable): Promise<{\n [K in B]: A;\n}>;\n\ndeclare function indexBy(f: (a: A) => B, iterable: Iterable): {\n [K in B]: A & {\n [K2 in GetKeyOf]: K;\n };\n};\n\ndeclare function indexBy(f: (a: A) => B | Promise, iterable: AsyncIterable): Promise<{\n [K in B]: A & {\n [K2 in GetKeyOf]: K;\n };\n}>;\n\ndeclare function indexBy | AsyncIterable, B extends Key>(f: (a: IterableInfer) => B | Promise): (iterable: A) => ReturnValueType;\n}>;\n\ndeclare function indexBy | AsyncIterable, F extends (a: IterableInfer) => any>(f: F): (iterable: I) => ReturnValueType>, IterableInfer> extends 1 ? {\n [key1 in Awaited>]: key1;\n} : {\n [key1 in Awaited>]: IterableInfer & {\n [key2 in GetKeyOf, object>, key1>]: key1;\n };\n}>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'const given = [\r\n { category: "clothes", desc: "good" },\r\n { category: "pants", desc: "bad" },\r\n { category: "shoes", desc: "not bad" },\r\n];\r\n\r\nindexBy(a => a.category, given);\r\n// {\r\n// clothes: { category: "clothes", desc: "good" },\r\n// pants: { category: "pants", desc: "bad" },\r\n// shoes: { category: "shoes", desc: "not bad" },\r\n// };\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-indexby-zpeok",children:"Try It"})})]})}function y(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>o});var r=t(6540);const i={},a=r.createContext(i);function s(e){const n=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),r.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9806],{3527:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>y,frontMatter:()=>s,metadata:()=>o,toc:()=>d});var r=t(4848),i=t(8453);const s={id:"indexBy"},a=void 0,o={id:"indexBy",title:"indexBy",description:"indexBy() function",source:"@site/docs/indexBy.md",sourceDirName:".",slug:"/indexBy",permalink:"/docs/indexBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"indexBy"},sidebar:"api",previous:{title:"includes",permalink:"/docs/includes"},next:{title:"isArray",permalink:"/docs/isArray"}},c={},d=[{value:"indexBy() function",id:"indexby-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"indexby-function",children:"indexBy() function"}),"\n",(0,r.jsxs)(n.p,{children:["Given ",(0,r.jsx)(n.code,{children:"f"})," that generates a key, turns a list of objects into an object indexing the objects by the given key. Note that if multiple objects generate the same value for the indexing key only the last value will be included in the generated object."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function indexBy(f: (a: A) => A, iterable: Iterable): {\n [K in A]: K;\n};\n\ndeclare function indexBy(f: (a: A) => B, iterable: Iterable): {\n [K in B]: A;\n};\n\ndeclare function indexBy(f: (a: A) => A | Promise, iterable: AsyncIterable): Promise<{\n [K in A]: K;\n}>;\n\ndeclare function indexBy(f: (a: A) => B | Promise, iterable: AsyncIterable): Promise<{\n [K in B]: A;\n}>;\n\ndeclare function indexBy(f: (a: A) => B, iterable: Iterable): {\n [K in B]: A & {\n [K2 in GetKeyOf]: K;\n };\n};\n\ndeclare function indexBy(f: (a: A) => B | Promise, iterable: AsyncIterable): Promise<{\n [K in B]: A & {\n [K2 in GetKeyOf]: K;\n };\n}>;\n\ndeclare function indexBy | AsyncIterable, B extends Key>(f: (a: IterableInfer) => B | Promise): (iterable: A) => ReturnValueType;\n}>;\n\ndeclare function indexBy | AsyncIterable, F extends (a: IterableInfer) => any>(f: F): (iterable: I) => ReturnValueType>, IterableInfer> extends 1 ? {\n [key1 in Awaited>]: key1;\n} : {\n [key1 in Awaited>]: IterableInfer & {\n [key2 in GetKeyOf, object>, key1>]: key1;\n };\n}>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'const given = [\r\n { category: "clothes", desc: "good" },\r\n { category: "pants", desc: "bad" },\r\n { category: "shoes", desc: "not bad" },\r\n];\r\n\r\nindexBy(a => a.category, given);\r\n// {\r\n// clothes: { category: "clothes", desc: "good" },\r\n// pants: { category: "pants", desc: "bad" },\r\n// shoes: { category: "shoes", desc: "not bad" },\r\n// };\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-indexby-zpeok",children:"Try It"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/indexBy.ts",children:"Open Source Code"})})]})}function y(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>o});var r=t(6540);const i={},s=r.createContext(i);function a(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/31ccc530.273a3c3f.js b/assets/js/31ccc530.c0a46178.js similarity index 72% rename from assets/js/31ccc530.273a3c3f.js rename to assets/js/31ccc530.c0a46178.js index bbe62bf8..0bfb9a17 100644 --- a/assets/js/31ccc530.273a3c3f.js +++ b/assets/js/31ccc530.c0a46178.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8712],{7611:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>i});var r=t(4848),c=t(8453);const a={id:"pluck"},s=void 0,o={id:"pluck",title:"pluck",description:"pluck() function",source:"@site/docs/pluck.md",sourceDirName:".",slug:"/pluck",permalink:"/docs/pluck",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"pluck"},sidebar:"api",previous:{title:"pipeLazy",permalink:"/docs/pipeLazy"},next:{title:"prepend",permalink:"/docs/prepend"}},l={},i=[{value:"pluck() function",id:"pluck-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"pluck-function",children:"pluck() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns Iterable/AsyncIterable by plucking the same named property off all objects in Iterable/AsyncIterable supplied."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function pluck(key: K, iterable: Iterable): IterableIterator;\n\ndeclare function pluck(key: K): (iterable: Iterable) => IterableIterator;\n\ndeclare function pluck(key: K, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function pluck(key: K): (iterable: AsyncIterable) => AsyncIterableIterator;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = pluck('age', [{age:21}, {age:22}, {age:23}]);\r\niter.next(); // {done:false, value: 21}\r\niter.next(); // {done:false, value: 22}\r\niter.next(); // {done:false, value: 23}\r\n\r\n// with pipe\r\npipe(\r\n [{age:21}, {age:22}, {age:23}],\r\n pluck('age'),\r\n toArray,\r\n); // [21, 22 ,23]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([{age:21}, {age:22}, {age:23}]),\r\n toAsync,\r\n pluck('age'),\r\n toArray,\r\n); // [21, 22 ,23]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve({age:21}), Promise.resolve({age:22}), Promise.resolve({age:23})],\r\n toAsync,\r\n pluck('age'),\r\n toArray,\r\n); // [21, 22 ,23]\n"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function u(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>o});var r=t(6540);const c={},a=r.createContext(c);function s(e){const n=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),r.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8712],{7611:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>i});var r=t(4848),c=t(8453);const a={id:"pluck"},s=void 0,l={id:"pluck",title:"pluck",description:"pluck() function",source:"@site/docs/pluck.md",sourceDirName:".",slug:"/pluck",permalink:"/docs/pluck",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"pluck"},sidebar:"api",previous:{title:"pipeLazy",permalink:"/docs/pipeLazy"},next:{title:"prepend",permalink:"/docs/prepend"}},o={},i=[{value:"pluck() function",id:"pluck-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"pluck-function",children:"pluck() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns Iterable/AsyncIterable by plucking the same named property off all objects in Iterable/AsyncIterable supplied."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function pluck(key: K, iterable: Iterable): IterableIterator;\n\ndeclare function pluck(key: K): (iterable: Iterable) => IterableIterator;\n\ndeclare function pluck(key: K, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function pluck(key: K): (iterable: AsyncIterable) => AsyncIterableIterator;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = pluck('age', [{age:21}, {age:22}, {age:23}]);\r\niter.next(); // {done:false, value: 21}\r\niter.next(); // {done:false, value: 22}\r\niter.next(); // {done:false, value: 23}\r\n\r\n// with pipe\r\npipe(\r\n [{age:21}, {age:22}, {age:23}],\r\n pluck('age'),\r\n toArray,\r\n); // [21, 22 ,23]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([{age:21}, {age:22}, {age:23}]),\r\n toAsync,\r\n pluck('age'),\r\n toArray,\r\n); // [21, 22 ,23]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve({age:21}), Promise.resolve({age:22}), Promise.resolve({age:23})],\r\n toAsync,\r\n pluck('age'),\r\n toArray,\r\n); // [21, 22 ,23]\n"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/pluck.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>l});var r=t(6540);const c={},a=r.createContext(c);function s(e){const n=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),r.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/3386ce0f.48f8e249.js b/assets/js/3386ce0f.48f8e249.js deleted file mode 100644 index 59024cbe..00000000 --- a/assets/js/3386ce0f.48f8e249.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9297],{7389:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>u,contentTitle:()=>c,default:()=>d,frontMatter:()=>t,metadata:()=>a,toc:()=>l});var s=r(4848),i=r(8453);const t={id:"isNumber"},c=void 0,a={id:"isNumber",title:"isNumber",description:"isNumber variable",source:"@site/docs/isNumber.md",sourceDirName:".",slug:"/isNumber",permalink:"/docs/isNumber",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isNumber"},sidebar:"api",previous:{title:"isNil",permalink:"/docs/isNil"},next:{title:"isObject",permalink:"/docs/isObject"}},u={},l=[{value:"isNumber variable",id:"isnumber-variable",level:2},{value:"Example",id:"example",level:2}];function o(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"isnumber-variable",children:"isNumber variable"}),"\n",(0,s.jsxs)(n.p,{children:["Returns true if ",(0,s.jsx)(n.code,{children:"n"})," is a Number."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"isNumber: (n: T) => n is Include\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:'isNumber(2); // true\r\nisNumber("a"); // false\n'})})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(o,{...e})}):o(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>c,x:()=>a});var s=r(6540);const i={},t=s.createContext(i);function c(e){const n=s.useContext(t);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:c(e.components),s.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/3386ce0f.c315dde2.js b/assets/js/3386ce0f.c315dde2.js new file mode 100644 index 00000000..278071ad --- /dev/null +++ b/assets/js/3386ce0f.c315dde2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9297],{7389:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>c,default:()=>d,frontMatter:()=>t,metadata:()=>a,toc:()=>u});var s=r(4848),i=r(8453);const t={id:"isNumber"},c=void 0,a={id:"isNumber",title:"isNumber",description:"isNumber variable",source:"@site/docs/isNumber.md",sourceDirName:".",slug:"/isNumber",permalink:"/docs/isNumber",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isNumber"},sidebar:"api",previous:{title:"isNil",permalink:"/docs/isNil"},next:{title:"isObject",permalink:"/docs/isObject"}},l={},u=[{value:"isNumber variable",id:"isnumber-variable",level:2},{value:"Example",id:"example",level:2}];function o(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"isnumber-variable",children:"isNumber variable"}),"\n",(0,s.jsxs)(n.p,{children:["Returns true if ",(0,s.jsx)(n.code,{children:"n"})," is a Number."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"isNumber: (n: T) => n is Include\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:'isNumber(2); // true\r\nisNumber("a"); // false\n'})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/isNumber.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(o,{...e})}):o(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>c,x:()=>a});var s=r(6540);const i={},t=s.createContext(i);function c(e){const n=s.useContext(t);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:c(e.components),s.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/3e2cea56.337d1748.js b/assets/js/3e2cea56.337d1748.js deleted file mode 100644 index fecae1ff..00000000 --- a/assets/js/3e2cea56.337d1748.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[421],{7646:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>r,default:()=>u,frontMatter:()=>c,metadata:()=>d,toc:()=>a});var i=n(4848),s=n(8453);const c={id:"identity"},r=void 0,d={id:"identity",title:"identity",description:"identity() function",source:"@site/docs/identity.md",sourceDirName:".",slug:"/identity",permalink:"/docs/identity",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"identity"},sidebar:"api",previous:{title:"head",permalink:"/docs/head"},next:{title:"includes",permalink:"/docs/includes"}},o={},a=[{value:"identity() function",id:"identity-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h2,{id:"identity-function",children:"identity() function"}),"\n",(0,i.jsx)(t.p,{children:"Returns the same value as the given argument."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-typescript",children:"declare function identity(a: T): T;\n"})}),"\n",(0,i.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",children:"identity(5); // 5\n"})})]})}function u(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>r,x:()=>d});var i=n(6540);const s={},c=i.createContext(s);function r(e){const t=i.useContext(c);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),i.createElement(c.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/3e2cea56.4a11746b.js b/assets/js/3e2cea56.4a11746b.js new file mode 100644 index 00000000..cd3f866e --- /dev/null +++ b/assets/js/3e2cea56.4a11746b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[421],{7646:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>r,default:()=>u,frontMatter:()=>c,metadata:()=>d,toc:()=>a});var i=n(4848),s=n(8453);const c={id:"identity"},r=void 0,d={id:"identity",title:"identity",description:"identity() function",source:"@site/docs/identity.md",sourceDirName:".",slug:"/identity",permalink:"/docs/identity",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"identity"},sidebar:"api",previous:{title:"head",permalink:"/docs/head"},next:{title:"includes",permalink:"/docs/includes"}},o={},a=[{value:"identity() function",id:"identity-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h2,{id:"identity-function",children:"identity() function"}),"\n",(0,i.jsx)(t.p,{children:"Returns the same value as the given argument."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-typescript",children:"declare function identity(a: T): T;\n"})}),"\n",(0,i.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",children:"identity(5); // 5\n"})}),"\n",(0,i.jsx)(t.p,{children:(0,i.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/identity.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>r,x:()=>d});var i=n(6540);const s={},c=i.createContext(s);function r(e){const t=i.useContext(c);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),i.createElement(c.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/41427dbd.4d1069dc.js b/assets/js/41427dbd.4d1069dc.js deleted file mode 100644 index efa6d58e..00000000 --- a/assets/js/41427dbd.4d1069dc.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[427],{2921:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>i,toc:()=>o});var a=t(4848),s=t(8453);const r={id:"always"},l=void 0,i={id:"always",title:"always",description:"always() function",source:"@site/docs/always.md",sourceDirName:".",slug:"/always",permalink:"/docs/always",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"always"},sidebar:"api",previous:{title:"add",permalink:"/docs/add"},next:{title:"apply",permalink:"/docs/apply"}},c={},o=[{value:"always() function",id:"always-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h2,{id:"always-function",children:"always() function"}),"\n",(0,a.jsx)(n.p,{children:"Returns a function that always returns the given value."}),"\n",(0,a.jsx)("b",{children:"Signature:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-typescript",children:"declare function always(value: T): (...args: any[]) => T;\n"})}),"\n",(0,a.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-ts",children:'const alwaysFive = always(5);\r\nalwaysFive(); // 5\r\n\r\nconst defaultToEmpty = always("");\r\nawait Promise.reject("error during operation").catch(defaultToEmpty); // ""\r\n\r\n// with pipe\r\nconst excludeNegatives = false;\r\npipe(\r\n [-1, 1, 2, 0 ,-3],\r\n filter(excludeNegatives ? lt(0) : always(true)),\r\n toArray,\r\n); // [-1, 1, 2, 0 ,-3]\n'})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>l,x:()=>i});var a=t(6540);const s={},r=a.createContext(s);function l(e){const n=a.useContext(r);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),a.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/41427dbd.7489012b.js b/assets/js/41427dbd.7489012b.js new file mode 100644 index 00000000..28211113 --- /dev/null +++ b/assets/js/41427dbd.7489012b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[427],{2921:(e,n,a)=>{a.r(n),a.d(n,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>i,toc:()=>o});var t=a(4848),s=a(8453);const r={id:"always"},l=void 0,i={id:"always",title:"always",description:"always() function",source:"@site/docs/always.md",sourceDirName:".",slug:"/always",permalink:"/docs/always",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"always"},sidebar:"api",previous:{title:"add",permalink:"/docs/add"},next:{title:"apply",permalink:"/docs/apply"}},c={},o=[{value:"always() function",id:"always-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"always-function",children:"always() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns a function that always returns the given value."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function always(value: T): (...args: any[]) => T;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:'const alwaysFive = always(5);\r\nalwaysFive(); // 5\r\n\r\nconst defaultToEmpty = always("");\r\nawait Promise.reject("error during operation").catch(defaultToEmpty); // ""\r\n\r\n// with pipe\r\nconst excludeNegatives = false;\r\npipe(\r\n [-1, 1, 2, 0 ,-3],\r\n filter(excludeNegatives ? lt(0) : always(true)),\r\n toArray,\r\n); // [-1, 1, 2, 0 ,-3]\n'})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/always.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,a)=>{a.d(n,{R:()=>l,x:()=>i});var t=a(6540);const s={},r=t.createContext(s);function l(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/41bcc097.edf21fb0.js b/assets/js/41bcc097.b142f783.js similarity index 51% rename from assets/js/41bcc097.edf21fb0.js rename to assets/js/41bcc097.b142f783.js index af985b24..002de279 100644 --- a/assets/js/41bcc097.edf21fb0.js +++ b/assets/js/41bcc097.b142f783.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5042],{7556:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>c,default:()=>d,frontMatter:()=>o,metadata:()=>a,toc:()=>l});var r=n(4848),s=n(8453);const o={id:"compress"},c=void 0,a={id:"compress",title:"compress",description:"compress() function",source:"@site/docs/compress.md",sourceDirName:".",slug:"/compress",permalink:"/docs/compress",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"compress"},sidebar:"api",previous:{title:"compact",permalink:"/docs/compact"},next:{title:"concat",permalink:"/docs/concat"}},i={},l=[{value:"compress() function",id:"compress-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"compress-function",children:"compress() function"}),"\n",(0,r.jsx)(t.p,{children:"Returns Iterable/AsyncIterable that filters elements from 'iterable' returning only those that have a corresponding element in 'selectors' that evaluates to 'true'. Stops when either 'iterable' or 'selectors' has been exhausted."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function compress(selector: Array, iterable: Iterable): IterableIterator;\n\ndeclare function compress(selector: Array, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function compress | AsyncIterable>(selector: Array): (iterable: B) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:'const iter1 = compress([false,true,false,false,true], [1, 2, 3, 4, 5]);\r\niter1.next(); // {value: 2, done:false}\r\niter1.next(); // {value: 5, done:false}\r\niter1.next(); // {value: undefined, done:true }\r\n\r\nconst iter2 = compress([1,0,0,1,0], "abcde");\r\niter2.next(); // {value: "a", done:false}\r\niter2.next(); // {value: "d", done:false}\r\niter2.next(); // {value: undefined, done:true }\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3],\r\n compress([false, true, true]),\r\n toArray,\r\n); // [2, 3]\n'})}),"\n",(0,r.jsxs)(t.p,{children:["see ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function d(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>a});var r=n(6540);const s={},o=r.createContext(s);function c(e){const t=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),r.createElement(o.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5042],{7556:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>i,contentTitle:()=>c,default:()=>d,frontMatter:()=>o,metadata:()=>a,toc:()=>l});var n=t(4848),s=t(8453);const o={id:"compress"},c=void 0,a={id:"compress",title:"compress",description:"compress() function",source:"@site/docs/compress.md",sourceDirName:".",slug:"/compress",permalink:"/docs/compress",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"compress"},sidebar:"api",previous:{title:"compact",permalink:"/docs/compact"},next:{title:"concat",permalink:"/docs/concat"}},i={},l=[{value:"compress() function",id:"compress-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.h2,{id:"compress-function",children:"compress() function"}),"\n",(0,n.jsx)(r.p,{children:"Returns Iterable/AsyncIterable that filters elements from 'iterable' returning only those that have a corresponding element in 'selectors' that evaluates to 'true'. Stops when either 'iterable' or 'selectors' has been exhausted."}),"\n",(0,n.jsx)("b",{children:"Signature:"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-typescript",children:"declare function compress(selector: Array, iterable: Iterable): IterableIterator;\n\ndeclare function compress(selector: Array, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function compress | AsyncIterable>(selector: Array): (iterable: B) => ReturnIterableIteratorType;\n"})}),"\n",(0,n.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,n.jsx)(r.pre,{children:(0,n.jsx)(r.code,{className:"language-ts",children:'const iter1 = compress([false,true,false,false,true], [1, 2, 3, 4, 5]);\r\niter1.next(); // {value: 2, done:false}\r\niter1.next(); // {value: 5, done:false}\r\niter1.next(); // {value: undefined, done:true }\r\n\r\nconst iter2 = compress([1,0,0,1,0], "abcde");\r\niter2.next(); // {value: "a", done:false}\r\niter2.next(); // {value: "d", done:false}\r\niter2.next(); // {value: undefined, done:true }\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3],\r\n compress([false, true, true]),\r\n toArray,\r\n); // [2, 3]\n'})}),"\n",(0,n.jsxs)(r.p,{children:["see ",(0,n.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,n.jsx)(r.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,n.jsx)(r.p,{children:(0,n.jsx)(r.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/compress.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:r}={...(0,s.R)(),...e.components};return r?(0,n.jsx)(r,{...e,children:(0,n.jsx)(p,{...e})}):p(e)}},8453:(e,r,t)=>{t.d(r,{R:()=>c,x:()=>a});var n=t(6540);const s={},o=n.createContext(s);function c(e){const r=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function a(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),n.createElement(o.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/423df7e1.bf0c4a71.js b/assets/js/423df7e1.bf0c4a71.js new file mode 100644 index 00000000..1a878658 --- /dev/null +++ b/assets/js/423df7e1.bf0c4a71.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9667],{6430:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>r,metadata:()=>a,toc:()=>u});var i=t(4848),o=t(8453);const r={id:"negate"},s=void 0,a={id:"negate",title:"negate",description:"negate() function",source:"@site/docs/negate.md",sourceDirName:".",slug:"/negate",permalink:"/docs/negate",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"negate"},sidebar:"api",previous:{title:"min",permalink:"/docs/min"},next:{title:"noop",permalink:"/docs/noop"}},c={},u=[{value:"negate() function",id:"negate-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"negate-function",children:"negate() function"}),"\n",(0,i.jsx)(n.p,{children:"Create a function that returns the opposite result of a predicate function"}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function negate(predicate: (input: T) => boolean): (input: T) => boolean;\n\ndeclare function negate(predicate: (input: T) => input is N): (input: T) => input is Exclude;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const isDefined: (input: string | undefined) => input is string = negate(isUndefined)\r\n\r\nconst isDefined: (input: unknown) => boolean = negate((input) => input === undefined)\n"})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/negate.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var i=t(6540);const o={},r=i.createContext(o);function s(e){const n=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/423df7e1.e0d3cf81.js b/assets/js/423df7e1.e0d3cf81.js deleted file mode 100644 index 103ee653..00000000 --- a/assets/js/423df7e1.e0d3cf81.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9667],{6430:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>r,default:()=>p,frontMatter:()=>s,metadata:()=>a,toc:()=>u});var i=t(4848),o=t(8453);const s={id:"negate"},r=void 0,a={id:"negate",title:"negate",description:"negate() function",source:"@site/docs/negate.md",sourceDirName:".",slug:"/negate",permalink:"/docs/negate",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"negate"},sidebar:"api",previous:{title:"min",permalink:"/docs/min"},next:{title:"noop",permalink:"/docs/noop"}},c={},u=[{value:"negate() function",id:"negate-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"negate-function",children:"negate() function"}),"\n",(0,i.jsx)(n.p,{children:"Create a function that returns the opposite result of a predicate function"}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function negate(predicate: (input: T) => boolean): (input: T) => boolean;\n\ndeclare function negate(predicate: (input: T) => input is N): (input: T) => input is Exclude;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const isDefined: (input: string | undefined) => input is string = negate(isUndefined)\r\n\r\nconst isDefined: (input: unknown) => boolean = negate((input) => input === undefined)\n"})})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>r,x:()=>a});var i=t(6540);const o={},s=i.createContext(o);function r(e){const n=i.useContext(s);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:r(e.components),i.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/428581d6.d1692b91.js b/assets/js/428581d6.63d0cb25.js similarity index 70% rename from assets/js/428581d6.d1692b91.js rename to assets/js/428581d6.63d0cb25.js index eb5bd682..49a373d3 100644 --- a/assets/js/428581d6.d1692b91.js +++ b/assets/js/428581d6.63d0cb25.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7959],{2726:(n,e,t)=>{t.r(e),t.d(e,{assets:()=>i,contentTitle:()=>o,default:()=>f,frontMatter:()=>s,metadata:()=>c,toc:()=>d});var r=t(4848),a=t(8453);const s={id:"fx"},o=void 0,c={id:"fx",title:"fx",description:"fx() function",source:"@site/docs/fx.md",sourceDirName:".",slug:"/fx",permalink:"/docs/fx",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"fx"},sidebar:"api",previous:{title:"flatMap",permalink:"/docs/flatMap"},next:{title:"intersection",permalink:"/docs/intersection"}},i={},d=[{value:"fx() function",id:"fx-function",level:2},{value:"Example",id:"example",level:2}];function l(n){const e={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...n.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e.h2,{id:"fx-function",children:"fx() function"}),"\n",(0,r.jsxs)(e.p,{children:[(0,r.jsx)(e.code,{children:"fx"})," allows functions provided by existing ",(0,r.jsx)(e.code,{children:"fxts"})," to be used in a method chaining. Not all functions are provided as methods and can be connected through ",(0,r.jsx)(e.code,{children:"chain"})," if necessary."]}),"\n",(0,r.jsxs)(e.p,{children:["see ",(0,r.jsx)(e.a,{href:"https://fxts.dev/docs/method-chaining",children:"guide"})]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(e.pre,{children:(0,r.jsx)(e.code,{className:"language-typescript",children:"declare function fx | AsyncIterable>(a: T): T extends Iterable ? FxIterable> : FxAsyncIterable>;\n"})}),"\n",(0,r.jsx)(e.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(e.pre,{children:(0,r.jsx)(e.code,{className:"language-ts",children:"const syncArr1 = fx([1, 2, 3, 4])\r\n .map((a) => a + 10)\r\n .toArray(); // [11, 12, 13, 14]\r\n\r\n// If you want to use another function that is not provided for the method, use `chain`.\r\nconst syncArr2 = fx([1, 2, 3, 4])\r\n .chain(append(5))\r\n .map((a) => a + 10)\r\n .toArray(); // [11, 12, 13, 14, 15]\r\n\r\nconst asyncArr1 = await fx([1, 2, 3, 4])\r\n .toAsync()\r\n .map((a) => a + 10)\r\n .toArray(); // [11, 12, 13, 14]\r\n\r\nconst asyncArr2 = await fx(toAsync([1, 2, 3, 4]))\r\n .map((a) => a + 10)\r\n .toArray(); // [11, 12, 13, 14]\n"})})]})}function f(n={}){const{wrapper:e}={...(0,a.R)(),...n.components};return e?(0,r.jsx)(e,{...n,children:(0,r.jsx)(l,{...n})}):l(n)}},8453:(n,e,t)=>{t.d(e,{R:()=>o,x:()=>c});var r=t(6540);const a={},s=r.createContext(a);function o(n){const e=r.useContext(s);return r.useMemo((function(){return"function"==typeof n?n(e):{...e,...n}}),[e,n])}function c(n){let e;return e=n.disableParentContext?"function"==typeof n.components?n.components(a):n.components||a:o(n.components),r.createElement(s.Provider,{value:e},n.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7959],{2726:(n,e,t)=>{t.r(e),t.d(e,{assets:()=>i,contentTitle:()=>c,default:()=>f,frontMatter:()=>a,metadata:()=>o,toc:()=>d});var r=t(4848),s=t(8453);const a={id:"fx"},c=void 0,o={id:"fx",title:"fx",description:"fx() function",source:"@site/docs/fx.md",sourceDirName:".",slug:"/fx",permalink:"/docs/fx",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"fx"},sidebar:"api",previous:{title:"flatMap",permalink:"/docs/flatMap"},next:{title:"intersection",permalink:"/docs/intersection"}},i={},d=[{value:"fx() function",id:"fx-function",level:2},{value:"Example",id:"example",level:2}];function l(n){const e={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...n.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e.h2,{id:"fx-function",children:"fx() function"}),"\n",(0,r.jsxs)(e.p,{children:[(0,r.jsx)(e.code,{children:"fx"})," allows functions provided by existing ",(0,r.jsx)(e.code,{children:"fxts"})," to be used in a method chaining. Not all functions are provided as methods and can be connected through ",(0,r.jsx)(e.code,{children:"chain"})," if necessary."]}),"\n",(0,r.jsxs)(e.p,{children:["see ",(0,r.jsx)(e.a,{href:"https://fxts.dev/docs/method-chaining",children:"guide"})]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(e.pre,{children:(0,r.jsx)(e.code,{className:"language-typescript",children:"declare function fx | AsyncIterable>(a: T): T extends Iterable ? FxIterable> : FxAsyncIterable>;\n"})}),"\n",(0,r.jsx)(e.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(e.pre,{children:(0,r.jsx)(e.code,{className:"language-ts",children:"const syncArr1 = fx([1, 2, 3, 4])\r\n .map((a) => a + 10)\r\n .toArray(); // [11, 12, 13, 14]\r\n\r\n// If you want to use another function that is not provided for the method, use `chain`.\r\nconst syncArr2 = fx([1, 2, 3, 4])\r\n .chain(append(5))\r\n .map((a) => a + 10)\r\n .toArray(); // [11, 12, 13, 14, 15]\r\n\r\nconst asyncArr1 = await fx([1, 2, 3, 4])\r\n .toAsync()\r\n .map((a) => a + 10)\r\n .toArray(); // [11, 12, 13, 14]\r\n\r\nconst asyncArr2 = await fx(toAsync([1, 2, 3, 4]))\r\n .map((a) => a + 10)\r\n .toArray(); // [11, 12, 13, 14]\n"})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/fx.ts",children:"Open Source Code"})})]})}function f(n={}){const{wrapper:e}={...(0,s.R)(),...n.components};return e?(0,r.jsx)(e,{...n,children:(0,r.jsx)(l,{...n})}):l(n)}},8453:(n,e,t)=>{t.d(e,{R:()=>c,x:()=>o});var r=t(6540);const s={},a=r.createContext(s);function c(n){const e=r.useContext(a);return r.useMemo((function(){return"function"==typeof n?n(e):{...e,...n}}),[e,n])}function o(n){let e;return e=n.disableParentContext?"function"==typeof n.components?n.components(s):n.components||s:c(n.components),r.createElement(a.Provider,{value:e},n.children)}}}]); \ No newline at end of file diff --git a/assets/js/45b965f9.33c9bf3e.js b/assets/js/45b965f9.33c9bf3e.js deleted file mode 100644 index 97b7b14c..00000000 --- a/assets/js/45b965f9.33c9bf3e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5921],{3017:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>l});var s=t(4848),i=t(8453);const r={id:"size"},c=void 0,o={id:"size",title:"size",description:"size() function",source:"@site/docs/size.md",sourceDirName:".",slug:"/size",permalink:"/docs/size",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"size"},sidebar:"api",previous:{title:"reduceLazy",permalink:"/docs/reduceLazy"},next:{title:"some",permalink:"/docs/some"}},a={},l=[{value:"size() function",id:"size-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"size-function",children:"size() function"}),"\n",(0,s.jsx)(n.p,{children:"Returns the size of Iterable/AsyncIterable"}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function size | AsyncIterable>(iterable: A): ReturnValueType;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:'size([1, 2, 3, 4]); // 4\r\nsize("abcde"); // 5\r\n\r\nawait size(toAsync([1, 2, 3, 4])); // 4\n'})})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(u,{...e})}):u(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>o});var s=t(6540);const i={},r=s.createContext(i);function c(e){const n=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:c(e.components),s.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/45b965f9.e3723ff4.js b/assets/js/45b965f9.e3723ff4.js new file mode 100644 index 00000000..c6eb31ee --- /dev/null +++ b/assets/js/45b965f9.e3723ff4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5921],{3017:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>d,frontMatter:()=>r,metadata:()=>o,toc:()=>l});var s=t(4848),i=t(8453);const r={id:"size"},c=void 0,o={id:"size",title:"size",description:"size() function",source:"@site/docs/size.md",sourceDirName:".",slug:"/size",permalink:"/docs/size",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"size"},sidebar:"api",previous:{title:"reduceLazy",permalink:"/docs/reduceLazy"},next:{title:"some",permalink:"/docs/some"}},a={},l=[{value:"size() function",id:"size-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"size-function",children:"size() function"}),"\n",(0,s.jsx)(n.p,{children:"Returns the size of Iterable/AsyncIterable"}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function size | AsyncIterable>(iterable: A): ReturnValueType;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:'size([1, 2, 3, 4]); // 4\r\nsize("abcde"); // 5\r\n\r\nawait size(toAsync([1, 2, 3, 4])); // 4\n'})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/size.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(u,{...e})}):u(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>o});var s=t(6540);const i={},r=s.createContext(i);function c(e){const n=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:c(e.components),s.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/47330074.fa37dda2.js b/assets/js/47330074.dea81c18.js similarity index 76% rename from assets/js/47330074.fa37dda2.js rename to assets/js/47330074.dea81c18.js index 69d7d2ee..0fc03efb 100644 --- a/assets/js/47330074.fa37dda2.js +++ b/assets/js/47330074.dea81c18.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7291],{725:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var t=r(4848),i=r(8453);const s={id:"uniq"},o=void 0,c={id:"uniq",title:"uniq",description:"uniq() function",source:"@site/docs/uniq.md",sourceDirName:".",slug:"/uniq",permalink:"/docs/uniq",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"uniq"},sidebar:"api",previous:{title:"toAsync",permalink:"/docs/toAsync"},next:{title:"uniqBy",permalink:"/docs/uniqBy"}},a={},l=[{value:"uniq() function",id:"uniq-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"uniq-function",children:"uniq() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns Iterable/AsyncIterable with duplicate values removed inside the given Iterable/AsyncIterable. Only primitive values can be compared."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function uniq | AsyncIterable>(iterable: A): ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = uniq([1, 2, 1, 3, 2]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 1, 3],\r\n uniq,\r\n toArray,\r\n); // [1, 2, 3]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 1, 3]),\r\n uniq,\r\n toArray,\r\n); // [1, 2, 3]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(1), Promise.resolve(3)],\r\n toAsync,\r\n uniq,\r\n toArray,\r\n); // [1, 2, 3]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-uniq-uljmk",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>c});var t=r(6540);const i={},s=t.createContext(i);function o(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7291],{725:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var t=r(4848),i=r(8453);const s={id:"uniq"},o=void 0,c={id:"uniq",title:"uniq",description:"uniq() function",source:"@site/docs/uniq.md",sourceDirName:".",slug:"/uniq",permalink:"/docs/uniq",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"uniq"},sidebar:"api",previous:{title:"toAsync",permalink:"/docs/toAsync"},next:{title:"uniqBy",permalink:"/docs/uniqBy"}},a={},l=[{value:"uniq() function",id:"uniq-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"uniq-function",children:"uniq() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns Iterable/AsyncIterable with duplicate values removed inside the given Iterable/AsyncIterable. Only primitive values can be compared."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function uniq | AsyncIterable>(iterable: A): ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = uniq([1, 2, 1, 3, 2]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 1, 3],\r\n uniq,\r\n toArray,\r\n); // [1, 2, 3]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 1, 3]),\r\n uniq,\r\n toArray,\r\n); // [1, 2, 3]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(1), Promise.resolve(3)],\r\n toAsync,\r\n uniq,\r\n toArray,\r\n); // [1, 2, 3]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-uniq-uljmk",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/uniq.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(u,{...e})}):u(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>c});var t=r(6540);const i={},s=t.createContext(i);function o(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/47332327.75dabcd8.js b/assets/js/47332327.75dabcd8.js new file mode 100644 index 00000000..5a51c5d6 --- /dev/null +++ b/assets/js/47332327.75dabcd8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7822],{5023:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>c,contentTitle:()=>t,default:()=>u,frontMatter:()=>i,metadata:()=>o,toc:()=>l});var s=n(4848),a=n(8453);const i={id:"isArray"},t=void 0,o={id:"isArray",title:"isArray",description:"isArray variable",source:"@site/docs/isArray.md",sourceDirName:".",slug:"/isArray",permalink:"/docs/isArray",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isArray"},sidebar:"api",previous:{title:"indexBy",permalink:"/docs/indexBy"},next:{title:"isBoolean",permalink:"/docs/isBoolean"}},c={},l=[{value:"isArray variable",id:"isarray-variable",level:2},{value:"Example",id:"example",level:2}];function d(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.h2,{id:"isarray-variable",children:"isArray variable"}),"\n",(0,s.jsxs)(r.p,{children:["Returns true if ",(0,s.jsx)(r.code,{children:"a"})," is an Array."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-typescript",children:"isArray: (a: T) => a is Include\n"})}),"\n",(0,s.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-ts",children:"isArray([1, 2, 3]); // true\r\nisArray(2); // false\n"})}),"\n",(0,s.jsx)(r.p,{children:(0,s.jsx)(r.a,{href:"https://github.com/marpple/FxTS/blob/main/src/isArray.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:r}={...(0,a.R)(),...e.components};return r?(0,s.jsx)(r,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>t,x:()=>o});var s=n(6540);const a={},i=s.createContext(a);function t(e){const r=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function o(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:t(e.components),s.createElement(i.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/47332327.a114955d.js b/assets/js/47332327.a114955d.js deleted file mode 100644 index 32e600bc..00000000 --- a/assets/js/47332327.a114955d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7822],{5023:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>c,contentTitle:()=>t,default:()=>u,frontMatter:()=>i,metadata:()=>o,toc:()=>l});var s=n(4848),a=n(8453);const i={id:"isArray"},t=void 0,o={id:"isArray",title:"isArray",description:"isArray variable",source:"@site/docs/isArray.md",sourceDirName:".",slug:"/isArray",permalink:"/docs/isArray",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isArray"},sidebar:"api",previous:{title:"indexBy",permalink:"/docs/indexBy"},next:{title:"isBoolean",permalink:"/docs/isBoolean"}},c={},l=[{value:"isArray variable",id:"isarray-variable",level:2},{value:"Example",id:"example",level:2}];function d(e){const r={code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.h2,{id:"isarray-variable",children:"isArray variable"}),"\n",(0,s.jsxs)(r.p,{children:["Returns true if ",(0,s.jsx)(r.code,{children:"a"})," is an Array."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-typescript",children:"isArray: (a: T) => a is Include\n"})}),"\n",(0,s.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(r.pre,{children:(0,s.jsx)(r.code,{className:"language-ts",children:"isArray([1, 2, 3]); // true\r\nisArray(2); // false\n"})})]})}function u(e={}){const{wrapper:r}={...(0,a.R)(),...e.components};return r?(0,s.jsx)(r,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>t,x:()=>o});var s=n(6540);const a={},i=s.createContext(a);function t(e){const r=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function o(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:t(e.components),s.createElement(i.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/47d70d6d.c41212f1.js b/assets/js/47d70d6d.470430ad.js similarity index 73% rename from assets/js/47d70d6d.c41212f1.js rename to assets/js/47d70d6d.470430ad.js index 5e58a508..151126e3 100644 --- a/assets/js/47d70d6d.c41212f1.js +++ b/assets/js/47d70d6d.470430ad.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2257],{5957:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>p,frontMatter:()=>c,metadata:()=>i,toc:()=>l});var s=t(4848),r=t(8453);const c={id:"toAsync"},o=void 0,i={id:"toAsync",title:"toAsync",description:"toAsync() function",source:"@site/docs/toAsync.md",sourceDirName:".",slug:"/toAsync",permalink:"/docs/toAsync",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"toAsync"},sidebar:"api",previous:{title:"takeWhile",permalink:"/docs/takeWhile"},next:{title:"uniq",permalink:"/docs/uniq"}},a={},l=[{value:"toAsync() function",id:"toasync-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"toasync-function",children:"toAsync() function"}),"\n",(0,s.jsxs)(n.p,{children:["Returns AsyncIterable, ",(0,s.jsx)(n.code,{children:"toAsync"})," used when you want to handle Promise values inside Iterable."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function toAsync(iter: Iterable>): AsyncIterableIterator;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"let acc = 0;\r\nfor await (const item of toAsync([1, 2, 3, 4, 5])) {\r\n acc += item;\r\n}\r\n// acc: 15\r\n\r\n// with pipe\r\nawait pipe(\r\n [Promise.resolve(1),Promise.resolve(2),Promise.resolve(3)],\r\n toAsync,\r\n map(a => a + 10),\r\n toArray, // [11, 12, 13]\r\n);\n"})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-toasync-00nxr",children:"Try It"})}),"\n",(0,s.jsxs)(n.p,{children:["see ",(0,s.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,s.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,s.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function p(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},c=s.createContext(r);function o(e){const n=s.useContext(c);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2257],{5957:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>p,frontMatter:()=>c,metadata:()=>i,toc:()=>l});var s=t(4848),r=t(8453);const c={id:"toAsync"},o=void 0,i={id:"toAsync",title:"toAsync",description:"toAsync() function",source:"@site/docs/toAsync.md",sourceDirName:".",slug:"/toAsync",permalink:"/docs/toAsync",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"toAsync"},sidebar:"api",previous:{title:"takeWhile",permalink:"/docs/takeWhile"},next:{title:"uniq",permalink:"/docs/uniq"}},a={},l=[{value:"toAsync() function",id:"toasync-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"toasync-function",children:"toAsync() function"}),"\n",(0,s.jsxs)(n.p,{children:["Returns AsyncIterable, ",(0,s.jsx)(n.code,{children:"toAsync"})," used when you want to handle Promise values inside Iterable."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function toAsync(iter: Iterable>): AsyncIterableIterator;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"let acc = 0;\r\nfor await (const item of toAsync([1, 2, 3, 4, 5])) {\r\n acc += item;\r\n}\r\n// acc: 15\r\n\r\n// with pipe\r\nawait pipe(\r\n [Promise.resolve(1),Promise.resolve(2),Promise.resolve(3)],\r\n toAsync,\r\n map(a => a + 10),\r\n toArray, // [11, 12, 13]\r\n);\n"})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-toasync-00nxr",children:"Try It"})}),"\n",(0,s.jsxs)(n.p,{children:["see ",(0,s.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,s.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,s.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/toAsync.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},c=s.createContext(r);function o(e){const n=s.useContext(c);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/49086167.e519f7da.js b/assets/js/49086167.b1ffded6.js similarity index 75% rename from assets/js/49086167.e519f7da.js rename to assets/js/49086167.b1ffded6.js index 908ba8da..70f8ba70 100644 --- a/assets/js/49086167.e519f7da.js +++ b/assets/js/49086167.b1ffded6.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3816],{1577:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>c});var r=n(4848),i=n(8453);const a={id:"takeRight"},s=void 0,o={id:"takeRight",title:"takeRight",description:"takeRight() function",source:"@site/docs/takeRight.md",sourceDirName:".",slug:"/takeRight",permalink:"/docs/takeRight",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"takeRight"},sidebar:"api",previous:{title:"take",permalink:"/docs/take"},next:{title:"takeUntil",permalink:"/docs/takeUntil"}},l={},c=[{value:"takeRight() function",id:"takeright-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"takeright-function",children:"takeRight() function"}),"\n",(0,r.jsxs)(t.p,{children:["Returns Iterable/AsyncIterable that taken the last argument ",(0,r.jsx)(t.code,{children:"l"})," values from iterable"]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function takeRight(l: number, iterable: Iterable): IterableIterator;\n\ndeclare function takeRight(l: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function takeRight | AsyncIterable>(l: number): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"const iter = takeRight(2, [0, 1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 5}\r\niter.next() // {done:false, value: 6}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [0, 1, 2, 3, 4, 5, 6],\r\n takeRight(2),\r\n toArray,\r\n); // [5, 6]\r\n\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n takeRight(2),\r\n toArray,\r\n); // [5, 6]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(0), Promise.resolve(1), Promise.resolve(2),\r\n Promise.resolve(3), Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n takeRight(2),\r\n toArray,\r\n); // [5, 6]\n"})}),"\n",(0,r.jsxs)(t.p,{children:["see ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>s,x:()=>o});var r=n(6540);const i={},a=r.createContext(i);function s(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3816],{1577:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>h,frontMatter:()=>a,metadata:()=>o,toc:()=>c});var r=n(4848),i=n(8453);const a={id:"takeRight"},s=void 0,o={id:"takeRight",title:"takeRight",description:"takeRight() function",source:"@site/docs/takeRight.md",sourceDirName:".",slug:"/takeRight",permalink:"/docs/takeRight",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"takeRight"},sidebar:"api",previous:{title:"take",permalink:"/docs/take"},next:{title:"takeUntil",permalink:"/docs/takeUntil"}},l={},c=[{value:"takeRight() function",id:"takeright-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"takeright-function",children:"takeRight() function"}),"\n",(0,r.jsxs)(t.p,{children:["Returns Iterable/AsyncIterable that taken the last argument ",(0,r.jsx)(t.code,{children:"l"})," values from iterable"]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function takeRight(l: number, iterable: Iterable): IterableIterator;\n\ndeclare function takeRight(l: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function takeRight | AsyncIterable>(l: number): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"const iter = takeRight(2, [0, 1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 5}\r\niter.next() // {done:false, value: 6}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [0, 1, 2, 3, 4, 5, 6],\r\n takeRight(2),\r\n toArray,\r\n); // [5, 6]\r\n\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n takeRight(2),\r\n toArray,\r\n); // [5, 6]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(0), Promise.resolve(1), Promise.resolve(2),\r\n Promise.resolve(3), Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n takeRight(2),\r\n toArray,\r\n); // [5, 6]\n"})}),"\n",(0,r.jsxs)(t.p,{children:["see ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/takeRight.ts",children:"Open Source Code"})})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>s,x:()=>o});var r=n(6540);const i={},a=r.createContext(i);function s(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/49e64ab8.343b5457.js b/assets/js/49e64ab8.343b5457.js new file mode 100644 index 00000000..33f15792 --- /dev/null +++ b/assets/js/49e64ab8.343b5457.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1828],{2527:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>m,frontMatter:()=>r,metadata:()=>l,toc:()=>o});var s=n(4848),i=n(8453);const r={id:"isEmpty"},a=void 0,l={id:"isEmpty",title:"isEmpty",description:"isEmpty variable",source:"@site/docs/isEmpty.md",sourceDirName:".",slug:"/isEmpty",permalink:"/docs/isEmpty",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isEmpty"},sidebar:"api",previous:{title:"isBoolean",permalink:"/docs/isBoolean"},next:{title:"isNil",permalink:"/docs/isNil"}},p={},o=[{value:"isEmpty variable",id:"isempty-variable",level:2},{value:"Example",id:"example",level:2}];function c(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h2,{id:"isempty-variable",children:"isEmpty variable"}),"\n",(0,s.jsx)(t.p,{children:"Returns true if the given value is empty value, false otherwise."}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-typescript",children:"isEmpty: (value: T) => boolean\n"})}),"\n",(0,s.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",children:'isEmpty({}) // true\r\nisEmpty([]) // true\r\nisEmpty(null) // true\r\nisEmpty(undefined) // true\r\nisEmpty("") // true\r\nisEmpty(new Map()) // true\r\nisEmpty(new Set()) // true\r\n\r\nisEmpty(0) // false\r\nisEmpty(false) // false\r\nisEmpty(function(){}) // false\r\nisEmpty(Symbol("")) // false\r\nisEmpty(new Date()) // false\n'})}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/isEmpty.ts",children:"Open Source Code"})})]})}function m(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>l});var s=n(6540);const i={},r=s.createContext(i);function a(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/49e64ab8.dc8a29af.js b/assets/js/49e64ab8.dc8a29af.js deleted file mode 100644 index a084923f..00000000 --- a/assets/js/49e64ab8.dc8a29af.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1828],{2527:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>m,frontMatter:()=>r,metadata:()=>l,toc:()=>o});var s=n(4848),i=n(8453);const r={id:"isEmpty"},a=void 0,l={id:"isEmpty",title:"isEmpty",description:"isEmpty variable",source:"@site/docs/isEmpty.md",sourceDirName:".",slug:"/isEmpty",permalink:"/docs/isEmpty",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isEmpty"},sidebar:"api",previous:{title:"isBoolean",permalink:"/docs/isBoolean"},next:{title:"isNil",permalink:"/docs/isNil"}},p={},o=[{value:"isEmpty variable",id:"isempty-variable",level:2},{value:"Example",id:"example",level:2}];function c(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h2,{id:"isempty-variable",children:"isEmpty variable"}),"\n",(0,s.jsx)(t.p,{children:"Returns true if the given value is empty value, false otherwise."}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-typescript",children:"isEmpty: (value: T) => boolean\n"})}),"\n",(0,s.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",children:'isEmpty({}) // true\r\nisEmpty([]) // true\r\nisEmpty(null) // true\r\nisEmpty(undefined) // true\r\nisEmpty("") // true\r\nisEmpty(new Map()) // true\r\nisEmpty(new Set()) // true\r\n\r\nisEmpty(0) // false\r\nisEmpty(false) // false\r\nisEmpty(function(){}) // false\r\nisEmpty(Symbol("")) // false\r\nisEmpty(new Date()) // false\n'})})]})}function m(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>l});var s=n(6540);const i={},r=s.createContext(i);function a(e){const t=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),s.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4e04d338.6d9bb731.js b/assets/js/4e04d338.6d9bb731.js deleted file mode 100644 index 71d6e32b..00000000 --- a/assets/js/4e04d338.6d9bb731.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2748],{6722:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>s,metadata:()=>o,toc:()=>l});var i=t(4848),r=t(8453);const s={id:"min"},c=void 0,o={id:"min",title:"min",description:"min() function",source:"@site/docs/min.md",sourceDirName:".",slug:"/min",permalink:"/docs/min",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"min"},sidebar:"api",previous:{title:"memoize",permalink:"/docs/memoize"},next:{title:"negate",permalink:"/docs/negate"}},a={},l=[{value:"min() function",id:"min-function",level:2},{value:"Example",id:"example",level:2}];function m(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"min-function",children:"min() function"}),"\n",(0,i.jsx)(n.p,{children:"Returns the smallest of the given iterable/AsyncIterable"}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function min | AsyncIterable>(iterable: A): ReturnValueType;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"min([1, 3, 5]); // 1;\r\nmin([1, NaN, 2]); // NaN;\r\nmin([1, Infinity, 3]); // 1;\r\nmin([1, -Infinity, 3]); // -Infinity;\r\nmin([]); // Infinity\n"})})]})}function u(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>o});var i=t(6540);const r={},s=i.createContext(r);function c(e){const n=i.useContext(s);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),i.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4e04d338.88a027de.js b/assets/js/4e04d338.88a027de.js new file mode 100644 index 00000000..c6e0d9d2 --- /dev/null +++ b/assets/js/4e04d338.88a027de.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2748],{6722:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>s,metadata:()=>o,toc:()=>l});var i=t(4848),r=t(8453);const s={id:"min"},c=void 0,o={id:"min",title:"min",description:"min() function",source:"@site/docs/min.md",sourceDirName:".",slug:"/min",permalink:"/docs/min",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"min"},sidebar:"api",previous:{title:"memoize",permalink:"/docs/memoize"},next:{title:"negate",permalink:"/docs/negate"}},a={},l=[{value:"min() function",id:"min-function",level:2},{value:"Example",id:"example",level:2}];function m(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"min-function",children:"min() function"}),"\n",(0,i.jsx)(n.p,{children:"Returns the smallest of the given iterable/AsyncIterable"}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function min | AsyncIterable>(iterable: A): ReturnValueType;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"min([1, 3, 5]); // 1;\r\nmin([1, NaN, 2]); // NaN;\r\nmin([1, Infinity, 3]); // 1;\r\nmin([1, -Infinity, 3]); // -Infinity;\r\nmin([]); // Infinity\n"})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/min.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>o});var i=t(6540);const r={},s=i.createContext(r);function c(e){const n=i.useContext(s);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),i.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4e369fd0.4a237579.js b/assets/js/4e369fd0.4a237579.js new file mode 100644 index 00000000..7cfca534 --- /dev/null +++ b/assets/js/4e369fd0.4a237579.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3464],{723:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>a,toc:()=>l});var t=r(4848),i=r(8453);const o={id:"join"},s=void 0,a={id:"join",title:"join",description:"join() function",source:"@site/docs/join.md",sourceDirName:".",slug:"/join",permalink:"/docs/join",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"join"},sidebar:"api",previous:{title:"isUndefined",permalink:"/docs/isUndefined"},next:{title:"juxt",permalink:"/docs/juxt"}},c={},l=[{value:"join() function",id:"join-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"join-function",children:"join() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns all elements in the given iterable into a string separated by separator."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:'declare function join(sep: string, iterable: Iterable): string;\n\ndeclare function join(sep: string, iterable: A): "";\n\ndeclare function join(sep: string, iterable: AsyncIterable): Promise;\n\ndeclare function join | AsyncIterable>(sep: string): (iterable: A) => ReturnJoinType;\n'})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const joined = join('~', ['a', 'b', 'c']); // 'a~b~c'\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0)\r\n join('-'),\r\n); // '12-14'\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n join('-'),\r\n); // '1-2-3-4'\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n join('-'),\r\n); // '1-2-3-4'\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/join.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>a});var t=r(6540);const i={},o=t.createContext(i);function s(e){const n=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4e369fd0.8efc45e7.js b/assets/js/4e369fd0.8efc45e7.js deleted file mode 100644 index 2a36e18d..00000000 --- a/assets/js/4e369fd0.8efc45e7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3464],{723:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>a,toc:()=>l});var i=t(4848),r=t(8453);const o={id:"join"},s=void 0,a={id:"join",title:"join",description:"join() function",source:"@site/docs/join.md",sourceDirName:".",slug:"/join",permalink:"/docs/join",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"join"},sidebar:"api",previous:{title:"isUndefined",permalink:"/docs/isUndefined"},next:{title:"juxt",permalink:"/docs/juxt"}},c={},l=[{value:"join() function",id:"join-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"join-function",children:"join() function"}),"\n",(0,i.jsx)(n.p,{children:"Returns all elements in the given iterable into a string separated by separator."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:'declare function join(sep: string, iterable: Iterable): string;\n\ndeclare function join(sep: string, iterable: A): "";\n\ndeclare function join(sep: string, iterable: AsyncIterable): Promise;\n\ndeclare function join | AsyncIterable>(sep: string): (iterable: A) => ReturnJoinType;\n'})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const joined = join('~', ['a', 'b', 'c']); // 'a~b~c'\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0)\r\n join('-'),\r\n); // '12-14'\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n join('-'),\r\n); // '1-2-3-4'\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n join('-'),\r\n); // '1-2-3-4'\n"})})]})}function p(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var i=t(6540);const r={},o=i.createContext(r);function s(e){const n=i.useContext(o);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),i.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4eabdd00.3d199759.js b/assets/js/4eabdd00.3d199759.js new file mode 100644 index 00000000..85c03fee --- /dev/null +++ b/assets/js/4eabdd00.3d199759.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7723],{171:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=t(4848),a=t(8453);const i={id:"repeat"},c=void 0,s={id:"repeat",title:"repeat",description:"repeat() function",source:"@site/docs/repeat.md",sourceDirName:".",slug:"/repeat",permalink:"/docs/repeat",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"repeat"},sidebar:"api",previous:{title:"reject",permalink:"/docs/reject"},next:{title:"reverse",permalink:"/docs/reverse"}},o={},l=[{value:"repeat() function",id:"repeat-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"repeat-function",children:"repeat() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns a Iterable/AsyncIterable of size n containing a specified value."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function repeat(n: number, value: T): IterableIterator;\n\ndeclare function repeat(n: number): (value: T) => IterableIterator;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = repeat(2, 10);\r\niter.next(); // {value: 10, done:false}\r\niter.next(); // {value: 10, done:false}\r\niter.next(); // {value: undefined, done:true}\r\n\r\n// with pipe\r\npipe(\r\n repeat(2, 10),\r\n toArray,\r\n); // [10, 10]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/repeat.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>s});var r=t(6540);const a={},i=r.createContext(a);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:c(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4eabdd00.b45a4dda.js b/assets/js/4eabdd00.b45a4dda.js deleted file mode 100644 index a533134d..00000000 --- a/assets/js/4eabdd00.b45a4dda.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7723],{171:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>o,toc:()=>l});var r=t(4848),a=t(8453);const i={id:"repeat"},c=void 0,o={id:"repeat",title:"repeat",description:"repeat() function",source:"@site/docs/repeat.md",sourceDirName:".",slug:"/repeat",permalink:"/docs/repeat",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"repeat"},sidebar:"api",previous:{title:"reject",permalink:"/docs/reject"},next:{title:"reverse",permalink:"/docs/reverse"}},s={},l=[{value:"repeat() function",id:"repeat-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"repeat-function",children:"repeat() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns a Iterable/AsyncIterable of size n containing a specified value."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function repeat(n: number, value: T): IterableIterator;\n\ndeclare function repeat(n: number): (value: T) => IterableIterator;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = repeat(2, 10);\r\niter.next(); // {value: 10, done:false}\r\niter.next(); // {value: 10, done:false}\r\niter.next(); // {value: undefined, done:true}\r\n\r\n// with pipe\r\npipe(\r\n repeat(2, 10),\r\n toArray,\r\n); // [10, 10]\n"})})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>o});var r=t(6540);const a={},i=r.createContext(a);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:c(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4f64f2cc.354fe461.js b/assets/js/4f64f2cc.354fe461.js new file mode 100644 index 00000000..4d53d868 --- /dev/null +++ b/assets/js/4f64f2cc.354fe461.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2853],{3916:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>u,frontMatter:()=>c,metadata:()=>a,toc:()=>s});var r=t(4848),i=t(8453);const c={id:"nth"},o=void 0,a={id:"nth",title:"nth",description:"nth() function",source:"@site/docs/nth.md",sourceDirName:".",slug:"/nth",permalink:"/docs/nth",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"nth"},sidebar:"api",previous:{title:"not",permalink:"/docs/not"},next:{title:"omit",permalink:"/docs/omit"}},d={},s=[{value:"nth() function",id:"nth-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"nth-function",children:"nth() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns the nth element of the given Iterable/AsyncIterable"}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function nth(index: number, iterable: readonly []): undefined;\n\ndeclare function nth(index: number, iterable: Iterable): T | undefined;\n\ndeclare function nth(index: number, iterable: AsyncIterable): Promise;\n\ndeclare function nth | AsyncIterable>(index: number): (iterable: T) => ReturnValueType | undefined>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"nth(2, [1,2,3,4]); // 3\r\nnth(5, [1,2,3,4]); // undefined\r\nnth(2, ['name', 'gender', 'age']); // 'age'\r\nnth(3, ['name', 'gender', 'age']); // undefined\r\nnth(2, 'abcdefg'); // 'c'\r\nnth(10, 'abcdefg'); // undefined\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/nth.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>a});var r=t(6540);const i={},c=r.createContext(i);function o(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4f64f2cc.bf2c38e2.js b/assets/js/4f64f2cc.bf2c38e2.js deleted file mode 100644 index 6adaeaf4..00000000 --- a/assets/js/4f64f2cc.bf2c38e2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2853],{3916:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>c,metadata:()=>d,toc:()=>s});var r=t(4848),i=t(8453);const c={id:"nth"},o=void 0,d={id:"nth",title:"nth",description:"nth() function",source:"@site/docs/nth.md",sourceDirName:".",slug:"/nth",permalink:"/docs/nth",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"nth"},sidebar:"api",previous:{title:"not",permalink:"/docs/not"},next:{title:"omit",permalink:"/docs/omit"}},a={},s=[{value:"nth() function",id:"nth-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"nth-function",children:"nth() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns the nth element of the given Iterable/AsyncIterable"}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function nth(index: number, iterable: readonly []): undefined;\n\ndeclare function nth(index: number, iterable: Iterable): T | undefined;\n\ndeclare function nth(index: number, iterable: AsyncIterable): Promise;\n\ndeclare function nth | AsyncIterable>(index: number): (iterable: T) => ReturnValueType | undefined>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"nth(2, [1,2,3,4]); // 3\r\nnth(5, [1,2,3,4]); // undefined\r\nnth(2, ['name', 'gender', 'age']); // 'age'\r\nnth(3, ['name', 'gender', 'age']); // undefined\r\nnth(2, 'abcdefg'); // 'c'\r\nnth(10, 'abcdefg'); // undefined\n"})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>d});var r=t(6540);const i={},c=r.createContext(i);function o(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/51b3d719.f53d478d.js b/assets/js/51b3d719.f53d478d.js deleted file mode 100644 index d4f7b43f..00000000 --- a/assets/js/51b3d719.f53d478d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4993],{8885:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>c,default:()=>d,frontMatter:()=>a,metadata:()=>o,toc:()=>s});var r=n(4848),l=n(8453);const a={id:"lte"},c=void 0,o={id:"lte",title:"lte",description:"lte() function",source:"@site/docs/lte.md",sourceDirName:".",slug:"/lte",permalink:"/docs/lte",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"lte"},sidebar:"api",previous:{title:"lt",permalink:"/docs/lt"},next:{title:"max",permalink:"/docs/max"}},i={},s=[{value:"lte() function",id:"lte-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",...(0,l.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"lte-function",children:"lte() function"}),"\n",(0,r.jsx)(t.p,{children:"Returns true if the first argument is less or equal than the second; false otherwise."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function lte(a: Date, b: Date): boolean;\n\ndeclare function lte(a: Date): (b: Date) => boolean;\n\ndeclare function lte(a: string, b: string): boolean;\n\ndeclare function lte(a: number, b: number): boolean;\n\ndeclare function lte(a: string): (b: string) => boolean;\n\ndeclare function lte(a: number): (b: number) => boolean;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:'lte(5, 1) // expected false\r\nlte(1, 1) // expected true\r\nlte(1, 5) // expected true\r\nlte("a", "b") // expected true\r\nlte("b", "a") // expected false\r\n\r\nfilter(lte(5), [1, 2, 4, 5, 8, 9]) // Iterable<[5, 8, 9]>\r\nfilter(lte(9), [6, 7, 8]) // Iterable<[]>\r\nfilter(lte("b"), ["a", "b", "c"]) // Iterable<["b", "c"]>\r\nfilter(lte("e"), ["c", "d"]) // Itreable<[]>\n'})})]})}function d(e={}){const{wrapper:t}={...(0,l.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>o});var r=n(6540);const l={},a=r.createContext(l);function c(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:c(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/51b3d719.fdb554a1.js b/assets/js/51b3d719.fdb554a1.js new file mode 100644 index 00000000..acd33f5d --- /dev/null +++ b/assets/js/51b3d719.fdb554a1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4993],{8885:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>c,default:()=>d,frontMatter:()=>a,metadata:()=>o,toc:()=>s});var r=n(4848),l=n(8453);const a={id:"lte"},c=void 0,o={id:"lte",title:"lte",description:"lte() function",source:"@site/docs/lte.md",sourceDirName:".",slug:"/lte",permalink:"/docs/lte",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"lte"},sidebar:"api",previous:{title:"lt",permalink:"/docs/lt"},next:{title:"max",permalink:"/docs/max"}},i={},s=[{value:"lte() function",id:"lte-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,l.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"lte-function",children:"lte() function"}),"\n",(0,r.jsx)(t.p,{children:"Returns true if the first argument is less or equal than the second; false otherwise."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function lte(a: Date, b: Date): boolean;\n\ndeclare function lte(a: Date): (b: Date) => boolean;\n\ndeclare function lte(a: string, b: string): boolean;\n\ndeclare function lte(a: number, b: number): boolean;\n\ndeclare function lte(a: string): (b: string) => boolean;\n\ndeclare function lte(a: number): (b: number) => boolean;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:'lte(5, 1) // expected false\r\nlte(1, 1) // expected true\r\nlte(1, 5) // expected true\r\nlte("a", "b") // expected true\r\nlte("b", "a") // expected false\r\n\r\nfilter(lte(5), [1, 2, 4, 5, 8, 9]) // Iterable<[5, 8, 9]>\r\nfilter(lte(9), [6, 7, 8]) // Iterable<[]>\r\nfilter(lte("b"), ["a", "b", "c"]) // Iterable<["b", "c"]>\r\nfilter(lte("e"), ["c", "d"]) // Itreable<[]>\n'})}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/lte.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:t}={...(0,l.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>o});var r=n(6540);const l={},a=r.createContext(l);function c(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:c(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5c36e323.ba347f62.js b/assets/js/5c36e323.ba347f62.js deleted file mode 100644 index 1ec41c1f..00000000 --- a/assets/js/5c36e323.ba347f62.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4225],{1881:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>o});var i=n(4848),r=n(8453);const a={id:"zipWith"},c=void 0,l={id:"zipWith",title:"zipWith",description:"zipWith() function",source:"@site/docs/zipWith.md",sourceDirName:".",slug:"/zipWith",permalink:"/docs/zipWith",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"zipWith"},sidebar:"api",previous:{title:"zip",permalink:"/docs/zip"},next:{title:"zipWithIndex",permalink:"/docs/zipWithIndex"}},s={},o=[{value:"zipWith() function",id:"zipwith-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h2,{id:"zipwith-function",children:"zipWith() function"}),"\n",(0,i.jsxs)(t.p,{children:["Returns Iterable/AsyncIterable out of the two supplied by applying ",(0,i.jsx)(t.code,{children:"f"})," to each same positioned pair in Iterable/AsyncIterable."]}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-typescript",children:"declare function zipWith(f: (a: A, b: B) => C, iterable1: Iterable, iterable2: Iterable): IterableIterator;\n\ndeclare function zipWith(f: (a: A, b: B) => C, iterable1: Iterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function zipWith(f: (a: A, b: B) => C, iterable1: AsyncIterable, iterable2: Iterable): AsyncIterableIterator;\n\ndeclare function zipWith(f: (a: A, b: B) => C, iterable1: AsyncIterable, iterable2: AsyncIterable): AsyncIterableIterator;\n"})}),"\n",(0,i.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",children:"const iter = zipWith((a,b) => [a,b], [1,2,3], ['a','b','c']);\r\niter.next(); // {value: [1, 'a'] , done: false}\r\niter.next(); // {value: [2, 'b'] , done: false}\r\niter.next(); // {value: [3, 'c'] , done: false}\r\niter.next(); // {value: undefined , done: true}\n"})})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(p,{...e})}):p(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>l});var i=n(6540);const r={},a=i.createContext(r);function c(e){const t=i.useContext(a);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),i.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5c36e323.ba42977f.js b/assets/js/5c36e323.ba42977f.js new file mode 100644 index 00000000..e47029d7 --- /dev/null +++ b/assets/js/5c36e323.ba42977f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4225],{1881:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>o});var i=n(4848),r=n(8453);const a={id:"zipWith"},c=void 0,l={id:"zipWith",title:"zipWith",description:"zipWith() function",source:"@site/docs/zipWith.md",sourceDirName:".",slug:"/zipWith",permalink:"/docs/zipWith",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"zipWith"},sidebar:"api",previous:{title:"zip",permalink:"/docs/zip"},next:{title:"zipWithIndex",permalink:"/docs/zipWithIndex"}},s={},o=[{value:"zipWith() function",id:"zipwith-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h2,{id:"zipwith-function",children:"zipWith() function"}),"\n",(0,i.jsxs)(t.p,{children:["Returns Iterable/AsyncIterable out of the two supplied by applying ",(0,i.jsx)(t.code,{children:"f"})," to each same positioned pair in Iterable/AsyncIterable."]}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-typescript",children:"declare function zipWith(f: (a: A, b: B) => C, iterable1: Iterable, iterable2: Iterable): IterableIterator;\n\ndeclare function zipWith(f: (a: A, b: B) => C, iterable1: Iterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function zipWith(f: (a: A, b: B) => C, iterable1: AsyncIterable, iterable2: Iterable): AsyncIterableIterator;\n\ndeclare function zipWith(f: (a: A, b: B) => C, iterable1: AsyncIterable, iterable2: AsyncIterable): AsyncIterableIterator;\n"})}),"\n",(0,i.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",children:"const iter = zipWith((a,b) => [a,b], [1,2,3], ['a','b','c']);\r\niter.next(); // {value: [1, 'a'] , done: false}\r\niter.next(); // {value: [2, 'b'] , done: false}\r\niter.next(); // {value: [3, 'c'] , done: false}\r\niter.next(); // {value: undefined , done: true}\n"})}),"\n",(0,i.jsx)(t.p,{children:(0,i.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/zipWith.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(p,{...e})}):p(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>l});var i=n(6540);const r={},a=i.createContext(r);function c(e){const t=i.useContext(a);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),i.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/608d5641.74778537.js b/assets/js/608d5641.74778537.js new file mode 100644 index 00000000..e77c0672 --- /dev/null +++ b/assets/js/608d5641.74778537.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1461],{392:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>p,default:()=>l,frontMatter:()=>s,metadata:()=>a,toc:()=>i});var o=r(4848),t=r(8453);const s={id:"props"},p=void 0,a={id:"props",title:"props",description:"props() function",source:"@site/docs/props.md",sourceDirName:".",slug:"/props",permalink:"/docs/props",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"props"},sidebar:"api",previous:{title:"prop",permalink:"/docs/prop"},next:{title:"reduce",permalink:"/docs/reduce"}},c={},i=[{value:"props() function",id:"props-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"props-function",children:"props() function"}),"\n",(0,o.jsx)(n.p,{children:"Returns an array containing the values of the specified props in the given object."}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function props(key: K, obj: T): PropsReturnType;\n\ndeclare function props(key: K): (obj: T) => PropsReturnType;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:'// get the `name` and `age` properties from an object\r\nconst person = { name: "John", age: 30, address: "123 Main St" };\r\nconst [name, age, phone] = props(["name", "age", "phone"], person); // ["John", 30, undefined]\r\n\r\n// with pipe\r\npipe(\r\n person,\r\n props(["name", "age", "phone"]),\r\n);\r\n\r\n// get the `address` and `phone` properties from an object that may be null or undefined\r\nconst maybePerson = null;\r\nconst [address, phone] = props(["address", "phone"], maybePerson); // [undefined, undefined]\n'})}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/props.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>p,x:()=>a});var o=r(6540);const t={},s=o.createContext(t);function p(e){const n=o.useContext(s);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:p(e.components),o.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/608d5641.e243217f.js b/assets/js/608d5641.e243217f.js deleted file mode 100644 index 1e53ba6a..00000000 --- a/assets/js/608d5641.e243217f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1461],{392:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>p,default:()=>l,frontMatter:()=>s,metadata:()=>a,toc:()=>c});var o=r(4848),t=r(8453);const s={id:"props"},p=void 0,a={id:"props",title:"props",description:"props() function",source:"@site/docs/props.md",sourceDirName:".",slug:"/props",permalink:"/docs/props",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"props"},sidebar:"api",previous:{title:"prop",permalink:"/docs/prop"},next:{title:"reduce",permalink:"/docs/reduce"}},i={},c=[{value:"props() function",id:"props-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"props-function",children:"props() function"}),"\n",(0,o.jsx)(n.p,{children:"Returns an array containing the values of the specified props in the given object."}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function props(key: K, obj: T): PropsReturnType;\n\ndeclare function props(key: K): (obj: T) => PropsReturnType;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:'// get the `name` and `age` properties from an object\r\nconst person = { name: "John", age: 30, address: "123 Main St" };\r\nconst [name, age, phone] = props(["name", "age", "phone"], person); // ["John", 30, undefined]\r\n\r\n// with pipe\r\npipe(\r\n person,\r\n props(["name", "age", "phone"]),\r\n);\r\n\r\n// get the `address` and `phone` properties from an object that may be null or undefined\r\nconst maybePerson = null;\r\nconst [address, phone] = props(["address", "phone"], maybePerson); // [undefined, undefined]\n'})})]})}function l(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>p,x:()=>a});var o=r(6540);const t={},s=o.createContext(t);function p(e){const n=o.useContext(s);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:p(e.components),o.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/60bd5769.4ef4ddf3.js b/assets/js/60bd5769.4ef4ddf3.js new file mode 100644 index 00000000..52f2af53 --- /dev/null +++ b/assets/js/60bd5769.4ef4ddf3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8008],{804:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>p,contentTitle:()=>s,default:()=>l,frontMatter:()=>c,metadata:()=>i,toc:()=>d});var t=o(4848),r=o(8453);const c={id:"noop"},s=void 0,i={id:"noop",title:"noop",description:"noop() function",source:"@site/docs/noop.md",sourceDirName:".",slug:"/noop",permalink:"/docs/noop",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"noop"},sidebar:"api",previous:{title:"negate",permalink:"/docs/negate"},next:{title:"not",permalink:"/docs/not"}},p={},d=[{value:"noop() function",id:"noop-function",level:2},{value:"Example",id:"example",level:2}];function a(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"noop-function",children:"noop() function"}),"\n",(0,t.jsxs)(n.p,{children:["Returns ",(0,t.jsx)(n.code,{children:"undefined"})]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function noop(): void;\n"})}),"\n",(0,t.jsx)("b",{children:"Returns:"}),"\n",(0,t.jsx)(n.p,{children:"void"}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"noop() // undefined\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/noop.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}},8453:(e,n,o)=>{o.d(n,{R:()=>s,x:()=>i});var t=o(6540);const r={},c=t.createContext(r);function s(e){const n=t.useContext(c);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),t.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/60bd5769.b1c59015.js b/assets/js/60bd5769.b1c59015.js deleted file mode 100644 index 510a054b..00000000 --- a/assets/js/60bd5769.b1c59015.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8008],{804:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>d,contentTitle:()=>r,default:()=>a,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var t=o(4848),c=o(8453);const i={id:"noop"},r=void 0,s={id:"noop",title:"noop",description:"noop() function",source:"@site/docs/noop.md",sourceDirName:".",slug:"/noop",permalink:"/docs/noop",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"noop"},sidebar:"api",previous:{title:"negate",permalink:"/docs/negate"},next:{title:"not",permalink:"/docs/not"}},d={},p=[{value:"noop() function",id:"noop-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"noop-function",children:"noop() function"}),"\n",(0,t.jsxs)(n.p,{children:["Returns ",(0,t.jsx)(n.code,{children:"undefined"})]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function noop(): void;\n"})}),"\n",(0,t.jsx)("b",{children:"Returns:"}),"\n",(0,t.jsx)(n.p,{children:"void"}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"noop() // undefined\n"})})]})}function a(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,o)=>{o.d(n,{R:()=>r,x:()=>s});var t=o(6540);const c={},i=t.createContext(c);function r(e){const n=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:r(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/658db2fd.271c4535.js b/assets/js/658db2fd.271c4535.js deleted file mode 100644 index 7500a2ad..00000000 --- a/assets/js/658db2fd.271c4535.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7690],{7748:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var s=t(4848),r=t(8453);const o={id:"keys"},c=void 0,i={id:"keys",title:"keys",description:"keys() function",source:"@site/docs/keys.md",sourceDirName:".",slug:"/keys",permalink:"/docs/keys",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"keys"},sidebar:"api",previous:{title:"intersectionBy",permalink:"/docs/intersectionBy"},next:{title:"map",permalink:"/docs/map"}},a={},l=[{value:"keys() function",id:"keys-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"keys-function",children:"keys() function"}),"\n",(0,s.jsx)(n.p,{children:"Returns an iterator of the own enumerable property names of object."}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function keys>(obj: T): Generator, void, unknown>;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:'[...keys({ a: 1, b: "2", c: true })]\r\n// ["a", "b", "c"]\n'})})]})}function u(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>i});var s=t(6540);const r={},o=s.createContext(r);function c(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/658db2fd.4439c77b.js b/assets/js/658db2fd.4439c77b.js new file mode 100644 index 00000000..1766a09f --- /dev/null +++ b/assets/js/658db2fd.4439c77b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7690],{7748:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var s=t(4848),r=t(8453);const o={id:"keys"},c=void 0,i={id:"keys",title:"keys",description:"keys() function",source:"@site/docs/keys.md",sourceDirName:".",slug:"/keys",permalink:"/docs/keys",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"keys"},sidebar:"api",previous:{title:"intersectionBy",permalink:"/docs/intersectionBy"},next:{title:"map",permalink:"/docs/map"}},a={},l=[{value:"keys() function",id:"keys-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"keys-function",children:"keys() function"}),"\n",(0,s.jsx)(n.p,{children:"Returns an iterator of the own enumerable property names of object."}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function keys>(obj: T): Generator, void, unknown>;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:'[...keys({ a: 1, b: "2", c: true })]\r\n// ["a", "b", "c"]\n'})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/keys.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>i});var s=t(6540);const r={},o=s.createContext(r);function c(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6612d0dd.a731cc1c.js b/assets/js/6612d0dd.8c487741.js similarity index 80% rename from assets/js/6612d0dd.a731cc1c.js rename to assets/js/6612d0dd.8c487741.js index d4fbcc4b..0be5dd4c 100644 --- a/assets/js/6612d0dd.a731cc1c.js +++ b/assets/js/6612d0dd.8c487741.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1554],{326:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>h,frontMatter:()=>s,metadata:()=>o,toc:()=>c});var r=t(4848),a=t(8453);const s={id:"takeWhile"},i=void 0,o={id:"takeWhile",title:"takeWhile",description:"takeWhile() function",source:"@site/docs/takeWhile.md",sourceDirName:".",slug:"/takeWhile",permalink:"/docs/takeWhile",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"takeWhile"},sidebar:"api",previous:{title:"takeUntil",permalink:"/docs/takeUntil"},next:{title:"toAsync",permalink:"/docs/toAsync"}},l={},c=[{value:"takeWhile() function",id:"takewhile-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"takewhile-function",children:"takeWhile() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable that taken values as long as each value satisfies the give ",(0,r.jsx)(n.code,{children:"f"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function takeWhile(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function takeWhile(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function takeWhile | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = takeWhile(a => a < 3, [1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5, 6],\r\n takeWhile(a => a < 3),\r\n toArray,\r\n); // [1, 2]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 6]),\r\n takeWhile(a => a < 3),\r\n toArray,\r\n); // [1, 2]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 6]),\r\n toAsync,\r\n takeWhile(async (a) => a < 3),\r\n toArray,\r\n); // [1, 2]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3),\r\nPromise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n takeWhile(a => a < 3),\r\n toArray,\r\n); // [1, 2]\r\n\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-takewhile-e6gqt",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>o});var r=t(6540);const a={},s=r.createContext(a);function i(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1554],{326:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>h,frontMatter:()=>s,metadata:()=>o,toc:()=>c});var r=t(4848),a=t(8453);const s={id:"takeWhile"},i=void 0,o={id:"takeWhile",title:"takeWhile",description:"takeWhile() function",source:"@site/docs/takeWhile.md",sourceDirName:".",slug:"/takeWhile",permalink:"/docs/takeWhile",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"takeWhile"},sidebar:"api",previous:{title:"takeUntil",permalink:"/docs/takeUntil"},next:{title:"toAsync",permalink:"/docs/toAsync"}},l={},c=[{value:"takeWhile() function",id:"takewhile-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"takewhile-function",children:"takeWhile() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable that taken values as long as each value satisfies the give ",(0,r.jsx)(n.code,{children:"f"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function takeWhile(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function takeWhile(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function takeWhile | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = takeWhile(a => a < 3, [1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5, 6],\r\n takeWhile(a => a < 3),\r\n toArray,\r\n); // [1, 2]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 6]),\r\n takeWhile(a => a < 3),\r\n toArray,\r\n); // [1, 2]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 6]),\r\n toAsync,\r\n takeWhile(async (a) => a < 3),\r\n toArray,\r\n); // [1, 2]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3),\r\nPromise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n takeWhile(a => a < 3),\r\n toArray,\r\n); // [1, 2]\r\n\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-takewhile-e6gqt",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/takeWhile.ts",children:"Open Source Code"})})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>o});var r=t(6540);const a={},s=r.createContext(a);function i(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/68451bba.1f363e12.js b/assets/js/68451bba.d0921f7e.js similarity index 78% rename from assets/js/68451bba.1f363e12.js rename to assets/js/68451bba.d0921f7e.js index 140e0e51..f577dfd3 100644 --- a/assets/js/68451bba.1f363e12.js +++ b/assets/js/68451bba.d0921f7e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4642],{6903:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>a,toc:()=>l});var r=t(4848),c=t(8453);const o={id:"compact"},s=void 0,a={id:"compact",title:"compact",description:"compact() function",source:"@site/docs/compact.md",sourceDirName:".",slug:"/compact",permalink:"/docs/compact",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"compact"},sidebar:"api",previous:{title:"chunk",permalink:"/docs/chunk"},next:{title:"compress",permalink:"/docs/compress"}},i={},l=[{value:"compact() function",id:"compact-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"compact-function",children:"compact() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable with all ",(0,r.jsx)(n.code,{children:"null"})," and ",(0,r.jsx)(n.code,{children:"undefined"})," values removed."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function compact | AsyncIterable>(iterable: T): ReturnIterableIteratorType>>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = compact([0, 1, undefined, 3, null]);\r\niter.next() // {done:false, value: 0}\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [0, 1, undefined, 3, null],\r\n compact,\r\n toArray,\r\n); // [0, 1, 3]\r\n\r\nawait pipe(\r\n Promise.resolve([0, 1, undefined, 3, null]),\r\n compact,\r\n toArray,\r\n); // [0, 1, 3]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(0), Promise.resolve(1), Promise.resolve(undefined),\r\n Promise.resolve(3), Promise.resolve(null)],\r\n toAsync,\r\n compact,\r\n toArray,\r\n); // [0, 1, 3]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-compact-lnvmd",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function p(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var r=t(6540);const c={},o=r.createContext(c);function s(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4642],{6903:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>p,frontMatter:()=>o,metadata:()=>a,toc:()=>l});var r=t(4848),c=t(8453);const o={id:"compact"},s=void 0,a={id:"compact",title:"compact",description:"compact() function",source:"@site/docs/compact.md",sourceDirName:".",slug:"/compact",permalink:"/docs/compact",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"compact"},sidebar:"api",previous:{title:"chunk",permalink:"/docs/chunk"},next:{title:"compress",permalink:"/docs/compress"}},i={},l=[{value:"compact() function",id:"compact-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"compact-function",children:"compact() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable with all ",(0,r.jsx)(n.code,{children:"null"})," and ",(0,r.jsx)(n.code,{children:"undefined"})," values removed."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function compact | AsyncIterable>(iterable: T): ReturnIterableIteratorType>>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = compact([0, 1, undefined, 3, null]);\r\niter.next() // {done:false, value: 0}\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [0, 1, undefined, 3, null],\r\n compact,\r\n toArray,\r\n); // [0, 1, 3]\r\n\r\nawait pipe(\r\n Promise.resolve([0, 1, undefined, 3, null]),\r\n compact,\r\n toArray,\r\n); // [0, 1, 3]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(0), Promise.resolve(1), Promise.resolve(undefined),\r\n Promise.resolve(3), Promise.resolve(null)],\r\n toAsync,\r\n compact,\r\n toArray,\r\n); // [0, 1, 3]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-compact-lnvmd",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/compact.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var r=t(6540);const c={},o=r.createContext(c);function s(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/690cbe68.24bcee2b.js b/assets/js/690cbe68.24bcee2b.js new file mode 100644 index 00000000..dbafa44b --- /dev/null +++ b/assets/js/690cbe68.24bcee2b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4630],{6525:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>v,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var o=t(4848),r=t(8453);const i={id:"evolve"},s=void 0,c={id:"evolve",title:"evolve",description:"evolve() function",source:"@site/docs/evolve.md",sourceDirName:".",slug:"/evolve",permalink:"/docs/evolve",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"evolve"},sidebar:"api",previous:{title:"every",permalink:"/docs/every"},next:{title:"find",permalink:"/docs/find"}},a={},l=[{value:"evolve() function",id:"evolve-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"evolve-function",children:"evolve() function"}),"\n",(0,o.jsx)(n.p,{children:"Creates a new object by recursively evolving a shallow copy of object, according to the transformation functions."}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function evolve, T extends Transformation>(transformation: T, obj: O): EvolveReturnType;\n\ndeclare function evolve, T extends Transformation>(transformation: T): (obj: O) => EvolveReturnType;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:'const add1String = (a: number) => String(a + 1);\r\nconst obj = { a: 1, b: 2, c: { d: 3, e: 4 }, f: true };\r\nconst transformation = {\r\n a: add1String,\r\n b: add1String,\r\n c: (obj: { d: number; e: number }) =>\r\n evolve({ d: add1String, e: add1String }, obj),\r\n};\r\nevolve(transformation, obj);\r\n// { a: "2", b: "3", c: { d: "4", e: "5" }, f: true }\n'})}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/evolve.ts",children:"Open Source Code"})})]})}function v(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var o=t(6540);const r={},i=o.createContext(r);function s(e){const n=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),o.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/690cbe68.8eb687d0.js b/assets/js/690cbe68.8eb687d0.js deleted file mode 100644 index 0a6c311e..00000000 --- a/assets/js/690cbe68.8eb687d0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4630],{6525:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>v,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var o=t(4848),r=t(8453);const i={id:"evolve"},s=void 0,c={id:"evolve",title:"evolve",description:"evolve() function",source:"@site/docs/evolve.md",sourceDirName:".",slug:"/evolve",permalink:"/docs/evolve",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"evolve"},sidebar:"api",previous:{title:"every",permalink:"/docs/every"},next:{title:"find",permalink:"/docs/find"}},a={},l=[{value:"evolve() function",id:"evolve-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"evolve-function",children:"evolve() function"}),"\n",(0,o.jsx)(n.p,{children:"Creates a new object by recursively evolving a shallow copy of object, according to the transformation functions."}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function evolve, T extends Transformation>(transformation: T, obj: O): EvolveReturnType;\n\ndeclare function evolve, T extends Transformation>(transformation: T): (obj: O) => EvolveReturnType;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:'const add1String = (a: number) => String(a + 1);\r\nconst obj = { a: 1, b: 2, c: { d: 3, e: 4 }, f: true };\r\nconst transformation = {\r\n a: add1String,\r\n b: add1String,\r\n c: (obj: { d: number; e: number }) =>\r\n evolve({ d: add1String, e: add1String }, obj),\r\n};\r\nevolve(transformation, obj);\r\n// { a: "2", b: "3", c: { d: "4", e: "5" }, f: true }\n'})})]})}function v(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var o=t(6540);const r={},i=o.createContext(r);function s(e){const n=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),o.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/69adfb8e.502258d0.js b/assets/js/69adfb8e.502258d0.js deleted file mode 100644 index 6e1f4852..00000000 --- a/assets/js/69adfb8e.502258d0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3246],{3069:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>s,default:()=>d,frontMatter:()=>c,metadata:()=>i,toc:()=>l});var a=t(4848),r=t(8453);const c={id:"average"},s=void 0,i={id:"average",title:"average",description:"average() function",source:"@site/docs/average.md",sourceDirName:".",slug:"/average",permalink:"/docs/average",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"average"},sidebar:"api",previous:{title:"apply",permalink:"/docs/apply"},next:{title:"compactObject",permalink:"/docs/compactObject"}},o={},l=[{value:"average() function",id:"average-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h2,{id:"average-function",children:"average() function"}),"\n",(0,a.jsx)(n.p,{children:"Returns the average of the given (Iterable/AsyncIterable) (mean)"}),"\n",(0,a.jsx)("b",{children:"Signature:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-typescript",children:"declare function average | AsyncIterable>(iterable: T): ReturnValueType;\n"})}),"\n",(0,a.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-ts",children:"average([]); // NaN\r\naverage([1, 2, 3, 4, 5]); // 3\r\nawait average(toAsync([1, 2, 3, 4, 5])); // 3\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n average,\r\n); // 3\n"})}),"\n",(0,a.jsxs)(n.p,{children:["see ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"})]})]})}function d(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>i});var a=t(6540);const r={},c=a.createContext(r);function s(e){const n=a.useContext(c);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),a.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/69adfb8e.8b3ae640.js b/assets/js/69adfb8e.8b3ae640.js new file mode 100644 index 00000000..1e536e0c --- /dev/null +++ b/assets/js/69adfb8e.8b3ae640.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3246],{3069:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>o,contentTitle:()=>s,default:()=>d,frontMatter:()=>c,metadata:()=>i,toc:()=>l});var t=r(4848),a=r(8453);const c={id:"average"},s=void 0,i={id:"average",title:"average",description:"average() function",source:"@site/docs/average.md",sourceDirName:".",slug:"/average",permalink:"/docs/average",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"average"},sidebar:"api",previous:{title:"apply",permalink:"/docs/apply"},next:{title:"compactObject",permalink:"/docs/compactObject"}},o={},l=[{value:"average() function",id:"average-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"average-function",children:"average() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns the average of the given (Iterable/AsyncIterable) (mean)"}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function average | AsyncIterable>(iterable: T): ReturnValueType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"average([]); // NaN\r\naverage([1, 2, 3, 4, 5]); // 3\r\nawait average(toAsync([1, 2, 3, 4, 5])); // 3\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n average,\r\n); // 3\n"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"})]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/average.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(p,{...e})}):p(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>i});var t=r(6540);const a={},c=t.createContext(a);function s(e){const n=t.useContext(c);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),t.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6ffcc0ea.0642ef39.js b/assets/js/6ffcc0ea.0642ef39.js deleted file mode 100644 index 3e2c6aac..00000000 --- a/assets/js/6ffcc0ea.0642ef39.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2353],{9529:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>l,frontMatter:()=>o,metadata:()=>u,toc:()=>d});var c=r(4848),t=r(8453);const o={id:"curry"},s=void 0,u={id:"curry",title:"curry",description:"curry() function",source:"@site/docs/curry.md",sourceDirName:".",slug:"/curry",permalink:"/docs/curry",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"curry"},sidebar:"api",previous:{title:"countBy",permalink:"/docs/countBy"},next:{title:"delay",permalink:"/docs/delay"}},i={},d=[{value:"curry() function",id:"curry-function",level:2},{value:"Example",id:"example",level:2}];function a(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h2,{id:"curry-function",children:"curry() function"}),"\n",(0,c.jsxs)(n.p,{children:["Returns a curried function of ",(0,c.jsx)(n.code,{children:"f"})]}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-typescript",children:"declare function curry any>(f: F): Curry;\n"})}),"\n",(0,c.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"const add = (a: number, b: number): number => a + b\r\n\r\nconst curried = curry(add)\r\nconst add10 = curried(10)\r\nconsole.log(add10(5)) // 15\r\nconsole.log(curried(3, 4)) // 7\n"})})]})}function l(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(a,{...e})}):a(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>u});var c=r(6540);const t={},o=c.createContext(t);function s(e){const n=c.useContext(o);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function u(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),c.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6ffcc0ea.893c0c53.js b/assets/js/6ffcc0ea.893c0c53.js new file mode 100644 index 00000000..fb1d1d87 --- /dev/null +++ b/assets/js/6ffcc0ea.893c0c53.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2353],{9529:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>l,frontMatter:()=>o,metadata:()=>u,toc:()=>a});var c=r(4848),t=r(8453);const o={id:"curry"},s=void 0,u={id:"curry",title:"curry",description:"curry() function",source:"@site/docs/curry.md",sourceDirName:".",slug:"/curry",permalink:"/docs/curry",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"curry"},sidebar:"api",previous:{title:"countBy",permalink:"/docs/countBy"},next:{title:"delay",permalink:"/docs/delay"}},i={},a=[{value:"curry() function",id:"curry-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h2,{id:"curry-function",children:"curry() function"}),"\n",(0,c.jsxs)(n.p,{children:["Returns a curried function of ",(0,c.jsx)(n.code,{children:"f"})]}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-typescript",children:"declare function curry any>(f: F): Curry;\n"})}),"\n",(0,c.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"const add = (a: number, b: number): number => a + b\r\n\r\nconst curried = curry(add)\r\nconst add10 = curried(10)\r\nconsole.log(add10(5)) // 15\r\nconsole.log(curried(3, 4)) // 7\n"})}),"\n",(0,c.jsx)(n.p,{children:(0,c.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/curry.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>u});var c=r(6540);const t={},o=c.createContext(t);function s(e){const n=c.useContext(o);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function u(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),c.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/7037e66f.88b66a0d.js b/assets/js/7037e66f.bb185e1a.js similarity index 75% rename from assets/js/7037e66f.88b66a0d.js rename to assets/js/7037e66f.bb185e1a.js index dca0a281..9a69ae2f 100644 --- a/assets/js/7037e66f.88b66a0d.js +++ b/assets/js/7037e66f.bb185e1a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8285],{7803:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>d});var t=r(4848),a=r(8453);const s={id:"range"},o=void 0,i={id:"range",title:"range",description:"range() function",source:"@site/docs/range.md",sourceDirName:".",slug:"/range",permalink:"/docs/range",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"range"},sidebar:"api",previous:{title:"prepend",permalink:"/docs/prepend"},next:{title:"reject",permalink:"/docs/reject"}},c={},d=[{value:"range() function",id:"range-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"range-function",children:"range() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns Iterable/AsyncIterable of numbers (positive and/or negative) progressing from start-up to, but not including, end. it's set to start with a start then set to 0."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function range(length: number): IterableIterator;\n\ndeclare function range(start: number, end: number): IterableIterator;\n\ndeclare function range(start: number, end: number, step: number): IterableIterator;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = range(4);\r\niter.next() // {done:false, value: 0}\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n range(4),\r\n toArray,\r\n); // [0, 1, 2, 3]\r\n\r\npipe(\r\n range(1, 4),\r\n toArray,\r\n); // [1, 2, 3]\r\n\r\n// with toAsync\r\nawait pipe(\r\n range(4),\r\n toAsync,\r\n toArray,\r\n); // [0, 1, 2, 3]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-range-3phyd",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>i});var t=r(6540);const a={},s=t.createContext(a);function o(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8285],{7803:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>p,frontMatter:()=>s,metadata:()=>i,toc:()=>d});var t=r(4848),a=r(8453);const s={id:"range"},o=void 0,i={id:"range",title:"range",description:"range() function",source:"@site/docs/range.md",sourceDirName:".",slug:"/range",permalink:"/docs/range",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"range"},sidebar:"api",previous:{title:"prepend",permalink:"/docs/prepend"},next:{title:"reject",permalink:"/docs/reject"}},c={},d=[{value:"range() function",id:"range-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"range-function",children:"range() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns Iterable/AsyncIterable of numbers (positive and/or negative) progressing from start-up to, but not including, end. it's set to start with a start then set to 0."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function range(length: number): IterableIterator;\n\ndeclare function range(start: number, end: number): IterableIterator;\n\ndeclare function range(start: number, end: number, step: number): IterableIterator;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = range(4);\r\niter.next() // {done:false, value: 0}\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n range(4),\r\n toArray,\r\n); // [0, 1, 2, 3]\r\n\r\npipe(\r\n range(1, 4),\r\n toArray,\r\n); // [1, 2, 3]\r\n\r\n// with toAsync\r\nawait pipe(\r\n range(4),\r\n toAsync,\r\n toArray,\r\n); // [0, 1, 2, 3]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-range-3phyd",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/range.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>i});var t=r(6540);const a={},s=t.createContext(a);function o(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/72bb5253.1df85cb3.js b/assets/js/72bb5253.1df85cb3.js deleted file mode 100644 index b2de70e0..00000000 --- a/assets/js/72bb5253.1df85cb3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9589],{5244:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>o,frontMatter:()=>t,metadata:()=>d,toc:()=>i});var c=r(4848),a=r(8453);const t={id:"reduceLazy"},s=void 0,d={id:"reduceLazy",title:"reduceLazy",description:"reduceLazy() function",source:"@site/docs/reduceLazy.md",sourceDirName:".",slug:"/reduceLazy",permalink:"/docs/reduceLazy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"reduceLazy"},sidebar:"api",previous:{title:"reduce",permalink:"/docs/reduce"},next:{title:"size",permalink:"/docs/size"}},l={},i=[{value:"reduceLazy() function",id:"reducelazy-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h2,{id:"reducelazy-function",children:"reduceLazy() function"}),"\n",(0,c.jsxs)(n.p,{children:["High order functional version of ",(0,c.jsx)(n.code,{children:"reduce"}),", which behaves identical to it."]}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-typescript",children:"declare function reduceLazy(f: AsyncReducer, seed?: T): (iterable: Iterable | AsyncIterable) => Promise;\n\ndeclare function reduceLazy(f: AsyncReducer, seed: Acc): (iterable: Iterable | AsyncIterable) => Promise;\n\ndeclare function reduceLazy(f: SyncReducer, seed?: T): | AsyncIterable>(iterable: C) => ReturnValueType;\n\ndeclare function reduceLazy(f: SyncReducer, seed: Acc): | AsyncIterable>(iterable: C) => ReturnValueType;\n\ndeclare function reduceLazy | AsyncIterable, Acc>(f: SyncReducer> | AsyncReducer>, seed: Acc): (iterable: InferCarrier) => ReturnValueType;\n\ndeclare function reduceLazy | AsyncIterable>(f: AsyncReducer, IterableInfer> | SyncReducer, IterableInfer>, seed?: IterableInfer): (iterable: InferCarrier) => ReturnValueType>;\n"})}),"\n",(0,c.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(n.p,{children:"Type must be provided for stand alone call."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"const reduce = reduceLazy((a: number, b: number) => a + b, 5)\r\n\r\nreduce([1, 2, 3]) // number\r\nreduce(toAsync([1, 2, 3])) // Promise\n"})}),"\n",(0,c.jsxs)(n.p,{children:["Fit perfectly with ",(0,c.jsx)(n.code,{children:"pipe"})]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"pipe(\r\n [1, 2, 3, 4],\r\n reduceLazy((a, b) => a + b, 5)\r\n); // 15\n"})}),"\n",(0,c.jsx)(n.p,{children:"You can use asynchronous callback"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"await pipe(\r\n [1, 2, 3, 4],\r\n reduceLazy(async (a, b) => a + b, 5)\r\n); // 15\n"})}),"\n",(0,c.jsxs)(n.p,{children:[(0,c.jsx)(n.code,{children:"AsyncIterable"})," doesn't matter."]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"await pipe(\r\n [1, 2, 3, 4],\r\n toAsync,\r\n reduceLazy((a, b) => a + b, 5)\r\n); // 15\n"})})]})}function o(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(u,{...e})}):u(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>d});var c=r(6540);const a={},t=c.createContext(a);function s(e){const n=c.useContext(t);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),c.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/72bb5253.bd017bac.js b/assets/js/72bb5253.bd017bac.js new file mode 100644 index 00000000..101d0640 --- /dev/null +++ b/assets/js/72bb5253.bd017bac.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9589],{5244:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>o,frontMatter:()=>t,metadata:()=>d,toc:()=>i});var c=r(4848),a=r(8453);const t={id:"reduceLazy"},s=void 0,d={id:"reduceLazy",title:"reduceLazy",description:"reduceLazy() function",source:"@site/docs/reduceLazy.md",sourceDirName:".",slug:"/reduceLazy",permalink:"/docs/reduceLazy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"reduceLazy"},sidebar:"api",previous:{title:"reduce",permalink:"/docs/reduce"},next:{title:"size",permalink:"/docs/size"}},l={},i=[{value:"reduceLazy() function",id:"reducelazy-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h2,{id:"reducelazy-function",children:"reduceLazy() function"}),"\n",(0,c.jsxs)(n.p,{children:["High order functional version of ",(0,c.jsx)(n.code,{children:"reduce"}),", which behaves identical to it."]}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-typescript",children:"declare function reduceLazy(f: AsyncReducer, seed?: T): (iterable: Iterable | AsyncIterable) => Promise;\n\ndeclare function reduceLazy(f: AsyncReducer, seed: Acc): (iterable: Iterable | AsyncIterable) => Promise;\n\ndeclare function reduceLazy(f: SyncReducer, seed?: T): | AsyncIterable>(iterable: C) => ReturnValueType;\n\ndeclare function reduceLazy(f: SyncReducer, seed: Acc): | AsyncIterable>(iterable: C) => ReturnValueType;\n\ndeclare function reduceLazy | AsyncIterable, Acc>(f: SyncReducer> | AsyncReducer>, seed: Acc): (iterable: InferCarrier) => ReturnValueType;\n\ndeclare function reduceLazy | AsyncIterable>(f: AsyncReducer, IterableInfer> | SyncReducer, IterableInfer>, seed?: IterableInfer): (iterable: InferCarrier) => ReturnValueType>;\n"})}),"\n",(0,c.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(n.p,{children:"Type must be provided for stand alone call."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"const reduce = reduceLazy((a: number, b: number) => a + b, 5)\r\n\r\nreduce([1, 2, 3]) // number\r\nreduce(toAsync([1, 2, 3])) // Promise\n"})}),"\n",(0,c.jsxs)(n.p,{children:["Fit perfectly with ",(0,c.jsx)(n.code,{children:"pipe"})]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"pipe(\r\n [1, 2, 3, 4],\r\n reduceLazy((a, b) => a + b, 5)\r\n); // 15\n"})}),"\n",(0,c.jsx)(n.p,{children:"You can use asynchronous callback"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"await pipe(\r\n [1, 2, 3, 4],\r\n reduceLazy(async (a, b) => a + b, 5)\r\n); // 15\n"})}),"\n",(0,c.jsxs)(n.p,{children:[(0,c.jsx)(n.code,{children:"AsyncIterable"})," doesn't matter."]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"await pipe(\r\n [1, 2, 3, 4],\r\n toAsync,\r\n reduceLazy((a, b) => a + b, 5)\r\n); // 15\n"})}),"\n",(0,c.jsx)(n.p,{children:(0,c.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/reduceLazy.ts",children:"Open Source Code"})})]})}function o(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(u,{...e})}):u(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>d});var c=r(6540);const a={},t=c.createContext(a);function s(e){const n=c.useContext(t);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),c.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/734f2e17.d11adcb0.js b/assets/js/734f2e17.316a6ae1.js similarity index 87% rename from assets/js/734f2e17.d11adcb0.js rename to assets/js/734f2e17.316a6ae1.js index 35245aa9..2aaca2bd 100644 --- a/assets/js/734f2e17.d11adcb0.js +++ b/assets/js/734f2e17.316a6ae1.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1028],{1498:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>t,metadata:()=>i,toc:()=>o});var c=r(4848),s=r(8453);const t={id:"reduce"},a=void 0,i={id:"reduce",title:"reduce",description:"reduce() function",source:"@site/docs/reduce.md",sourceDirName:".",slug:"/reduce",permalink:"/docs/reduce",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"reduce"},sidebar:"api",previous:{title:"props",permalink:"/docs/props"},next:{title:"reduceLazy",permalink:"/docs/reduceLazy"}},d={},o=[{value:"reduce() function",id:"reduce-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h2,{id:"reduce-function",children:"reduce() function"}),"\n",(0,c.jsx)(n.p,{children:"Also known as foldl, this method boils down a list of values into a single value."}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-typescript",children:"declare function reduce(f: SyncReducer, iterable: Iterable): T;\n\ndeclare function reduce(f: SyncReducer, iterable: Iterable): Acc;\n\ndeclare function reduce(f: SyncReducer, iterable: AsyncIterable): Promise;\n\ndeclare function reduce(f: Arrow, seed: Acc, iterable: T): Acc;\n\ndeclare function reduce(f: SyncReducer, seed: Acc, iterable: Iterable): Acc;\n\ndeclare function reduce(f: AsyncReducer, iterable: AsyncIterable): Promise;\n\ndeclare function reduce(f: AsyncReducer, seed: Acc | Promise, iterable: AsyncIterable): Promise;\n\ndeclare function reduce | AsyncIterable, Acc>(f: AsyncReducer>): (iterable: T) => ReturnValueType;\n\ndeclare function reduce | AsyncIterable>(f: AsyncReducer, IterableInfer>): (iterable: T) => ReturnValueType;\n"})}),"\n",(0,c.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(n.p,{children:"You can reduce values into homogeneous type."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"const sum = (a:number, b:number) => a + b;\r\n\r\n// with implicit seed with first element\r\nreduce(sum, [1, 2, 3, 4]); // 10\r\n\r\n// with explicit seed\r\nreduce(sum, 0, [1, 2, 3, 4]); // 10\n"})}),"\n",(0,c.jsx)(n.p,{children:"You can reduce values into heterogeneous type."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"// reduce { id: number; score: number; } to number\r\nreduce((acc, value) => acc + value.score, 0, [\r\n { id: 0, score: 1 },\r\n { id: 5, score: 2 },\r\n { id: 9, score: 3 },\r\n { id: 3, score: 4 }\r\n])\n"})}),"\n",(0,c.jsx)(n.p,{children:"Omitting iterable will returns function, useful when using with pipe."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"pipe(\r\n [1, 2, 3, 4],\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n reduce(sum),\r\n); // 26\n"})}),"\n",(0,c.jsxs)(n.p,{children:["For backward compatibility, ",(0,c.jsx)(n.code,{children:"reduce"})," can support partial lazy form. You may want to use ",(0,c.jsx)(n.code,{children:"reduceLazy"})," to use ",(0,c.jsx)(n.code,{children:"seed"}),"."]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"await pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n map((a) => a + 10),\r\n filter(a => a % 2 === 0),\r\n reduce(sum),\r\n); // 26\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n toAsync,\r\n map(async (a) => a + 10),\r\n filter(a => a % 2 === 0),\r\n reduce(sum),\r\n); // 26\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n reduce(sum),\r\n); // 26\n"})}),"\n",(0,c.jsx)(n.p,{children:(0,c.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-reduce-tf56j",children:"Try It"})}),"\n",(0,c.jsxs)(n.p,{children:["see ",(0,c.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,c.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,c.jsx)(n.a,{href:"https://fxts.dev/docs/map",children:"map"}),", ",(0,c.jsx)(n.a,{href:"https://fxts.dev/docs/filter",children:"filter"})]})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>a,x:()=>i});var c=r(6540);const s={},t=c.createContext(s);function a(e){const n=c.useContext(t);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),c.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1028],{1498:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>d,contentTitle:()=>a,default:()=>u,frontMatter:()=>t,metadata:()=>i,toc:()=>o});var c=r(4848),s=r(8453);const t={id:"reduce"},a=void 0,i={id:"reduce",title:"reduce",description:"reduce() function",source:"@site/docs/reduce.md",sourceDirName:".",slug:"/reduce",permalink:"/docs/reduce",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"reduce"},sidebar:"api",previous:{title:"props",permalink:"/docs/props"},next:{title:"reduceLazy",permalink:"/docs/reduceLazy"}},d={},o=[{value:"reduce() function",id:"reduce-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h2,{id:"reduce-function",children:"reduce() function"}),"\n",(0,c.jsx)(n.p,{children:"Also known as foldl, this method boils down a list of values into a single value."}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-typescript",children:"declare function reduce(f: SyncReducer, iterable: Iterable): T;\n\ndeclare function reduce(f: SyncReducer, iterable: Iterable): Acc;\n\ndeclare function reduce(f: SyncReducer, iterable: AsyncIterable): Promise;\n\ndeclare function reduce(f: Arrow, seed: Acc, iterable: T): Acc;\n\ndeclare function reduce(f: SyncReducer, seed: Acc, iterable: Iterable): Acc;\n\ndeclare function reduce(f: AsyncReducer, iterable: AsyncIterable): Promise;\n\ndeclare function reduce(f: AsyncReducer, seed: Acc | Promise, iterable: AsyncIterable): Promise;\n\ndeclare function reduce | AsyncIterable, Acc>(f: AsyncReducer>): (iterable: T) => ReturnValueType;\n\ndeclare function reduce | AsyncIterable>(f: AsyncReducer, IterableInfer>): (iterable: T) => ReturnValueType;\n"})}),"\n",(0,c.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(n.p,{children:"You can reduce values into homogeneous type."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"const sum = (a:number, b:number) => a + b;\r\n\r\n// with implicit seed with first element\r\nreduce(sum, [1, 2, 3, 4]); // 10\r\n\r\n// with explicit seed\r\nreduce(sum, 0, [1, 2, 3, 4]); // 10\n"})}),"\n",(0,c.jsx)(n.p,{children:"You can reduce values into heterogeneous type."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"// reduce { id: number; score: number; } to number\r\nreduce((acc, value) => acc + value.score, 0, [\r\n { id: 0, score: 1 },\r\n { id: 5, score: 2 },\r\n { id: 9, score: 3 },\r\n { id: 3, score: 4 }\r\n])\n"})}),"\n",(0,c.jsx)(n.p,{children:"Omitting iterable will returns function, useful when using with pipe."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"pipe(\r\n [1, 2, 3, 4],\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n reduce(sum),\r\n); // 26\n"})}),"\n",(0,c.jsxs)(n.p,{children:["For backward compatibility, ",(0,c.jsx)(n.code,{children:"reduce"})," can support partial lazy form. You may want to use ",(0,c.jsx)(n.code,{children:"reduceLazy"})," to use ",(0,c.jsx)(n.code,{children:"seed"}),"."]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:"await pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n map((a) => a + 10),\r\n filter(a => a % 2 === 0),\r\n reduce(sum),\r\n); // 26\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n toAsync,\r\n map(async (a) => a + 10),\r\n filter(a => a % 2 === 0),\r\n reduce(sum),\r\n); // 26\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n reduce(sum),\r\n); // 26\n"})}),"\n",(0,c.jsx)(n.p,{children:(0,c.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-reduce-tf56j",children:"Try It"})}),"\n",(0,c.jsxs)(n.p,{children:["see ",(0,c.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,c.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,c.jsx)(n.a,{href:"https://fxts.dev/docs/map",children:"map"}),", ",(0,c.jsx)(n.a,{href:"https://fxts.dev/docs/filter",children:"filter"})]}),"\n",(0,c.jsx)(n.p,{children:(0,c.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/reduce.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>a,x:()=>i});var c=r(6540);const s={},t=c.createContext(s);function a(e){const n=c.useContext(t);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),c.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/7432206e.45fdedd1.js b/assets/js/7432206e.50ce865c.js similarity index 58% rename from assets/js/7432206e.45fdedd1.js rename to assets/js/7432206e.50ce865c.js index f696c751..1d228e69 100644 --- a/assets/js/7432206e.45fdedd1.js +++ b/assets/js/7432206e.50ce865c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8756],{2996:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>l,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var i=t(4848),c=t(8453);const r={id:"pickBy"},a=void 0,s={id:"pickBy",title:"pickBy",description:"pickBy() function",source:"@site/docs/pickBy.md",sourceDirName:".",slug:"/pickBy",permalink:"/docs/pickBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"pickBy"},sidebar:"api",previous:{title:"pick",permalink:"/docs/pick"},next:{title:"pipe",permalink:"/docs/pipe"}},o={},p=[{value:"pickBy() function",id:"pickby-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"pickby-function",children:"pickBy() function"}),"\n",(0,i.jsx)(n.p,{children:"Returns a partial copy of an object which contains only the keys that satisfy the supplied predicate."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function pickBy>(f: F, obj: T): Partial;\n\ndeclare function pickBy>(f: F): (obj: T) => Partial;\n\ndeclare function pickBy>(f: F, obj: T): Promise>;\n\ndeclare function pickBy>(f: F): (obj: T) => Promise>;\n\ndeclare function pickBy>(f: F, obj: T): Partial | Promise>;\n\ndeclare function pickBy>(f: F): (obj: T) => Partial | Promise>;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:'const obj = { a: 1, b: "2", c: true };\r\npickBy(([key, value]) => key === "a" || value === true, obj); // { a: 1, c: true }\r\n\r\n// asynchronous predicate\r\nawait pickBy(async ([key, value]) => key === "a" || value === true, obj); // { a: 1, c: true }\r\n\r\n// Using with the `pipe` function\r\npipe(\r\n obj,\r\n pickBy(([key, value]) => key === "a" || value === true)\r\n);\r\n\r\nawait pipe(\r\n obj,\r\n pickBy(async ([key, value]) => key === "a" || value === true)\r\n);\n'})}),"\n",(0,i.jsxs)(n.p,{children:["see ",(0,i.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,i.jsx)(n.a,{href:"https://fxts.dev/docs/pick",children:"pick"}),","]})]})}function l(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>s});var i=t(6540);const c={},r=i.createContext(c);function a(e){const n=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:a(e.components),i.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8756],{2996:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>l,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var c=t(4848),i=t(8453);const r={id:"pickBy"},a=void 0,s={id:"pickBy",title:"pickBy",description:"pickBy() function",source:"@site/docs/pickBy.md",sourceDirName:".",slug:"/pickBy",permalink:"/docs/pickBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"pickBy"},sidebar:"api",previous:{title:"pick",permalink:"/docs/pick"},next:{title:"pipe",permalink:"/docs/pipe"}},o={},p=[{value:"pickBy() function",id:"pickby-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h2,{id:"pickby-function",children:"pickBy() function"}),"\n",(0,c.jsx)(n.p,{children:"Returns a partial copy of an object which contains only the keys that satisfy the supplied predicate."}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-typescript",children:"declare function pickBy>(f: F, obj: T): Partial;\n\ndeclare function pickBy>(f: F): (obj: T) => Partial;\n\ndeclare function pickBy>(f: F, obj: T): Promise>;\n\ndeclare function pickBy>(f: F): (obj: T) => Promise>;\n\ndeclare function pickBy>(f: F, obj: T): Partial | Promise>;\n\ndeclare function pickBy>(f: F): (obj: T) => Partial | Promise>;\n"})}),"\n",(0,c.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:'const obj = { a: 1, b: "2", c: true };\r\npickBy(([key, value]) => key === "a" || value === true, obj); // { a: 1, c: true }\r\n\r\n// asynchronous predicate\r\nawait pickBy(async ([key, value]) => key === "a" || value === true, obj); // { a: 1, c: true }\r\n\r\n// Using with the `pipe` function\r\npipe(\r\n obj,\r\n pickBy(([key, value]) => key === "a" || value === true)\r\n);\r\n\r\nawait pipe(\r\n obj,\r\n pickBy(async ([key, value]) => key === "a" || value === true)\r\n);\n'})}),"\n",(0,c.jsxs)(n.p,{children:["see ",(0,c.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,c.jsx)(n.a,{href:"https://fxts.dev/docs/pick",children:"pick"}),","]}),"\n",(0,c.jsx)(n.p,{children:(0,c.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/pickBy.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>s});var c=t(6540);const i={},r=c.createContext(i);function a(e){const n=c.useContext(r);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),c.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/81602ec0.b65c2674.js b/assets/js/81602ec0.b65c2674.js new file mode 100644 index 00000000..9dc44fdd --- /dev/null +++ b/assets/js/81602ec0.b65c2674.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7778],{4499:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=t(4848),c=t(8453);const i={id:"difference"},a=void 0,l={id:"difference",title:"difference",description:"difference() function",source:"@site/docs/difference.md",sourceDirName:".",slug:"/difference",permalink:"/docs/difference",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"difference"},sidebar:"api",previous:{title:"dropRight",permalink:"/docs/dropRight"},next:{title:"differenceBy",permalink:"/docs/differenceBy"}},o={},s=[{value:"difference() function",id:"difference-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"difference-function",children:"difference() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable of all elements in the ",(0,r.jsx)(n.code,{children:"iterable2"})," not contained in the ",(0,r.jsx)(n.code,{children:"iterable1"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function difference(iterable1: Iterable, iterable2: Iterable): IterableIterator;\n\ndeclare function difference(iterable1: AsyncIterable, iterable2: Iterable): AsyncIterableIterator;\n\ndeclare function difference(iterable1: Iterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function difference(iterable1: AsyncIterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function difference | AsyncIterable, B extends Iterable | AsyncIterable>(iterable1: A): (iterable2: B) => A extends AsyncIterable ? AsyncIterableIterator> : B extends AsyncIterable ? AsyncIterableIterator> : IterableIterator>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = difference([2, 1], [2, 3, 4]);\r\niter.next(); // {value: 3, done:false}\r\niter.next(); // {value: 4, done:false}\r\niter.next(); // {value: undefined, done: true}\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/difference.ts",children:"Open Source Code"})})]})}function f(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>l});var r=t(6540);const c={},i=r.createContext(c);function a(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:a(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/81602ec0.f7117244.js b/assets/js/81602ec0.f7117244.js deleted file mode 100644 index 83e95468..00000000 --- a/assets/js/81602ec0.f7117244.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7778],{4499:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=t(4848),c=t(8453);const i={id:"difference"},a=void 0,l={id:"difference",title:"difference",description:"difference() function",source:"@site/docs/difference.md",sourceDirName:".",slug:"/difference",permalink:"/docs/difference",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"difference"},sidebar:"api",previous:{title:"dropRight",permalink:"/docs/dropRight"},next:{title:"differenceBy",permalink:"/docs/differenceBy"}},o={},s=[{value:"difference() function",id:"difference-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"difference-function",children:"difference() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable of all elements in the ",(0,r.jsx)(n.code,{children:"iterable2"})," not contained in the ",(0,r.jsx)(n.code,{children:"iterable1"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function difference(iterable1: Iterable, iterable2: Iterable): IterableIterator;\n\ndeclare function difference(iterable1: AsyncIterable, iterable2: Iterable): AsyncIterableIterator;\n\ndeclare function difference(iterable1: Iterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function difference(iterable1: AsyncIterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function difference | AsyncIterable, B extends Iterable | AsyncIterable>(iterable1: A): (iterable2: B) => A extends AsyncIterable ? AsyncIterableIterator> : B extends AsyncIterable ? AsyncIterableIterator> : IterableIterator>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = difference([2, 1], [2, 3, 4]);\r\niter.next(); // {value: 3, done:false}\r\niter.next(); // {value: 4, done:false}\r\niter.next(); // {value: undefined, done: true}\n"})})]})}function f(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>l});var r=t(6540);const c={},i=r.createContext(c);function a(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:a(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/81f1b453.9808f77a.js b/assets/js/81f1b453.f8ea057b.js similarity index 79% rename from assets/js/81f1b453.9808f77a.js rename to assets/js/81f1b453.f8ea057b.js index db01387e..5a9a7b8d 100644 --- a/assets/js/81f1b453.9808f77a.js +++ b/assets/js/81f1b453.f8ea057b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8935],{2113:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>a,toc:()=>p});var t=r(4848),i=r(8453);const s={id:"zip"},o=void 0,a={id:"zip",title:"zip",description:"zip() function",source:"@site/docs/zip.md",sourceDirName:".",slug:"/zip",permalink:"/docs/zip",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"zip"},sidebar:"api",previous:{title:"values",permalink:"/docs/values"},next:{title:"zipWith",permalink:"/docs/zipWith"}},c={},p=[{value:"zip() function",id:"zip-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"zip-function",children:"zip() function"}),"\n",(0,t.jsx)(n.p,{children:"Merges the values of each of the arrays with the values at the corresponding position together. Useful when you have separate data sources that are coordinated through matching array indices."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function zip(...args: T): ReturnZipType<[...T]>;\n\ndeclare function zip(a: T): (...args: TS) => ReturnZipType<[T, ...TS]>;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = zip([1, 2, 3, 4], [5, 6, 7, 8]);\r\niter.next() // {done:false, value: [1, 5]}\r\niter.next() // {done:false, value: [2, 6]}\r\niter.next() // {done:false, value: [3, 7]}\r\niter.next() // {done:false, value: [4, 8]}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [5, 6, 7, 8],\r\n zip([1, 2, 3, 4]),\r\n toArray,\r\n); // [[1, 5], [2, 6], [3, 7], [4, 8]]\r\n\r\nawait pipe(\r\n Promise.resolve([5, 6, 7, 8]),\r\n zip([1, 2, 3, 4]),\r\n toArray,\r\n); // [[1, 5], [2, 6], [3, 7], [4, 8]]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(5), Promise.resolve(6), Promise.resolve(7), Promise.resolve(8)],\r\n toAsync,\r\n zip([1, 2, 3, 4]),\r\n toArray,\r\n); // [[1, 5], [2, 6], [3, 7], [4, 8]]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-zip-81jnh",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>a});var t=r(6540);const i={},s=t.createContext(i);function o(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8935],{2113:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>a,toc:()=>p});var t=r(4848),i=r(8453);const s={id:"zip"},o=void 0,a={id:"zip",title:"zip",description:"zip() function",source:"@site/docs/zip.md",sourceDirName:".",slug:"/zip",permalink:"/docs/zip",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"zip"},sidebar:"api",previous:{title:"values",permalink:"/docs/values"},next:{title:"zipWith",permalink:"/docs/zipWith"}},c={},p=[{value:"zip() function",id:"zip-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"zip-function",children:"zip() function"}),"\n",(0,t.jsx)(n.p,{children:"Merges the values of each of the arrays with the values at the corresponding position together. Useful when you have separate data sources that are coordinated through matching array indices."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function zip(...args: T): ReturnZipType<[...T]>;\n\ndeclare function zip(a: T): (...args: TS) => ReturnZipType<[T, ...TS]>;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = zip([1, 2, 3, 4], [5, 6, 7, 8]);\r\niter.next() // {done:false, value: [1, 5]}\r\niter.next() // {done:false, value: [2, 6]}\r\niter.next() // {done:false, value: [3, 7]}\r\niter.next() // {done:false, value: [4, 8]}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [5, 6, 7, 8],\r\n zip([1, 2, 3, 4]),\r\n toArray,\r\n); // [[1, 5], [2, 6], [3, 7], [4, 8]]\r\n\r\nawait pipe(\r\n Promise.resolve([5, 6, 7, 8]),\r\n zip([1, 2, 3, 4]),\r\n toArray,\r\n); // [[1, 5], [2, 6], [3, 7], [4, 8]]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(5), Promise.resolve(6), Promise.resolve(7), Promise.resolve(8)],\r\n toAsync,\r\n zip([1, 2, 3, 4]),\r\n toArray,\r\n); // [[1, 5], [2, 6], [3, 7], [4, 8]]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-zip-81jnh",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/zip.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>a});var t=r(6540);const i={},s=t.createContext(i);function o(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/826618bd.007549ad.js b/assets/js/826618bd.dce0d5c9.js similarity index 87% rename from assets/js/826618bd.007549ad.js rename to assets/js/826618bd.dce0d5c9.js index dc85b17e..6e33aa4d 100644 --- a/assets/js/826618bd.007549ad.js +++ b/assets/js/826618bd.dce0d5c9.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9744],{6713:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>a,toc:()=>l});var t=r(4848),c=r(8453);const s={id:"concurrent"},o=void 0,a={id:"concurrent",title:"concurrent",description:"concurrent() function",source:"@site/docs/concurrent.md",sourceDirName:".",slug:"/concurrent",permalink:"/docs/concurrent",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"concurrent"},sidebar:"api",previous:{title:"concat",permalink:"/docs/concat"},next:{title:"cycle",permalink:"/docs/cycle"}},i={},l=[{value:"concurrent() function",id:"concurrent-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"concurrent-function",children:"concurrent() function"}),"\n",(0,t.jsxs)(n.p,{children:["Concurrent is used to balance the load of multiple asynchronous requests. The first argument receives a number that controls the number of loads, and the second argument is an AsyncIterable. See ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"})," to create an AsyncIterable ."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function concurrent(length: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function concurrent(length: number, iterable?: AsyncIterable): (iterable: AsyncIterable) => AsyncIterableIterator;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"await pipe(\r\n [1, 2, 3, 4, 5, 6],\r\n toAsync,\r\n map((a) => delay(1000, a)),\r\n concurrent(3),\r\n each(console.log), // log 1, 2, 3, 4, 5, 6\r\n); // 2 seconds\r\n\r\n// evaluation\r\n// \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510\r\n// \u2502 1 \u2502\u2500\u2500\u2502 2 \u2502\u2500\u2500\u2502 3 \u2502\u2500\u2500\u2502 4 \u2502\u2500\u2500\u2502 5 \u2502\u2500\u2500\u2502 6 \u2502\r\n// \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518\r\n// map \u2502 \u2502 \u2502 \u2502 \u2502 \u2502\r\n// concurrent(3) (1) (1) (1) (2) (2) (2)\r\n// \u2502 \u2502 \u2502 \u2502 \u2502 \u2502\r\n// \u25bc \u25bc \u25bc \u25bc \u25bc \u25bc\r\n\r\nawait pipe(\r\n [1, 2, 3, 4, 5, 6],\r\n toAsync,\r\n map((a) => delay(1000, a)),\r\n each(console.log), // log 1, 2, 3, 4, 5, 6\r\n); // 6 seconds\r\n\r\n// evaluation\r\n// \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510\r\n// \u2502 1 \u2502\u2500\u2500\u2502 2 \u2502\u2500\u2500\u2502 3 \u2502\u2500\u2500\u2502 4 \u2502\u2500\u2500\u2502 5 \u2502\u2500\u2500\u2502 6 \u2502\r\n// \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518\r\n// map \u2502 \u2502 \u2502 \u2502 \u2502 \u2502\r\n// (1) (2) (3) (4) (5) (6)\r\n// \u2502 \u2502 \u2502 \u2502 \u2502 \u2502\r\n// \u25bc \u25bc \u25bc \u25bc \u25bc \u25bc\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-concurrent-4x58c",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})," ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/each",children:"each"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/map",children:"map"})]})]})}function u(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>a});var t=r(6540);const c={},s=t.createContext(c);function o(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:o(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9744],{6713:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>a,toc:()=>l});var t=r(4848),c=r(8453);const s={id:"concurrent"},o=void 0,a={id:"concurrent",title:"concurrent",description:"concurrent() function",source:"@site/docs/concurrent.md",sourceDirName:".",slug:"/concurrent",permalink:"/docs/concurrent",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"concurrent"},sidebar:"api",previous:{title:"concat",permalink:"/docs/concat"},next:{title:"cycle",permalink:"/docs/cycle"}},i={},l=[{value:"concurrent() function",id:"concurrent-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"concurrent-function",children:"concurrent() function"}),"\n",(0,t.jsxs)(n.p,{children:["Concurrent is used to balance the load of multiple asynchronous requests. The first argument receives a number that controls the number of loads, and the second argument is an AsyncIterable. See ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"})," to create an AsyncIterable ."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function concurrent(length: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function concurrent(length: number, iterable?: AsyncIterable): (iterable: AsyncIterable) => AsyncIterableIterator;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"await pipe(\r\n [1, 2, 3, 4, 5, 6],\r\n toAsync,\r\n map((a) => delay(1000, a)),\r\n concurrent(3),\r\n each(console.log), // log 1, 2, 3, 4, 5, 6\r\n); // 2 seconds\r\n\r\n// evaluation\r\n// \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510\r\n// \u2502 1 \u2502\u2500\u2500\u2502 2 \u2502\u2500\u2500\u2502 3 \u2502\u2500\u2500\u2502 4 \u2502\u2500\u2500\u2502 5 \u2502\u2500\u2500\u2502 6 \u2502\r\n// \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518\r\n// map \u2502 \u2502 \u2502 \u2502 \u2502 \u2502\r\n// concurrent(3) (1) (1) (1) (2) (2) (2)\r\n// \u2502 \u2502 \u2502 \u2502 \u2502 \u2502\r\n// \u25bc \u25bc \u25bc \u25bc \u25bc \u25bc\r\n\r\nawait pipe(\r\n [1, 2, 3, 4, 5, 6],\r\n toAsync,\r\n map((a) => delay(1000, a)),\r\n each(console.log), // log 1, 2, 3, 4, 5, 6\r\n); // 6 seconds\r\n\r\n// evaluation\r\n// \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2510\r\n// \u2502 1 \u2502\u2500\u2500\u2502 2 \u2502\u2500\u2500\u2502 3 \u2502\u2500\u2500\u2502 4 \u2502\u2500\u2500\u2502 5 \u2502\u2500\u2500\u2502 6 \u2502\r\n// \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518 \u2514\u2500\u2500\u252c\u2500\u2500\u2518\r\n// map \u2502 \u2502 \u2502 \u2502 \u2502 \u2502\r\n// (1) (2) (3) (4) (5) (6)\r\n// \u2502 \u2502 \u2502 \u2502 \u2502 \u2502\r\n// \u25bc \u25bc \u25bc \u25bc \u25bc \u25bc\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-concurrent-4x58c",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})," ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/each",children:"each"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/map",children:"map"})]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/concurrent.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>a});var t=r(6540);const c={},s=t.createContext(c);function o(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:o(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/86f5e2e4.5e205259.js b/assets/js/86f5e2e4.7addd9de.js similarity index 66% rename from assets/js/86f5e2e4.5e205259.js rename to assets/js/86f5e2e4.7addd9de.js index c7e2dd3f..524eb0cd 100644 --- a/assets/js/86f5e2e4.5e205259.js +++ b/assets/js/86f5e2e4.7addd9de.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4048],{5462:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>c,toc:()=>o});var r=n(4848),s=n(8453);const i={id:"split"},l=void 0,c={id:"split",title:"split",description:"split() function",source:"@site/docs/split.md",sourceDirName:".",slug:"/split",permalink:"/docs/split",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"split"},sidebar:"api",previous:{title:"slice",permalink:"/docs/slice"},next:{title:"take",permalink:"/docs/take"}},a={},o=[{value:"split() function",id:"split-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"split-function",children:"split() function"}),"\n",(0,r.jsx)(t.p,{children:"Splits string by separator."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function split(sep: string, iterable: Iterable): IterableIterator;\n\ndeclare function split(sep: string, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function split | AsyncIterable>(sep: string): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:'const iter = split(\',\', \'1,2,3,4\');\r\niter.next(); // 1\r\niter.next(); // 2\r\niter.next(); // 3\r\niter.next(); // 4\r\niter.next(); // undefined\r\n\r\n// with pipe\r\npipe(\r\n "1,2,3,4,5",\r\n split(\',\'),\r\n toArray,\r\n); // ["1", "2", "3", "4", "5"]\n'})}),"\n",(0,r.jsxs)(t.p,{children:["see ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function d(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>c});var r=n(6540);const s={},i=r.createContext(s);function l(e){const t=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4048],{5462:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var r=n(4848),s=n(8453);const i={id:"split"},l=void 0,c={id:"split",title:"split",description:"split() function",source:"@site/docs/split.md",sourceDirName:".",slug:"/split",permalink:"/docs/split",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"split"},sidebar:"api",previous:{title:"slice",permalink:"/docs/slice"},next:{title:"take",permalink:"/docs/take"}},a={},p=[{value:"split() function",id:"split-function",level:2},{value:"Example",id:"example",level:2}];function o(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"split-function",children:"split() function"}),"\n",(0,r.jsx)(t.p,{children:"Splits string by separator."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function split(sep: string, iterable: Iterable): IterableIterator;\n\ndeclare function split(sep: string, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function split | AsyncIterable>(sep: string): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:'const iter = split(\',\', \'1,2,3,4\');\r\niter.next(); // 1\r\niter.next(); // 2\r\niter.next(); // 3\r\niter.next(); // 4\r\niter.next(); // undefined\r\n\r\n// with pipe\r\npipe(\r\n "1,2,3,4,5",\r\n split(\',\'),\r\n toArray,\r\n); // ["1", "2", "3", "4", "5"]\n'})}),"\n",(0,r.jsxs)(t.p,{children:["see ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/split.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(o,{...e})}):o(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>c});var r=n(6540);const s={},i=r.createContext(s);function l(e){const t=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(i.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/88f603ff.9b93ad80.js b/assets/js/88f603ff.9b93ad80.js deleted file mode 100644 index f14e8620..00000000 --- a/assets/js/88f603ff.9b93ad80.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7904],{3068:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>c,default:()=>d,frontMatter:()=>a,metadata:()=>o,toc:()=>s});var l=n(4848),r=n(8453);const a={id:"lt"},c=void 0,o={id:"lt",title:"lt",description:"lt() function",source:"@site/docs/lt.md",sourceDirName:".",slug:"/lt",permalink:"/docs/lt",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"lt"},sidebar:"api",previous:{title:"last",permalink:"/docs/last"},next:{title:"lte",permalink:"/docs/lte"}},i={},s=[{value:"lt() function",id:"lt-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(t.h2,{id:"lt-function",children:"lt() function"}),"\n",(0,l.jsx)(t.p,{children:"Returns true if the first argument is less than the second; false otherwise."}),"\n",(0,l.jsx)("b",{children:"Signature:"}),"\n",(0,l.jsx)(t.pre,{children:(0,l.jsx)(t.code,{className:"language-typescript",children:"declare function lt(a: Date, b: Date): boolean;\n\ndeclare function lt(a: Date): (b: Date) => boolean;\n\ndeclare function lt(a: string, b: string): boolean;\n\ndeclare function lt(a: number, b: number): boolean;\n\ndeclare function lt(a: string): (b: string) => boolean;\n\ndeclare function lt(a: number): (b: number) => boolean;\n"})}),"\n",(0,l.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,l.jsx)(t.pre,{children:(0,l.jsx)(t.code,{className:"language-ts",children:'lt(5, 1) // expected false\r\nlt(1, 5) // expected true\r\nlt("a", "b") // expected true\r\nlt("b", "a") // expected false\r\n\r\nfilter(lt(5), [1, 2, 4, 5, 8, 9]) // Iterable<[8, 9]>\r\nfilter(lt(7), [5, 6, 7]) // Iterable<[]>\r\nfilter(lt("b"), ["a", "b", "c"]) // Iterable<["c"]>\r\nfilter(lt("e"), ["b", "c", "d"]) // Itreable<[]>\n'})})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,l.jsx)(t,{...e,children:(0,l.jsx)(u,{...e})}):u(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>o});var l=n(6540);const r={},a=l.createContext(r);function c(e){const t=l.useContext(a);return l.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),l.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/88f603ff.9bd1b8d0.js b/assets/js/88f603ff.9bd1b8d0.js new file mode 100644 index 00000000..48f51044 --- /dev/null +++ b/assets/js/88f603ff.9bd1b8d0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7904],{3068:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>i});var l=n(4848),r=n(8453);const a={id:"lt"},c=void 0,o={id:"lt",title:"lt",description:"lt() function",source:"@site/docs/lt.md",sourceDirName:".",slug:"/lt",permalink:"/docs/lt",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"lt"},sidebar:"api",previous:{title:"last",permalink:"/docs/last"},next:{title:"lte",permalink:"/docs/lte"}},s={},i=[{value:"lt() function",id:"lt-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(t.h2,{id:"lt-function",children:"lt() function"}),"\n",(0,l.jsx)(t.p,{children:"Returns true if the first argument is less than the second; false otherwise."}),"\n",(0,l.jsx)("b",{children:"Signature:"}),"\n",(0,l.jsx)(t.pre,{children:(0,l.jsx)(t.code,{className:"language-typescript",children:"declare function lt(a: Date, b: Date): boolean;\n\ndeclare function lt(a: Date): (b: Date) => boolean;\n\ndeclare function lt(a: string, b: string): boolean;\n\ndeclare function lt(a: number, b: number): boolean;\n\ndeclare function lt(a: string): (b: string) => boolean;\n\ndeclare function lt(a: number): (b: number) => boolean;\n"})}),"\n",(0,l.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,l.jsx)(t.pre,{children:(0,l.jsx)(t.code,{className:"language-ts",children:'lt(5, 1) // expected false\r\nlt(1, 5) // expected true\r\nlt("a", "b") // expected true\r\nlt("b", "a") // expected false\r\n\r\nfilter(lt(5), [1, 2, 4, 5, 8, 9]) // Iterable<[8, 9]>\r\nfilter(lt(7), [5, 6, 7]) // Iterable<[]>\r\nfilter(lt("b"), ["a", "b", "c"]) // Iterable<["c"]>\r\nfilter(lt("e"), ["b", "c", "d"]) // Itreable<[]>\n'})}),"\n",(0,l.jsx)(t.p,{children:(0,l.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/lt.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,l.jsx)(t,{...e,children:(0,l.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>c,x:()=>o});var l=n(6540);const r={},a=l.createContext(r);function c(e){const t=l.useContext(a);return l.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),l.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/8f4062da.ac9be399.js b/assets/js/8f4062da.71beaa26.js similarity index 94% rename from assets/js/8f4062da.ac9be399.js rename to assets/js/8f4062da.71beaa26.js index bfb47cd0..36578dd5 100644 --- a/assets/js/8f4062da.ac9be399.js +++ b/assets/js/8f4062da.71beaa26.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9548],{6184:(T,a,e)=>{e.r(a),e.d(a,{assets:()=>w,contentTitle:()=>f,default:()=>p,frontMatter:()=>d,metadata:()=>n,toc:()=>A});var i=e(4848),t=e(8453);const d={id:"pipe"},f=void 0,n={id:"pipe",title:"pipe",description:"pipe() function",source:"@site/docs/pipe.md",sourceDirName:".",slug:"/pipe",permalink:"/docs/pipe",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"pipe"},sidebar:"api",previous:{title:"pickBy",permalink:"/docs/pickBy"},next:{title:"prop",permalink:"/docs/prop"}},w={},A=[{value:"pipe() function",id:"pipe-function",level:2},{value:"Example",id:"example",level:2}];function r(T){const a={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...T.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.h2,{id:"pipe-function",children:"pipe() function"}),"\n",(0,i.jsx)(a.p,{children:"Performs left to right function composition. The first argument can have any value; the remaining arguments must be unary."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(a.pre,{children:(0,i.jsx)(a.code,{className:"language-typescript",children:"declare function pipe(a: T1, f1: (a: Awaited) => R): ReturnPipeType<[T1, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => R): ReturnPipeType<[T1, T2, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => T19, f19: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => T19, f19: (a: Awaited) => T20, f20: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R]>;\n"})}),"\n",(0,i.jsx)(a.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(a.pre,{children:(0,i.jsx)(a.code,{className:"language-ts",children:"pipe(\r\n [1, 2, 3, 4, 5],\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n toAsync,\r\n map(async (a) => a + 10),\r\n filter((a) => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)],\r\n toAsync,\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\n"})}),"\n",(0,i.jsx)(a.p,{children:(0,i.jsx)(a.a,{href:"https://codesandbox.io/s/fxts-toarray-fy84i",children:"Try It"})}),"\n",(0,i.jsxs)(a.p,{children:["see ",(0,i.jsx)(a.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,i.jsx)(a.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,i.jsx)(a.a,{href:"https://fxts.dev/docs/map",children:"map"}),", ",(0,i.jsx)(a.a,{href:"https://fxts.dev/docs/filter",children:"filter"})]})]})}function p(T={}){const{wrapper:a}={...(0,t.R)(),...T.components};return a?(0,i.jsx)(a,{...T,children:(0,i.jsx)(r,{...T})}):r(T)}},8453:(T,a,e)=>{e.d(a,{R:()=>f,x:()=>n});var i=e(6540);const t={},d=i.createContext(t);function f(T){const a=i.useContext(d);return i.useMemo((function(){return"function"==typeof T?T(a):{...a,...T}}),[a,T])}function n(T){let a;return a=T.disableParentContext?"function"==typeof T.components?T.components(t):T.components||t:f(T.components),i.createElement(d.Provider,{value:a},T.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9548],{6184:(T,a,e)=>{e.r(a),e.d(a,{assets:()=>w,contentTitle:()=>f,default:()=>p,frontMatter:()=>d,metadata:()=>n,toc:()=>A});var i=e(4848),t=e(8453);const d={id:"pipe"},f=void 0,n={id:"pipe",title:"pipe",description:"pipe() function",source:"@site/docs/pipe.md",sourceDirName:".",slug:"/pipe",permalink:"/docs/pipe",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"pipe"},sidebar:"api",previous:{title:"pickBy",permalink:"/docs/pickBy"},next:{title:"prop",permalink:"/docs/prop"}},w={},A=[{value:"pipe() function",id:"pipe-function",level:2},{value:"Example",id:"example",level:2}];function r(T){const a={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...T.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.h2,{id:"pipe-function",children:"pipe() function"}),"\n",(0,i.jsx)(a.p,{children:"Performs left to right function composition. The first argument can have any value; the remaining arguments must be unary."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(a.pre,{children:(0,i.jsx)(a.code,{className:"language-typescript",children:"declare function pipe(a: T1, f1: (a: Awaited) => R): ReturnPipeType<[T1, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => R): ReturnPipeType<[T1, T2, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => T19, f19: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R]>;\n\ndeclare function pipe(a: T1, f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => T19, f19: (a: Awaited) => T20, f20: (a: Awaited) => R): ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R]>;\n"})}),"\n",(0,i.jsx)(a.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(a.pre,{children:(0,i.jsx)(a.code,{className:"language-ts",children:"pipe(\r\n [1, 2, 3, 4, 5],\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n toAsync,\r\n map(async (a) => a + 10),\r\n filter((a) => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)],\r\n toAsync,\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [12, 14]\n"})}),"\n",(0,i.jsx)(a.p,{children:(0,i.jsx)(a.a,{href:"https://codesandbox.io/s/fxts-toarray-fy84i",children:"Try It"})}),"\n",(0,i.jsxs)(a.p,{children:["see ",(0,i.jsx)(a.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,i.jsx)(a.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,i.jsx)(a.a,{href:"https://fxts.dev/docs/map",children:"map"}),", ",(0,i.jsx)(a.a,{href:"https://fxts.dev/docs/filter",children:"filter"})]}),"\n",(0,i.jsx)(a.p,{children:(0,i.jsx)(a.a,{href:"https://github.com/marpple/FxTS/blob/main/src/pipe.ts",children:"Open Source Code"})})]})}function p(T={}){const{wrapper:a}={...(0,t.R)(),...T.components};return a?(0,i.jsx)(a,{...T,children:(0,i.jsx)(r,{...T})}):r(T)}},8453:(T,a,e)=>{e.d(a,{R:()=>f,x:()=>n});var i=e(6540);const t={},d=i.createContext(t);function f(T){const a=i.useContext(d);return i.useMemo((function(){return"function"==typeof T?T(a):{...a,...T}}),[a,T])}function n(T){let a;return a=T.disableParentContext?"function"==typeof T.components?T.components(t):T.components||t:f(T.components),i.createElement(d.Provider,{value:a},T.children)}}}]); \ No newline at end of file diff --git a/assets/js/902de5c0.0053db98.js b/assets/js/902de5c0.0053db98.js new file mode 100644 index 00000000..cf77dc2f --- /dev/null +++ b/assets/js/902de5c0.0053db98.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6297],{2183:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>f,frontMatter:()=>d,metadata:()=>a,toc:()=>s});var r=t(4848),i=t(8453);const d={id:"findIndex"},o=void 0,a={id:"findIndex",title:"findIndex",description:"findIndex() function",source:"@site/docs/findIndex.md",sourceDirName:".",slug:"/findIndex",permalink:"/docs/findIndex",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"findIndex"},sidebar:"api",previous:{title:"find",permalink:"/docs/find"},next:{title:"fromEntries",permalink:"/docs/fromEntries"}},c={},s=[{value:"findIndex() function",id:"findindex-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"findindex-function",children:"findIndex() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns the index of the first element of Iterable/AsyncIterable which matches f, or -1 if no element matches."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function findIndex(f: Arrow, iterable: T): -1;\n\ndeclare function findIndex(f: (a: T) => unknown, iterable: Iterable): number;\n\ndeclare function findIndex(f: (a: T) => unknown, iterable: AsyncIterable): Promise;\n\ndeclare function findIndex | AsyncIterable>(f: (a: IterableInfer) => unknown, iterable?: T): (iterable: T) => ReturnValueType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const arr = [{a:1}, {a:2}, {a:3}]\r\nfindIndex((obj) => obj.a === 1, arr); // 0\r\nfindIndex((obj) => obj.a === 2, arr); // 1\r\nfindIndex((obj) => obj.a === 4, arr); // -1\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/findIndex.ts",children:"Open Source Code"})})]})}function f(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>a});var r=t(6540);const i={},d=r.createContext(i);function o(e){const n=r.useContext(d);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),r.createElement(d.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/902de5c0.84c3eafd.js b/assets/js/902de5c0.84c3eafd.js deleted file mode 100644 index 30a37638..00000000 --- a/assets/js/902de5c0.84c3eafd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6297],{2183:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>f,frontMatter:()=>d,metadata:()=>a,toc:()=>s});var r=t(4848),i=t(8453);const d={id:"findIndex"},o=void 0,a={id:"findIndex",title:"findIndex",description:"findIndex() function",source:"@site/docs/findIndex.md",sourceDirName:".",slug:"/findIndex",permalink:"/docs/findIndex",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"findIndex"},sidebar:"api",previous:{title:"find",permalink:"/docs/find"},next:{title:"fromEntries",permalink:"/docs/fromEntries"}},c={},s=[{value:"findIndex() function",id:"findindex-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"findindex-function",children:"findIndex() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns the index of the first element of Iterable/AsyncIterable which matches f, or -1 if no element matches."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function findIndex(f: Arrow, iterable: T): -1;\n\ndeclare function findIndex(f: (a: T) => unknown, iterable: Iterable): number;\n\ndeclare function findIndex(f: (a: T) => unknown, iterable: AsyncIterable): Promise;\n\ndeclare function findIndex | AsyncIterable>(f: (a: IterableInfer) => unknown, iterable?: T): (iterable: T) => ReturnValueType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const arr = [{a:1}, {a:2}, {a:3}]\r\nfindIndex((obj) => obj.a === 1, arr); // 0\r\nfindIndex((obj) => obj.a === 2, arr); // 1\r\nfindIndex((obj) => obj.a === 4, arr); // -1\n"})})]})}function f(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>a});var r=t(6540);const i={},d=r.createContext(i);function o(e){const n=r.useContext(d);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),r.createElement(d.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/92858fbc.f3fdcfe7.js b/assets/js/92858fbc.16ff3d45.js similarity index 80% rename from assets/js/92858fbc.f3fdcfe7.js rename to assets/js/92858fbc.16ff3d45.js index b6b37447..72f6eb5f 100644 --- a/assets/js/92858fbc.f3fdcfe7.js +++ b/assets/js/92858fbc.16ff3d45.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7212],{5787:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>r,metadata:()=>c,toc:()=>d});var i=n(4848),o=n(8453);const r={id:"omitBy"},a=void 0,c={id:"omitBy",title:"omitBy",description:"omitBy() function",source:"@site/docs/omitBy.md",sourceDirName:".",slug:"/omitBy",permalink:"/docs/omitBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"omitBy"},sidebar:"api",previous:{title:"omit",permalink:"/docs/omit"},next:{title:"partition",permalink:"/docs/partition"}},s={},d=[{value:"omitBy() function",id:"omitby-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h2,{id:"omitby-function",children:"omitBy() function"}),"\n",(0,i.jsx)(t.p,{children:"Returns a partial copy of an object containing only the keys that satisfy the supplied predicate."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-typescript",children:"declare function omitBy>(f: F, obj: T): Partial;\n\ndeclare function omitBy>(f: F): (obj: T) => Partial;\n\ndeclare function omitBy>(f: F, obj: T): Promise>;\n\ndeclare function omitBy>(f: F): (obj: T) => Promise>;\n\ndeclare function omitBy>(f: F, obj: T): Partial | Promise>;\n\ndeclare function omitBy>(f: F): (obj: T) => Partial | Promise>;\n"})}),"\n",(0,i.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",children:'const obj = { a: 1, b: "2", c: true };\r\nomitBy(([key, value]) => key === "a" || value === true, obj); // { b: "2" }\r\n\r\n// asynchronous predicate\r\nawait omitBy(async ([key, value]) => key === "a" || value === true, obj); // { b: "2" }\r\n\r\n// Using with the `pipe` function\r\npipe(\r\n obj,\r\n omitBy(([key, value]) => key === "a" || value === true)\r\n);\r\n\r\nawait pipe(\r\n obj,\r\n omitBy(async ([key, value]) => key === "a" || value === true)\r\n);\n'})}),"\n",(0,i.jsxs)(t.p,{children:["see ",(0,i.jsx)(t.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,i.jsx)(t.a,{href:"https://fxts.dev/docs/omit",children:"omit"}),","]})]})}function u(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>c});var i=n(6540);const o={},r=i.createContext(o);function a(e){const t=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),i.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7212],{5787:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>r,metadata:()=>c,toc:()=>d});var i=n(4848),o=n(8453);const r={id:"omitBy"},a=void 0,c={id:"omitBy",title:"omitBy",description:"omitBy() function",source:"@site/docs/omitBy.md",sourceDirName:".",slug:"/omitBy",permalink:"/docs/omitBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"omitBy"},sidebar:"api",previous:{title:"omit",permalink:"/docs/omit"},next:{title:"partition",permalink:"/docs/partition"}},s={},d=[{value:"omitBy() function",id:"omitby-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h2,{id:"omitby-function",children:"omitBy() function"}),"\n",(0,i.jsx)(t.p,{children:"Returns a partial copy of an object containing only the keys that satisfy the supplied predicate."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-typescript",children:"declare function omitBy>(f: F, obj: T): Partial;\n\ndeclare function omitBy>(f: F): (obj: T) => Partial;\n\ndeclare function omitBy>(f: F, obj: T): Promise>;\n\ndeclare function omitBy>(f: F): (obj: T) => Promise>;\n\ndeclare function omitBy>(f: F, obj: T): Partial | Promise>;\n\ndeclare function omitBy>(f: F): (obj: T) => Partial | Promise>;\n"})}),"\n",(0,i.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-ts",children:'const obj = { a: 1, b: "2", c: true };\r\nomitBy(([key, value]) => key === "a" || value === true, obj); // { b: "2" }\r\n\r\n// asynchronous predicate\r\nawait omitBy(async ([key, value]) => key === "a" || value === true, obj); // { b: "2" }\r\n\r\n// Using with the `pipe` function\r\npipe(\r\n obj,\r\n omitBy(([key, value]) => key === "a" || value === true)\r\n);\r\n\r\nawait pipe(\r\n obj,\r\n omitBy(async ([key, value]) => key === "a" || value === true)\r\n);\n'})}),"\n",(0,i.jsxs)(t.p,{children:["see ",(0,i.jsx)(t.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,i.jsx)(t.a,{href:"https://fxts.dev/docs/omit",children:"omit"}),","]}),"\n",(0,i.jsx)(t.p,{children:(0,i.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/omitBy.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>c});var i=n(6540);const o={},r=i.createContext(o);function a(e){const t=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),i.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/964876d0.ed80321a.js b/assets/js/964876d0.b34535ac.js similarity index 84% rename from assets/js/964876d0.ed80321a.js rename to assets/js/964876d0.b34535ac.js index 40f0119a..36105417 100644 --- a/assets/js/964876d0.ed80321a.js +++ b/assets/js/964876d0.b34535ac.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[573],{8559:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>c,default:()=>u,frontMatter:()=>s,metadata:()=>o,toc:()=>i});var t=n(4848),a=n(8453);const s={id:"reject"},c=void 0,o={id:"reject",title:"reject",description:"reject() function",source:"@site/docs/reject.md",sourceDirName:".",slug:"/reject",permalink:"/docs/reject",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"reject"},sidebar:"api",previous:{title:"range",permalink:"/docs/range"},next:{title:"repeat",permalink:"/docs/repeat"}},l={},i=[{value:"reject() function",id:"reject-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h2,{id:"reject-function",children:"reject() function"}),"\n",(0,t.jsxs)(r.p,{children:["The opposite of ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/filter",children:"filter"})," Iterable/AsyncIterable of all elements ",(0,t.jsx)(r.code,{children:"f"})," returns falsy for"]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"declare function reject(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function reject(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function reject(f: (a: A) => a is B, iterable: Iterable): IterableIterator : Exclude>;\n\ndeclare function reject(f: (a: A) => a is B, iterable: AsyncIterable): AsyncIterableIterator : Exclude>;\n\ndeclare function reject | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B, iterable?: A): (iterable: A) => ReturnIterableIteratorType>;\n\ndeclare function reject | AsyncIterable, B extends IterableInfer, C extends B, R = B extends object ? ExcludeObject : Exclude>(f: (a: IterableInfer) => a is C): (iterable: A) => A extends AsyncIterable ? AsyncIterableIterator : IterableIterator;\n"})}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"const iter = reject((a)=> a % 2 === 0, [0, 1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:false, value: 5}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [0, 1, 2, 3, 4, 5, 6],\r\n reject(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 3, 5]\r\n\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n reject(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 3, 5]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n toAsync,\r\n reject(async a => a % 2 === 0),\r\n toArray,\r\n); // [1, 3, 5]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(0), Promise.resolve(1), Promise.resolve(2),\r\n Promise.resolve(3), Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n reject(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 3, 5]\n"})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://codesandbox.io/s/fxts-reject-vrc7d",children:"Try It"})}),"\n",(0,t.jsxs)(r.p,{children:["see ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function u(e={}){const{wrapper:r}={...(0,a.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>c,x:()=>o});var t=n(6540);const a={},s=t.createContext(a);function c(e){const r=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function o(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:c(e.components),t.createElement(s.Provider,{value:r},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[573],{8559:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>c,default:()=>u,frontMatter:()=>s,metadata:()=>o,toc:()=>i});var t=n(4848),a=n(8453);const s={id:"reject"},c=void 0,o={id:"reject",title:"reject",description:"reject() function",source:"@site/docs/reject.md",sourceDirName:".",slug:"/reject",permalink:"/docs/reject",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"reject"},sidebar:"api",previous:{title:"range",permalink:"/docs/range"},next:{title:"repeat",permalink:"/docs/repeat"}},l={},i=[{value:"reject() function",id:"reject-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h2,{id:"reject-function",children:"reject() function"}),"\n",(0,t.jsxs)(r.p,{children:["The opposite of ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/filter",children:"filter"})," Iterable/AsyncIterable of all elements ",(0,t.jsx)(r.code,{children:"f"})," returns falsy for"]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"declare function reject(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function reject(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function reject(f: (a: A) => a is B, iterable: Iterable): IterableIterator : Exclude>;\n\ndeclare function reject(f: (a: A) => a is B, iterable: AsyncIterable): AsyncIterableIterator : Exclude>;\n\ndeclare function reject | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B, iterable?: A): (iterable: A) => ReturnIterableIteratorType>;\n\ndeclare function reject | AsyncIterable, B extends IterableInfer, C extends B, R = B extends object ? ExcludeObject : Exclude>(f: (a: IterableInfer) => a is C): (iterable: A) => A extends AsyncIterable ? AsyncIterableIterator : IterableIterator;\n"})}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"const iter = reject((a)=> a % 2 === 0, [0, 1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:false, value: 5}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [0, 1, 2, 3, 4, 5, 6],\r\n reject(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 3, 5]\r\n\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n reject(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 3, 5]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n toAsync,\r\n reject(async a => a % 2 === 0),\r\n toArray,\r\n); // [1, 3, 5]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(0), Promise.resolve(1), Promise.resolve(2),\r\n Promise.resolve(3), Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n reject(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 3, 5]\n"})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://codesandbox.io/s/fxts-reject-vrc7d",children:"Try It"})}),"\n",(0,t.jsxs)(r.p,{children:["see ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/reject.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:r}={...(0,a.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>c,x:()=>o});var t=n(6540);const a={},s=t.createContext(a);function c(e){const r=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function o(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:c(e.components),t.createElement(s.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/965109f3.96026f61.js b/assets/js/965109f3.96026f61.js deleted file mode 100644 index fc440171..00000000 --- a/assets/js/965109f3.96026f61.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2828],{8417:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>d,contentTitle:()=>i,default:()=>p,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var t=r(4848),o=r(8453);const s={id:"drop"},i=void 0,c={id:"drop",title:"drop",description:"drop() function",source:"@site/docs/drop.md",sourceDirName:".",slug:"/drop",permalink:"/docs/drop",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"drop"},sidebar:"api",previous:{title:"cycle",permalink:"/docs/cycle"},next:{title:"dropRight",permalink:"/docs/dropRight"}},d={},l=[{value:"drop() function",id:"drop-function",level:2},{value:"Example",id:"example",level:2}];function a(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"drop-function",children:"drop() function"}),"\n",(0,t.jsxs)(n.p,{children:["Returns all but the first ",(0,t.jsx)(n.code,{children:"length"})," elements of the given iterable."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function drop(length: number, iterable: Iterable): IterableIterator;\n\ndeclare function drop(length: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function drop | AsyncIterable>(length: number): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = drop(2, [1, 2, 3, 4]);\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:false, value: 4}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n drop(2),\r\n toArray,\r\n); // [3, 4]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n drop(2),\r\n toArray,\r\n); // [3, 4]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n drop(2),\r\n toArray,\r\n); // [3, 4]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-drop-2t0h0",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>i,x:()=>c});var t=r(6540);const o={},s=t.createContext(o);function i(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/965109f3.fbce69a3.js b/assets/js/965109f3.fbce69a3.js new file mode 100644 index 00000000..a7ef5bf8 --- /dev/null +++ b/assets/js/965109f3.fbce69a3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2828],{8417:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>d,contentTitle:()=>i,default:()=>p,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var t=n(4848),o=n(8453);const s={id:"drop"},i=void 0,c={id:"drop",title:"drop",description:"drop() function",source:"@site/docs/drop.md",sourceDirName:".",slug:"/drop",permalink:"/docs/drop",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"drop"},sidebar:"api",previous:{title:"cycle",permalink:"/docs/cycle"},next:{title:"dropRight",permalink:"/docs/dropRight"}},d={},l=[{value:"drop() function",id:"drop-function",level:2},{value:"Example",id:"example",level:2}];function a(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h2,{id:"drop-function",children:"drop() function"}),"\n",(0,t.jsxs)(r.p,{children:["Returns all but the first ",(0,t.jsx)(r.code,{children:"length"})," elements of the given iterable."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"declare function drop(length: number, iterable: Iterable): IterableIterator;\n\ndeclare function drop(length: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function drop | AsyncIterable>(length: number): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"const iter = drop(2, [1, 2, 3, 4]);\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:false, value: 4}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n drop(2),\r\n toArray,\r\n); // [3, 4]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n drop(2),\r\n toArray,\r\n); // [3, 4]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n drop(2),\r\n toArray,\r\n); // [3, 4]\n"})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://codesandbox.io/s/fxts-drop-2t0h0",children:"Try It"})}),"\n",(0,t.jsxs)(r.p,{children:["see ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/drop.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:r}={...(0,o.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>i,x:()=>c});var t=n(6540);const o={},s=t.createContext(o);function i(e){const r=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function c(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(s.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/969cdbf6.62d84f87.js b/assets/js/969cdbf6.5b0bc850.js similarity index 72% rename from assets/js/969cdbf6.62d84f87.js rename to assets/js/969cdbf6.5b0bc850.js index 882724bb..3e8eafb8 100644 --- a/assets/js/969cdbf6.62d84f87.js +++ b/assets/js/969cdbf6.5b0bc850.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3708],{1934:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var t=r(4848),s=r(8453);const i={id:"fromEntries"},o=void 0,c={id:"fromEntries",title:"fromEntries",description:"fromEntries() function",source:"@site/docs/fromEntries.md",sourceDirName:".",slug:"/fromEntries",permalink:"/docs/fromEntries",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"fromEntries"},sidebar:"api",previous:{title:"findIndex",permalink:"/docs/findIndex"},next:{title:"groupBy",permalink:"/docs/groupBy"}},a={},d=[{value:"fromEntries() function",id:"fromentries-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"fromentries-function",children:"fromEntries() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns an object from string keyed-value pairs."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function fromEntries | AsyncIterable>(iterable: T): ReturnValueType as K[0]]: K[1];\r\n}>;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:'const arr = [\r\n ["a", 1],\r\n ["b", true],\r\n ["c", "hello"],\r\n ["d", { d1: 1, d2: 3 }],\r\n] as (\r\n | ["a", number]\r\n | ["b", boolean]\r\n | ["c", string]\r\n | ["d", { d1: number, d2: number; }]\r\n)[];\r\nfromEntries(arr); // { a: 1, b: true, c: \'hello\', d: { d1: 1, d2: 3 } }\n'})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/entries",children:"entries"})]})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>c});var t=r(6540);const s={},i=t.createContext(s);function o(e){const n=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3708],{1934:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var t=r(4848),s=r(8453);const i={id:"fromEntries"},o=void 0,c={id:"fromEntries",title:"fromEntries",description:"fromEntries() function",source:"@site/docs/fromEntries.md",sourceDirName:".",slug:"/fromEntries",permalink:"/docs/fromEntries",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"fromEntries"},sidebar:"api",previous:{title:"findIndex",permalink:"/docs/findIndex"},next:{title:"groupBy",permalink:"/docs/groupBy"}},a={},d=[{value:"fromEntries() function",id:"fromentries-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"fromentries-function",children:"fromEntries() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns an object from string keyed-value pairs."}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function fromEntries | AsyncIterable>(iterable: T): ReturnValueType as K[0]]: K[1];\r\n}>;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:'const arr = [\r\n ["a", 1],\r\n ["b", true],\r\n ["c", "hello"],\r\n ["d", { d1: 1, d2: 3 }],\r\n] as (\r\n | ["a", number]\r\n | ["b", boolean]\r\n | ["c", string]\r\n | ["d", { d1: number, d2: number; }]\r\n)[];\r\nfromEntries(arr); // { a: 1, b: true, c: \'hello\', d: { d1: 1, d2: 3 } }\n'})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/entries",children:"entries"})]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/fromEntries.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>c});var t=r(6540);const s={},i=t.createContext(s);function o(e){const n=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/975fef74.c828b921.js b/assets/js/975fef74.e49373e1.js similarity index 77% rename from assets/js/975fef74.c828b921.js rename to assets/js/975fef74.e49373e1.js index d89e0e22..b5323d75 100644 --- a/assets/js/975fef74.c828b921.js +++ b/assets/js/975fef74.e49373e1.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5610],{646:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>l,frontMatter:()=>i,metadata:()=>a,toc:()=>m});var o=t(4848),r=t(8453);const i={id:"memoize"},s=void 0,a={id:"memoize",title:"memoize",description:"memoize() function",source:"@site/docs/memoize.md",sourceDirName:".",slug:"/memoize",permalink:"/docs/memoize",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"memoize"},sidebar:"api",previous:{title:"max",permalink:"/docs/max"},next:{title:"min",permalink:"/docs/min"}},c={},m=[{value:"memoize() function",id:"memoize-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"memoize-function",children:"memoize() function"}),"\n",(0,o.jsxs)(n.p,{children:["Creates a new function that, stores the results of its calculations in a ",(0,o.jsx)(n.a,{href:"http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object",children:"Map"}),". When the function is called with same input again, it retrieves the cached result instead of recalculating it. If resolver is provided, it determines the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the map cache key"]}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function memoize any, K extends Parameters[0], Return extends F & {\n cache: K extends object ? WeakMap> : Map>;\n}>(f: F): Return;\n\ndeclare function memoize any, Resolver extends (...args: Parameters) => any, K extends ReturnType, Return extends F & {\n cache: K extends object ? WeakMap> : Map>;\n}>(f: F, resolver: Resolver): Return;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"const add10 = (a: number): number => a + 10;\r\n\r\nconst memoized = memoize(add10);\r\nconsole.log(memoized(5)); // 15\r\nconsole.log(memoized(10)) // 20\r\nconsole.log(memoized(5)); // 15 (cached)\r\n\r\nmemoized.cache.clear(); // clear cache\r\nconsole.log(memoized(5)); // 15 (no cache)\n"})})]})}function l(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var o=t(6540);const r={},i=o.createContext(r);function s(e){const n=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),o.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5610],{646:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>l,frontMatter:()=>i,metadata:()=>a,toc:()=>m});var o=t(4848),r=t(8453);const i={id:"memoize"},s=void 0,a={id:"memoize",title:"memoize",description:"memoize() function",source:"@site/docs/memoize.md",sourceDirName:".",slug:"/memoize",permalink:"/docs/memoize",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"memoize"},sidebar:"api",previous:{title:"max",permalink:"/docs/max"},next:{title:"min",permalink:"/docs/min"}},c={},m=[{value:"memoize() function",id:"memoize-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"memoize-function",children:"memoize() function"}),"\n",(0,o.jsxs)(n.p,{children:["Creates a new function that, stores the results of its calculations in a ",(0,o.jsx)(n.a,{href:"http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object",children:"Map"}),". When the function is called with same input again, it retrieves the cached result instead of recalculating it. If resolver is provided, it determines the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the map cache key"]}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function memoize any, K extends Parameters[0], Return extends F & {\n cache: K extends object ? WeakMap> : Map>;\n}>(f: F): Return;\n\ndeclare function memoize any, Resolver extends (...args: Parameters) => any, K extends ReturnType, Return extends F & {\n cache: K extends object ? WeakMap> : Map>;\n}>(f: F, resolver: Resolver): Return;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"const add10 = (a: number): number => a + 10;\r\n\r\nconst memoized = memoize(add10);\r\nconsole.log(memoized(5)); // 15\r\nconsole.log(memoized(10)) // 20\r\nconsole.log(memoized(5)); // 15 (cached)\r\n\r\nmemoized.cache.clear(); // clear cache\r\nconsole.log(memoized(5)); // 15 (no cache)\n"})}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/memoize.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var o=t(6540);const r={},i=o.createContext(r);function s(e){const n=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),o.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9a026d11.77235ba5.js b/assets/js/9a026d11.548d710e.js similarity index 80% rename from assets/js/9a026d11.77235ba5.js rename to assets/js/9a026d11.548d710e.js index 136e3ddd..fc027802 100644 --- a/assets/js/9a026d11.77235ba5.js +++ b/assets/js/9a026d11.548d710e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4163],{8357:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>l,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var r=t(4848),c=t(8453);const i={id:"pick"},s=void 0,o={id:"pick",title:"pick",description:"pick() function",source:"@site/docs/pick.md",sourceDirName:".",slug:"/pick",permalink:"/docs/pick",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"pick"},sidebar:"api",previous:{title:"partition",permalink:"/docs/partition"},next:{title:"pickBy",permalink:"/docs/pickBy"}},a={},p=[{value:"pick() function",id:"pick-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"pick-function",children:"pick() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns a partial copy of an object containing given keys."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function pick(iterable: U, obj: T): Record;\n\ndeclare function pick>(iterable: U, obj: T): Pick>;\n\ndeclare function pick>(iterable: U): (obj: T) => Pick>;\n\ndeclare function pick>(iterable: U, obj: T): Promise>>;\n\ndeclare function pick>(iterable: U): (obj: T) => Promise>>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'const person = {\r\n name: "james",\r\n age: 40,\r\n numberOfKids: 2,\r\n team: "Software Development",\r\n preferredLanguage: "Rust",\r\n};\r\n\r\nconst dad = pick(["name", "age", "numberOfKids"], person);\r\n// { name: "james", age: 40, numberOfKids: 2 }\r\n\r\nconst developer = pick(["name", "team", "preferredLanguage"], person);\r\n// { name: "james", team: "Software Development", preferredLanguage: "Rust" }\r\n\r\n// with pipe\r\npipe(\r\n person,\r\n pick(["name", "age", "numberOfKids"]),\r\n);\r\n\r\n// if you want to use AsyncIterable as the list of property names\r\nconst anonymousDeveloper = await pick(toAsync(["preferredLanguage"] as const), person);\n'})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/omit",children:"omit"}),","]})]})}function l(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>o});var r=t(6540);const c={},i=r.createContext(c);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4163],{8357:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>l,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var r=t(4848),c=t(8453);const i={id:"pick"},s=void 0,o={id:"pick",title:"pick",description:"pick() function",source:"@site/docs/pick.md",sourceDirName:".",slug:"/pick",permalink:"/docs/pick",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"pick"},sidebar:"api",previous:{title:"partition",permalink:"/docs/partition"},next:{title:"pickBy",permalink:"/docs/pickBy"}},a={},p=[{value:"pick() function",id:"pick-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"pick-function",children:"pick() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns a partial copy of an object containing given keys."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function pick(iterable: U, obj: T): Record;\n\ndeclare function pick>(iterable: U, obj: T): Pick>;\n\ndeclare function pick>(iterable: U): (obj: T) => Pick>;\n\ndeclare function pick>(iterable: U, obj: T): Promise>>;\n\ndeclare function pick>(iterable: U): (obj: T) => Promise>>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'const person = {\r\n name: "james",\r\n age: 40,\r\n numberOfKids: 2,\r\n team: "Software Development",\r\n preferredLanguage: "Rust",\r\n};\r\n\r\nconst dad = pick(["name", "age", "numberOfKids"], person);\r\n// { name: "james", age: 40, numberOfKids: 2 }\r\n\r\nconst developer = pick(["name", "team", "preferredLanguage"], person);\r\n// { name: "james", team: "Software Development", preferredLanguage: "Rust" }\r\n\r\n// with pipe\r\npipe(\r\n person,\r\n pick(["name", "age", "numberOfKids"]),\r\n);\r\n\r\n// if you want to use AsyncIterable as the list of property names\r\nconst anonymousDeveloper = await pick(toAsync(["preferredLanguage"] as const), person);\n'})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/omit",children:"omit"}),","]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/pick.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>o});var r=t(6540);const c={},i=r.createContext(c);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9c758254.55c66adf.js b/assets/js/9c758254.55c66adf.js deleted file mode 100644 index 0091fb59..00000000 --- a/assets/js/9c758254.55c66adf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6758],{8985:(n,e,t)=>{t.r(e),t.d(e,{assets:()=>d,contentTitle:()=>s,default:()=>f,frontMatter:()=>o,metadata:()=>c,toc:()=>u});var r=t(4848),i=t(8453);const o={id:"throwIf"},s=void 0,c={id:"throwIf",title:"throwIf",description:"throwIf() function",source:"@site/docs/throwIf.md",sourceDirName:".",slug:"/throwIf",permalink:"/docs/throwIf",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"throwIf"},sidebar:"api",previous:{title:"throwError",permalink:"/docs/throwError"},next:{title:"toArray",permalink:"/docs/toArray"}},d={},u=[{value:"throwIf() function",id:"throwif-function",level:2},{value:"Example",id:"example",level:2}];function a(n){const e={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...n.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e.h2,{id:"throwif-function",children:"throwIf() function"}),"\n",(0,r.jsxs)(e.p,{children:["throw return of ",(0,r.jsx)(e.code,{children:"err"})," if predicate function return true"]}),"\n",(0,r.jsxs)(e.p,{children:["default throw function is ",(0,r.jsx)(e.a,{href:"https://fxts.dev/docs/identity",children:"identity"})]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(e.pre,{children:(0,r.jsx)(e.code,{className:"language-typescript",children:"declare function throwIf(predicate: (input: T) => boolean, err?: (input: T) => unknown): (input: T) => T;\n\ndeclare function throwIf(predicate: (input: T) => input is N, err?: (input: N) => unknown): (input: T) => Exclude;\n"})}),"\n",(0,r.jsx)(e.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(e.pre,{children:(0,r.jsx)(e.code,{className:"language-ts",children:' pipe(\r\n fn(), // return type is string | undefined\r\n\r\n throwIf(isUndefined, (err) => Error("return of fn() is undefined")),\r\n // err is undefined, and it is return of fn\r\n\r\n (input) => input, // input is string\r\n )\n'})})]})}function f(n={}){const{wrapper:e}={...(0,i.R)(),...n.components};return e?(0,r.jsx)(e,{...n,children:(0,r.jsx)(a,{...n})}):a(n)}},8453:(n,e,t)=>{t.d(e,{R:()=>s,x:()=>c});var r=t(6540);const i={},o=r.createContext(i);function s(n){const e=r.useContext(o);return r.useMemo((function(){return"function"==typeof n?n(e):{...e,...n}}),[e,n])}function c(n){let e;return e=n.disableParentContext?"function"==typeof n.components?n.components(i):n.components||i:s(n.components),r.createElement(o.Provider,{value:e},n.children)}}}]); \ No newline at end of file diff --git a/assets/js/9c758254.e19595a1.js b/assets/js/9c758254.e19595a1.js new file mode 100644 index 00000000..b31daa41 --- /dev/null +++ b/assets/js/9c758254.e19595a1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6758],{8985:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>s,default:()=>f,frontMatter:()=>o,metadata:()=>c,toc:()=>u});var r=t(4848),i=t(8453);const o={id:"throwIf"},s=void 0,c={id:"throwIf",title:"throwIf",description:"throwIf() function",source:"@site/docs/throwIf.md",sourceDirName:".",slug:"/throwIf",permalink:"/docs/throwIf",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"throwIf"},sidebar:"api",previous:{title:"throwError",permalink:"/docs/throwError"},next:{title:"toArray",permalink:"/docs/toArray"}},d={},u=[{value:"throwIf() function",id:"throwif-function",level:2},{value:"Example",id:"example",level:2}];function a(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"throwif-function",children:"throwIf() function"}),"\n",(0,r.jsxs)(n.p,{children:["throw return of ",(0,r.jsx)(n.code,{children:"err"})," if predicate function return true"]}),"\n",(0,r.jsxs)(n.p,{children:["default throw function is ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/identity",children:"identity"})]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function throwIf(predicate: (input: T) => boolean, err?: (input: T) => unknown): (input: T) => T;\n\ndeclare function throwIf(predicate: (input: T) => input is N, err?: (input: N) => unknown): (input: T) => Exclude;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:' pipe(\r\n fn(), // return type is string | undefined\r\n\r\n throwIf(isUndefined, (err) => Error("return of fn() is undefined")),\r\n // err is undefined, and it is return of fn\r\n\r\n (input) => input, // input is string\r\n )\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/throwIf.ts",children:"Open Source Code"})})]})}function f(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(a,{...e})}):a(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var r=t(6540);const i={},o=r.createContext(i);function s(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/9ff03b8f.2f05b883.js b/assets/js/9ff03b8f.e50b41b3.js similarity index 76% rename from assets/js/9ff03b8f.2f05b883.js rename to assets/js/9ff03b8f.e50b41b3.js index 5434fc28..c698aa1c 100644 --- a/assets/js/9ff03b8f.2f05b883.js +++ b/assets/js/9ff03b8f.e50b41b3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8005],{9547:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>f,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var r=n(4848),a=n(8453);const s={id:"flat"},l=void 0,i={id:"flat",title:"flat",description:"flat() function",source:"@site/docs/flat.md",sourceDirName:".",slug:"/flat",permalink:"/docs/flat",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"flat"},sidebar:"api",previous:{title:"filter",permalink:"/docs/filter"},next:{title:"flatMap",permalink:"/docs/flatMap"}},o={},c=[{value:"flat() function",id:"flat-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"flat-function",children:"flat() function"}),"\n",(0,r.jsxs)(t.p,{children:["Returns flattened Iterable/AsyncIterable. If first argument is number, more perform flatten ",(0,r.jsx)(t.code,{children:"flat([[[1,2]]], 2) // [1,2]"})]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function flat | AsyncIterable, B extends number = 1>(iterator: A, depth?: B): ReturnFlatType;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"const iter = flat([1,[2,3],[[4,5]]]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:false, value: [4, 5]}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1,[2, 3],[[4, 5]]],\r\n flat,\r\n toArray,\r\n); // [1, 2, 3, [4, 5]]\r\n\r\nawait pipe(\r\n Promise.resolve([1,[2, 3],[[4, 5]]]),\r\n flat,\r\n toArray,\r\n); // [1, 2, 3, [4, 5]]\n"})}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"https://codesandbox.io/s/fxts-flat-6t2in",children:"Try It"})}),"\n",(0,r.jsxs)(t.p,{children:["see ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function f(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var r=n(6540);const a={},s=r.createContext(a);function l(e){const t=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:l(e.components),r.createElement(s.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8005],{9547:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>f,frontMatter:()=>s,metadata:()=>i,toc:()=>c});var r=n(4848),a=n(8453);const s={id:"flat"},l=void 0,i={id:"flat",title:"flat",description:"flat() function",source:"@site/docs/flat.md",sourceDirName:".",slug:"/flat",permalink:"/docs/flat",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"flat"},sidebar:"api",previous:{title:"filter",permalink:"/docs/filter"},next:{title:"flatMap",permalink:"/docs/flatMap"}},o={},c=[{value:"flat() function",id:"flat-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"flat-function",children:"flat() function"}),"\n",(0,r.jsxs)(t.p,{children:["Returns flattened Iterable/AsyncIterable. If first argument is number, more perform flatten ",(0,r.jsx)(t.code,{children:"flat([[[1,2]]], 2) // [1,2]"})]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function flat | AsyncIterable, B extends number = 1>(iterator: A, depth?: B): ReturnFlatType;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"const iter = flat([1,[2,3],[[4,5]]]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:false, value: [4, 5]}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1,[2, 3],[[4, 5]]],\r\n flat,\r\n toArray,\r\n); // [1, 2, 3, [4, 5]]\r\n\r\nawait pipe(\r\n Promise.resolve([1,[2, 3],[[4, 5]]]),\r\n flat,\r\n toArray,\r\n); // [1, 2, 3, [4, 5]]\n"})}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"https://codesandbox.io/s/fxts-flat-6t2in",children:"Try It"})}),"\n",(0,r.jsxs)(t.p,{children:["see ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/flat.ts",children:"Open Source Code"})})]})}function f(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var r=n(6540);const a={},s=r.createContext(a);function l(e){const t=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:l(e.components),r.createElement(s.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a00302a7.136560e1.js b/assets/js/a00302a7.136560e1.js deleted file mode 100644 index fcb9cfbd..00000000 --- a/assets/js/a00302a7.136560e1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3205],{1740:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>c,metadata:()=>s,toc:()=>l});var i=t(4848),r=t(8453);const c={id:"intersectionBy"},o=void 0,s={id:"intersectionBy",title:"intersectionBy",description:"intersectionBy() function",source:"@site/docs/intersectionBy.md",sourceDirName:".",slug:"/intersectionBy",permalink:"/docs/intersectionBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"intersectionBy"},sidebar:"api",previous:{title:"intersection",permalink:"/docs/intersection"},next:{title:"keys",permalink:"/docs/keys"}},a={},l=[{value:"intersectionBy() function",id:"intersectionby-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"intersectionby-function",children:"intersectionBy() function"}),"\n",(0,i.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable(i.e no duplicate) of all elements in the ",(0,i.jsx)(n.code,{children:"iterable2"})," contained in the ",(0,i.jsx)(n.code,{children:"iterable1"}),". Duplication is determined according to the value returned by applying the supplied ",(0,i.jsx)(n.code,{children:"f"})," to ",(0,i.jsx)(n.code,{children:"iterable2"}),"."]}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function intersectionBy(f: (a: A) => B, iterable1: Iterable, iterable2: Iterable): IterableIterator;\n\ndeclare function intersectionBy(f: (a: A) => B, iterable1: AsyncIterable, iterable2: Iterable): AsyncIterableIterator;\n\ndeclare function intersectionBy(f: (a: A) => B, iterable1: Iterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function intersectionBy(f: (a: A) => B, iterable1: AsyncIterable, iterable2: AsyncIterable): AsyncIterableIterator;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const iter = intersectionBy(a => a.x, [{ x: 1 }, { x: 4 }], [{ x: 1 }, { x: 2 }, { x: 3 }])\r\niter.next(); // {value: {x: 1, done: false}\r\niter.next(); // {value: undefined, done: true}\n"})})]})}function u(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>s});var i=t(6540);const r={},c=i.createContext(r);function o(e){const n=i.useContext(c);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),i.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a00302a7.de892624.js b/assets/js/a00302a7.de892624.js new file mode 100644 index 00000000..e7acd6de --- /dev/null +++ b/assets/js/a00302a7.de892624.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3205],{1740:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>c,metadata:()=>s,toc:()=>l});var r=t(4848),i=t(8453);const c={id:"intersectionBy"},o=void 0,s={id:"intersectionBy",title:"intersectionBy",description:"intersectionBy() function",source:"@site/docs/intersectionBy.md",sourceDirName:".",slug:"/intersectionBy",permalink:"/docs/intersectionBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"intersectionBy"},sidebar:"api",previous:{title:"intersection",permalink:"/docs/intersection"},next:{title:"keys",permalink:"/docs/keys"}},a={},l=[{value:"intersectionBy() function",id:"intersectionby-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"intersectionby-function",children:"intersectionBy() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable(i.e no duplicate) of all elements in the ",(0,r.jsx)(n.code,{children:"iterable2"})," contained in the ",(0,r.jsx)(n.code,{children:"iterable1"}),". Duplication is determined according to the value returned by applying the supplied ",(0,r.jsx)(n.code,{children:"f"})," to ",(0,r.jsx)(n.code,{children:"iterable2"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function intersectionBy(f: (a: A) => B, iterable1: Iterable, iterable2: Iterable): IterableIterator;\n\ndeclare function intersectionBy(f: (a: A) => B, iterable1: AsyncIterable, iterable2: Iterable): AsyncIterableIterator;\n\ndeclare function intersectionBy(f: (a: A) => B, iterable1: Iterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function intersectionBy(f: (a: A) => B, iterable1: AsyncIterable, iterable2: AsyncIterable): AsyncIterableIterator;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = intersectionBy(a => a.x, [{ x: 1 }, { x: 4 }], [{ x: 1 }, { x: 2 }, { x: 3 }])\r\niter.next(); // {value: {x: 1, done: false}\r\niter.next(); // {value: undefined, done: true}\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/intersectionBy.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>s});var r=t(6540);const i={},c=r.createContext(i);function o(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a0f9174f.1ddec857.js b/assets/js/a0f9174f.92ba0bdf.js similarity index 78% rename from assets/js/a0f9174f.1ddec857.js rename to assets/js/a0f9174f.92ba0bdf.js index 206360cf..685a7816 100644 --- a/assets/js/a0f9174f.1ddec857.js +++ b/assets/js/a0f9174f.92ba0bdf.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4873],{753:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>p,frontMatter:()=>s,metadata:()=>o,toc:()=>c});var a=t(4848),r=t(8453);const s={id:"flatMap"},l=void 0,o={id:"flatMap",title:"flatMap",description:"flatMap() function",source:"@site/docs/flatMap.md",sourceDirName:".",slug:"/flatMap",permalink:"/docs/flatMap",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"flatMap"},sidebar:"api",previous:{title:"flat",permalink:"/docs/flat"},next:{title:"fx",permalink:"/docs/fx"}},i={},c=[{value:"flatMap() function",id:"flatmap-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h2,{id:"flatmap-function",children:"flatMap() function"}),"\n",(0,a.jsx)(n.p,{children:"Returns flattened Iterable/AsyncIterable of values by running each element flattening the mapped results."}),"\n",(0,a.jsx)("b",{children:"Signature:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-typescript",children:"declare function flatMap(f: (a: A) => B, iterable: Iterable): IterableIterator>;\n\ndeclare function flatMap(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator, 1>>;\n\ndeclare function flatMap | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B): (iterable: A) => ReturnFlatMapType;\n\ndeclare function flatMap | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B, iterable?: A): (iterable: A) => ReturnFlatMapType;\n"})}),"\n",(0,a.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-ts",children:'const iter = flatMap(s => s.split(" "), ["It is", "a good", "day"]);\r\niter.next() // {done:false, value: "It"}\r\niter.next() // {done:false, value: "is"}\r\niter.next() // {done:false, value: "a"}\r\niter.next() // {done:false, value: "good"},\r\niter.next() // {done:false, value: "day"},\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n ["It is", "a good", "day"],\r\n flatMap(s => s.split(" ")),\r\n toArray,\r\n); // ["It", "is", "a", "good", "day"]\r\n\r\nawait pipe(\r\n Promise.resolve(["It is", "a good", "day"]),\r\n flatMap(s => s.split(" ")),\r\n toArray,\r\n); // ["It", "is", "a", "good", "day"]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve(["It is", "a good", "day"]),\r\n toAsync,\r\n flatMap(async (s) => s.split(" ")),\r\n toArray,\r\n); // ["It", "is", "a", "good", "day"]\n'})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-flatmap-3g9k8",children:"Try It"})}),"\n",(0,a.jsxs)(n.p,{children:["see ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function p(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>l,x:()=>o});var a=t(6540);const r={},s=a.createContext(r);function l(e){const n=a.useContext(s);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),a.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4873],{753:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>d,frontMatter:()=>s,metadata:()=>o,toc:()=>c});var a=t(4848),r=t(8453);const s={id:"flatMap"},l=void 0,o={id:"flatMap",title:"flatMap",description:"flatMap() function",source:"@site/docs/flatMap.md",sourceDirName:".",slug:"/flatMap",permalink:"/docs/flatMap",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"flatMap"},sidebar:"api",previous:{title:"flat",permalink:"/docs/flat"},next:{title:"fx",permalink:"/docs/fx"}},i={},c=[{value:"flatMap() function",id:"flatmap-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h2,{id:"flatmap-function",children:"flatMap() function"}),"\n",(0,a.jsx)(n.p,{children:"Returns flattened Iterable/AsyncIterable of values by running each element flattening the mapped results."}),"\n",(0,a.jsx)("b",{children:"Signature:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-typescript",children:"declare function flatMap(f: (a: A) => B, iterable: Iterable): IterableIterator>;\n\ndeclare function flatMap(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator, 1>>;\n\ndeclare function flatMap | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B): (iterable: A) => ReturnFlatMapType;\n\ndeclare function flatMap | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B, iterable?: A): (iterable: A) => ReturnFlatMapType;\n"})}),"\n",(0,a.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-ts",children:'const iter = flatMap(s => s.split(" "), ["It is", "a good", "day"]);\r\niter.next() // {done:false, value: "It"}\r\niter.next() // {done:false, value: "is"}\r\niter.next() // {done:false, value: "a"}\r\niter.next() // {done:false, value: "good"},\r\niter.next() // {done:false, value: "day"},\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n ["It is", "a good", "day"],\r\n flatMap(s => s.split(" ")),\r\n toArray,\r\n); // ["It", "is", "a", "good", "day"]\r\n\r\nawait pipe(\r\n Promise.resolve(["It is", "a good", "day"]),\r\n flatMap(s => s.split(" ")),\r\n toArray,\r\n); // ["It", "is", "a", "good", "day"]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve(["It is", "a good", "day"]),\r\n toAsync,\r\n flatMap(async (s) => s.split(" ")),\r\n toArray,\r\n); // ["It", "is", "a", "good", "day"]\n'})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-flatmap-3g9k8",children:"Try It"})}),"\n",(0,a.jsxs)(n.p,{children:["see ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/flatMap.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>l,x:()=>o});var a=t(6540);const r={},s=a.createContext(r);function l(e){const n=a.useContext(s);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),a.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a13c8d3b.837efaad.js b/assets/js/a13c8d3b.b22f4dc3.js similarity index 84% rename from assets/js/a13c8d3b.837efaad.js rename to assets/js/a13c8d3b.b22f4dc3.js index 6b69f604..20863de8 100644 --- a/assets/js/a13c8d3b.837efaad.js +++ b/assets/js/a13c8d3b.b22f4dc3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[644],{2730:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>c});var t=n(4848),a=n(8453);const l={id:"filter"},i=void 0,o={id:"filter",title:"filter",description:"filter() function",source:"@site/docs/filter.md",sourceDirName:".",slug:"/filter",permalink:"/docs/filter",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"filter"},sidebar:"api",previous:{title:"entries",permalink:"/docs/entries"},next:{title:"flat",permalink:"/docs/flat"}},s={},c=[{value:"filter() function",id:"filter-function",level:2},{value:"Example",id:"example",level:2}];function f(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h2,{id:"filter-function",children:"filter() function"}),"\n",(0,t.jsxs)(r.p,{children:["Return Iterable/AsyncIterable of all elements ",(0,t.jsx)(r.code,{children:"f"})," returns truthy for"]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"declare function filter(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function filter(f: (a: A) => a is B, iterable: Iterable): IterableIterator;\n\ndeclare function filter(f: BooleanConstructor, iterable: Iterable): IterableIterator>;\n\ndeclare function filter(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function filter(f: (a: A) => a is B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function filter(f: BooleanConstructor, iterable: AsyncIterable): AsyncIterableIterator>;\n\ndeclare function filter | AsyncIterable>(f: BooleanConstructor): (iterable: A) => ReturnIterableIteratorType>>;\n\ndeclare function filter | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType>;\n\ndeclare function filter | AsyncIterable, B extends IterableInfer>(f: (a: IterableInfer) => a is B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"const iter = filter((a)=> a % 2 === 0, [0, 1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 0}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 4}\r\niter.next() // {done:false, value: 6}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [0, 1, 2, 3, 4, 5, 6],\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [0, 2, 4, 6]\r\n\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [0, 2, 4, 6]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n toAsync,\r\n filter(async a => a % 2 === 0),\r\n toArray,\r\n); // [0, 2, 4, 6]\r\n\r\n// toAsync\r\nawait pipe(\r\n [Promise.resolve(0), Promise.resolve(1), Promise.resolve(2), Promise.resolve(3),\r\n Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [0, 2, 4, 6]\n"})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://codesandbox.io/s/fxts-filter-2ibz2",children:"Try It"})}),"\n",(0,t.jsxs)(r.p,{children:["see ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function d(e={}){const{wrapper:r}={...(0,a.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(f,{...e})}):f(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>i,x:()=>o});var t=n(6540);const a={},l=t.createContext(a);function i(e){const r=t.useContext(l);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function o(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),t.createElement(l.Provider,{value:r},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[644],{2730:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>c});var t=n(4848),a=n(8453);const l={id:"filter"},i=void 0,o={id:"filter",title:"filter",description:"filter() function",source:"@site/docs/filter.md",sourceDirName:".",slug:"/filter",permalink:"/docs/filter",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"filter"},sidebar:"api",previous:{title:"entries",permalink:"/docs/entries"},next:{title:"flat",permalink:"/docs/flat"}},s={},c=[{value:"filter() function",id:"filter-function",level:2},{value:"Example",id:"example",level:2}];function f(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h2,{id:"filter-function",children:"filter() function"}),"\n",(0,t.jsxs)(r.p,{children:["Return Iterable/AsyncIterable of all elements ",(0,t.jsx)(r.code,{children:"f"})," returns truthy for"]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"declare function filter(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function filter(f: (a: A) => a is B, iterable: Iterable): IterableIterator;\n\ndeclare function filter(f: BooleanConstructor, iterable: Iterable): IterableIterator>;\n\ndeclare function filter(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function filter(f: (a: A) => a is B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function filter(f: BooleanConstructor, iterable: AsyncIterable): AsyncIterableIterator>;\n\ndeclare function filter | AsyncIterable>(f: BooleanConstructor): (iterable: A) => ReturnIterableIteratorType>>;\n\ndeclare function filter | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType>;\n\ndeclare function filter | AsyncIterable, B extends IterableInfer>(f: (a: IterableInfer) => a is B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:"const iter = filter((a)=> a % 2 === 0, [0, 1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 0}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 4}\r\niter.next() // {done:false, value: 6}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [0, 1, 2, 3, 4, 5, 6],\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [0, 2, 4, 6]\r\n\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [0, 2, 4, 6]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n toAsync,\r\n filter(async a => a % 2 === 0),\r\n toArray,\r\n); // [0, 2, 4, 6]\r\n\r\n// toAsync\r\nawait pipe(\r\n [Promise.resolve(0), Promise.resolve(1), Promise.resolve(2), Promise.resolve(3),\r\n Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n); // [0, 2, 4, 6]\n"})}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://codesandbox.io/s/fxts-filter-2ibz2",children:"Try It"})}),"\n",(0,t.jsxs)(r.p,{children:["see ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/filter.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:r}={...(0,a.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(f,{...e})}):f(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>i,x:()=>o});var t=n(6540);const a={},l=t.createContext(a);function i(e){const r=t.useContext(l);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function o(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),t.createElement(l.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a19ef396.12daeaea.js b/assets/js/a19ef396.12daeaea.js new file mode 100644 index 00000000..08bffbff --- /dev/null +++ b/assets/js/a19ef396.12daeaea.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7635],{9469:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>o,contentTitle:()=>c,default:()=>p,frontMatter:()=>r,metadata:()=>a,toc:()=>l});var t=i(4848),s=i(8453);const r={id:"isString"},c=void 0,a={id:"isString",title:"isString",description:"isString variable",source:"@site/docs/isString.md",sourceDirName:".",slug:"/isString",permalink:"/docs/isString",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isString"},sidebar:"api",previous:{title:"isObject",permalink:"/docs/isObject"},next:{title:"isUndefined",permalink:"/docs/isUndefined"}},o={},l=[{value:"isString variable",id:"isstring-variable",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"isstring-variable",children:"isString variable"}),"\n",(0,t.jsxs)(n.p,{children:["Returns true if ",(0,t.jsx)(n.code,{children:"s"})," is a String."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"isString: (s: T) => s is Include\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:'isString("a"); // true\r\nisString(2); // false\n'})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/isString.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,i)=>{i.d(n,{R:()=>c,x:()=>a});var t=i(6540);const s={},r=t.createContext(s);function c(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a19ef396.2c18c938.js b/assets/js/a19ef396.2c18c938.js deleted file mode 100644 index c8fdbd11..00000000 --- a/assets/js/a19ef396.2c18c938.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7635],{9469:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>o,contentTitle:()=>c,default:()=>u,frontMatter:()=>r,metadata:()=>a,toc:()=>l});var t=i(4848),s=i(8453);const r={id:"isString"},c=void 0,a={id:"isString",title:"isString",description:"isString variable",source:"@site/docs/isString.md",sourceDirName:".",slug:"/isString",permalink:"/docs/isString",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isString"},sidebar:"api",previous:{title:"isObject",permalink:"/docs/isObject"},next:{title:"isUndefined",permalink:"/docs/isUndefined"}},o={},l=[{value:"isString variable",id:"isstring-variable",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"isstring-variable",children:"isString variable"}),"\n",(0,t.jsxs)(n.p,{children:["Returns true if ",(0,t.jsx)(n.code,{children:"s"})," is a String."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"isString: (s: T) => s is Include\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:'isString("a"); // true\r\nisString(2); // false\n'})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,i)=>{i.d(n,{R:()=>c,x:()=>a});var t=i(6540);const s={},r=t.createContext(s);function c(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a3072847.67e063a1.js b/assets/js/a3072847.67e063a1.js new file mode 100644 index 00000000..4a8579be --- /dev/null +++ b/assets/js/a3072847.67e063a1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3973],{4027:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>r,default:()=>u,frontMatter:()=>c,metadata:()=>a,toc:()=>l});var s=n(4848),i=n(8453);const c={id:"isObject"},r=void 0,a={id:"isObject",title:"isObject",description:"isObject variable",source:"@site/docs/isObject.md",sourceDirName:".",slug:"/isObject",permalink:"/docs/isObject",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isObject"},sidebar:"api",previous:{title:"isNumber",permalink:"/docs/isNumber"},next:{title:"isString",permalink:"/docs/isString"}},o={},l=[{value:"isObject variable",id:"isobject-variable",level:2},{value:"Example",id:"example",level:2}];function d(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h2,{id:"isobject-variable",children:"isObject variable"}),"\n",(0,s.jsx)(t.p,{children:"Checks if value is the type of object."}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-typescript",children:"isObject: (a: T) => a is Include\n"})}),"\n",(0,s.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",children:"isObject({}); // true\r\nisObject([1, 2, 3]); // true\r\nisObject(() => {}); // true\r\nisObject(null); // false\r\nisObject(123); // false\n"})}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/isObject.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>r,x:()=>a});var s=n(6540);const i={},c=s.createContext(i);function r(e){const t=s.useContext(c);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),s.createElement(c.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a3072847.82b427c1.js b/assets/js/a3072847.82b427c1.js deleted file mode 100644 index 217fb17b..00000000 --- a/assets/js/a3072847.82b427c1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3973],{4027:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>r,default:()=>u,frontMatter:()=>c,metadata:()=>a,toc:()=>l});var s=n(4848),i=n(8453);const c={id:"isObject"},r=void 0,a={id:"isObject",title:"isObject",description:"isObject variable",source:"@site/docs/isObject.md",sourceDirName:".",slug:"/isObject",permalink:"/docs/isObject",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isObject"},sidebar:"api",previous:{title:"isNumber",permalink:"/docs/isNumber"},next:{title:"isString",permalink:"/docs/isString"}},o={},l=[{value:"isObject variable",id:"isobject-variable",level:2},{value:"Example",id:"example",level:2}];function d(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h2,{id:"isobject-variable",children:"isObject variable"}),"\n",(0,s.jsx)(t.p,{children:"Checks if value is the type of object."}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-typescript",children:"isObject: (a: T) => a is Include\n"})}),"\n",(0,s.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",children:"isObject({}); // true\r\nisObject([1, 2, 3]); // true\r\nisObject(() => {}); // true\r\nisObject(null); // false\r\nisObject(123); // false\n"})})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>r,x:()=>a});var s=n(6540);const i={},c=s.createContext(i);function r(e){const t=s.useContext(c);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),s.createElement(c.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a43d1a0b.57f55437.js b/assets/js/a43d1a0b.57f55437.js deleted file mode 100644 index 795fe220..00000000 --- a/assets/js/a43d1a0b.57f55437.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4361],{8632:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>s,default:()=>d,frontMatter:()=>c,metadata:()=>i,toc:()=>a});var r=t(4848),o=t(8453);const c={id:"consume"},s=void 0,i={id:"consume",title:"consume",description:"consume() function",source:"@site/docs/consume.md",sourceDirName:".",slug:"/consume",permalink:"/docs/consume",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"consume"},sidebar:"api",previous:{title:"compactObject",permalink:"/docs/compactObject"},next:{title:"countBy",permalink:"/docs/countBy"}},u={},a=[{value:"consume() function",id:"consume-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"consume-function",children:"consume() function"}),"\n",(0,r.jsx)(n.p,{children:"Consumes the given number of Iterable/AsyncIterable. If the number is empty, all is consumed."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function consume | AsyncIterable, B extends number>(iterator: A, n?: B): ReturnValueType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iterator = (function *(){\r\n yield 1;\r\n yield 2;\r\n yield 3;\r\n})();\r\nconsume(iterator, 2);\r\niterator.next(); // {value:3, done:false}\r\niterator.next(); // {value:undefined, done:true}\r\n\r\n// with pipe\r\npipe(\r\n range(10),\r\n peek(updateApi),\r\n concurrent(5),\r\n consume,\r\n);\n"})})]})}function d(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>i});var r=t(6540);const o={},c=r.createContext(o);function s(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a43d1a0b.8a8b0bda.js b/assets/js/a43d1a0b.8a8b0bda.js new file mode 100644 index 00000000..a6e6fe24 --- /dev/null +++ b/assets/js/a43d1a0b.8a8b0bda.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4361],{8632:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>s,default:()=>d,frontMatter:()=>c,metadata:()=>i,toc:()=>a});var r=t(4848),o=t(8453);const c={id:"consume"},s=void 0,i={id:"consume",title:"consume",description:"consume() function",source:"@site/docs/consume.md",sourceDirName:".",slug:"/consume",permalink:"/docs/consume",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"consume"},sidebar:"api",previous:{title:"compactObject",permalink:"/docs/compactObject"},next:{title:"countBy",permalink:"/docs/countBy"}},u={},a=[{value:"consume() function",id:"consume-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"consume-function",children:"consume() function"}),"\n",(0,r.jsx)(n.p,{children:"Consumes the given number of Iterable/AsyncIterable. If the number is empty, all is consumed."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function consume | AsyncIterable, B extends number>(iterator: A, n?: B): ReturnValueType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iterator = (function *(){\r\n yield 1;\r\n yield 2;\r\n yield 3;\r\n})();\r\nconsume(iterator, 2);\r\niterator.next(); // {value:3, done:false}\r\niterator.next(); // {value:undefined, done:true}\r\n\r\n// with pipe\r\npipe(\r\n range(10),\r\n peek(updateApi),\r\n concurrent(5),\r\n consume,\r\n);\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/consume.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>i});var r=t(6540);const o={},c=r.createContext(o);function s(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a444bd10.7a41a0a9.js b/assets/js/a444bd10.b17c5b1f.js similarity index 80% rename from assets/js/a444bd10.7a41a0a9.js rename to assets/js/a444bd10.b17c5b1f.js index ae643834..7b2c77a8 100644 --- a/assets/js/a444bd10.7a41a0a9.js +++ b/assets/js/a444bd10.b17c5b1f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5085],{6512:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=s(4848),t=s(8453);const o={id:"some"},a=void 0,i={id:"some",title:"some",description:"some() function",source:"@site/docs/some.md",sourceDirName:".",slug:"/some",permalink:"/docs/some",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"some"},sidebar:"api",previous:{title:"size",permalink:"/docs/size"},next:{title:"sort",permalink:"/docs/sort"}},c={},l=[{value:"some() function",id:"some-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"some-function",children:"some() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns true if any of the values in Iterable/AsyncIterable pass ",(0,r.jsx)(n.code,{children:"f"})," truth test"]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function some(f: Arrow, iterable: A): false;\n\ndeclare function some(f: (a: A) => B, iterable: Iterable): boolean;\n\ndeclare function some(f: (a: A) => B, iterable: AsyncIterable): Promise;\n\ndeclare function some | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B): (a: A) => ReturnValueType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"some(a=> a, [null, 0, 1, false]); // true\r\n\r\n// with pipe\r\npipe(\r\n [{id:1, age: 27}, {id:2, age: 36}, {id:3, age: 42}],\r\n map(user => user.age),\r\n some(age => age > 40),\r\n); // true\r\n\r\nawait pipe(\r\n Promise.resolve([{id:1, age: 27}, {id:2, age: 36}, {id:3, age: 42}]),\r\n map(user => user.age),\r\n some(age => age > 40),\r\n); // true\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve({id:1, age: 27}), Promise.resolve({id:2, age: 36}), Promise.resolve({id:3, age: 42})],\r\n toAsync,\r\n map(user => user.age),\r\n some(age => age > 40),\r\n); // true\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-some-inp3l",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/map",children:"map"})]})]})}function u(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>a,x:()=>i});var r=s(6540);const t={},o=r.createContext(t);function a(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:a(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5085],{6512:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=s(4848),t=s(8453);const o={id:"some"},a=void 0,i={id:"some",title:"some",description:"some() function",source:"@site/docs/some.md",sourceDirName:".",slug:"/some",permalink:"/docs/some",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"some"},sidebar:"api",previous:{title:"size",permalink:"/docs/size"},next:{title:"sort",permalink:"/docs/sort"}},c={},l=[{value:"some() function",id:"some-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"some-function",children:"some() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns true if any of the values in Iterable/AsyncIterable pass ",(0,r.jsx)(n.code,{children:"f"})," truth test"]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function some(f: Arrow, iterable: A): false;\n\ndeclare function some(f: (a: A) => B, iterable: Iterable): boolean;\n\ndeclare function some(f: (a: A) => B, iterable: AsyncIterable): Promise;\n\ndeclare function some | AsyncIterable, B = unknown>(f: (a: IterableInfer) => B): (a: A) => ReturnValueType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"some(a=> a, [null, 0, 1, false]); // true\r\n\r\n// with pipe\r\npipe(\r\n [{id:1, age: 27}, {id:2, age: 36}, {id:3, age: 42}],\r\n map(user => user.age),\r\n some(age => age > 40),\r\n); // true\r\n\r\nawait pipe(\r\n Promise.resolve([{id:1, age: 27}, {id:2, age: 36}, {id:3, age: 42}]),\r\n map(user => user.age),\r\n some(age => age > 40),\r\n); // true\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve({id:1, age: 27}), Promise.resolve({id:2, age: 36}), Promise.resolve({id:3, age: 42})],\r\n toAsync,\r\n map(user => user.age),\r\n some(age => age > 40),\r\n); // true\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-some-inp3l",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/map",children:"map"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/some.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>a,x:()=>i});var r=s(6540);const t={},o=r.createContext(t);function a(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:a(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a792ae6b.67e4f970.js b/assets/js/a792ae6b.f39b3588.js similarity index 81% rename from assets/js/a792ae6b.67e4f970.js rename to assets/js/a792ae6b.f39b3588.js index 7778a437..673a0494 100644 --- a/assets/js/a792ae6b.67e4f970.js +++ b/assets/js/a792ae6b.f39b3588.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[232],{9752:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var t=r(4848),a=r(8453);const s={id:"map"},o=void 0,i={id:"map",title:"map",description:"map() function",source:"@site/docs/map.md",sourceDirName:".",slug:"/map",permalink:"/docs/map",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"map"},sidebar:"api",previous:{title:"keys",permalink:"/docs/keys"},next:{title:"peek",permalink:"/docs/peek"}},c={},l=[{value:"map() function",id:"map-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"map-function",children:"map() function"}),"\n",(0,t.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable of values by running each applying ",(0,t.jsx)(n.code,{children:"f"}),"."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function map(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function map(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator>;\n\ndeclare function map | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = map(a => a + 10, [1, 2, 3, 4]);\r\niter.next() // {done:false, value: 11}\r\niter.next() // {done:false, value: 12}\r\niter.next() // {done:false, value: 13}\r\niter.next() // {done:false, value: 14},\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n map(a => a + 10),\r\n toArray,\r\n); // [11, 12, 13, 14]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n map(a => a + 10),\r\n toArray,\r\n); // [11, 12, 13, 14]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n toAsync,\r\n map(async (a) => a + 10),\r\n toArray,\r\n); // [11, 12, 13, 14]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n map(a => a + 10),\r\n toArray,\r\n); // [11, 12, 13, 14]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-map-j68jv",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function d(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(p,{...e})}):p(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>i});var t=r(6540);const a={},s=t.createContext(a);function o(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[232],{9752:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var t=r(4848),a=r(8453);const s={id:"map"},o=void 0,i={id:"map",title:"map",description:"map() function",source:"@site/docs/map.md",sourceDirName:".",slug:"/map",permalink:"/docs/map",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"map"},sidebar:"api",previous:{title:"keys",permalink:"/docs/keys"},next:{title:"peek",permalink:"/docs/peek"}},c={},l=[{value:"map() function",id:"map-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"map-function",children:"map() function"}),"\n",(0,t.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable of values by running each applying ",(0,t.jsx)(n.code,{children:"f"}),"."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function map(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function map(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator>;\n\ndeclare function map | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = map(a => a + 10, [1, 2, 3, 4]);\r\niter.next() // {done:false, value: 11}\r\niter.next() // {done:false, value: 12}\r\niter.next() // {done:false, value: 13}\r\niter.next() // {done:false, value: 14},\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n map(a => a + 10),\r\n toArray,\r\n); // [11, 12, 13, 14]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n map(a => a + 10),\r\n toArray,\r\n); // [11, 12, 13, 14]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n toAsync,\r\n map(async (a) => a + 10),\r\n toArray,\r\n); // [11, 12, 13, 14]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n map(a => a + 10),\r\n toArray,\r\n); // [11, 12, 13, 14]\n"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-map-j68jv",children:"Try It"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/map.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(p,{...e})}):p(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>i});var t=r(6540);const a={},s=t.createContext(a);function o(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a7a0251b.5aeceaba.js b/assets/js/a7a0251b.5aeceaba.js new file mode 100644 index 00000000..46189623 --- /dev/null +++ b/assets/js/a7a0251b.5aeceaba.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6170],{7980:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>a,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var c=n(4848),o=n(8453);const r={id:"compactObject"},a=void 0,s={id:"compactObject",title:"compactObject",description:"compactObject() function",source:"@site/docs/compactObject.md",sourceDirName:".",slug:"/compactObject",permalink:"/docs/compactObject",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"compactObject"},sidebar:"api",previous:{title:"average",permalink:"/docs/average"},next:{title:"consume",permalink:"/docs/consume"}},i={},l=[{value:"compactObject() function",id:"compactobject-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(t.h2,{id:"compactobject-function",children:"compactObject() function"}),"\n",(0,c.jsx)(t.p,{children:"Returns an object with all nullable values removed."}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(t.pre,{children:(0,c.jsx)(t.code,{className:"language-typescript",children:"export default function compactObject(obj: T): Merge<{\r\n [K in Extract>]: Extract, [\r\n K,\r\n any\r\n ]>[1];\r\n}, {\r\n [K in Extract>]?: Extract, [\r\n K,\r\n any\r\n ]>[1];\r\n}>;\n"})}),"\n",(0,c.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(t.pre,{children:(0,c.jsx)(t.code,{className:"language-ts",children:'const compacted = compactObject({ a: 1, b: "b", c: null, d: undefined });\r\n// {a: 1, b: "b"}\n'})}),"\n",(0,c.jsx)(t.p,{children:(0,c.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/compactObject.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,c.jsx)(t,{...e,children:(0,c.jsx)(p,{...e})}):p(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>s});var c=n(6540);const o={},r=c.createContext(o);function a(e){const t=c.useContext(r);return c.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function s(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),c.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a7a0251b.850517dc.js b/assets/js/a7a0251b.850517dc.js deleted file mode 100644 index c8d1381a..00000000 --- a/assets/js/a7a0251b.850517dc.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6170],{7980:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>a,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var c=n(4848),o=n(8453);const r={id:"compactObject"},a=void 0,s={id:"compactObject",title:"compactObject",description:"compactObject() function",source:"@site/docs/compactObject.md",sourceDirName:".",slug:"/compactObject",permalink:"/docs/compactObject",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"compactObject"},sidebar:"api",previous:{title:"average",permalink:"/docs/average"},next:{title:"consume",permalink:"/docs/consume"}},i={},l=[{value:"compactObject() function",id:"compactobject-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const t={code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(t.h2,{id:"compactobject-function",children:"compactObject() function"}),"\n",(0,c.jsx)(t.p,{children:"Returns an object with all nullable values removed."}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(t.pre,{children:(0,c.jsx)(t.code,{className:"language-typescript",children:"export default function compactObject(obj: T): Merge<{\r\n [K in Extract>]: Extract, [\r\n K,\r\n any\r\n ]>[1];\r\n}, {\r\n [K in Extract>]?: Extract, [\r\n K,\r\n any\r\n ]>[1];\r\n}>;\n"})}),"\n",(0,c.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(t.pre,{children:(0,c.jsx)(t.code,{className:"language-ts",children:'const compacted = compactObject({ a: 1, b: "b", c: null, d: undefined });\r\n// {a: 1, b: "b"}\n'})})]})}function u(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,c.jsx)(t,{...e,children:(0,c.jsx)(p,{...e})}):p(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>s});var c=n(6540);const o={},r=c.createContext(o);function a(e){const t=c.useContext(r);return c.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function s(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),c.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ac6e9832.cdcdc460.js b/assets/js/ac6e9832.cdcdc460.js new file mode 100644 index 00000000..6ae7495e --- /dev/null +++ b/assets/js/ac6e9832.cdcdc460.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6752],{5128:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var r=t(4848),o=t(8453);const s={id:"sort"},a=void 0,c={id:"sort",title:"sort",description:"sort() function",source:"@site/docs/sort.md",sourceDirName:".",slug:"/sort",permalink:"/docs/sort",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"sort"},sidebar:"api",previous:{title:"some",permalink:"/docs/some"},next:{title:"sortBy",permalink:"/docs/sortBy"}},i={},l=[{value:"sort() function",id:"sort-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"sort-function",children:"sort() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns an array, sorted according to the comparator ",(0,r.jsx)(n.code,{children:"f"}),", which should accept two values"]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function sort(f: (a: T, b: T) => unknown, iterable: Iterable): T[];\n\ndeclare function sort(f: (a: any, b: any) => unknown, iterable: readonly []): any[];\n\ndeclare function sort(f: (a: T, b: T) => unknown, iterable: AsyncIterable): Promise;\n\ndeclare function sort | AsyncIterable>(f: (a: IterableInfer, b: IterableInfer) => unknown): (iterable: T) => ReturnValueType[]>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'sort((a, b) => a > b, [3, 4, 1, 2, 5, 2]); // [1, 2, 2, 3, 4, 5]\r\nsort((a, b) => a > b, \'bcdaef); // ["a", "b", "c", "d", "e", "f"]\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/sort.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>c});var r=t(6540);const o={},s=r.createContext(o);function a(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ac6e9832.e922afae.js b/assets/js/ac6e9832.e922afae.js deleted file mode 100644 index 86e64a19..00000000 --- a/assets/js/ac6e9832.e922afae.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6752],{5128:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var r=t(4848),o=t(8453);const s={id:"sort"},a=void 0,c={id:"sort",title:"sort",description:"sort() function",source:"@site/docs/sort.md",sourceDirName:".",slug:"/sort",permalink:"/docs/sort",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"sort"},sidebar:"api",previous:{title:"some",permalink:"/docs/some"},next:{title:"sortBy",permalink:"/docs/sortBy"}},i={},l=[{value:"sort() function",id:"sort-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"sort-function",children:"sort() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns an array, sorted according to the comparator ",(0,r.jsx)(n.code,{children:"f"}),", which should accept two values"]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function sort(f: (a: T, b: T) => unknown, iterable: Iterable): T[];\n\ndeclare function sort(f: (a: any, b: any) => unknown, iterable: readonly []): any[];\n\ndeclare function sort(f: (a: T, b: T) => unknown, iterable: AsyncIterable): Promise;\n\ndeclare function sort | AsyncIterable>(f: (a: IterableInfer, b: IterableInfer) => unknown): (iterable: T) => ReturnValueType[]>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'sort((a, b) => a > b, [3, 4, 1, 2, 5, 2]); // [1, 2, 2, 3, 4, 5]\r\nsort((a, b) => a > b, \'bcdaef); // ["a", "b", "c", "d", "e", "f"]\n'})})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>c});var r=t(6540);const o={},s=r.createContext(o);function a(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b3f87c10.ad1f91e9.js b/assets/js/b3f87c10.280cfd74.js similarity index 83% rename from assets/js/b3f87c10.ad1f91e9.js rename to assets/js/b3f87c10.280cfd74.js index 34b76833..1e43637d 100644 --- a/assets/js/b3f87c10.ad1f91e9.js +++ b/assets/js/b3f87c10.280cfd74.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9869],{1496:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=t(4848),i=t(8453);const a={id:"partition"},o=void 0,s={id:"partition",title:"partition",description:"partition() function",source:"@site/docs/partition.md",sourceDirName:".",slug:"/partition",permalink:"/docs/partition",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"partition"},sidebar:"api",previous:{title:"omitBy",permalink:"/docs/omitBy"},next:{title:"pick",permalink:"/docs/pick"}},c={},l=[{value:"partition() function",id:"partition-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"partition-function",children:"partition() function"}),"\n",(0,r.jsxs)(n.p,{children:["Split Iterable/AsyncIterable into two arrays: one with all elements which satisfies ",(0,r.jsx)(n.code,{children:"f"})," and the other with all elements that does not."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function partition(f: (a: A) => B, iterable: Iterable): [A[], A[]];\n\ndeclare function partition(f: (a: A) => B, iterable: AsyncIterable): Promise<[A[], A[]]>;\n\ndeclare function partition | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnPartitionType;\n\ndeclare function partition : Exclude>(f: (a: A) => a is L, iterable: Iterable): [L[], R[]];\n\ndeclare function partition : Exclude>(f: (a: A) => a is L, iterable: AsyncIterable): Promise<[L[], R[]]>;\n\ndeclare function partition | AsyncIterable, B extends IterableInfer, L extends B, R extends B = B extends object ? ExcludeObject : Exclude>(f: (a: IterableInfer) => a is L): (iterable: A) => A extends AsyncIterable ? Promise<[L[], R[]]> : [L[], R[]];\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"partition((a) => a % 2 === 0, [1, 2, 3, 4, 5]); // [[2, 4], [1, 3, 5]]\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n partition((a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]\r\n);\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n partition((a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]\r\n);\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n toAsync,\r\n partition(async (a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]\r\n);\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)],\r\n toAsync,\r\n partition((a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]\r\n);\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-partition-7vns0",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"})]})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>s});var r=t(6540);const i={},a=r.createContext(i);function o(e){const n=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),r.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9869],{1496:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=t(4848),i=t(8453);const a={id:"partition"},o=void 0,s={id:"partition",title:"partition",description:"partition() function",source:"@site/docs/partition.md",sourceDirName:".",slug:"/partition",permalink:"/docs/partition",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"partition"},sidebar:"api",previous:{title:"omitBy",permalink:"/docs/omitBy"},next:{title:"pick",permalink:"/docs/pick"}},c={},l=[{value:"partition() function",id:"partition-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"partition-function",children:"partition() function"}),"\n",(0,r.jsxs)(n.p,{children:["Split Iterable/AsyncIterable into two arrays: one with all elements which satisfies ",(0,r.jsx)(n.code,{children:"f"})," and the other with all elements that does not."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function partition(f: (a: A) => B, iterable: Iterable): [A[], A[]];\n\ndeclare function partition(f: (a: A) => B, iterable: AsyncIterable): Promise<[A[], A[]]>;\n\ndeclare function partition | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnPartitionType;\n\ndeclare function partition : Exclude>(f: (a: A) => a is L, iterable: Iterable): [L[], R[]];\n\ndeclare function partition : Exclude>(f: (a: A) => a is L, iterable: AsyncIterable): Promise<[L[], R[]]>;\n\ndeclare function partition | AsyncIterable, B extends IterableInfer, L extends B, R extends B = B extends object ? ExcludeObject : Exclude>(f: (a: IterableInfer) => a is L): (iterable: A) => A extends AsyncIterable ? Promise<[L[], R[]]> : [L[], R[]];\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"partition((a) => a % 2 === 0, [1, 2, 3, 4, 5]); // [[2, 4], [1, 3, 5]]\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n partition((a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]\r\n);\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n partition((a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]\r\n);\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n toAsync,\r\n partition(async (a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]\r\n);\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)],\r\n toAsync,\r\n partition((a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]\r\n);\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-partition-7vns0",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/partition.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>s});var r=t(6540);const i={},a=r.createContext(i);function o(e){const n=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),r.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b45b40f8.0c0e5676.js b/assets/js/b45b40f8.0c0e5676.js deleted file mode 100644 index 41c777a0..00000000 --- a/assets/js/b45b40f8.0c0e5676.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6254],{9483:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=t(4848),o=t(8453);const a={id:"tap"},i=void 0,s={id:"tap",title:"tap",description:"tap() function",source:"@site/docs/tap.md",sourceDirName:".",slug:"/tap",permalink:"/docs/tap",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"tap"},sidebar:"api",previous:{title:"sum",permalink:"/docs/sum"},next:{title:"throwError",permalink:"/docs/throwError"}},c={},l=[{value:"tap() function",id:"tap-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"tap-function",children:"tap() function"}),"\n",(0,r.jsx)(n.p,{children:"This method invokes interceptor and returns a value. The interceptor is invoked with one argument."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function tap(f: (arg: Awaited) => U, v: T): U extends Promise ? Promise> : T;\n\ndeclare function tap(f: (arg: Awaited) => U): (v: T) => U extends Promise ? Promise> : T;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"tap(console.log, [1,2,3,4,5])\r\n// log [1, 2, 3, 4, 5]\r\n// return [1, 2, 3, 4, 5]\r\n\r\ntap(async (a) => console.log(a), [1,2,3,4,5]);\r\n// log [1, 2, 3, 4, 5]\r\n// return Promise<[1, 2, 3, 4, 5]>\n"})})]})}function d(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>s});var r=t(6540);const o={},a=r.createContext(o);function i(e){const n=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),r.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b45b40f8.36716ffb.js b/assets/js/b45b40f8.36716ffb.js new file mode 100644 index 00000000..3e74d1d9 --- /dev/null +++ b/assets/js/b45b40f8.36716ffb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6254],{9483:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var r=t(4848),o=t(8453);const a={id:"tap"},s=void 0,i={id:"tap",title:"tap",description:"tap() function",source:"@site/docs/tap.md",sourceDirName:".",slug:"/tap",permalink:"/docs/tap",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"tap"},sidebar:"api",previous:{title:"sum",permalink:"/docs/sum"},next:{title:"throwError",permalink:"/docs/throwError"}},c={},p=[{value:"tap() function",id:"tap-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"tap-function",children:"tap() function"}),"\n",(0,r.jsx)(n.p,{children:"This method invokes interceptor and returns a value. The interceptor is invoked with one argument."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function tap(f: (arg: Awaited) => U, v: T): U extends Promise ? Promise> : T;\n\ndeclare function tap(f: (arg: Awaited) => U): (v: T) => U extends Promise ? Promise> : T;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"tap(console.log, [1,2,3,4,5])\r\n// log [1, 2, 3, 4, 5]\r\n// return [1, 2, 3, 4, 5]\r\n\r\ntap(async (a) => console.log(a), [1,2,3,4,5]);\r\n// log [1, 2, 3, 4, 5]\r\n// return Promise<[1, 2, 3, 4, 5]>\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/tap.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>i});var r=t(6540);const o={},a=r.createContext(o);function s(e){const n=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),r.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b82dbf03.14ce09f0.js b/assets/js/b82dbf03.14ce09f0.js new file mode 100644 index 00000000..569aca48 --- /dev/null +++ b/assets/js/b82dbf03.14ce09f0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2244],{9:(e,i,n)=>{n.r(i),n.d(i,{assets:()=>a,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>c,toc:()=>o});var s=n(4848),t=n(8453);const l={id:"isNil"},r=void 0,c={id:"isNil",title:"isNil",description:"isNil variable",source:"@site/docs/isNil.md",sourceDirName:".",slug:"/isNil",permalink:"/docs/isNil",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isNil"},sidebar:"api",previous:{title:"isEmpty",permalink:"/docs/isEmpty"},next:{title:"isNumber",permalink:"/docs/isNumber"}},a={},o=[{value:"isNil variable",id:"isnil-variable",level:2},{value:"Example",id:"example",level:2}];function d(e){const i={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.h2,{id:"isnil-variable",children:"isNil variable"}),"\n",(0,s.jsxs)(i.p,{children:["Checks if the given value is ",(0,s.jsx)(i.code,{children:"null"})," or ",(0,s.jsx)(i.code,{children:"undefined"}),"."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-typescript",children:"isNil: (a: T) => a is Include\n"})}),"\n",(0,s.jsx)(i.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-ts",children:"isNil(1); // false\r\nisNil('1'); // false\r\nisNil(undefined); // true\r\nisNil(null); // true\n"})}),"\n",(0,s.jsx)(i.p,{children:(0,s.jsx)(i.a,{href:"https://github.com/marpple/FxTS/blob/main/src/isNil.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:i}={...(0,t.R)(),...e.components};return i?(0,s.jsx)(i,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,i,n)=>{n.d(i,{R:()=>r,x:()=>c});var s=n(6540);const t={},l=s.createContext(t);function r(e){const i=s.useContext(l);return s.useMemo((function(){return"function"==typeof e?e(i):{...i,...e}}),[i,e])}function c(e){let i;return i=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:r(e.components),s.createElement(l.Provider,{value:i},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b82dbf03.d8694c10.js b/assets/js/b82dbf03.d8694c10.js deleted file mode 100644 index 5b4d7a63..00000000 --- a/assets/js/b82dbf03.d8694c10.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2244],{9:(e,i,n)=>{n.r(i),n.d(i,{assets:()=>a,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>c,toc:()=>o});var s=n(4848),t=n(8453);const l={id:"isNil"},r=void 0,c={id:"isNil",title:"isNil",description:"isNil variable",source:"@site/docs/isNil.md",sourceDirName:".",slug:"/isNil",permalink:"/docs/isNil",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isNil"},sidebar:"api",previous:{title:"isEmpty",permalink:"/docs/isEmpty"},next:{title:"isNumber",permalink:"/docs/isNumber"}},a={},o=[{value:"isNil variable",id:"isnil-variable",level:2},{value:"Example",id:"example",level:2}];function d(e){const i={code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.h2,{id:"isnil-variable",children:"isNil variable"}),"\n",(0,s.jsxs)(i.p,{children:["Checks if the given value is ",(0,s.jsx)(i.code,{children:"null"})," or ",(0,s.jsx)(i.code,{children:"undefined"}),"."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-typescript",children:"isNil: (a: T) => a is Include\n"})}),"\n",(0,s.jsx)(i.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(i.pre,{children:(0,s.jsx)(i.code,{className:"language-ts",children:"isNil(1); // false\r\nisNil('1'); // false\r\nisNil(undefined); // true\r\nisNil(null); // true\n"})})]})}function u(e={}){const{wrapper:i}={...(0,t.R)(),...e.components};return i?(0,s.jsx)(i,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,i,n)=>{n.d(i,{R:()=>r,x:()=>c});var s=n(6540);const t={},l=s.createContext(t);function r(e){const i=s.useContext(l);return s.useMemo((function(){return"function"==typeof e?e(i):{...i,...e}}),[i,e])}function c(e){let i;return i=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:r(e.components),s.createElement(l.Provider,{value:i},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b8471ed6.9ea0ab36.js b/assets/js/b8471ed6.777f216c.js similarity index 67% rename from assets/js/b8471ed6.9ea0ab36.js rename to assets/js/b8471ed6.777f216c.js index ad7b389a..11db54a6 100644 --- a/assets/js/b8471ed6.9ea0ab36.js +++ b/assets/js/b8471ed6.777f216c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8350],{992:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var r=t(4848),o=t(8453);const s={id:"groupBy"},a=void 0,c={id:"groupBy",title:"groupBy",description:"groupBy() function",source:"@site/docs/groupBy.md",sourceDirName:".",slug:"/groupBy",permalink:"/docs/groupBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"groupBy"},sidebar:"api",previous:{title:"fromEntries",permalink:"/docs/fromEntries"},next:{title:"gt",permalink:"/docs/gt"}},i={},l=[{value:"groupBy() function",id:"groupby-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"groupby-function",children:"groupBy() function"}),"\n",(0,r.jsxs)(n.p,{children:["Splits Iterable/AsyncIterable into sets, grouped by the result of running each value through ",(0,r.jsx)(n.code,{children:"f"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function groupBy(f: (a: A) => A, iterable: Iterable): {\n [K in A]: K[];\n};\n\ndeclare function groupBy(f: (a: A) => B, iterable: Iterable): {\n [K in B]: A[];\n};\n\ndeclare function groupBy(f: (a: A) => A | Promise, iterable: AsyncIterable): Promise<{\n [K in A]: K[];\n}>;\n\ndeclare function groupBy(f: (a: A) => B | Promise, iterable: AsyncIterable): Promise<{\n [K in B]: A[];\n}>;\n\ndeclare function groupBy | AsyncIterable>(f: (a: A) => A | Promise): (iterable: B) => ReturnValueType;\n\ndeclare function groupBy(f: (a: A) => B, iterable: Iterable): {\n [K in B]: (A & {\n [K2 in GetKeyOf]: K;\n })[];\n};\n\ndeclare function groupBy(f: (a: A) => B | Promise, iterable: AsyncIterable): Promise<{\n [K in B]: (A & {\n [K2 in GetKeyOf]: K;\n })[];\n}>;\n\ndeclare function groupBy | AsyncIterable, B extends Key>(f: (a: IterableInfer) => B | Promise): (iterable: A) => ReturnValueType[];\n}>;\n\ndeclare function groupBy | AsyncIterable, F extends (a: IterableInfer) => any>(f: F): (iterable: I) => ReturnValueType>, IterableInfer> extends 1 ? {\n [key1 in Awaited>]: key1[];\n} : {\n [key1 in Awaited>]: (IterableInfer & {\n [key2 in GetKeyOf, object>, key1>]: key1;\n })[];\n}>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'const given = [\r\n { category: "clothes", desc: "good" },\r\n { category: "pants", desc: "bad" },\r\n { category: "shoes", desc: "not bad" },\r\n { category: "shoes", desc: "great" },\r\n { category: "pants", desc: "good" },\r\n];\r\n\r\ngroupBy((a) => a.category, given);\r\n// {\r\n// clothes: [{ category: "clothes", desc: "good" }],\r\n// pants: [\r\n// { category: "pants", desc: "bad" },\r\n// { category: "pants", desc: "good" },\r\n// ],\r\n// shoes: [\r\n// { category: "shoes", desc: "not bad" },\r\n// { category: "shoes", desc: "great" },\r\n// ],\r\n// };\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-groupby-v8q3b",children:"Try It"})})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>c});var r=t(6540);const o={},s=r.createContext(o);function a(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8350],{992:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var t=r(4848),o=r(8453);const s={id:"groupBy"},a=void 0,c={id:"groupBy",title:"groupBy",description:"groupBy() function",source:"@site/docs/groupBy.md",sourceDirName:".",slug:"/groupBy",permalink:"/docs/groupBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"groupBy"},sidebar:"api",previous:{title:"fromEntries",permalink:"/docs/fromEntries"},next:{title:"gt",permalink:"/docs/gt"}},i={},l=[{value:"groupBy() function",id:"groupby-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"groupby-function",children:"groupBy() function"}),"\n",(0,t.jsxs)(n.p,{children:["Splits Iterable/AsyncIterable into sets, grouped by the result of running each value through ",(0,t.jsx)(n.code,{children:"f"}),"."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function groupBy(f: (a: A) => A, iterable: Iterable): {\n [K in A]: K[];\n};\n\ndeclare function groupBy(f: (a: A) => B, iterable: Iterable): {\n [K in B]: A[];\n};\n\ndeclare function groupBy(f: (a: A) => A | Promise, iterable: AsyncIterable): Promise<{\n [K in A]: K[];\n}>;\n\ndeclare function groupBy(f: (a: A) => B | Promise, iterable: AsyncIterable): Promise<{\n [K in B]: A[];\n}>;\n\ndeclare function groupBy | AsyncIterable>(f: (a: A) => A | Promise): (iterable: B) => ReturnValueType;\n\ndeclare function groupBy(f: (a: A) => B, iterable: Iterable): {\n [K in B]: (A & {\n [K2 in GetKeyOf]: K;\n })[];\n};\n\ndeclare function groupBy(f: (a: A) => B | Promise, iterable: AsyncIterable): Promise<{\n [K in B]: (A & {\n [K2 in GetKeyOf]: K;\n })[];\n}>;\n\ndeclare function groupBy | AsyncIterable, B extends Key>(f: (a: IterableInfer) => B | Promise): (iterable: A) => ReturnValueType[];\n}>;\n\ndeclare function groupBy | AsyncIterable, F extends (a: IterableInfer) => any>(f: F): (iterable: I) => ReturnValueType>, IterableInfer> extends 1 ? {\n [key1 in Awaited>]: key1[];\n} : {\n [key1 in Awaited>]: (IterableInfer & {\n [key2 in GetKeyOf, object>, key1>]: key1;\n })[];\n}>;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:'const given = [\r\n { category: "clothes", desc: "good" },\r\n { category: "pants", desc: "bad" },\r\n { category: "shoes", desc: "not bad" },\r\n { category: "shoes", desc: "great" },\r\n { category: "pants", desc: "good" },\r\n];\r\n\r\ngroupBy((a) => a.category, given);\r\n// {\r\n// clothes: [{ category: "clothes", desc: "good" }],\r\n// pants: [\r\n// { category: "pants", desc: "bad" },\r\n// { category: "pants", desc: "good" },\r\n// ],\r\n// shoes: [\r\n// { category: "shoes", desc: "not bad" },\r\n// { category: "shoes", desc: "great" },\r\n// ],\r\n// };\n'})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-groupby-v8q3b",children:"Try It"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/groupBy.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>a,x:()=>c});var t=r(6540);const o={},s=t.createContext(o);function a(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/bae179e2.c80359c8.js b/assets/js/bae179e2.31a5db22.js similarity index 70% rename from assets/js/bae179e2.c80359c8.js rename to assets/js/bae179e2.31a5db22.js index b02731a4..e68d5e70 100644 --- a/assets/js/bae179e2.c80359c8.js +++ b/assets/js/bae179e2.31a5db22.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3091],{5327:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>d,toc:()=>a});var t=n(4848),o=n(8453);const i={id:"dropRight"},s=void 0,d={id:"dropRight",title:"dropRight",description:"dropRight() function",source:"@site/docs/dropRight.md",sourceDirName:".",slug:"/dropRight",permalink:"/docs/dropRight",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"dropRight"},sidebar:"api",previous:{title:"drop",permalink:"/docs/drop"},next:{title:"difference",permalink:"/docs/difference"}},c={},a=[{value:"dropRight() function",id:"dropright-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h2,{id:"dropright-function",children:"dropRight() function"}),"\n",(0,t.jsxs)(r.p,{children:["Returns all but the last ",(0,t.jsx)(r.code,{children:"length"})," elements of the given iterable."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"declare function dropRight(length: number, iterable: Iterable): IterableIterator;\n\ndeclare function dropRight(length: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function dropRight | AsyncIterable>(length: number): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:'const iter = dropRight(2, [1, 2, 3, 4]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n dropRight(2),\r\n toArray,\r\n); // [1, 2]\r\n\r\npipe(\r\n "abcde",\r\n dropRight(2),\r\n toArray,\r\n); // ["a", "b", "c"]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n dropRight(2),\r\n toArray,\r\n); // [1, 2]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n dropRight(2),\r\n toArray,\r\n); // [1, 2]\n'})}),"\n",(0,t.jsxs)(r.p,{children:["see ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function p(e={}){const{wrapper:r}={...(0,o.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>s,x:()=>d});var t=n(6540);const o={},i=t.createContext(o);function s(e){const r=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function d(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),t.createElement(i.Provider,{value:r},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3091],{5327:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>d,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>c,toc:()=>a});var t=n(4848),o=n(8453);const i={id:"dropRight"},s=void 0,c={id:"dropRight",title:"dropRight",description:"dropRight() function",source:"@site/docs/dropRight.md",sourceDirName:".",slug:"/dropRight",permalink:"/docs/dropRight",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"dropRight"},sidebar:"api",previous:{title:"drop",permalink:"/docs/drop"},next:{title:"difference",permalink:"/docs/difference"}},d={},a=[{value:"dropRight() function",id:"dropright-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h2,{id:"dropright-function",children:"dropRight() function"}),"\n",(0,t.jsxs)(r.p,{children:["Returns all but the last ",(0,t.jsx)(r.code,{children:"length"})," elements of the given iterable."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"declare function dropRight(length: number, iterable: Iterable): IterableIterator;\n\ndeclare function dropRight(length: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function dropRight | AsyncIterable>(length: number): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:'const iter = dropRight(2, [1, 2, 3, 4]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n dropRight(2),\r\n toArray,\r\n); // [1, 2]\r\n\r\npipe(\r\n "abcde",\r\n dropRight(2),\r\n toArray,\r\n); // ["a", "b", "c"]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4]),\r\n dropRight(2),\r\n toArray,\r\n); // [1, 2]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n dropRight(2),\r\n toArray,\r\n); // [1, 2]\n'})}),"\n",(0,t.jsxs)(r.p,{children:["see ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/dropRight.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:r}={...(0,o.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>s,x:()=>c});var t=n(6540);const o={},i=t.createContext(o);function s(e){const r=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function c(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),t.createElement(i.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/bfd2bef3.6ea197b4.js b/assets/js/bfd2bef3.9f58f1e1.js similarity index 82% rename from assets/js/bfd2bef3.6ea197b4.js rename to assets/js/bfd2bef3.9f58f1e1.js index 211e0a11..4cb5e660 100644 --- a/assets/js/bfd2bef3.6ea197b4.js +++ b/assets/js/bfd2bef3.9f58f1e1.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7195],{9764:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});var a=r(4848),t=r(8453);const i={id:"uniqBy"},s=void 0,o={id:"uniqBy",title:"uniqBy",description:"uniqBy() function",source:"@site/docs/uniqBy.md",sourceDirName:".",slug:"/uniqBy",permalink:"/docs/uniqBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"uniqBy"},sidebar:"api",previous:{title:"uniq",permalink:"/docs/uniq"},next:{title:"values",permalink:"/docs/values"}},c={},l=[{value:"uniqBy() function",id:"uniqby-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h2,{id:"uniqby-function",children:"uniqBy() function"}),"\n",(0,a.jsxs)(n.p,{children:["Unlike ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/uniq",children:"uniq"})," returns Iterable/AsyncIterable with duplicate values removed by applying with ",(0,a.jsx)(n.code,{children:"f"})," inside the given Iterable/AsyncIterable."]}),"\n",(0,a.jsx)("b",{children:"Signature:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-typescript",children:"declare function uniqBy(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function uniqBy(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function uniqBy | AsyncIterable, B>(f: (a: IterableInfer) => B, iterable?: A): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,a.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-ts",children:"const iter = uniqBy(a => a.age, [{age: 21}, {age: 23}, {age: 21}, {age: 34}]);\r\niter.next() // {done:false, value: {age: 21}}\r\niter.next() // {done:false, value: {age: 23}}\r\niter.next() // {done:false, value: {age: 34}}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [{age: 21}, {age: 23}, {age: 21}, {age: 34}],\r\n uniqBy(a => a.age),\r\n toArray,\r\n); // [{age: 21}, {age: 23}, {age: 34}]\r\n\r\nawait pipe(\r\n Promise.resolve([{age: 21}, {age: 23}, {age: 21}, {age: 34}]),\r\n uniqBy(a => a.age),\r\n toArray,\r\n); // [{age: 21}, {age: 23}, {age: 34}]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([{age: 21}, {age: 23}, {age: 21}, {age: 34}]),\r\n toAsync,\r\n uniqBy(async (a) => a.age),\r\n toArray,\r\n); // [{age: 21}, {age: 23}, {age: 34}]\r\n\r\n// toAsync\r\nawait pipe(\r\n [Promise.resolve({age: 21}), Promise.resolve({age: 23}), Promise.resolve({age: 21}), Promise.resolve({age: 34})],\r\n toAsync,\r\n uniqBy(a => a.age),\r\n toArray,\r\n); // [{age: 21}, {age: 23}, {age: 34}]\n"})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-uniqby-zb5d9",children:"Try It"})}),"\n",(0,a.jsxs)(n.p,{children:["see ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function d(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(u,{...e})}):u(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>o});var a=r(6540);const t={},i=a.createContext(t);function s(e){const n=a.useContext(i);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),a.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7195],{9764:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>l});var a=r(4848),t=r(8453);const i={id:"uniqBy"},s=void 0,o={id:"uniqBy",title:"uniqBy",description:"uniqBy() function",source:"@site/docs/uniqBy.md",sourceDirName:".",slug:"/uniqBy",permalink:"/docs/uniqBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"uniqBy"},sidebar:"api",previous:{title:"uniq",permalink:"/docs/uniq"},next:{title:"values",permalink:"/docs/values"}},c={},l=[{value:"uniqBy() function",id:"uniqby-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h2,{id:"uniqby-function",children:"uniqBy() function"}),"\n",(0,a.jsxs)(n.p,{children:["Unlike ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/uniq",children:"uniq"})," returns Iterable/AsyncIterable with duplicate values removed by applying with ",(0,a.jsx)(n.code,{children:"f"})," inside the given Iterable/AsyncIterable."]}),"\n",(0,a.jsx)("b",{children:"Signature:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-typescript",children:"declare function uniqBy(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function uniqBy(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function uniqBy | AsyncIterable, B>(f: (a: IterableInfer) => B, iterable?: A): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,a.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-ts",children:"const iter = uniqBy(a => a.age, [{age: 21}, {age: 23}, {age: 21}, {age: 34}]);\r\niter.next() // {done:false, value: {age: 21}}\r\niter.next() // {done:false, value: {age: 23}}\r\niter.next() // {done:false, value: {age: 34}}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [{age: 21}, {age: 23}, {age: 21}, {age: 34}],\r\n uniqBy(a => a.age),\r\n toArray,\r\n); // [{age: 21}, {age: 23}, {age: 34}]\r\n\r\nawait pipe(\r\n Promise.resolve([{age: 21}, {age: 23}, {age: 21}, {age: 34}]),\r\n uniqBy(a => a.age),\r\n toArray,\r\n); // [{age: 21}, {age: 23}, {age: 34}]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([{age: 21}, {age: 23}, {age: 21}, {age: 34}]),\r\n toAsync,\r\n uniqBy(async (a) => a.age),\r\n toArray,\r\n); // [{age: 21}, {age: 23}, {age: 34}]\r\n\r\n// toAsync\r\nawait pipe(\r\n [Promise.resolve({age: 21}), Promise.resolve({age: 23}), Promise.resolve({age: 21}), Promise.resolve({age: 34})],\r\n toAsync,\r\n uniqBy(a => a.age),\r\n toArray,\r\n); // [{age: 21}, {age: 23}, {age: 34}]\n"})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-uniqby-zb5d9",children:"Try It"})}),"\n",(0,a.jsxs)(n.p,{children:["see ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,a.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/uniqBy.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(u,{...e})}):u(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>o});var a=r(6540);const t={},i=a.createContext(t);function s(e){const n=a.useContext(i);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),a.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c1b47848.be6bf7d1.js b/assets/js/c1b47848.be6bf7d1.js new file mode 100644 index 00000000..0974aed4 --- /dev/null +++ b/assets/js/c1b47848.be6bf7d1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6244],{6073:(e,l,n)=>{n.r(l),n.d(l,{assets:()=>c,contentTitle:()=>r,default:()=>d,frontMatter:()=>t,metadata:()=>u,toc:()=>a});var s=n(4848),i=n(8453);const t={id:"isNull"},r=void 0,u={id:"isNull",title:"isNull",description:"isNull variable",source:"@site/docs/isNull.md",sourceDirName:".",slug:"/isNull",permalink:"/docs/isNull",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isNull"}},c={},a=[{value:"isNull variable",id:"isnull-variable",level:2},{value:"Example",id:"example",level:2}];function o(e){const l={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.h2,{id:"isnull-variable",children:"isNull variable"}),"\n",(0,s.jsxs)(l.p,{children:["Checks if the given value is ",(0,s.jsx)(l.code,{children:"null"}),"."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(l.pre,{children:(0,s.jsx)(l.code,{className:"language-typescript",children:"isNull: (input: T) => input is Include\n"})}),"\n",(0,s.jsx)(l.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(l.pre,{children:(0,s.jsx)(l.code,{className:"language-ts",children:"isNull(1); // false\r\nisNull('1'); // false\r\nisNull(undefined); // false\r\nisNull(null); // true\n"})}),"\n",(0,s.jsx)(l.p,{children:(0,s.jsx)(l.a,{href:"https://github.com/marpple/FxTS/blob/main/src/isNull.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:l}={...(0,i.R)(),...e.components};return l?(0,s.jsx)(l,{...e,children:(0,s.jsx)(o,{...e})}):o(e)}},8453:(e,l,n)=>{n.d(l,{R:()=>r,x:()=>u});var s=n(6540);const i={},t=s.createContext(i);function r(e){const l=s.useContext(t);return s.useMemo((function(){return"function"==typeof e?e(l):{...l,...e}}),[l,e])}function u(e){let l;return l=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),s.createElement(t.Provider,{value:l},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c1b47848.d024e865.js b/assets/js/c1b47848.d024e865.js deleted file mode 100644 index d634f7f3..00000000 --- a/assets/js/c1b47848.d024e865.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6244],{6073:(e,n,l)=>{l.r(n),l.d(n,{assets:()=>c,contentTitle:()=>r,default:()=>d,frontMatter:()=>t,metadata:()=>u,toc:()=>a});var s=l(4848),i=l(8453);const t={id:"isNull"},r=void 0,u={id:"isNull",title:"isNull",description:"isNull variable",source:"@site/docs/isNull.md",sourceDirName:".",slug:"/isNull",permalink:"/docs/isNull",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isNull"}},c={},a=[{value:"isNull variable",id:"isnull-variable",level:2},{value:"Example",id:"example",level:2}];function o(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"isnull-variable",children:"isNull variable"}),"\n",(0,s.jsxs)(n.p,{children:["Checks if the given value is ",(0,s.jsx)(n.code,{children:"null"}),"."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"isNull: (input: T) => input is Include\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"isNull(1); // false\r\nisNull('1'); // false\r\nisNull(undefined); // false\r\nisNull(null); // true\n"})})]})}function d(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(o,{...e})}):o(e)}},8453:(e,n,l)=>{l.d(n,{R:()=>r,x:()=>u});var s=l(6540);const i={},t=s.createContext(i);function r(e){const n=s.useContext(t);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function u(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),s.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c2f8a836.d4c709e1.js b/assets/js/c2f8a836.1684225e.js similarity index 79% rename from assets/js/c2f8a836.d4c709e1.js rename to assets/js/c2f8a836.1684225e.js index 171e7cf1..5189eee2 100644 --- a/assets/js/c2f8a836.d4c709e1.js +++ b/assets/js/c2f8a836.1684225e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2626],{5117:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>d,default:()=>l,frontMatter:()=>s,metadata:()=>o,toc:()=>c});var i=t(4848),r=t(8453);const s={id:"zipWithIndex"},d=void 0,o={id:"zipWithIndex",title:"zipWithIndex",description:"zipWithIndex() function",source:"@site/docs/zipWithIndex.md",sourceDirName:".",slug:"/zipWithIndex",permalink:"/docs/zipWithIndex",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"zipWithIndex"},sidebar:"api",previous:{title:"zipWith",permalink:"/docs/zipWith"},next:{title:"add",permalink:"/docs/add"}},a={},c=[{value:"zipWithIndex() function",id:"zipwithindex-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"zipwithindex-function",children:"zipWithIndex() function"}),"\n",(0,i.jsx)(n.p,{children:"Returns Iterable/AsyncIterable including an index to the existing Iterable/AsyncIterable value."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function zipWithIndex | AsyncIterable>(iterable: T): ReturnZipWithIndexType;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:'const iter = zipWithIndex(["a", "b", "c", "d"]);\r\niter.next() // {done:false, value: [0, "a"]}\r\niter.next() // {done:false, value: [1, "b"]}\r\niter.next() // {done:false, value: [2, "c"]}\r\niter.next() // {done:false, value: [3, "d"]}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n ["a", "b", "c", "d"],\r\n zipWithIndex,\r\n toArray,\r\n); // [[0, "a"], [1, "b"], [2, "c"], [3, "d"]]\r\n\r\nawait pipe(\r\n Promise.resolve(["a", "b", "c", "d"]),\r\n zipWithIndex,\r\n toArray,\r\n); // [[0, "a"], [1, "b"], [2, "c"], [3, "d"]]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve("a"), Promise.resolve("b"), Promise.resolve("c"), Promise.resolve("d")],\r\n toAsync,\r\n zipWithIndex,\r\n toArray,\r\n); // [[0, "a"], [1, "b"], [2, "c"], [3, "d"]]\n'})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-zipwithindex-p1k31",children:"Try It"})}),"\n",(0,i.jsxs)(n.p,{children:["see ",(0,i.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,i.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,i.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function l(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>d,x:()=>o});var i=t(6540);const r={},s=i.createContext(r);function d(e){const n=i.useContext(s);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),i.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2626],{5117:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>d,default:()=>l,frontMatter:()=>s,metadata:()=>o,toc:()=>c});var i=t(4848),r=t(8453);const s={id:"zipWithIndex"},d=void 0,o={id:"zipWithIndex",title:"zipWithIndex",description:"zipWithIndex() function",source:"@site/docs/zipWithIndex.md",sourceDirName:".",slug:"/zipWithIndex",permalink:"/docs/zipWithIndex",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"zipWithIndex"},sidebar:"api",previous:{title:"zipWith",permalink:"/docs/zipWith"},next:{title:"add",permalink:"/docs/add"}},a={},c=[{value:"zipWithIndex() function",id:"zipwithindex-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"zipwithindex-function",children:"zipWithIndex() function"}),"\n",(0,i.jsx)(n.p,{children:"Returns Iterable/AsyncIterable including an index to the existing Iterable/AsyncIterable value."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function zipWithIndex | AsyncIterable>(iterable: T): ReturnZipWithIndexType;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:'const iter = zipWithIndex(["a", "b", "c", "d"]);\r\niter.next() // {done:false, value: [0, "a"]}\r\niter.next() // {done:false, value: [1, "b"]}\r\niter.next() // {done:false, value: [2, "c"]}\r\niter.next() // {done:false, value: [3, "d"]}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n ["a", "b", "c", "d"],\r\n zipWithIndex,\r\n toArray,\r\n); // [[0, "a"], [1, "b"], [2, "c"], [3, "d"]]\r\n\r\nawait pipe(\r\n Promise.resolve(["a", "b", "c", "d"]),\r\n zipWithIndex,\r\n toArray,\r\n); // [[0, "a"], [1, "b"], [2, "c"], [3, "d"]]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve("a"), Promise.resolve("b"), Promise.resolve("c"), Promise.resolve("d")],\r\n toAsync,\r\n zipWithIndex,\r\n toArray,\r\n); // [[0, "a"], [1, "b"], [2, "c"], [3, "d"]]\n'})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-zipwithindex-p1k31",children:"Try It"})}),"\n",(0,i.jsxs)(n.p,{children:["see ",(0,i.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,i.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,i.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/zipWithIndex.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>d,x:()=>o});var i=t(6540);const r={},s=i.createContext(r);function d(e){const n=i.useContext(s);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),i.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c35f9c57.d04d9012.js b/assets/js/c35f9c57.d04d9012.js new file mode 100644 index 00000000..b50cea68 --- /dev/null +++ b/assets/js/c35f9c57.d04d9012.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4468],{4185:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>s,default:()=>o,frontMatter:()=>l,metadata:()=>r,toc:()=>a});var i=t(4848),c=t(8453);const l={id:"includes"},s=void 0,r={id:"includes",title:"includes",description:"includes() function",source:"@site/docs/includes.md",sourceDirName:".",slug:"/includes",permalink:"/docs/includes",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"includes"},sidebar:"api",previous:{title:"identity",permalink:"/docs/identity"},next:{title:"indexBy",permalink:"/docs/indexBy"}},u={},a=[{value:"includes() function",id:"includes-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"includes-function",children:"includes() function"}),"\n",(0,i.jsx)(n.p,{children:"Checks if the specified value is equal. (contains)"}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function includes(value: unknown, iterable: Iterable): boolean;\n\ndeclare function includes(value: unknown, iterable: T): false;\n\ndeclare function includes(value: T, iterable: Iterable): value is U;\n\ndeclare function includes(value: unknown, iterable: AsyncIterable): Promise;\n\ndeclare function includes | AsyncIterable>(value: unknown): (iterable: T) => ReturnValueType;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"includes('c', 'abcd'); // true\r\nincludes('e', 'abcd'); // false\r\nincludes(3, [1,2,3,4]); // true\r\nincludes(5, [1,2,3,4]); // false\n"})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/includes.ts",children:"Open Source Code"})})]})}function o(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>r});var i=t(6540);const c={},l=i.createContext(c);function s(e){const n=i.useContext(l);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),i.createElement(l.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c35f9c57.e84cfe6d.js b/assets/js/c35f9c57.e84cfe6d.js deleted file mode 100644 index 908f2a9e..00000000 --- a/assets/js/c35f9c57.e84cfe6d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4468],{4185:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>r,contentTitle:()=>s,default:()=>o,frontMatter:()=>l,metadata:()=>u,toc:()=>a});var i=t(4848),c=t(8453);const l={id:"includes"},s=void 0,u={id:"includes",title:"includes",description:"includes() function",source:"@site/docs/includes.md",sourceDirName:".",slug:"/includes",permalink:"/docs/includes",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"includes"},sidebar:"api",previous:{title:"identity",permalink:"/docs/identity"},next:{title:"indexBy",permalink:"/docs/indexBy"}},r={},a=[{value:"includes() function",id:"includes-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"includes-function",children:"includes() function"}),"\n",(0,i.jsx)(n.p,{children:"Checks if the specified value is equal. (contains)"}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function includes(value: unknown, iterable: Iterable): boolean;\n\ndeclare function includes(value: unknown, iterable: T): false;\n\ndeclare function includes(value: T, iterable: Iterable): value is U;\n\ndeclare function includes(value: unknown, iterable: AsyncIterable): Promise;\n\ndeclare function includes | AsyncIterable>(value: unknown): (iterable: T) => ReturnValueType;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"includes('c', 'abcd'); // true\r\nincludes('e', 'abcd'); // false\r\nincludes(3, [1,2,3,4]); // true\r\nincludes(5, [1,2,3,4]); // false\n"})})]})}function o(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>u});var i=t(6540);const c={},l=i.createContext(c);function s(e){const n=i.useContext(l);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function u(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),i.createElement(l.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c6a029fa.398cb270.js b/assets/js/c6a029fa.398cb270.js deleted file mode 100644 index 55b498e9..00000000 --- a/assets/js/c6a029fa.398cb270.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5327],{5216:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var r=t(4848),a=t(8453);const i={id:"max"},s=void 0,c={id:"max",title:"max",description:"max() function",source:"@site/docs/max.md",sourceDirName:".",slug:"/max",permalink:"/docs/max",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"max"},sidebar:"api",previous:{title:"lte",permalink:"/docs/lte"},next:{title:"memoize",permalink:"/docs/memoize"}},o={},l=[{value:"max() function",id:"max-function",level:2},{value:"Example",id:"example",level:2}];function m(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"max-function",children:"max() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns the largest of the given iterable/AsyncIterable"}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function max | AsyncIterable>(iterable: A): ReturnValueType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"max([1, 3, 5]); // 5;\r\nmax([1, NaN, 2]); // NaN;\r\nmax([1, Infinity, 2]); // Infinity;\r\nmax([]); // -Infinity\n"})})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(m,{...e})}):m(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var r=t(6540);const a={},i=r.createContext(a);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c6a029fa.cd1364db.js b/assets/js/c6a029fa.cd1364db.js new file mode 100644 index 00000000..29ecc100 --- /dev/null +++ b/assets/js/c6a029fa.cd1364db.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5327],{5216:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var r=t(4848),a=t(8453);const i={id:"max"},s=void 0,c={id:"max",title:"max",description:"max() function",source:"@site/docs/max.md",sourceDirName:".",slug:"/max",permalink:"/docs/max",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"max"},sidebar:"api",previous:{title:"lte",permalink:"/docs/lte"},next:{title:"memoize",permalink:"/docs/memoize"}},o={},l=[{value:"max() function",id:"max-function",level:2},{value:"Example",id:"example",level:2}];function m(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"max-function",children:"max() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns the largest of the given iterable/AsyncIterable"}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function max | AsyncIterable>(iterable: A): ReturnValueType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"max([1, 3, 5]); // 5;\r\nmax([1, NaN, 2]); // NaN;\r\nmax([1, Infinity, 2]); // Infinity;\r\nmax([]); // -Infinity\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/max.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(m,{...e})}):m(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>c});var r=t(6540);const a={},i=r.createContext(a);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/c74ee130.ef4c778b.js b/assets/js/c74ee130.797388d9.js similarity index 78% rename from assets/js/c74ee130.ef4c778b.js rename to assets/js/c74ee130.797388d9.js index 93fe6e73..d5624ab9 100644 --- a/assets/js/c74ee130.ef4c778b.js +++ b/assets/js/c74ee130.797388d9.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9103],{147:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>i,default:()=>d,frontMatter:()=>c,metadata:()=>o,toc:()=>l});var r=t(4848),s=t(8453);const c={id:"chunk"},i=void 0,o={id:"chunk",title:"chunk",description:"chunk() function",source:"@site/docs/chunk.md",sourceDirName:".",slug:"/chunk",permalink:"/docs/chunk",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"chunk"},sidebar:"api",previous:{title:"append",permalink:"/docs/append"},next:{title:"compact",permalink:"/docs/compact"}},a={},l=[{value:"chunk() function",id:"chunk-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"chunk-function",children:"chunk() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns Iterable/AsyncIterable of elements split into groups the length of size. If iterableIterator can't be split evenly, the final chunk will be the remaining elements."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function chunk(size: number, iterable: Iterable): IterableIterator;\n\ndeclare function chunk(size: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function chunk | AsyncIterable>(size: number): (iterable: T) => ReturnIterableIteratorType[]>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = chunk(2, [1, 2, 3, 4]);\r\niter.next() // {done:false, value:[1, 2]}\r\niter.next() // {done:false, value:[3, 4]}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n chunk(2),\r\n toArray,\r\n); // [[1, 2],[3, 4]]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3 ,4]),\r\n chunk(2),\r\n toArray,\r\n); // [[1, 2],[3, 4]]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n chunk(2),\r\n toArray,\r\n); // [[1, 2],[3, 4]]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-chunk-gksly",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function d(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>o});var r=t(6540);const s={},c=r.createContext(s);function i(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9103],{147:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>i,default:()=>d,frontMatter:()=>c,metadata:()=>o,toc:()=>l});var r=t(4848),s=t(8453);const c={id:"chunk"},i=void 0,o={id:"chunk",title:"chunk",description:"chunk() function",source:"@site/docs/chunk.md",sourceDirName:".",slug:"/chunk",permalink:"/docs/chunk",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"chunk"},sidebar:"api",previous:{title:"append",permalink:"/docs/append"},next:{title:"compact",permalink:"/docs/compact"}},a={},l=[{value:"chunk() function",id:"chunk-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"chunk-function",children:"chunk() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns Iterable/AsyncIterable of elements split into groups the length of size. If iterableIterator can't be split evenly, the final chunk will be the remaining elements."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function chunk(size: number, iterable: Iterable): IterableIterator;\n\ndeclare function chunk(size: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function chunk | AsyncIterable>(size: number): (iterable: T) => ReturnIterableIteratorType[]>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = chunk(2, [1, 2, 3, 4]);\r\niter.next() // {done:false, value:[1, 2]}\r\niter.next() // {done:false, value:[3, 4]}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4],\r\n chunk(2),\r\n toArray,\r\n); // [[1, 2],[3, 4]]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3 ,4]),\r\n chunk(2),\r\n toArray,\r\n); // [[1, 2],[3, 4]]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n chunk(2),\r\n toArray,\r\n); // [[1, 2],[3, 4]]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-chunk-gksly",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/chunk.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>o});var r=t(6540);const s={},c=r.createContext(s);function i(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/cd579993.e8b228c3.js b/assets/js/cd579993.e8b228c3.js deleted file mode 100644 index 6bbf932e..00000000 --- a/assets/js/cd579993.e8b228c3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1068],{694:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>u});var s=t(4848),r=t(8453);const o={id:"values"},a=void 0,i={id:"values",title:"values",description:"values() function",source:"@site/docs/values.md",sourceDirName:".",slug:"/values",permalink:"/docs/values",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"values"},sidebar:"api",previous:{title:"uniqBy",permalink:"/docs/uniqBy"},next:{title:"zip",permalink:"/docs/zip"}},c={},u=[{value:"values() function",id:"values-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"values-function",children:"values() function"}),"\n",(0,s.jsx)(n.p,{children:"Returns an iterator of the own enumerable string keyed property values of object."}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function values>(obj: T): Generator], void, unknown>;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:'[...values({ a: 1, b: "2", c: true })]\r\n// [1, "2", true]\n'})})]})}function d(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>i});var s=t(6540);const r={},o=s.createContext(r);function a(e){const n=s.useContext(o);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:a(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/cd579993.f9063ab4.js b/assets/js/cd579993.f9063ab4.js new file mode 100644 index 00000000..30d49128 --- /dev/null +++ b/assets/js/cd579993.f9063ab4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1068],{694:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var s=t(4848),r=t(8453);const a={id:"values"},o=void 0,i={id:"values",title:"values",description:"values() function",source:"@site/docs/values.md",sourceDirName:".",slug:"/values",permalink:"/docs/values",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"values"},sidebar:"api",previous:{title:"uniqBy",permalink:"/docs/uniqBy"},next:{title:"zip",permalink:"/docs/zip"}},c={},l=[{value:"values() function",id:"values-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"values-function",children:"values() function"}),"\n",(0,s.jsx)(n.p,{children:"Returns an iterator of the own enumerable string keyed property values of object."}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function values>(obj: T): Generator], void, unknown>;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:'[...values({ a: 1, b: "2", c: true })]\r\n// [1, "2", true]\n'})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/values.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(u,{...e})}):u(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/cdf7d60f.3a645df8.js b/assets/js/cdf7d60f.3a645df8.js deleted file mode 100644 index d7127749..00000000 --- a/assets/js/cdf7d60f.3a645df8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5231],{658:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>t,metadata:()=>r,toc:()=>c});var s=o(4848),i=o(8453);const t={id:"isBoolean"},a=void 0,r={id:"isBoolean",title:"isBoolean",description:"isBoolean variable",source:"@site/docs/isBoolean.md",sourceDirName:".",slug:"/isBoolean",permalink:"/docs/isBoolean",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isBoolean"},sidebar:"api",previous:{title:"isArray",permalink:"/docs/isArray"},next:{title:"isEmpty",permalink:"/docs/isEmpty"}},l={},c=[{value:"isBoolean variable",id:"isboolean-variable",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"isboolean-variable",children:"isBoolean variable"}),"\n",(0,s.jsxs)(n.p,{children:["Returns true if ",(0,s.jsx)(n.code,{children:"n"})," is a Boolean."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"isBoolean: (n: T) => n is Include\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:'isBoolean(true); // true\r\nisBoolean(null); // false\r\nisBoolean("FxTS"); // false\n'})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,o)=>{o.d(n,{R:()=>a,x:()=>r});var s=o(6540);const i={},t=s.createContext(i);function a(e){const n=s.useContext(t);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),s.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/cdf7d60f.78599143.js b/assets/js/cdf7d60f.78599143.js new file mode 100644 index 00000000..a83aa735 --- /dev/null +++ b/assets/js/cdf7d60f.78599143.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5231],{658:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>t,metadata:()=>r,toc:()=>c});var s=o(4848),i=o(8453);const t={id:"isBoolean"},a=void 0,r={id:"isBoolean",title:"isBoolean",description:"isBoolean variable",source:"@site/docs/isBoolean.md",sourceDirName:".",slug:"/isBoolean",permalink:"/docs/isBoolean",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isBoolean"},sidebar:"api",previous:{title:"isArray",permalink:"/docs/isArray"},next:{title:"isEmpty",permalink:"/docs/isEmpty"}},l={},c=[{value:"isBoolean variable",id:"isboolean-variable",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"isboolean-variable",children:"isBoolean variable"}),"\n",(0,s.jsxs)(n.p,{children:["Returns true if ",(0,s.jsx)(n.code,{children:"n"})," is a Boolean."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"isBoolean: (n: T) => n is Include\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:'isBoolean(true); // true\r\nisBoolean(null); // false\r\nisBoolean("FxTS"); // false\n'})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/isBoolean.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,o)=>{o.d(n,{R:()=>a,x:()=>r});var s=o(6540);const i={},t=s.createContext(i);function a(e){const n=s.useContext(t);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),s.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/cdfe3287.f9faad78.js b/assets/js/cdfe3287.572e7205.js similarity index 78% rename from assets/js/cdfe3287.f9faad78.js rename to assets/js/cdfe3287.572e7205.js index 563f9a1a..ff1ca063 100644 --- a/assets/js/cdfe3287.f9faad78.js +++ b/assets/js/cdfe3287.572e7205.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2109],{6527:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var r=t(4848),a=t(8453);const i={id:"takeUntil"},s=void 0,l={id:"takeUntil",title:"takeUntil",description:"takeUntil() function",source:"@site/docs/takeUntil.md",sourceDirName:".",slug:"/takeUntil",permalink:"/docs/takeUntil",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"takeUntil"},sidebar:"api",previous:{title:"takeRight",permalink:"/docs/takeRight"},next:{title:"takeWhile",permalink:"/docs/takeWhile"}},o={},c=[{value:"takeUntil() function",id:"takeuntil-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"takeuntil-function",children:"takeUntil() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable that taken values until truthy when given ",(0,r.jsx)(n.code,{children:"f"})," is applied."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function takeUntil(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function takeUntil(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function takeUntil | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = takeUntil(a => a % 2 === 0, [1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5, 6],\r\n takeUntil(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 2]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 6]),\r\n takeUntil(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 2]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 6]),\r\n toAsync,\r\n takeUntil(async (a) => a % 2 === 0),\r\n toArray,\r\n); // [1, 2]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3),\r\nPromise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n takeUntil(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 2]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-takeuntil-gv1jk",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>l});var r=t(6540);const a={},i=r.createContext(a);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2109],{6527:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var r=t(4848),a=t(8453);const i={id:"takeUntil"},s=void 0,l={id:"takeUntil",title:"takeUntil",description:"takeUntil() function",source:"@site/docs/takeUntil.md",sourceDirName:".",slug:"/takeUntil",permalink:"/docs/takeUntil",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"takeUntil"},sidebar:"api",previous:{title:"takeRight",permalink:"/docs/takeRight"},next:{title:"takeWhile",permalink:"/docs/takeWhile"}},o={},c=[{value:"takeUntil() function",id:"takeuntil-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"takeuntil-function",children:"takeUntil() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable that taken values until truthy when given ",(0,r.jsx)(n.code,{children:"f"})," is applied."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function takeUntil(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function takeUntil(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function takeUntil | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = takeUntil(a => a % 2 === 0, [1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5, 6],\r\n takeUntil(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 2]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 6]),\r\n takeUntil(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 2]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 6]),\r\n toAsync,\r\n takeUntil(async (a) => a % 2 === 0),\r\n toArray,\r\n); // [1, 2]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3),\r\nPromise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n takeUntil(a => a % 2 === 0),\r\n toArray,\r\n); // [1, 2]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-takeuntil-gv1jk",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/takeUntil.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>l});var r=t(6540);const a={},i=r.createContext(a);function s(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:s(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/cfe017da.7b05f06c.js b/assets/js/cfe017da.80ca5a49.js similarity index 73% rename from assets/js/cfe017da.7b05f06c.js rename to assets/js/cfe017da.80ca5a49.js index 0ce61ab9..bbd8fcaf 100644 --- a/assets/js/cfe017da.7b05f06c.js +++ b/assets/js/cfe017da.80ca5a49.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1682],{9200:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>i,default:()=>l,frontMatter:()=>s,metadata:()=>o,toc:()=>d});var r=t(4848),a=t(8453);const s={id:"append"},i=void 0,o={id:"append",title:"append",description:"append() function",source:"@site/docs/append.md",sourceDirName:".",slug:"/append",permalink:"/docs/append",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"append"},sidebar:"api",previous:{title:"index",permalink:"/docs/"},next:{title:"chunk",permalink:"/docs/chunk"}},p={},d=[{value:"append() function",id:"append-function",level:2},{value:"Example",id:"example",level:2}];function c(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"append-function",children:"append() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns Iterable/AsyncIterable containing the contents of the given iterable, followed by the given element."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function append(a: A, iterable: Iterable): IterableIterator;\n\ndeclare function append(a: A | Promise, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function append | AsyncIterable>>(a: A): (iterable: B) => ReturnIterableIteratorType>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = append(4, [1,2,3]);\r\niter.next() // {done: false, value: 1}\r\niter.next() // {done: false, value: 2}\r\niter.next() // {done: false, value: 3}\r\niter.next() // {done: false, value: 4}\r\niter.next() // {done: true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1,2,3],\r\n append(4),\r\n toArray,\r\n); // [1,2,3,4]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3]),\r\n append(4),\r\n toArray,\r\n); // [1, 2, 3, 4]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],\r\n toAsync,\r\n append(4),\r\n toArray,\r\n); // [1, 2, 3, 4]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-append-civf7",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function l(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>o});var r=t(6540);const a={},s=r.createContext(a);function i(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1682],{9200:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>i,default:()=>l,frontMatter:()=>s,metadata:()=>o,toc:()=>c});var r=t(4848),a=t(8453);const s={id:"append"},i=void 0,o={id:"append",title:"append",description:"append() function",source:"@site/docs/append.md",sourceDirName:".",slug:"/append",permalink:"/docs/append",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"append"},sidebar:"api",previous:{title:"index",permalink:"/docs/"},next:{title:"chunk",permalink:"/docs/chunk"}},p={},c=[{value:"append() function",id:"append-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"append-function",children:"append() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns Iterable/AsyncIterable containing the contents of the given iterable, followed by the given element."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function append(a: A, iterable: Iterable): IterableIterator;\n\ndeclare function append(a: A | Promise, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function append | AsyncIterable>>(a: A): (iterable: B) => ReturnIterableIteratorType>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = append(4, [1,2,3]);\r\niter.next() // {done: false, value: 1}\r\niter.next() // {done: false, value: 2}\r\niter.next() // {done: false, value: 3}\r\niter.next() // {done: false, value: 4}\r\niter.next() // {done: true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [1,2,3],\r\n append(4),\r\n toArray,\r\n); // [1,2,3,4]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3]),\r\n append(4),\r\n toArray,\r\n); // [1, 2, 3, 4]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],\r\n toAsync,\r\n append(4),\r\n toArray,\r\n); // [1, 2, 3, 4]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-append-civf7",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/append.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>o});var r=t(6540);const a={},s=r.createContext(a);function i(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d2672ed8.0510c444.js b/assets/js/d2672ed8.9ec231aa.js similarity index 68% rename from assets/js/d2672ed8.0510c444.js rename to assets/js/d2672ed8.9ec231aa.js index 28e04786..fc7cea6e 100644 --- a/assets/js/d2672ed8.0510c444.js +++ b/assets/js/d2672ed8.9ec231aa.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7615],{9776:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>p,frontMatter:()=>l,metadata:()=>i,toc:()=>c});var s=t(4848),r=t(8453);const l={id:"last"},a=void 0,i={id:"last",title:"last",description:"last() function",source:"@site/docs/last.md",sourceDirName:".",slug:"/last",permalink:"/docs/last",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"last"},sidebar:"api",previous:{title:"juxt",permalink:"/docs/juxt"},next:{title:"lt",permalink:"/docs/lt"}},o={},c=[{value:"last() function",id:"last-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"last-function",children:"last() function"}),"\n",(0,s.jsx)(n.p,{children:"Returns the last element of Iterable/AsyncIterable"}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function last | AsyncIterable>(iterable: T): LastReturnType;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"last([1, 2, 3, 4, 5]); // 5\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n last,\r\n); // 5\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n last,\r\n); // 5\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],\r\n toAsync,\r\n last,\r\n); // 3\n"})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-last-zbvq8",children:"Try It"})}),"\n",(0,s.jsxs)(n.p,{children:["see ",(0,s.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,s.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"})]})]})}function p(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>i});var s=t(6540);const r={},l=s.createContext(r);function a(e){const n=s.useContext(l);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:a(e.components),s.createElement(l.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7615],{9776:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>d,frontMatter:()=>l,metadata:()=>i,toc:()=>c});var s=t(4848),r=t(8453);const l={id:"last"},a=void 0,i={id:"last",title:"last",description:"last() function",source:"@site/docs/last.md",sourceDirName:".",slug:"/last",permalink:"/docs/last",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"last"},sidebar:"api",previous:{title:"juxt",permalink:"/docs/juxt"},next:{title:"lt",permalink:"/docs/lt"}},o={},c=[{value:"last() function",id:"last-function",level:2},{value:"Example",id:"example",level:2}];function p(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"last-function",children:"last() function"}),"\n",(0,s.jsx)(n.p,{children:"Returns the last element of Iterable/AsyncIterable"}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function last | AsyncIterable>(iterable: T): LastReturnType;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"last([1, 2, 3, 4, 5]); // 5\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n last,\r\n); // 5\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5]),\r\n last,\r\n); // 5\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],\r\n toAsync,\r\n last,\r\n); // 3\n"})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-last-zbvq8",children:"Try It"})}),"\n",(0,s.jsxs)(n.p,{children:["see ",(0,s.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,s.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"})]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/last.ts",children:"Open Source Code"})})]})}function d(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>i});var s=t(6540);const r={},l=s.createContext(r);function a(e){const n=s.useContext(l);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:a(e.components),s.createElement(l.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d4522a55.81a34697.js b/assets/js/d4522a55.65c0bdcb.js similarity index 70% rename from assets/js/d4522a55.81a34697.js rename to assets/js/d4522a55.65c0bdcb.js index 0a80164a..e8bb7f7c 100644 --- a/assets/js/d4522a55.81a34697.js +++ b/assets/js/d4522a55.65c0bdcb.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2123],{9395:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>r,metadata:()=>i,toc:()=>l});var o=t(4848),s=t(8453);const r={id:"not"},c=void 0,i={id:"not",title:"not",description:"not() function",source:"@site/docs/not.md",sourceDirName:".",slug:"/not",permalink:"/docs/not",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"not"},sidebar:"api",previous:{title:"noop",permalink:"/docs/noop"},next:{title:"nth",permalink:"/docs/nth"}},a={},l=[{value:"not() function",id:"not-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"not-function",children:"not() function"}),"\n",(0,o.jsxs)(n.p,{children:["Returns the ",(0,o.jsx)(n.code,{children:"!"})," of its argument. It will return ",(0,o.jsx)(n.code,{children:"true"})," when passed falsy value, and ",(0,o.jsx)(n.code,{children:"false"})," when passed a truth value."]}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function not(a: unknown): boolean;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"not(true); // false\r\nnot(1); // false\r\nnot(NaN); // true\n"})}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-not-37xmk",children:"Try It"})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>i});var o=t(6540);const s={},r=o.createContext(s);function c(e){const n=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),o.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2123],{9395:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>r,metadata:()=>i,toc:()=>l});var o=t(4848),s=t(8453);const r={id:"not"},c=void 0,i={id:"not",title:"not",description:"not() function",source:"@site/docs/not.md",sourceDirName:".",slug:"/not",permalink:"/docs/not",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"not"},sidebar:"api",previous:{title:"noop",permalink:"/docs/noop"},next:{title:"nth",permalink:"/docs/nth"}},a={},l=[{value:"not() function",id:"not-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"not-function",children:"not() function"}),"\n",(0,o.jsxs)(n.p,{children:["Returns the ",(0,o.jsx)(n.code,{children:"!"})," of its argument. It will return ",(0,o.jsx)(n.code,{children:"true"})," when passed falsy value, and ",(0,o.jsx)(n.code,{children:"false"})," when passed a truth value."]}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function not(a: unknown): boolean;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:"not(true); // false\r\nnot(1); // false\r\nnot(NaN); // true\n"})}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-not-37xmk",children:"Try It"})}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/not.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>i});var o=t(6540);const s={},r=o.createContext(s);function c(e){const n=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),o.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d4621bd6.179e3988.js b/assets/js/d4621bd6.7e934224.js similarity index 73% rename from assets/js/d4621bd6.179e3988.js rename to assets/js/d4621bd6.7e934224.js index be40653c..2981da15 100644 --- a/assets/js/d4621bd6.179e3988.js +++ b/assets/js/d4621bd6.7e934224.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[192],{55:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>p,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var r=n(4848),s=n(8453);const a={id:"take"},o=void 0,i={id:"take",title:"take",description:"take() function",source:"@site/docs/take.md",sourceDirName:".",slug:"/take",permalink:"/docs/take",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"take"},sidebar:"api",previous:{title:"split",permalink:"/docs/split"},next:{title:"takeRight",permalink:"/docs/takeRight"}},l={},c=[{value:"take() function",id:"take-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"take-function",children:"take() function"}),"\n",(0,r.jsxs)(t.p,{children:["Returns Iterable/AsyncIterable that taken the first argument ",(0,r.jsx)(t.code,{children:"l"})," values from iterable"]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function take(l: number, iterable: Iterable): IterableIterator;\n\ndeclare function take(l: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function take | AsyncIterable>(l: number): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"const iter = take(2, [0, 1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 0}\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [0, 1, 2, 3, 4, 5, 6],\r\n take(2),\r\n toArray,\r\n); // [0, 1]\r\n\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n take(2),\r\n toArray,\r\n); // [0, 1]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(0), Promise.resolve(1), Promise.resolve(2),\r\n Promise.resolve(3), Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n take(2),\r\n toArray,\r\n); // [0, 1]\n"})}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"https://codesandbox.io/s/fxts-take-372bs",children:"Try It"})}),"\n",(0,r.jsxs)(t.p,{children:["see ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function p(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>i});var r=n(6540);const s={},a=r.createContext(s);function o(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[192],{55:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>p,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var r=n(4848),s=n(8453);const a={id:"take"},o=void 0,i={id:"take",title:"take",description:"take() function",source:"@site/docs/take.md",sourceDirName:".",slug:"/take",permalink:"/docs/take",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"take"},sidebar:"api",previous:{title:"split",permalink:"/docs/split"},next:{title:"takeRight",permalink:"/docs/takeRight"}},c={},l=[{value:"take() function",id:"take-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const t={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h2,{id:"take-function",children:"take() function"}),"\n",(0,r.jsxs)(t.p,{children:["Returns Iterable/AsyncIterable that taken the first argument ",(0,r.jsx)(t.code,{children:"l"})," values from iterable"]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-typescript",children:"declare function take(l: number, iterable: Iterable): IterableIterator;\n\ndeclare function take(l: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function take | AsyncIterable>(l: number): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-ts",children:"const iter = take(2, [0, 1, 2, 3, 4, 5, 6]);\r\niter.next() // {done:false, value: 0}\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [0, 1, 2, 3, 4, 5, 6],\r\n take(2),\r\n toArray,\r\n); // [0, 1]\r\n\r\nawait pipe(\r\n Promise.resolve([0, 1, 2, 3, 4, 5, 6]),\r\n take(2),\r\n toArray,\r\n); // [0, 1]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(0), Promise.resolve(1), Promise.resolve(2),\r\n Promise.resolve(3), Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],\r\n toAsync,\r\n take(2),\r\n toArray,\r\n); // [0, 1]\n"})}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"https://codesandbox.io/s/fxts-take-372bs",children:"Try It"})}),"\n",(0,r.jsxs)(t.p,{children:["see ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(t.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/take.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>o,x:()=>i});var r=n(6540);const s={},a=r.createContext(s);function o(e){const t=r.useContext(a);return r.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),r.createElement(a.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d63e7be9.628d70b0.js b/assets/js/d63e7be9.628d70b0.js new file mode 100644 index 00000000..b9c0fc5f --- /dev/null +++ b/assets/js/d63e7be9.628d70b0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8647],{8638:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>u,contentTitle:()=>c,default:()=>a,frontMatter:()=>r,metadata:()=>o,toc:()=>l});var t=s(4848),i=s(8453);const r={id:"unless"},c=void 0,o={id:"unless",title:"unless",description:"unless() function",source:"@site/docs/unless.md",sourceDirName:".",slug:"/unless",permalink:"/docs/unless",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"unless"},sidebar:"api",previous:{title:"unicodeToArray",permalink:"/docs/unicodeToArray"}},u={},l=[{value:"unless() function",id:"unless-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"unless-function",children:"unless() function"}),"\n",(0,t.jsxs)(n.p,{children:["If the result of ",(0,t.jsx)(n.code,{children:"predicate"})," is true, ",(0,t.jsx)(n.code,{children:"process"})," will not be executed. ",(0,t.jsx)(n.code,{children:"unless"})," return the result of ",(0,t.jsx)(n.code,{children:"process"})," if it is executed, and if the ",(0,t.jsx)(n.code,{children:"process"})," is not executed, it returns the function argument as is."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function unless(predicate: (input: T) => boolean, process: (input: T) => U): (input: T) => T | (U extends void ? undefined : U);\n\ndeclare function unless(predicate: (input: T) => input is N, process: (input: Exclude) => U): (input: T) => N | (U extends void ? undefined : U);\n"})}),"\n",(0,t.jsxs)(n.p,{children:["original input or result of ",(0,t.jsx)(n.code,{children:"process"})]}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:'// it will return only string\r\nconst unlessIsString: (input: string | undefined) => string = unless(isString, (input) => {\r\n throw Error("input is undefiend.")\r\n});\n'})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/unless.ts",children:"Open Source Code"})})]})}function a(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>c,x:()=>o});var t=s(6540);const i={},r=t.createContext(i);function c(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:c(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d63e7be9.d0c1a5c3.js b/assets/js/d63e7be9.d0c1a5c3.js deleted file mode 100644 index 69b9e54e..00000000 --- a/assets/js/d63e7be9.d0c1a5c3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8647],{8638:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>u,contentTitle:()=>c,default:()=>a,frontMatter:()=>r,metadata:()=>o,toc:()=>l});var t=s(4848),i=s(8453);const r={id:"unless"},c=void 0,o={id:"unless",title:"unless",description:"unless() function",source:"@site/docs/unless.md",sourceDirName:".",slug:"/unless",permalink:"/docs/unless",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"unless"},sidebar:"api",previous:{title:"unicodeToArray",permalink:"/docs/unicodeToArray"}},u={},l=[{value:"unless() function",id:"unless-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"unless-function",children:"unless() function"}),"\n",(0,t.jsxs)(n.p,{children:["If the result of ",(0,t.jsx)(n.code,{children:"predicate"})," is true, ",(0,t.jsx)(n.code,{children:"process"})," will not be executed. ",(0,t.jsx)(n.code,{children:"unless"})," return the result of ",(0,t.jsx)(n.code,{children:"process"})," if it is executed, and if the ",(0,t.jsx)(n.code,{children:"process"})," is not executed, it returns the function argument as is."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function unless(predicate: (input: T) => boolean, process: (input: T) => U): (input: T) => T | (U extends void ? undefined : U);\n\ndeclare function unless(predicate: (input: T) => input is N, process: (input: Exclude) => U): (input: T) => N | (U extends void ? undefined : U);\n"})}),"\n",(0,t.jsxs)(n.p,{children:["original input or result of ",(0,t.jsx)(n.code,{children:"process"})]}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:'// it will return only string\r\nconst unlessIsString: (input: string | undefined) => string = unless(isString, (input) => {\r\n throw Error("input is undefiend.")\r\n});\n'})})]})}function a(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>c,x:()=>o});var t=s(6540);const i={},r=t.createContext(i);function c(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:c(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d6512fd8.a252669f.js b/assets/js/d6512fd8.cb02da6b.js similarity index 69% rename from assets/js/d6512fd8.a252669f.js rename to assets/js/d6512fd8.cb02da6b.js index 992eea30..26d0da0f 100644 --- a/assets/js/d6512fd8.a252669f.js +++ b/assets/js/d6512fd8.cb02da6b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9071],{9238:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var r=t(4848),s=t(8453);const i={id:"entries"},o=void 0,c={id:"entries",title:"entries",description:"entries() function",source:"@site/docs/entries.md",sourceDirName:".",slug:"/entries",permalink:"/docs/entries",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"entries"},sidebar:"api",previous:{title:"dropWhile",permalink:"/docs/dropWhile"},next:{title:"filter",permalink:"/docs/filter"}},a={},l=[{value:"entries() function",id:"entries-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"entries-function",children:"entries() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns an iterator of the own enumerable string keyed-value pairs."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function entries>(obj: T): Generator, void>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'\r\n[...entries({ a: 1, b: "2", c: true })]\r\n// [["a", 1], ["b", "2"], ["c", true]]\n'})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/fromEntries",children:"fromEntries"})]})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>c});var r=t(6540);const s={},i=r.createContext(s);function o(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9071],{9238:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var r=t(4848),s=t(8453);const i={id:"entries"},o=void 0,c={id:"entries",title:"entries",description:"entries() function",source:"@site/docs/entries.md",sourceDirName:".",slug:"/entries",permalink:"/docs/entries",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"entries"},sidebar:"api",previous:{title:"dropWhile",permalink:"/docs/dropWhile"},next:{title:"filter",permalink:"/docs/filter"}},a={},l=[{value:"entries() function",id:"entries-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"entries-function",children:"entries() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns an iterator of the own enumerable string keyed-value pairs."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function entries>(obj: T): Generator, void>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'\r\n[...entries({ a: 1, b: "2", c: true })]\r\n// [["a", 1], ["b", "2"], ["c", true]]\n'})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/fromEntries",children:"fromEntries"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/entries.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>c});var r=t(6540);const s={},i=r.createContext(s);function o(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d7cff035.e414f881.js b/assets/js/d7cff035.7a2ac8fb.js similarity index 69% rename from assets/js/d7cff035.e414f881.js rename to assets/js/d7cff035.7a2ac8fb.js index 37e2d12d..eec0c455 100644 --- a/assets/js/d7cff035.e414f881.js +++ b/assets/js/d7cff035.7a2ac8fb.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7817],{9067:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>f,frontMatter:()=>d,metadata:()=>o,toc:()=>c});var i=t(4848),r=t(8453);const d={id:"find"},s=void 0,o={id:"find",title:"find",description:"find() function",source:"@site/docs/find.md",sourceDirName:".",slug:"/find",permalink:"/docs/find",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"find"},sidebar:"api",previous:{title:"evolve",permalink:"/docs/evolve"},next:{title:"findIndex",permalink:"/docs/findIndex"}},a={},c=[{value:"find() function",id:"find-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"find-function",children:"find() function"}),"\n",(0,i.jsxs)(n.p,{children:["Looks through each value in Iterable/AsyncIterable, returning the first one that passes a truth test ",(0,i.jsx)(n.code,{children:"f"}),", or ",(0,i.jsx)(n.code,{children:"undefined"})," if no value passes the test."]}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function find(f: (a: T) => unknown, iterable: Iterable): T | undefined;\n\ndeclare function find(f: (a: T) => unknown, iterable: AsyncIterable): Promise;\n\ndeclare function find | AsyncIterable>(f: (a: IterableInfer) => unknown, iterable?: T): (iterable: T) => ReturnValueType | undefined>;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:'find((a) => a === 2, [1, 2, 3, 4]); // 2\r\n\r\nfind((a) => a === "r", "marpple"); // \'r\'\n'})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-find-uhl0o",children:"Try It"})})]})}function f(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>o});var i=t(6540);const r={},d=i.createContext(r);function s(e){const n=i.useContext(d);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),i.createElement(d.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7817],{9067:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>d,default:()=>f,frontMatter:()=>s,metadata:()=>o,toc:()=>c});var i=t(4848),r=t(8453);const s={id:"find"},d=void 0,o={id:"find",title:"find",description:"find() function",source:"@site/docs/find.md",sourceDirName:".",slug:"/find",permalink:"/docs/find",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"find"},sidebar:"api",previous:{title:"evolve",permalink:"/docs/evolve"},next:{title:"findIndex",permalink:"/docs/findIndex"}},a={},c=[{value:"find() function",id:"find-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"find-function",children:"find() function"}),"\n",(0,i.jsxs)(n.p,{children:["Looks through each value in Iterable/AsyncIterable, returning the first one that passes a truth test ",(0,i.jsx)(n.code,{children:"f"}),", or ",(0,i.jsx)(n.code,{children:"undefined"})," if no value passes the test."]}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-typescript",children:"declare function find(f: (a: T) => unknown, iterable: Iterable): T | undefined;\n\ndeclare function find(f: (a: T) => unknown, iterable: AsyncIterable): Promise;\n\ndeclare function find | AsyncIterable>(f: (a: IterableInfer) => unknown, iterable?: T): (iterable: T) => ReturnValueType | undefined>;\n"})}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:'find((a) => a === 2, [1, 2, 3, 4]); // 2\r\n\r\nfind((a) => a === "r", "marpple"); // \'r\'\n'})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-find-uhl0o",children:"Try It"})}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/find.ts",children:"Open Source Code"})})]})}function f(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>d,x:()=>o});var i=t(6540);const r={},s=i.createContext(r);function d(e){const n=i.useContext(s);return i.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),i.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/d8e1327c.210a6b71.js b/assets/js/d8e1327c.dc24b842.js similarity index 89% rename from assets/js/d8e1327c.210a6b71.js rename to assets/js/d8e1327c.dc24b842.js index bdf29005..044db108 100644 --- a/assets/js/d8e1327c.210a6b71.js +++ b/assets/js/d8e1327c.dc24b842.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8500],{7446:(T,a,e)=>{e.r(a),e.d(a,{assets:()=>r,contentTitle:()=>f,default:()=>p,frontMatter:()=>d,metadata:()=>n,toc:()=>w});var i=e(4848),t=e(8453);const d={id:"pipeLazy"},f=void 0,n={id:"pipeLazy",title:"pipeLazy",description:"pipeLazy() function",source:"@site/docs/pipeLazy.md",sourceDirName:".",slug:"/pipeLazy",permalink:"/docs/pipeLazy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"pipeLazy"},sidebar:"api",previous:{title:"peek",permalink:"/docs/peek"},next:{title:"pluck",permalink:"/docs/pluck"}},r={},w=[{value:"pipeLazy() function",id:"pipelazy-function",level:2},{value:"Example",id:"example",level:2}];function A(T){const a={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...T.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.h2,{id:"pipelazy-function",children:"pipeLazy() function"}),"\n",(0,i.jsx)(a.p,{children:"Make function, that performs left to right function composition. All arguments must be unary."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(a.pre,{children:(0,i.jsx)(a.code,{className:"language-typescript",children:"declare function pipeLazy(f1: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, R]>) & ((a: Promise) => ReturnPipeType<[Promise, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => T19, f19: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => T19, f19: (a: Awaited) => T20, f20: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R]>);\n"})}),"\n",(0,i.jsx)(a.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(a.pre,{children:(0,i.jsx)(a.code,{className:"language-ts",children:"pipeLazy(\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n)([1, 2, 3, 4, 5]); // [12, 14]\r\n\r\nawait pipeLazy(\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n)(Promise.resolve([1, 2, 3, 4, 5])); // [12, 14]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipeLazy(\r\n toAsync,\r\n map(async (a) => a + 10),\r\n filter((a) => a % 2 === 0),\r\n toArray,\r\n)(Promise.resolve([1, 2, 3, 4, 5])); // [12, 14]\r\n\r\n// with toAsync\r\nawait pipeLazy(\r\n toAsync,\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n)([Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)]); // [12, 14]\n"})}),"\n",(0,i.jsxs)(a.p,{children:["see ",(0,i.jsx)(a.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,i.jsx)(a.a,{href:"https://fxts.dev/docs/map",children:"map"}),", ",(0,i.jsx)(a.a,{href:"https://fxts.dev/docs/filter",children:"filter"})]})]})}function p(T={}){const{wrapper:a}={...(0,t.R)(),...T.components};return a?(0,i.jsx)(a,{...T,children:(0,i.jsx)(A,{...T})}):A(T)}},8453:(T,a,e)=>{e.d(a,{R:()=>f,x:()=>n});var i=e(6540);const t={},d=i.createContext(t);function f(T){const a=i.useContext(d);return i.useMemo((function(){return"function"==typeof T?T(a):{...a,...T}}),[a,T])}function n(T){let a;return a=T.disableParentContext?"function"==typeof T.components?T.components(t):T.components||t:f(T.components),i.createElement(d.Provider,{value:a},T.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8500],{7446:(T,e,a)=>{a.r(e),a.d(e,{assets:()=>r,contentTitle:()=>f,default:()=>p,frontMatter:()=>d,metadata:()=>n,toc:()=>w});var i=a(4848),t=a(8453);const d={id:"pipeLazy"},f=void 0,n={id:"pipeLazy",title:"pipeLazy",description:"pipeLazy() function",source:"@site/docs/pipeLazy.md",sourceDirName:".",slug:"/pipeLazy",permalink:"/docs/pipeLazy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"pipeLazy"},sidebar:"api",previous:{title:"peek",permalink:"/docs/peek"},next:{title:"pluck",permalink:"/docs/pluck"}},r={},w=[{value:"pipeLazy() function",id:"pipelazy-function",level:2},{value:"Example",id:"example",level:2}];function A(T){const e={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...T.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(e.h2,{id:"pipelazy-function",children:"pipeLazy() function"}),"\n",(0,i.jsx)(e.p,{children:"Make function, that performs left to right function composition. All arguments must be unary."}),"\n",(0,i.jsx)("b",{children:"Signature:"}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-typescript",children:"declare function pipeLazy(f1: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, R]>) & ((a: Promise) => ReturnPipeType<[Promise, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => T19, f19: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R]>);\n\ndeclare function pipeLazy(f1: (a: Awaited) => T2, f2: (a: Awaited) => T3, f3: (a: Awaited) => T4, f4: (a: Awaited) => T5, f5: (a: Awaited) => T6, f6: (a: Awaited) => T7, f7: (a: Awaited) => T8, f8: (a: Awaited) => T9, f9: (a: Awaited) => T10, f10: (a: Awaited) => T11, f11: (a: Awaited) => T12, f12: (a: Awaited) => T13, f13: (a: Awaited) => T14, f14: (a: Awaited) => T15, f15: (a: Awaited) => T16, f16: (a: Awaited) => T17, f17: (a: Awaited) => T18, f18: (a: Awaited) => T19, f19: (a: Awaited) => T20, f20: (a: Awaited) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R]>) & ((a: Promise) => ReturnPipeType<[Promise, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R]>);\n"})}),"\n",(0,i.jsx)(e.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(e.pre,{children:(0,i.jsx)(e.code,{className:"language-ts",children:"pipeLazy(\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n)([1, 2, 3, 4, 5]); // [12, 14]\r\n\r\nawait pipeLazy(\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n)(Promise.resolve([1, 2, 3, 4, 5])); // [12, 14]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipeLazy(\r\n toAsync,\r\n map(async (a) => a + 10),\r\n filter((a) => a % 2 === 0),\r\n toArray,\r\n)(Promise.resolve([1, 2, 3, 4, 5])); // [12, 14]\r\n\r\n// with toAsync\r\nawait pipeLazy(\r\n toAsync,\r\n map(a => a + 10),\r\n filter(a => a % 2 === 0),\r\n toArray,\r\n)([Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)]); // [12, 14]\n"})}),"\n",(0,i.jsxs)(e.p,{children:["see ",(0,i.jsx)(e.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,i.jsx)(e.a,{href:"https://fxts.dev/docs/map",children:"map"}),", ",(0,i.jsx)(e.a,{href:"https://fxts.dev/docs/filter",children:"filter"})]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/pipeLazy.ts",children:"Open Source Code"})})]})}function p(T={}){const{wrapper:e}={...(0,t.R)(),...T.components};return e?(0,i.jsx)(e,{...T,children:(0,i.jsx)(A,{...T})}):A(T)}},8453:(T,e,a)=>{a.d(e,{R:()=>f,x:()=>n});var i=a(6540);const t={},d=i.createContext(t);function f(T){const e=i.useContext(d);return i.useMemo((function(){return"function"==typeof T?T(e):{...e,...T}}),[e,T])}function n(T){let e;return e=T.disableParentContext?"function"==typeof T.components?T.components(t):T.components||t:f(T.components),i.createElement(d.Provider,{value:e},T.children)}}}]); \ No newline at end of file diff --git a/assets/js/db45fef8.105d8780.js b/assets/js/db45fef8.85999cd0.js similarity index 75% rename from assets/js/db45fef8.105d8780.js rename to assets/js/db45fef8.85999cd0.js index 6d37f28b..12fd292a 100644 --- a/assets/js/db45fef8.105d8780.js +++ b/assets/js/db45fef8.85999cd0.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3289],{7264:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>o});var r=t(4848),s=t(8453);const i={id:"slice"},l=void 0,c={id:"slice",title:"slice",description:"slice() function",source:"@site/docs/slice.md",sourceDirName:".",slug:"/slice",permalink:"/docs/slice",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"slice"},sidebar:"api",previous:{title:"scan",permalink:"/docs/scan"},next:{title:"split",permalink:"/docs/split"}},a={},o=[{value:"slice() function",id:"slice-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"slice-function",children:"slice() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns Iterable/AsyncIterable of the given elements from startIndex(inclusive) to endIndex(exclusive)."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function slice(start: number, iterable: Iterable): IterableIterator;\n\ndeclare function slice(start: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function slice(start: number, end: number, iterable: Iterable): IterableIterator;\n\ndeclare function slice(start: number, end: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function slice | AsyncIterable>(start: number): (iterable: A) => ReturnIterableIteratorType;\n\ndeclare function slice | AsyncIterable>(start: number, end: number): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter1 = slice(1, 3, ['a', 'b', 'c', 'd', 'e']);\r\niter1.next(); // {value: 'b', done: false};\r\niter1.next(); // {value: 'c', done: false};\r\niter1.next(); // {value: undefined, done: true};\r\n\r\nconst iter2 = slice(3, ['a', 'b', 'c', 'd', 'e']);\r\niter2.next(); // {value: 'd', done: false};\r\niter2.next(); // {value: 'e', done: false};\r\niter2.next(); // {value: undefined, done: true};\r\n\r\nconst iter3 = slice(3, \"abcde\");\r\niter3.next(); // {value: 'd', done: false};\r\niter3.next(); // {value: 'e', done: false};\r\niter3.next(); // {value: undefined, done: true};\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n slice(3),\r\n toArray,\r\n); // [4, 5]\r\n\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n slice(1, 3),\r\n toArray,\r\n); // [2, 3]\n"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>l,x:()=>c});var r=t(6540);const s={},i=r.createContext(s);function l(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3289],{7264:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>o});var r=t(4848),s=t(8453);const i={id:"slice"},c=void 0,l={id:"slice",title:"slice",description:"slice() function",source:"@site/docs/slice.md",sourceDirName:".",slug:"/slice",permalink:"/docs/slice",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"slice"},sidebar:"api",previous:{title:"scan",permalink:"/docs/scan"},next:{title:"split",permalink:"/docs/split"}},a={},o=[{value:"slice() function",id:"slice-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"slice-function",children:"slice() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns Iterable/AsyncIterable of the given elements from startIndex(inclusive) to endIndex(exclusive)."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function slice(start: number, iterable: Iterable): IterableIterator;\n\ndeclare function slice(start: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function slice(start: number, end: number, iterable: Iterable): IterableIterator;\n\ndeclare function slice(start: number, end: number, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function slice | AsyncIterable>(start: number): (iterable: A) => ReturnIterableIteratorType;\n\ndeclare function slice | AsyncIterable>(start: number, end: number): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter1 = slice(1, 3, ['a', 'b', 'c', 'd', 'e']);\r\niter1.next(); // {value: 'b', done: false};\r\niter1.next(); // {value: 'c', done: false};\r\niter1.next(); // {value: undefined, done: true};\r\n\r\nconst iter2 = slice(3, ['a', 'b', 'c', 'd', 'e']);\r\niter2.next(); // {value: 'd', done: false};\r\niter2.next(); // {value: 'e', done: false};\r\niter2.next(); // {value: undefined, done: true};\r\n\r\nconst iter3 = slice(3, \"abcde\");\r\niter3.next(); // {value: 'd', done: false};\r\niter3.next(); // {value: 'e', done: false};\r\niter3.next(); // {value: undefined, done: true};\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n slice(3),\r\n toArray,\r\n); // [4, 5]\r\n\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n slice(1, 3),\r\n toArray,\r\n); // [2, 3]\n"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/slice.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>l});var r=t(6540);const s={},i=r.createContext(s);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/df6c63a4.d5d5445c.js b/assets/js/df6c63a4.54ca4f7a.js similarity index 78% rename from assets/js/df6c63a4.d5d5445c.js rename to assets/js/df6c63a4.54ca4f7a.js index 019c37e9..94e8b0e4 100644 --- a/assets/js/df6c63a4.d5d5445c.js +++ b/assets/js/df6c63a4.54ca4f7a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5562],{3721:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>l,frontMatter:()=>s,metadata:()=>a,toc:()=>d});var r=t(4848),o=t(8453);const s={id:"omit"},i=void 0,a={id:"omit",title:"omit",description:"omit() function",source:"@site/docs/omit.md",sourceDirName:".",slug:"/omit",permalink:"/docs/omit",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"omit"},sidebar:"api",previous:{title:"nth",permalink:"/docs/nth"},next:{title:"omitBy",permalink:"/docs/omitBy"}},c={},d=[{value:"omit() function",id:"omit-function",level:2},{value:"Example",id:"example",level:2}];function m(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"omit-function",children:"omit() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns a partial copy of an object omitting the keys specified."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function omit>(iterable: U, obj: T): Omit>;\n\ndeclare function omit>(iterable: U): (obj: T) => Omit>;\n\ndeclare function omit>(iterable: U, obj: T): Promise>>;\n\ndeclare function omit>(iterable: U): (obj: T) => Promise>>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'const person = {\r\n name: "james",\r\n age: 40,\r\n numberOfKids: 2,\r\n team: "Software Development",\r\n preferredLanguage: "Rust",\r\n};\r\n\r\nconst dad = omit(["team", "preferredLanguage"], person);\r\n// { name: "james", age: 40, numberOfKids: 2 }\r\n\r\nconst developer = omit(["age", "numberOfKids"], person);\r\n// { name: "james", team: "Software Development", preferredLanguage: "Rust" }\r\n\r\n// with pipe\r\npipe(\r\n person,\r\n omit(["team", "preferredLanguage"]),\r\n);\r\n\r\n// if you want to use AsyncIterable as the list of property names\r\nconst anonymous = await omit(toAsync(["name"] as const), person);\n'})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pick",children:"pick"}),","]})]})}function l(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(m,{...e})}):m(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var r=t(6540);const o={},s=r.createContext(o);function i(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5562],{3721:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>l,frontMatter:()=>s,metadata:()=>a,toc:()=>d});var r=t(4848),o=t(8453);const s={id:"omit"},i=void 0,a={id:"omit",title:"omit",description:"omit() function",source:"@site/docs/omit.md",sourceDirName:".",slug:"/omit",permalink:"/docs/omit",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"omit"},sidebar:"api",previous:{title:"nth",permalink:"/docs/nth"},next:{title:"omitBy",permalink:"/docs/omitBy"}},c={},d=[{value:"omit() function",id:"omit-function",level:2},{value:"Example",id:"example",level:2}];function m(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"omit-function",children:"omit() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns a partial copy of an object omitting the keys specified."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function omit>(iterable: U, obj: T): Omit>;\n\ndeclare function omit>(iterable: U): (obj: T) => Omit>;\n\ndeclare function omit>(iterable: U, obj: T): Promise>>;\n\ndeclare function omit>(iterable: U): (obj: T) => Promise>>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'const person = {\r\n name: "james",\r\n age: 40,\r\n numberOfKids: 2,\r\n team: "Software Development",\r\n preferredLanguage: "Rust",\r\n};\r\n\r\nconst dad = omit(["team", "preferredLanguage"], person);\r\n// { name: "james", age: 40, numberOfKids: 2 }\r\n\r\nconst developer = omit(["age", "numberOfKids"], person);\r\n// { name: "james", team: "Software Development", preferredLanguage: "Rust" }\r\n\r\n// with pipe\r\npipe(\r\n person,\r\n omit(["team", "preferredLanguage"]),\r\n);\r\n\r\n// if you want to use AsyncIterable as the list of property names\r\nconst anonymous = await omit(toAsync(["name"] as const), person);\n'})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pick",children:"pick"}),","]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/omit.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(m,{...e})}):m(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var r=t(6540);const o={},s=r.createContext(o);function i(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/df8ead47.d9a4cf08.js b/assets/js/df8ead47.4963ac37.js similarity index 64% rename from assets/js/df8ead47.d9a4cf08.js rename to assets/js/df8ead47.4963ac37.js index 955acb12..a5d2f062 100644 --- a/assets/js/df8ead47.d9a4cf08.js +++ b/assets/js/df8ead47.4963ac37.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8244],{5745:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>o,default:()=>p,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=t(4848),s=t(8453);const i={id:"juxt"},o=void 0,c={id:"juxt",title:"juxt",description:"juxt() function",source:"@site/docs/juxt.md",sourceDirName:".",slug:"/juxt",permalink:"/docs/juxt",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"juxt"},sidebar:"api",previous:{title:"join",permalink:"/docs/join"},next:{title:"last",permalink:"/docs/last"}},a={},u=[{value:"juxt() function",id:"juxt-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"juxt-function",children:"juxt() function"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"juxt"})," applies a list of functions to a list of values."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function juxt>(fs: readonly [...FS]): (...args: JuxtArgs) => JuxtReturnTypes;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'const range = juxt([Math.min, Math.max])(1, 2, 3, 4); // [1, 4]\r\n\r\n// with pipe\r\nconst entries = (obj: { a: number; b: number }) =>\r\n pipe(\r\n [Object.keys, Object.values] as const,\r\n juxt,\r\n (f) => f(obj),\r\n apply(zip),\r\n toArray,\r\n );\r\n\r\nentries({ a: 1, b: 2 }); // [ ["a", 1], ["b", 2] ]\n'})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/apply",children:"apply"})]})]})}function p(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>c});var r=t(6540);const s={},i=r.createContext(s);function o(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8244],{5745:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>o,toc:()=>u});var r=t(4848),s=t(8453);const i={id:"juxt"},c=void 0,o={id:"juxt",title:"juxt",description:"juxt() function",source:"@site/docs/juxt.md",sourceDirName:".",slug:"/juxt",permalink:"/docs/juxt",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"juxt"},sidebar:"api",previous:{title:"join",permalink:"/docs/join"},next:{title:"last",permalink:"/docs/last"}},a={},u=[{value:"juxt() function",id:"juxt-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"juxt-function",children:"juxt() function"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"juxt"})," applies a list of functions to a list of values."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function juxt>(fs: readonly [...FS]): (...args: JuxtArgs) => JuxtReturnTypes;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:'const range = juxt([Math.min, Math.max])(1, 2, 3, 4); // [1, 4]\r\n\r\n// with pipe\r\nconst entries = (obj: { a: number; b: number }) =>\r\n pipe(\r\n [Object.keys, Object.values] as const,\r\n juxt,\r\n (f) => f(obj),\r\n apply(zip),\r\n toArray,\r\n );\r\n\r\nentries({ a: 1, b: 2 }); // [ ["a", 1], ["b", 2] ]\n'})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/apply",children:"apply"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/juxt.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>o});var r=t(6540);const s={},i=r.createContext(s);function c(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:c(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e1a677fb.bb59eb17.js b/assets/js/e1a677fb.bb59eb17.js new file mode 100644 index 00000000..cbd5c2df --- /dev/null +++ b/assets/js/e1a677fb.bb59eb17.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8594],{800:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>s});var c=t(4848),r=t(8453);const l={id:"cycle"},a=void 0,i={id:"cycle",title:"cycle",description:"cycle() function",source:"@site/docs/cycle.md",sourceDirName:".",slug:"/cycle",permalink:"/docs/cycle",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"cycle"},sidebar:"api",previous:{title:"concurrent",permalink:"/docs/concurrent"},next:{title:"drop",permalink:"/docs/drop"}},o={},s=[{value:"cycle() function",id:"cycle-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h2,{id:"cycle-function",children:"cycle() function"}),"\n",(0,c.jsx)(n.p,{children:"Returns Iterable/AsyncIterable that infinitely repeats the given Iterable/AsyncIterable"}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-typescript",children:"declare function cycle | AsyncIterable>(iter: A): ReturnIterableIteratorType;\n"})}),"\n",(0,c.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:'const iter = cycle("abc")\r\niter.next(); // {value:"a", done: false}\r\niter.next(); // {value:"b", done: false}\r\niter.next(); // {value:"c", done: false}\r\niter.next(); // {value:"a", done: false}\r\niter.next(); // {value:"b", done: false}\r\n\r\n// with pipe\r\npipe(\r\n cycle([1,2,3,4]),\r\n take(5),\r\n toArray,\r\n); // [1,2,3,4,1]\n'})}),"\n",(0,c.jsx)(n.p,{children:(0,c.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/cycle.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>i});var c=t(6540);const r={},l=c.createContext(r);function a(e){const n=c.useContext(l);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:a(e.components),c.createElement(l.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e1a677fb.fa2f20f3.js b/assets/js/e1a677fb.fa2f20f3.js deleted file mode 100644 index 6b952995..00000000 --- a/assets/js/e1a677fb.fa2f20f3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8594],{800:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>a});var c=t(4848),r=t(8453);const l={id:"cycle"},i=void 0,o={id:"cycle",title:"cycle",description:"cycle() function",source:"@site/docs/cycle.md",sourceDirName:".",slug:"/cycle",permalink:"/docs/cycle",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"cycle"},sidebar:"api",previous:{title:"concurrent",permalink:"/docs/concurrent"},next:{title:"drop",permalink:"/docs/drop"}},s={},a=[{value:"cycle() function",id:"cycle-function",level:2},{value:"Example",id:"example",level:2}];function u(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h2,{id:"cycle-function",children:"cycle() function"}),"\n",(0,c.jsx)(n.p,{children:"Returns Iterable/AsyncIterable that infinitely repeats the given Iterable/AsyncIterable"}),"\n",(0,c.jsx)("b",{children:"Signature:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-typescript",children:"declare function cycle | AsyncIterable>(iter: A): ReturnIterableIteratorType;\n"})}),"\n",(0,c.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{className:"language-ts",children:'const iter = cycle("abc")\r\niter.next(); // {value:"a", done: false}\r\niter.next(); // {value:"b", done: false}\r\niter.next(); // {value:"c", done: false}\r\niter.next(); // {value:"a", done: false}\r\niter.next(); // {value:"b", done: false}\r\n\r\n// with pipe\r\npipe(\r\n cycle([1,2,3,4]),\r\n take(5),\r\n toArray,\r\n); // [1,2,3,4,1]\n'})})]})}function d(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(u,{...e})}):u(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>o});var c=t(6540);const r={},l=c.createContext(r);function i(e){const n=c.useContext(l);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),c.createElement(l.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e240fc47.38bcd155.js b/assets/js/e240fc47.38bcd155.js new file mode 100644 index 00000000..b95c6549 --- /dev/null +++ b/assets/js/e240fc47.38bcd155.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3724],{4237:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>o,default:()=>m,frontMatter:()=>c,metadata:()=>i,toc:()=>a});var s=t(4848),r=t(8453);const c={id:"sum"},o=void 0,i={id:"sum",title:"sum",description:"sum() function",source:"@site/docs/sum.md",sourceDirName:".",slug:"/sum",permalink:"/docs/sum",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"sum"},sidebar:"api",previous:{title:"sortBy",permalink:"/docs/sortBy"},next:{title:"tap",permalink:"/docs/tap"}},u={},a=[{value:"sum() function",id:"sum-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"sum-function",children:"sum() function"}),"\n",(0,s.jsx)(n.p,{children:"Adds all the elements of a Iterable/AsyncIterable."}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function sum | AsyncIterable>(iterable: A): A extends Iterable ? number : A extends AsyncIterable ? Promise : never;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"sum([]); // 0\r\nsum([1, 2, 3, 4]); // 10\r\nawait sum(toAsync([1, 2, 3, 4])); // 10\n"})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/sum.ts",children:"Open Source Code"})})]})}function m(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},c=s.createContext(r);function o(e){const n=s.useContext(c);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e240fc47.e06f3cff.js b/assets/js/e240fc47.e06f3cff.js deleted file mode 100644 index 3f2d726c..00000000 --- a/assets/js/e240fc47.e06f3cff.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3724],{4237:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>m,frontMatter:()=>c,metadata:()=>u,toc:()=>a});var s=t(4848),r=t(8453);const c={id:"sum"},o=void 0,u={id:"sum",title:"sum",description:"sum() function",source:"@site/docs/sum.md",sourceDirName:".",slug:"/sum",permalink:"/docs/sum",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"sum"},sidebar:"api",previous:{title:"sortBy",permalink:"/docs/sortBy"},next:{title:"tap",permalink:"/docs/tap"}},i={},a=[{value:"sum() function",id:"sum-function",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"sum-function",children:"sum() function"}),"\n",(0,s.jsx)(n.p,{children:"Adds all the elements of a Iterable/AsyncIterable."}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"declare function sum | AsyncIterable>(iterable: A): A extends Iterable ? number : A extends AsyncIterable ? Promise : never;\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"sum([]); // 0\r\nsum([1, 2, 3, 4]); // 10\r\nawait sum(toAsync([1, 2, 3, 4])); // 10\n"})})]})}function m(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>u});var s=t(6540);const r={},c=s.createContext(r);function o(e){const n=s.useContext(c);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function u(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e394e23a.3a05e979.js b/assets/js/e394e23a.3a05e979.js new file mode 100644 index 00000000..ff6fe31b --- /dev/null +++ b/assets/js/e394e23a.3a05e979.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3073],{9654:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>c,contentTitle:()=>r,default:()=>u,frontMatter:()=>t,metadata:()=>a,toc:()=>o});var s=i(4848),d=i(8453);const t={id:"isUndefined"},r=void 0,a={id:"isUndefined",title:"isUndefined",description:"isUndefined variable",source:"@site/docs/isUndefined.md",sourceDirName:".",slug:"/isUndefined",permalink:"/docs/isUndefined",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isUndefined"},sidebar:"api",previous:{title:"isString",permalink:"/docs/isString"},next:{title:"join",permalink:"/docs/join"}},c={},o=[{value:"isUndefined variable",id:"isundefined-variable",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,d.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"isundefined-variable",children:"isUndefined variable"}),"\n",(0,s.jsxs)(n.p,{children:["Checks if the given value is ",(0,s.jsx)(n.code,{children:"undefined"}),"."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"isUndefined: (a: T) => a is Include\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"isUndefined(undefined); // true\r\nisUndefined(2); // false\n"})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/isUndefined.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,d.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},8453:(e,n,i)=>{i.d(n,{R:()=>r,x:()=>a});var s=i(6540);const d={},t=s.createContext(d);function r(e){const n=s.useContext(t);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:r(e.components),s.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e394e23a.8b7d49eb.js b/assets/js/e394e23a.8b7d49eb.js deleted file mode 100644 index 1f8429d0..00000000 --- a/assets/js/e394e23a.8b7d49eb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3073],{9654:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>c,contentTitle:()=>r,default:()=>u,frontMatter:()=>t,metadata:()=>a,toc:()=>o});var s=i(4848),d=i(8453);const t={id:"isUndefined"},r=void 0,a={id:"isUndefined",title:"isUndefined",description:"isUndefined variable",source:"@site/docs/isUndefined.md",sourceDirName:".",slug:"/isUndefined",permalink:"/docs/isUndefined",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"isUndefined"},sidebar:"api",previous:{title:"isString",permalink:"/docs/isString"},next:{title:"join",permalink:"/docs/join"}},c={},o=[{value:"isUndefined variable",id:"isundefined-variable",level:2},{value:"Example",id:"example",level:2}];function l(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,d.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"isundefined-variable",children:"isUndefined variable"}),"\n",(0,s.jsxs)(n.p,{children:["Checks if the given value is ",(0,s.jsx)(n.code,{children:"undefined"}),"."]}),"\n",(0,s.jsx)("b",{children:"Signature:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-typescript",children:"isUndefined: (a: T) => a is Include\n"})}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-ts",children:"isUndefined(undefined); // true\r\nisUndefined(2); // false\n"})})]})}function u(e={}){const{wrapper:n}={...(0,d.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},8453:(e,n,i)=>{i.d(n,{R:()=>r,x:()=>a});var s=i(6540);const d={},t=s.createContext(d);function r(e){const n=s.useContext(t);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:r(e.components),s.createElement(t.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e495ac88.241fdfdd.js b/assets/js/e495ac88.241fdfdd.js deleted file mode 100644 index 9f642a80..00000000 --- a/assets/js/e495ac88.241fdfdd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7214],{7501:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>l,frontMatter:()=>p,metadata:()=>c,toc:()=>a});var o=r(4848),t=r(8453);const p={id:"prop"},s=void 0,c={id:"prop",title:"prop",description:"prop() function",source:"@site/docs/prop.md",sourceDirName:".",slug:"/prop",permalink:"/docs/prop",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"prop"},sidebar:"api",previous:{title:"pipe",permalink:"/docs/pipe"},next:{title:"props",permalink:"/docs/props"}},i={},a=[{value:"prop() function",id:"prop-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"prop-function",children:"prop() function"}),"\n",(0,o.jsx)(n.p,{children:"Get the value of a property from an object, or return undefined if the property does not exist on the object."}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function prop(key: K, obj: T): Prop;\n\ndeclare function prop(key: K): (obj: T) => Prop;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:'// get the `name` property from an object\r\nconst person = { name: "John", age: 30 };\r\nconst name = prop("name", person); // "John"\r\n\r\n// with pipe\r\npipe(\r\n person,\r\n prop("name"),\r\n);\r\n\r\n// get the `address` property from an object that may be null or undefined\r\nconst maybePerson = null;\r\nconst address = prop("address", maybePerson); // undefined\n'})})]})}function l(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>c});var o=r(6540);const t={},p=o.createContext(t);function s(e){const n=o.useContext(p);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),o.createElement(p.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e495ac88.ac258f66.js b/assets/js/e495ac88.ac258f66.js new file mode 100644 index 00000000..8af47597 --- /dev/null +++ b/assets/js/e495ac88.ac258f66.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7214],{7501:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>l,frontMatter:()=>p,metadata:()=>c,toc:()=>a});var o=r(4848),t=r(8453);const p={id:"prop"},s=void 0,c={id:"prop",title:"prop",description:"prop() function",source:"@site/docs/prop.md",sourceDirName:".",slug:"/prop",permalink:"/docs/prop",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"prop"},sidebar:"api",previous:{title:"pipe",permalink:"/docs/pipe"},next:{title:"props",permalink:"/docs/props"}},i={},a=[{value:"prop() function",id:"prop-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,t.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h2,{id:"prop-function",children:"prop() function"}),"\n",(0,o.jsx)(n.p,{children:"Get the value of a property from an object, or return undefined if the property does not exist on the object."}),"\n",(0,o.jsx)("b",{children:"Signature:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-typescript",children:"declare function prop(key: K, obj: T): Prop;\n\ndeclare function prop(key: K): (obj: T) => Prop;\n"})}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-ts",children:'// get the `name` property from an object\r\nconst person = { name: "John", age: 30 };\r\nconst name = prop("name", person); // "John"\r\n\r\n// with pipe\r\npipe(\r\n person,\r\n prop("name"),\r\n);\r\n\r\n// get the `address` property from an object that may be null or undefined\r\nconst maybePerson = null;\r\nconst address = prop("address", maybePerson); // undefined\n'})}),"\n",(0,o.jsx)(n.p,{children:(0,o.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/prop.ts",children:"Open Source Code"})})]})}function l(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>c});var o=r(6540);const t={},p=o.createContext(t);function s(e){const n=o.useContext(p);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),o.createElement(p.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e7c93931.45806d3a.js b/assets/js/e7c93931.45806d3a.js deleted file mode 100644 index 1fc108e1..00000000 --- a/assets/js/e7c93931.45806d3a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6723],{8445:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=t(4848),o=t(8453);const s={id:"sortBy"},a=void 0,i={id:"sortBy",title:"sortBy",description:"sortBy() function",source:"@site/docs/sortBy.md",sourceDirName:".",slug:"/sortBy",permalink:"/docs/sortBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"sortBy"},sidebar:"api",previous:{title:"sort",permalink:"/docs/sort"},next:{title:"sum",permalink:"/docs/sum"}},c={},l=[{value:"sortBy() function",id:"sortby-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"sortby-function",children:"sortBy() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns an array which sorted according to the ",(0,r.jsx)(n.code,{children:"f"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function sortBy(f: (a: T) => unknown, iterable: Iterable): T[];\n\ndeclare function sortBy(f: (a: any) => unknown, iterable: readonly []): any[];\n\ndeclare function sortBy(f: (a: T) => unknown, iterable: AsyncIterable): Promise;\n\ndeclare function sortBy | AsyncIterable>(f: (a: IterableInfer) => unknown): (iterable: T) => ReturnValueType[]>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"sortBy(a => a, [3, 4, 1, 2, 5, 2]);\r\n// [1, 2, 2, 3, 4, 5]\r\nsortBy((a) => a.id, [{id:4,name:'foo'}, {id:2,name:'bar'},{id:3, name:'lee'}]);\r\n// [{id:2,name:'bar'}, {id:3, name:'lee'}, {id:4,name:'foo'}]\n"})})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>i});var r=t(6540);const o={},s=r.createContext(o);function a(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e7c93931.6c61f1c4.js b/assets/js/e7c93931.6c61f1c4.js new file mode 100644 index 00000000..e2ed8d41 --- /dev/null +++ b/assets/js/e7c93931.6c61f1c4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6723],{8445:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=t(4848),o=t(8453);const s={id:"sortBy"},a=void 0,i={id:"sortBy",title:"sortBy",description:"sortBy() function",source:"@site/docs/sortBy.md",sourceDirName:".",slug:"/sortBy",permalink:"/docs/sortBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"sortBy"},sidebar:"api",previous:{title:"sort",permalink:"/docs/sort"},next:{title:"sum",permalink:"/docs/sum"}},c={},l=[{value:"sortBy() function",id:"sortby-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"sortby-function",children:"sortBy() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns an array which sorted according to the ",(0,r.jsx)(n.code,{children:"f"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function sortBy(f: (a: T) => unknown, iterable: Iterable): T[];\n\ndeclare function sortBy(f: (a: any) => unknown, iterable: readonly []): any[];\n\ndeclare function sortBy(f: (a: T) => unknown, iterable: AsyncIterable): Promise;\n\ndeclare function sortBy | AsyncIterable>(f: (a: IterableInfer) => unknown): (iterable: T) => ReturnValueType[]>;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"sortBy(a => a, [3, 4, 1, 2, 5, 2]);\r\n// [1, 2, 2, 3, 4, 5]\r\nsortBy((a) => a.id, [{id:4,name:'foo'}, {id:2,name:'bar'},{id:3, name:'lee'}]);\r\n// [{id:2,name:'bar'}, {id:3, name:'lee'}, {id:4,name:'foo'}]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/sortBy.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>i});var r=t(6540);const o={},s=r.createContext(o);function a(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/eba555e9.44f43222.js b/assets/js/eba555e9.b1a219a1.js similarity index 77% rename from assets/js/eba555e9.44f43222.js rename to assets/js/eba555e9.b1a219a1.js index f2255fcc..b6074d90 100644 --- a/assets/js/eba555e9.44f43222.js +++ b/assets/js/eba555e9.b1a219a1.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[712],{300:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>l});var t=n(4848),s=n(8453);const a={id:"reverse"},i=void 0,o={id:"reverse",title:"reverse",description:"reverse() function",source:"@site/docs/reverse.md",sourceDirName:".",slug:"/reverse",permalink:"/docs/reverse",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"reverse"},sidebar:"api",previous:{title:"repeat",permalink:"/docs/repeat"},next:{title:"scan",permalink:"/docs/scan"}},c={},l=[{value:"reverse() function",id:"reverse-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h2,{id:"reverse-function",children:"reverse() function"}),"\n",(0,t.jsxs)(r.p,{children:["Returns Iterable/AsyncIterable of the given elements in reverse order. Note",":Evaluates"," all Iterable, except for array, and returns a lazy-reversed iterator."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"declare function reverse | AsyncIterable>(iterable: T): ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:'const iter1 = reverse([1, 2, 3]);\r\niter1.next(); // {value: 3, done: false}\r\niter1.next(); // {value: 2, done: false}\r\niter1.next(); // {value: 1, done: false}\r\niter1.next(); // {value: undefined, done: true}\r\n\r\nconst iter2 = reverse("abc");\r\niter2.next(); // {value: "c", done: false}\r\niter2.next(); // {value: "b", done: false}\r\niter2.next(); // {value: "a", done: false}\r\niter2.next(); // {value: undefined, done: true}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n reverse,\r\n toArray,\r\n); // [5, 4, 3, 2, 1]\r\n\r\npipe(\r\n "abcde",\r\n reverse,\r\n toArray,\r\n); // "edcba"\n'})}),"\n",(0,t.jsxs)(r.p,{children:["see ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"})," ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function u(e={}){const{wrapper:r}={...(0,s.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>i,x:()=>o});var t=n(6540);const s={},a=t.createContext(s);function i(e){const r=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function o(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),t.createElement(a.Provider,{value:r},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[712],{300:(e,r,n)=>{n.r(r),n.d(r,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>l});var t=n(4848),s=n(8453);const a={id:"reverse"},i=void 0,o={id:"reverse",title:"reverse",description:"reverse() function",source:"@site/docs/reverse.md",sourceDirName:".",slug:"/reverse",permalink:"/docs/reverse",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"reverse"},sidebar:"api",previous:{title:"repeat",permalink:"/docs/repeat"},next:{title:"scan",permalink:"/docs/scan"}},c={},l=[{value:"reverse() function",id:"reverse-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const r={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.h2,{id:"reverse-function",children:"reverse() function"}),"\n",(0,t.jsxs)(r.p,{children:["Returns Iterable/AsyncIterable of the given elements in reverse order. Note",":Evaluates"," all Iterable, except for array, and returns a lazy-reversed iterator."]}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-typescript",children:"declare function reverse | AsyncIterable>(iterable: T): ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(r.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(r.pre,{children:(0,t.jsx)(r.code,{className:"language-ts",children:'const iter1 = reverse([1, 2, 3]);\r\niter1.next(); // {value: 3, done: false}\r\niter1.next(); // {value: 2, done: false}\r\niter1.next(); // {value: 1, done: false}\r\niter1.next(); // {value: undefined, done: true}\r\n\r\nconst iter2 = reverse("abc");\r\niter2.next(); // {value: "c", done: false}\r\niter2.next(); // {value: "b", done: false}\r\niter2.next(); // {value: "a", done: false}\r\niter2.next(); // {value: undefined, done: true}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5],\r\n reverse,\r\n toArray,\r\n); // [5, 4, 3, 2, 1]\r\n\r\npipe(\r\n "abcde",\r\n reverse,\r\n toArray,\r\n); // "edcba"\n'})}),"\n",(0,t.jsxs)(r.p,{children:["see ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"})," ",(0,t.jsx)(r.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(r.p,{children:(0,t.jsx)(r.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/reverse.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:r}={...(0,s.R)(),...e.components};return r?(0,t.jsx)(r,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,r,n)=>{n.d(r,{R:()=>i,x:()=>o});var t=n(6540);const s={},a=t.createContext(s);function i(e){const r=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(r):{...r,...e}}),[r,e])}function o(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),t.createElement(a.Provider,{value:r},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ec6f8993.04e92de9.js b/assets/js/ec6f8993.04e92de9.js new file mode 100644 index 00000000..946ab142 --- /dev/null +++ b/assets/js/ec6f8993.04e92de9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6270],{5562:(r,e,t)=>{t.r(e),t.d(e,{assets:()=>c,contentTitle:()=>s,default:()=>d,frontMatter:()=>i,metadata:()=>a,toc:()=>l});var n=t(4848),o=t(8453);const i={id:"throwError"},s=void 0,a={id:"throwError",title:"throwError",description:"throwError variable",source:"@site/docs/throwError.md",sourceDirName:".",slug:"/throwError",permalink:"/docs/throwError",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"throwError"},sidebar:"api",previous:{title:"tap",permalink:"/docs/tap"},next:{title:"throwIf",permalink:"/docs/throwIf"}},c={},l=[{value:"throwError variable",id:"throwerror-variable",level:2},{value:"Example",id:"example",level:2}];function p(r){const e={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...r.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e.h2,{id:"throwerror-variable",children:"throwError variable"}),"\n",(0,n.jsxs)(e.p,{children:["throw result of ",(0,n.jsx)(e.code,{children:"toError"})]}),"\n",(0,n.jsx)("b",{children:"Signature:"}),"\n",(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:"language-typescript",children:"throwError: (toError: (input: T) => E) => (input: T) => never\n"})}),"\n",(0,n.jsx)(e.h2,{id:"example",children:"Example"}),"\n",(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:"language-ts",children:"const result: never = pipe(\r\n 0,\r\n\r\n throwError((input) => Error(`input is ${input}`)),\r\n\r\n (input: never) => {\r\n // unreachable point\r\n },\r\n);\n"})}),"\n",(0,n.jsx)(e.p,{children:(0,n.jsx)(e.a,{href:"https://github.com/marpple/FxTS/blob/main/src/throwError.ts",children:"Open Source Code"})})]})}function d(r={}){const{wrapper:e}={...(0,o.R)(),...r.components};return e?(0,n.jsx)(e,{...r,children:(0,n.jsx)(p,{...r})}):p(r)}},8453:(r,e,t)=>{t.d(e,{R:()=>s,x:()=>a});var n=t(6540);const o={},i=n.createContext(o);function s(r){const e=n.useContext(i);return n.useMemo((function(){return"function"==typeof r?r(e):{...e,...r}}),[e,r])}function a(r){let e;return e=r.disableParentContext?"function"==typeof r.components?r.components(o):r.components||o:s(r.components),n.createElement(i.Provider,{value:e},r.children)}}}]); \ No newline at end of file diff --git a/assets/js/ec6f8993.967974c3.js b/assets/js/ec6f8993.967974c3.js deleted file mode 100644 index 09e54dff..00000000 --- a/assets/js/ec6f8993.967974c3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6270],{5562:(r,e,t)=>{t.r(e),t.d(e,{assets:()=>c,contentTitle:()=>s,default:()=>d,frontMatter:()=>i,metadata:()=>a,toc:()=>l});var n=t(4848),o=t(8453);const i={id:"throwError"},s=void 0,a={id:"throwError",title:"throwError",description:"throwError variable",source:"@site/docs/throwError.md",sourceDirName:".",slug:"/throwError",permalink:"/docs/throwError",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"throwError"},sidebar:"api",previous:{title:"tap",permalink:"/docs/tap"},next:{title:"throwIf",permalink:"/docs/throwIf"}},c={},l=[{value:"throwError variable",id:"throwerror-variable",level:2},{value:"Example",id:"example",level:2}];function p(r){const e={code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...r.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e.h2,{id:"throwerror-variable",children:"throwError variable"}),"\n",(0,n.jsxs)(e.p,{children:["throw result of ",(0,n.jsx)(e.code,{children:"toError"})]}),"\n",(0,n.jsx)("b",{children:"Signature:"}),"\n",(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:"language-typescript",children:"throwError: (toError: (input: T) => E) => (input: T) => never\n"})}),"\n",(0,n.jsx)(e.h2,{id:"example",children:"Example"}),"\n",(0,n.jsx)(e.pre,{children:(0,n.jsx)(e.code,{className:"language-ts",children:"const result: never = pipe(\r\n 0,\r\n\r\n throwError((input) => Error(`input is ${input}`)),\r\n\r\n (input: never) => {\r\n // unreachable point\r\n },\r\n);\n"})})]})}function d(r={}){const{wrapper:e}={...(0,o.R)(),...r.components};return e?(0,n.jsx)(e,{...r,children:(0,n.jsx)(p,{...r})}):p(r)}},8453:(r,e,t)=>{t.d(e,{R:()=>s,x:()=>a});var n=t(6540);const o={},i=n.createContext(o);function s(r){const e=n.useContext(i);return n.useMemo((function(){return"function"==typeof r?r(e):{...e,...r}}),[e,r])}function a(r){let e;return e=r.disableParentContext?"function"==typeof r.components?r.components(o):r.components||o:s(r.components),n.createElement(i.Provider,{value:e},r.children)}}}]); \ No newline at end of file diff --git a/assets/js/f56215be.9a62399a.js b/assets/js/f56215be.ca139be3.js similarity index 79% rename from assets/js/f56215be.9a62399a.js rename to assets/js/f56215be.ca139be3.js index 7ef7585c..2646bba8 100644 --- a/assets/js/f56215be.9a62399a.js +++ b/assets/js/f56215be.ca139be3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[129],{1860:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>a,toc:()=>l});var r=t(4848),c=t(8453);const o={id:"concat"},s=void 0,a={id:"concat",title:"concat",description:"concat() function",source:"@site/docs/concat.md",sourceDirName:".",slug:"/concat",permalink:"/docs/concat",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"concat"},sidebar:"api",previous:{title:"compress",permalink:"/docs/compress"},next:{title:"concurrent",permalink:"/docs/concurrent"}},i={},l=[{value:"concat() function",id:"concat-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"concat-function",children:"concat() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns the result of concatenating the given iterable."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function concat | AsyncIterable, B extends Iterable | AsyncIterable>(iterable1: A, iterable2: B): ReturnConcatType;\n\ndeclare function concat | AsyncIterable, B extends Iterable | AsyncIterable>(iterable1: A): (iterable2: B) => ReturnConcatType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = concat([1, 2], [3, 4]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:false, value: 4}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [3, 4],\r\n concat([1, 2]),\r\n toArray,\r\n); // [1, 2, 3, 4]\r\n\r\nawait pipe(\r\n Promise.resolve([3, 4]),\r\n concat([1, 2]),\r\n toArray,\r\n); // [1, 2, 3, 4]\r\n\r\n await pipe(\r\n [Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n concat([1, 2]),\r\n toArray,\r\n); // [1, 2, 3, 4]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-concat-mhd7d",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function u(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var r=t(6540);const c={},o=r.createContext(c);function s(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[129],{1860:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>a,toc:()=>l});var r=t(4848),c=t(8453);const o={id:"concat"},s=void 0,a={id:"concat",title:"concat",description:"concat() function",source:"@site/docs/concat.md",sourceDirName:".",slug:"/concat",permalink:"/docs/concat",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"concat"},sidebar:"api",previous:{title:"compress",permalink:"/docs/compress"},next:{title:"concurrent",permalink:"/docs/concurrent"}},i={},l=[{value:"concat() function",id:"concat-function",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"concat-function",children:"concat() function"}),"\n",(0,r.jsx)(n.p,{children:"Returns the result of concatenating the given iterable."}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function concat | AsyncIterable, B extends Iterable | AsyncIterable>(iterable1: A, iterable2: B): ReturnConcatType;\n\ndeclare function concat | AsyncIterable, B extends Iterable | AsyncIterable>(iterable1: A): (iterable2: B) => ReturnConcatType;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = concat([1, 2], [3, 4]);\r\niter.next() // {done:false, value: 1}\r\niter.next() // {done:false, value: 2}\r\niter.next() // {done:false, value: 3}\r\niter.next() // {done:false, value: 4}\r\niter.next() // {done:true, value: undefined}\r\n\r\n// with pipe\r\npipe(\r\n [3, 4],\r\n concat([1, 2]),\r\n toArray,\r\n); // [1, 2, 3, 4]\r\n\r\nawait pipe(\r\n Promise.resolve([3, 4]),\r\n concat([1, 2]),\r\n toArray,\r\n); // [1, 2, 3, 4]\r\n\r\n await pipe(\r\n [Promise.resolve(3), Promise.resolve(4)],\r\n toAsync,\r\n concat([1, 2]),\r\n toArray,\r\n); // [1, 2, 3, 4]\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://codesandbox.io/s/fxts-concat-mhd7d",children:"Try It"})}),"\n",(0,r.jsxs)(n.p,{children:["see ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,r.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/concat.ts",children:"Open Source Code"})})]})}function u(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var r=t(6540);const c={},o=r.createContext(c);function s(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/fc04fdc5.805ad509.js b/assets/js/fc04fdc5.4bc18d25.js similarity index 80% rename from assets/js/fc04fdc5.805ad509.js rename to assets/js/fc04fdc5.4bc18d25.js index f1a37e1f..7f047e7f 100644 --- a/assets/js/fc04fdc5.805ad509.js +++ b/assets/js/fc04fdc5.4bc18d25.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4940],{8505:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var t=r(4848),o=r(8453);const i={id:"dropUntil"},s=void 0,l={id:"dropUntil",title:"dropUntil",description:"dropUntil() function",source:"@site/docs/dropUntil.md",sourceDirName:".",slug:"/dropUntil",permalink:"/docs/dropUntil",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"dropUntil"},sidebar:"api",previous:{title:"differenceBy",permalink:"/docs/differenceBy"},next:{title:"dropWhile",permalink:"/docs/dropWhile"}},a={},d=[{value:"dropUntil() function",id:"dropuntil-function",level:2},{value:"Example",id:"example",level:2}];function c(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"dropuntil-function",children:"dropUntil() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns Iterable/AsyncIterable excluding elements dropped from the beginning. Elements are deleted until the value applied to f returns truly. (It is deleted including the first value applied as true)"}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function dropUntil(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function dropUntil(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function dropUntil | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = dropUntil((a) => a < 3, [1, 2, 3, 4, 5, 1, 2]);\r\niter.next(); // {done:false, value: 3}\r\niter.next(); // {done:false, value: 4}\r\niter.next(); // {done:false, value: 5}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5, 1, 2],\r\n dropUntil((a) => a > 3),\r\n toArray,\r\n); // [5, 1, 2]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 1, 2]),\r\n dropUntil((a) => a > 3),\r\n toArray,\r\n); // [5, 1, 2]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 1, 2]),\r\n toAsync,\r\n dropUntil(async (a) => a > 3),\r\n toArray,\r\n); // [5, 1, 2]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4),\r\nPromise.resolve(5), Promise.resolve(1), Promise.resolve(2)],\r\n toAsync,\r\n dropUntil((a) => a > 3),\r\n toArray,\r\n); // [5, 1, 2]\n"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>l});var t=r(6540);const o={},i=t.createContext(o);function s(e){const n=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4940],{8505:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var t=r(4848),o=r(8453);const i={id:"dropUntil"},s=void 0,l={id:"dropUntil",title:"dropUntil",description:"dropUntil() function",source:"@site/docs/dropUntil.md",sourceDirName:".",slug:"/dropUntil",permalink:"/docs/dropUntil",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"dropUntil"},sidebar:"api",previous:{title:"differenceBy",permalink:"/docs/differenceBy"},next:{title:"dropWhile",permalink:"/docs/dropWhile"}},a={},d=[{value:"dropUntil() function",id:"dropuntil-function",level:2},{value:"Example",id:"example",level:2}];function c(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"dropuntil-function",children:"dropUntil() function"}),"\n",(0,t.jsx)(n.p,{children:"Returns Iterable/AsyncIterable excluding elements dropped from the beginning. Elements are deleted until the value applied to f returns truly. (It is deleted including the first value applied as true)"}),"\n",(0,t.jsx)("b",{children:"Signature:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-typescript",children:"declare function dropUntil(f: (a: A) => B, iterable: Iterable): IterableIterator;\n\ndeclare function dropUntil(f: (a: A) => B, iterable: AsyncIterable): AsyncIterableIterator;\n\ndeclare function dropUntil | AsyncIterable, B>(f: (a: IterableInfer) => B): (iterable: A) => ReturnIterableIteratorType;\n"})}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ts",children:"const iter = dropUntil((a) => a < 3, [1, 2, 3, 4, 5, 1, 2]);\r\niter.next(); // {done:false, value: 3}\r\niter.next(); // {done:false, value: 4}\r\niter.next(); // {done:false, value: 5}\r\n\r\n// with pipe\r\npipe(\r\n [1, 2, 3, 4, 5, 1, 2],\r\n dropUntil((a) => a > 3),\r\n toArray,\r\n); // [5, 1, 2]\r\n\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 1, 2]),\r\n dropUntil((a) => a > 3),\r\n toArray,\r\n); // [5, 1, 2]\r\n\r\n// if you want to use asynchronous callback\r\nawait pipe(\r\n Promise.resolve([1, 2, 3, 4, 5, 1, 2]),\r\n toAsync,\r\n dropUntil(async (a) => a > 3),\r\n toArray,\r\n); // [5, 1, 2]\r\n\r\n// with toAsync\r\nawait pipe(\r\n [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4),\r\nPromise.resolve(5), Promise.resolve(1), Promise.resolve(2)],\r\n toAsync,\r\n dropUntil((a) => a > 3),\r\n toArray,\r\n); // [5, 1, 2]\n"})}),"\n",(0,t.jsxs)(n.p,{children:["see ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/pipe",children:"pipe"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toAsync",children:"toAsync"}),", ",(0,t.jsx)(n.a,{href:"https://fxts.dev/docs/toArray",children:"toArray"})]}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/dropUntil.ts",children:"Open Source Code"})})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>l});var t=r(6540);const o={},i=t.createContext(o);function s(e){const n=t.useContext(i);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/fc648345.3c39e1be.js b/assets/js/fc648345.3c39e1be.js deleted file mode 100644 index 6a4a9dec..00000000 --- a/assets/js/fc648345.3c39e1be.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7622],{6670:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>f,frontMatter:()=>c,metadata:()=>l,toc:()=>d});var r=t(4848),i=t(8453);const c={id:"differenceBy"},a=void 0,l={id:"differenceBy",title:"differenceBy",description:"differenceBy() function",source:"@site/docs/differenceBy.md",sourceDirName:".",slug:"/differenceBy",permalink:"/docs/differenceBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"differenceBy"},sidebar:"api",previous:{title:"difference",permalink:"/docs/difference"},next:{title:"dropUntil",permalink:"/docs/dropUntil"}},o={},d=[{value:"differenceBy() function",id:"differenceby-function",level:2},{value:"Example",id:"example",level:2}];function s(e){const n={code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"differenceby-function",children:"differenceBy() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable(i.e no duplicate) of all elements in the ",(0,r.jsx)(n.code,{children:"iterable2"})," not contained in the ",(0,r.jsx)(n.code,{children:"iterable1"}),". Duplication is determined according to the value returned by applying the supplied ",(0,r.jsx)(n.code,{children:"f"})," to ",(0,r.jsx)(n.code,{children:"iterable2"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function differenceBy(f: (a: A) => B, iterable1: Iterable, iterable2: Iterable): IterableIterator;\n\ndeclare function differenceBy(f: (a: A) => B, iterable1: AsyncIterable, iterable2: Iterable): AsyncIterableIterator;\n\ndeclare function differenceBy(f: (a: A) => B, iterable1: Iterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function differenceBy(f: (a: A) => B, iterable1: AsyncIterable, iterable2: AsyncIterable): AsyncIterableIterator;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = differenceBy(a => a.x, [{ x: 1 }, { x: 4 }], [{ x: 1 }, { x: 2 }, { x: 3 }])\r\niter.next(); // {value: {x: 2}, done: false}\r\niter.next(); // {value: {x: 3}, done: false}\r\niter.next(); // {value: undefined, done: true}\n"})})]})}function f(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>l});var r=t(6540);const i={},c=r.createContext(i);function a(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/fc648345.5b04b10b.js b/assets/js/fc648345.5b04b10b.js new file mode 100644 index 00000000..d8c21b6f --- /dev/null +++ b/assets/js/fc648345.5b04b10b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7622],{6670:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>f,frontMatter:()=>c,metadata:()=>l,toc:()=>d});var r=t(4848),i=t(8453);const c={id:"differenceBy"},a=void 0,l={id:"differenceBy",title:"differenceBy",description:"differenceBy() function",source:"@site/docs/differenceBy.md",sourceDirName:".",slug:"/differenceBy",permalink:"/docs/differenceBy",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"differenceBy"},sidebar:"api",previous:{title:"difference",permalink:"/docs/difference"},next:{title:"dropUntil",permalink:"/docs/dropUntil"}},o={},d=[{value:"differenceBy() function",id:"differenceby-function",level:2},{value:"Example",id:"example",level:2}];function s(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"differenceby-function",children:"differenceBy() function"}),"\n",(0,r.jsxs)(n.p,{children:["Returns Iterable/AsyncIterable(i.e no duplicate) of all elements in the ",(0,r.jsx)(n.code,{children:"iterable2"})," not contained in the ",(0,r.jsx)(n.code,{children:"iterable1"}),". Duplication is determined according to the value returned by applying the supplied ",(0,r.jsx)(n.code,{children:"f"})," to ",(0,r.jsx)(n.code,{children:"iterable2"}),"."]}),"\n",(0,r.jsx)("b",{children:"Signature:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"declare function differenceBy(f: (a: A) => B, iterable1: Iterable, iterable2: Iterable): IterableIterator;\n\ndeclare function differenceBy(f: (a: A) => B, iterable1: AsyncIterable, iterable2: Iterable): AsyncIterableIterator;\n\ndeclare function differenceBy(f: (a: A) => B, iterable1: Iterable, iterable2: AsyncIterable): AsyncIterableIterator;\n\ndeclare function differenceBy(f: (a: A) => B, iterable1: AsyncIterable, iterable2: AsyncIterable): AsyncIterableIterator;\n"})}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-ts",children:"const iter = differenceBy(a => a.x, [{ x: 1 }, { x: 4 }], [{ x: 1 }, { x: 2 }, { x: 3 }])\r\niter.next(); // {value: {x: 2}, done: false}\r\niter.next(); // {value: {x: 3}, done: false}\r\niter.next(); // {value: undefined, done: true}\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://github.com/marpple/FxTS/blob/main/src/Lazy/differenceBy.ts",children:"Open Source Code"})})]})}function f(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(s,{...e})}):s(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>a,x:()=>l});var r=t(6540);const i={},c=r.createContext(i);function a(e){const n=r.useContext(c);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),r.createElement(c.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.9aefc66d.js b/assets/js/runtime~main.0b240a77.js similarity index 52% rename from assets/js/runtime~main.9aefc66d.js rename to assets/js/runtime~main.0b240a77.js index 9ec4331c..9bd4c663 100644 --- a/assets/js/runtime~main.9aefc66d.js +++ b/assets/js/runtime~main.0b240a77.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,f,d,c,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var f=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(f.exports,f,f.exports,r),f.loaded=!0,f.exports}r.m=b,r.c=t,e=[],r.O=(a,f,d,c)=>{if(!f){var b=1/0;for(i=0;i=c)&&Object.keys(r.O).every((e=>r.O[e](f[o])))?f.splice(o--,1):(t=!1,c0&&e[i-1][2]>c;i--)e[i]=e[i-1];e[i]=[f,d,c]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},f=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,d){if(1&d&&(e=this(e)),8&d)return e;if("object"==typeof e&&e){if(4&d&&e.__esModule)return e;if(16&d&&"function"==typeof e.then)return e}var c=Object.create(null);r.r(c);var b={};a=a||[null,f({}),f([]),f(f)];for(var t=2&d&&e;"object"==typeof t&&!~a.indexOf(t);t=f(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,r.d(c,b),c},r.d=(e,a)=>{for(var f in a)r.o(a,f)&&!r.o(e,f)&&Object.defineProperty(e,f,{enumerable:!0,get:a[f]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,f)=>(r.f[f](e,a),a)),[])),r.u=e=>"assets/js/"+({76:"16e8e4ea",108:"0058a559",129:"f56215be",192:"d4621bd6",232:"a792ae6b",289:"1afe06e6",421:"3e2cea56",427:"41427dbd",573:"964876d0",644:"a13c8d3b",712:"eba555e9",925:"02ee0895",1028:"734f2e17",1068:"cd579993",1331:"d02cd5ce",1461:"608d5641",1554:"6612d0dd",1682:"cfe017da",1795:"1d08bea3",1828:"49e64ab8",2109:"cdfe3287",2123:"d4522a55",2138:"1a4e3797",2244:"b82dbf03",2257:"47d70d6d",2287:"210bf649",2353:"6ffcc0ea",2392:"158706f2",2626:"c2f8a836",2634:"c4f5d8e4",2748:"4e04d338",2828:"965109f3",2853:"4f64f2cc",3073:"e394e23a",3091:"bae179e2",3205:"a00302a7",3246:"69adfb8e",3289:"db45fef8",3464:"4e369fd0",3601:"50af6950",3683:"39eb40a6",3708:"969cdbf6",3724:"e240fc47",3816:"49086167",3973:"a3072847",4048:"86f5e2e4",4163:"9a026d11",4225:"5c36e323",4361:"a43d1a0b",4468:"c35f9c57",4541:"06388b3b",4630:"690cbe68",4642:"68451bba",4834:"248f8a93",4873:"a0f9174f",4940:"fc04fdc5",4993:"51b3d719",5042:"41bcc097",5085:"a444bd10",5090:"04d88e6b",5211:"1211b948",5231:"cdf7d60f",5327:"c6a029fa",5562:"df6c63a4",5610:"975fef74",5742:"c377a04b",5750:"120a4791",5921:"45b965f9",6087:"47a5dbed",6156:"16369154",6170:"a7a0251b",6244:"c1b47848",6254:"b45b40f8",6270:"ec6f8993",6297:"902de5c0",6407:"17853b1a",6451:"8cc724d7",6723:"e7c93931",6752:"ac6e9832",6758:"9c758254",7098:"a7bd4aaa",7195:"bfd2bef3",7212:"92858fbc",7214:"e495ac88",7291:"47330074",7615:"d2672ed8",7622:"fc648345",7635:"a19ef396",7690:"658db2fd",7723:"4eabdd00",7778:"81602ec0",7817:"d7cff035",7822:"47332327",7902:"19a99a72",7904:"88f603ff",7924:"d589d3a7",7959:"428581d6",8005:"9ff03b8f",8008:"60bd5769",8133:"ad6a40b0",8244:"df8ead47",8285:"7037e66f",8350:"b8471ed6",8401:"17896441",8500:"d8e1327c",8581:"935f2afb",8594:"e1a677fb",8609:"88a06dd7",8647:"d63e7be9",8712:"31ccc530",8756:"7432206e",8935:"81f1b453",9030:"92a861f2",9048:"a94703ab",9071:"d6512fd8",9103:"c74ee130",9297:"3386ce0f",9446:"264024be",9548:"8f4062da",9589:"72bb5253",9647:"5e95c892",9664:"382622a1",9667:"423df7e1",9744:"826618bd",9786:"0762c7f6",9806:"2860049b",9869:"b3f87c10"}[e]||e)+"."+{76:"3541bc5f",108:"5addc267",129:"9a62399a",192:"179e3988",232:"67e4f970",289:"1bb211d7",416:"36a683d5",421:"337d1748",427:"4d1069dc",573:"ed80321a",644:"837efaad",712:"44f43222",925:"fa6bd938",1028:"d11adcb0",1068:"e8b228c3",1331:"3f1c21ec",1461:"e243217f",1554:"a731cc1c",1682:"7b05f06c",1795:"050f02ca",1828:"dc8a29af",2109:"f9faad78",2123:"81a34697",2138:"e464e946",2237:"828f95f0",2244:"d8694c10",2257:"c41212f1",2287:"2d11665b",2353:"0642ef39",2392:"1bc950e1",2626:"d4c709e1",2634:"37a26a9a",2748:"6d9bb731",2828:"96026f61",2853:"bf2c38e2",3073:"8b7d49eb",3091:"c80359c8",3205:"136560e1",3246:"502258d0",3289:"105d8780",3464:"8efc45e7",3601:"e728c1da",3683:"02e93613",3708:"62d84f87",3724:"e06f3cff",3816:"e519f7da",3973:"82b427c1",4048:"5e205259",4163:"77235ba5",4225:"ba347f62",4361:"57f55437",4468:"e84cfe6d",4541:"75efeec7",4630:"8eb687d0",4642:"1f363e12",4696:"43aa3ccb",4834:"4588a0cc",4873:"1ddec857",4940:"805ad509",4993:"f53d478d",5042:"edf21fb0",5085:"7a41a0a9",5090:"8c612788",5211:"e03c30cd",5231:"3a645df8",5327:"398cb270",5562:"d5d5445c",5610:"c828b921",5742:"36b2287c",5750:"7e0ed2a4",5921:"33c9bf3e",6087:"fc2aafdc",6156:"efede7a5",6170:"850517dc",6244:"d024e865",6254:"0c0e5676",6270:"967974c3",6297:"84c3eafd",6407:"d1bacbb7",6451:"ad1fa60f",6723:"45806d3a",6752:"e922afae",6758:"55c66adf",7098:"dc097708",7195:"6ea197b4",7212:"f3fdcfe7",7214:"241fdfdd",7291:"fa37dda2",7615:"0510c444",7622:"3c39e1be",7635:"2c18c938",7690:"271c4535",7723:"b45a4dda",7778:"f7117244",7817:"e414f881",7822:"a114955d",7902:"2551b7ea",7904:"9b93ad80",7924:"0c4d5e69",7959:"d1692b91",8005:"2f05b883",8008:"b1c59015",8133:"fd28c1c6",8244:"d9a4cf08",8285:"88b66a0d",8350:"9ea0ab36",8401:"7ed15aa0",8500:"210a6b71",8581:"ad07f17c",8594:"fa2f20f3",8609:"cb752d50",8647:"d0c1a5c3",8712:"273a3c3f",8756:"45fdedd1",8913:"83bce4ad",8935:"9808f77a",9030:"a5ea8774",9048:"cef9f040",9071:"a252669f",9103:"ef4c778b",9297:"48f8e249",9446:"5b62c829",9462:"3ff722d9",9548:"ac9be399",9589:"1df85cb3",9647:"c7e58006",9664:"e928d1d2",9667:"e0d3cf81",9744:"007549ad",9786:"e66e4904",9806:"ad41c2d2",9869:"ad1f91e9"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),d={},c="website:",r.l=(e,a,f,b)=>{if(d[e])d[e].push(a);else{var t,o;if(void 0!==f)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var c=d[e];if(delete d[e],t.parentNode&&t.parentNode.removeChild(t),c&&c.forEach((e=>e(f))),a)return a(f)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/",r.gca=function(e){return e={16369154:"6156",17896441:"8401",47330074:"7291",47332327:"7822",49086167:"3816","16e8e4ea":"76","0058a559":"108",f56215be:"129",d4621bd6:"192",a792ae6b:"232","1afe06e6":"289","3e2cea56":"421","41427dbd":"427","964876d0":"573",a13c8d3b:"644",eba555e9:"712","02ee0895":"925","734f2e17":"1028",cd579993:"1068",d02cd5ce:"1331","608d5641":"1461","6612d0dd":"1554",cfe017da:"1682","1d08bea3":"1795","49e64ab8":"1828",cdfe3287:"2109",d4522a55:"2123","1a4e3797":"2138",b82dbf03:"2244","47d70d6d":"2257","210bf649":"2287","6ffcc0ea":"2353","158706f2":"2392",c2f8a836:"2626",c4f5d8e4:"2634","4e04d338":"2748","965109f3":"2828","4f64f2cc":"2853",e394e23a:"3073",bae179e2:"3091",a00302a7:"3205","69adfb8e":"3246",db45fef8:"3289","4e369fd0":"3464","50af6950":"3601","39eb40a6":"3683","969cdbf6":"3708",e240fc47:"3724",a3072847:"3973","86f5e2e4":"4048","9a026d11":"4163","5c36e323":"4225",a43d1a0b:"4361",c35f9c57:"4468","06388b3b":"4541","690cbe68":"4630","68451bba":"4642","248f8a93":"4834",a0f9174f:"4873",fc04fdc5:"4940","51b3d719":"4993","41bcc097":"5042",a444bd10:"5085","04d88e6b":"5090","1211b948":"5211",cdf7d60f:"5231",c6a029fa:"5327",df6c63a4:"5562","975fef74":"5610",c377a04b:"5742","120a4791":"5750","45b965f9":"5921","47a5dbed":"6087",a7a0251b:"6170",c1b47848:"6244",b45b40f8:"6254",ec6f8993:"6270","902de5c0":"6297","17853b1a":"6407","8cc724d7":"6451",e7c93931:"6723",ac6e9832:"6752","9c758254":"6758",a7bd4aaa:"7098",bfd2bef3:"7195","92858fbc":"7212",e495ac88:"7214",d2672ed8:"7615",fc648345:"7622",a19ef396:"7635","658db2fd":"7690","4eabdd00":"7723","81602ec0":"7778",d7cff035:"7817","19a99a72":"7902","88f603ff":"7904",d589d3a7:"7924","428581d6":"7959","9ff03b8f":"8005","60bd5769":"8008",ad6a40b0:"8133",df8ead47:"8244","7037e66f":"8285",b8471ed6:"8350",d8e1327c:"8500","935f2afb":"8581",e1a677fb:"8594","88a06dd7":"8609",d63e7be9:"8647","31ccc530":"8712","7432206e":"8756","81f1b453":"8935","92a861f2":"9030",a94703ab:"9048",d6512fd8:"9071",c74ee130:"9103","3386ce0f":"9297","264024be":"9446","8f4062da":"9548","72bb5253":"9589","5e95c892":"9647","382622a1":"9664","423df7e1":"9667","826618bd":"9744","0762c7f6":"9786","2860049b":"9806",b3f87c10:"9869"}[e]||e,r.p+r.u(e)},(()=>{var e={5354:0,1869:0};r.f.j=(a,f)=>{var d=r.o(e,a)?e[a]:void 0;if(0!==d)if(d)f.push(d[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var c=new Promise(((f,c)=>d=e[a]=[f,c]));f.push(d[2]=c);var b=r.p+r.u(a),t=new Error;r.l(b,(f=>{if(r.o(e,a)&&(0!==(d=e[a])&&(e[a]=void 0),d)){var c=f&&("load"===f.type?"missing":f.type),b=f&&f.target&&f.target.src;t.message="Loading chunk "+a+" failed.\n("+c+": "+b+")",t.name="ChunkLoadError",t.type=c,t.request=b,d[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,f)=>{var d,c,b=f[0],t=f[1],o=f[2],n=0;if(b.some((a=>0!==e[a]))){for(d in t)r.o(t,d)&&(r.m[d]=t[d]);if(o)var i=o(r)}for(a&&a(f);n{"use strict";var e,a,d,f,b,c={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var d=t[e]={id:e,loaded:!1,exports:{}};return c[e].call(d.exports,d,d.exports,r),d.loaded=!0,d.exports}r.m=c,r.c=t,e=[],r.O=(a,d,f,b)=>{if(!d){var c=1/0;for(i=0;i=b)&&Object.keys(r.O).every((e=>r.O[e](d[o])))?d.splice(o--,1):(t=!1,b0&&e[i-1][2]>b;i--)e[i]=e[i-1];e[i]=[d,f,b]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},d=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var b=Object.create(null);r.r(b);var c={};a=a||[null,d({}),d([]),d(d)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=d(t))Object.getOwnPropertyNames(t).forEach((a=>c[a]=()=>e[a]));return c.default=()=>e,r.d(b,c),b},r.d=(e,a)=>{for(var d in a)r.o(a,d)&&!r.o(e,d)&&Object.defineProperty(e,d,{enumerable:!0,get:a[d]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,d)=>(r.f[d](e,a),a)),[])),r.u=e=>"assets/js/"+({76:"16e8e4ea",108:"0058a559",129:"f56215be",192:"d4621bd6",232:"a792ae6b",289:"1afe06e6",421:"3e2cea56",427:"41427dbd",573:"964876d0",644:"a13c8d3b",712:"eba555e9",925:"02ee0895",1028:"734f2e17",1068:"cd579993",1331:"d02cd5ce",1461:"608d5641",1554:"6612d0dd",1682:"cfe017da",1795:"1d08bea3",1828:"49e64ab8",2109:"cdfe3287",2123:"d4522a55",2138:"1a4e3797",2244:"b82dbf03",2257:"47d70d6d",2287:"210bf649",2353:"6ffcc0ea",2392:"158706f2",2626:"c2f8a836",2634:"c4f5d8e4",2748:"4e04d338",2828:"965109f3",2853:"4f64f2cc",3073:"e394e23a",3091:"bae179e2",3205:"a00302a7",3246:"69adfb8e",3289:"db45fef8",3464:"4e369fd0",3601:"50af6950",3683:"39eb40a6",3708:"969cdbf6",3724:"e240fc47",3816:"49086167",3973:"a3072847",4048:"86f5e2e4",4163:"9a026d11",4225:"5c36e323",4361:"a43d1a0b",4468:"c35f9c57",4541:"06388b3b",4630:"690cbe68",4642:"68451bba",4834:"248f8a93",4873:"a0f9174f",4940:"fc04fdc5",4993:"51b3d719",5042:"41bcc097",5085:"a444bd10",5090:"04d88e6b",5211:"1211b948",5231:"cdf7d60f",5327:"c6a029fa",5562:"df6c63a4",5610:"975fef74",5742:"c377a04b",5750:"120a4791",5921:"45b965f9",6087:"47a5dbed",6156:"16369154",6170:"a7a0251b",6244:"c1b47848",6254:"b45b40f8",6270:"ec6f8993",6297:"902de5c0",6407:"17853b1a",6451:"8cc724d7",6723:"e7c93931",6752:"ac6e9832",6758:"9c758254",7098:"a7bd4aaa",7195:"bfd2bef3",7212:"92858fbc",7214:"e495ac88",7291:"47330074",7615:"d2672ed8",7622:"fc648345",7635:"a19ef396",7690:"658db2fd",7723:"4eabdd00",7778:"81602ec0",7817:"d7cff035",7822:"47332327",7902:"19a99a72",7904:"88f603ff",7924:"d589d3a7",7959:"428581d6",8005:"9ff03b8f",8008:"60bd5769",8133:"ad6a40b0",8244:"df8ead47",8285:"7037e66f",8350:"b8471ed6",8401:"17896441",8500:"d8e1327c",8581:"935f2afb",8594:"e1a677fb",8609:"88a06dd7",8647:"d63e7be9",8712:"31ccc530",8756:"7432206e",8935:"81f1b453",9030:"92a861f2",9048:"a94703ab",9071:"d6512fd8",9103:"c74ee130",9297:"3386ce0f",9446:"264024be",9548:"8f4062da",9589:"72bb5253",9647:"5e95c892",9664:"382622a1",9667:"423df7e1",9744:"826618bd",9786:"0762c7f6",9806:"2860049b",9869:"b3f87c10"}[e]||e)+"."+{76:"3541bc5f",108:"7f5bdfa5",129:"ca139be3",192:"7e934224",232:"f39b3588",289:"8c29c435",416:"36a683d5",421:"4a11746b",427:"7489012b",573:"b34535ac",644:"b22f4dc3",712:"b1a219a1",925:"e7a821f2",1028:"316a6ae1",1068:"f9063ab4",1331:"3f1c21ec",1461:"74778537",1554:"8c487741",1682:"80ca5a49",1795:"a9b74722",1828:"343b5457",2109:"572e7205",2123:"65c0bdcb",2138:"e464e946",2237:"828f95f0",2244:"14ce09f0",2257:"470430ad",2287:"100b94cb",2353:"893c0c53",2392:"ab7b413b",2626:"1684225e",2634:"37a26a9a",2748:"88a027de",2828:"fbce69a3",2853:"354fe461",3073:"3a05e979",3091:"31a5db22",3205:"de892624",3246:"8b3ae640",3289:"85999cd0",3464:"4a237579",3601:"e728c1da",3683:"02e93613",3708:"5b0bc850",3724:"38bcd155",3816:"b1ffded6",3973:"67e063a1",4048:"7addd9de",4163:"548d710e",4225:"ba42977f",4361:"8a8b0bda",4468:"d04d9012",4541:"637e88f3",4630:"24bcee2b",4642:"d0921f7e",4696:"43aa3ccb",4834:"2b5ad1b9",4873:"92ba0bdf",4940:"4bc18d25",4993:"fdb554a1",5042:"b142f783",5085:"b17c5b1f",5090:"81169ff7",5211:"d2aa9c42",5231:"78599143",5327:"cd1364db",5562:"54ca4f7a",5610:"e49373e1",5742:"36b2287c",5750:"0cac6f19",5921:"e3723ff4",6087:"fc2aafdc",6156:"af5c9fa7",6170:"5aeceaba",6244:"be6bf7d1",6254:"36716ffb",6270:"04e92de9",6297:"0053db98",6407:"04c750e8",6451:"ad1fa60f",6723:"6c61f1c4",6752:"cdcdc460",6758:"e19595a1",7098:"dc097708",7195:"9f58f1e1",7212:"16ff3d45",7214:"ac258f66",7291:"dea81c18",7615:"9ec231aa",7622:"5b04b10b",7635:"12daeaea",7690:"4439c77b",7723:"3d199759",7778:"b65c2674",7817:"7a2ac8fb",7822:"75dabcd8",7902:"29454dec",7904:"9bd1b8d0",7924:"0c4d5e69",7959:"63d0cb25",8005:"e50b41b3",8008:"4ef4ddf3",8133:"fd28c1c6",8244:"4963ac37",8285:"bb185e1a",8350:"777f216c",8401:"7ed15aa0",8500:"dc24b842",8581:"ad07f17c",8594:"bb59eb17",8609:"cb752d50",8647:"628d70b0",8712:"c0a46178",8756:"50ce865c",8913:"83bce4ad",8935:"f8ea057b",9030:"a5ea8774",9048:"cef9f040",9071:"cb02da6b",9103:"797388d9",9297:"c315dde2",9446:"ee21b5b0",9462:"3ff722d9",9548:"71beaa26",9589:"bd017bac",9647:"c7e58006",9664:"e928d1d2",9667:"bf0c4a71",9744:"dce0d5c9",9786:"4a1f34f7",9806:"25d4ab3e",9869:"280cfd74"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},b="website:",r.l=(e,a,d,c)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==d)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var b=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),b&&b.forEach((e=>e(d))),a)return a(d)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/",r.gca=function(e){return e={16369154:"6156",17896441:"8401",47330074:"7291",47332327:"7822",49086167:"3816","16e8e4ea":"76","0058a559":"108",f56215be:"129",d4621bd6:"192",a792ae6b:"232","1afe06e6":"289","3e2cea56":"421","41427dbd":"427","964876d0":"573",a13c8d3b:"644",eba555e9:"712","02ee0895":"925","734f2e17":"1028",cd579993:"1068",d02cd5ce:"1331","608d5641":"1461","6612d0dd":"1554",cfe017da:"1682","1d08bea3":"1795","49e64ab8":"1828",cdfe3287:"2109",d4522a55:"2123","1a4e3797":"2138",b82dbf03:"2244","47d70d6d":"2257","210bf649":"2287","6ffcc0ea":"2353","158706f2":"2392",c2f8a836:"2626",c4f5d8e4:"2634","4e04d338":"2748","965109f3":"2828","4f64f2cc":"2853",e394e23a:"3073",bae179e2:"3091",a00302a7:"3205","69adfb8e":"3246",db45fef8:"3289","4e369fd0":"3464","50af6950":"3601","39eb40a6":"3683","969cdbf6":"3708",e240fc47:"3724",a3072847:"3973","86f5e2e4":"4048","9a026d11":"4163","5c36e323":"4225",a43d1a0b:"4361",c35f9c57:"4468","06388b3b":"4541","690cbe68":"4630","68451bba":"4642","248f8a93":"4834",a0f9174f:"4873",fc04fdc5:"4940","51b3d719":"4993","41bcc097":"5042",a444bd10:"5085","04d88e6b":"5090","1211b948":"5211",cdf7d60f:"5231",c6a029fa:"5327",df6c63a4:"5562","975fef74":"5610",c377a04b:"5742","120a4791":"5750","45b965f9":"5921","47a5dbed":"6087",a7a0251b:"6170",c1b47848:"6244",b45b40f8:"6254",ec6f8993:"6270","902de5c0":"6297","17853b1a":"6407","8cc724d7":"6451",e7c93931:"6723",ac6e9832:"6752","9c758254":"6758",a7bd4aaa:"7098",bfd2bef3:"7195","92858fbc":"7212",e495ac88:"7214",d2672ed8:"7615",fc648345:"7622",a19ef396:"7635","658db2fd":"7690","4eabdd00":"7723","81602ec0":"7778",d7cff035:"7817","19a99a72":"7902","88f603ff":"7904",d589d3a7:"7924","428581d6":"7959","9ff03b8f":"8005","60bd5769":"8008",ad6a40b0:"8133",df8ead47:"8244","7037e66f":"8285",b8471ed6:"8350",d8e1327c:"8500","935f2afb":"8581",e1a677fb:"8594","88a06dd7":"8609",d63e7be9:"8647","31ccc530":"8712","7432206e":"8756","81f1b453":"8935","92a861f2":"9030",a94703ab:"9048",d6512fd8:"9071",c74ee130:"9103","3386ce0f":"9297","264024be":"9446","8f4062da":"9548","72bb5253":"9589","5e95c892":"9647","382622a1":"9664","423df7e1":"9667","826618bd":"9744","0762c7f6":"9786","2860049b":"9806",b3f87c10:"9869"}[e]||e,r.p+r.u(e)},(()=>{var e={5354:0,1869:0};r.f.j=(a,d)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)d.push(f[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var b=new Promise(((d,b)=>f=e[a]=[d,b]));d.push(f[2]=b);var c=r.p+r.u(a),t=new Error;r.l(c,(d=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var b=d&&("load"===d.type?"missing":d.type),c=d&&d.target&&d.target.src;t.message="Loading chunk "+a+" failed.\n("+b+": "+c+")",t.name="ChunkLoadError",t.type=b,t.request=c,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,d)=>{var f,b,c=d[0],t=d[1],o=d[2],n=0;if(c.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(d);n

Example

-
add(1, 2); // 3
await add(1, Promise.resolve(2)); // 3
await add(Promise.resolve(1), 2); // 3
await add(Promise.resolve(1), Promise.resolve(2)); // 3

add('a', 'b'); // 'ab'
await add('a', Promise.resolve('b')); // 'ab'
await add(Promise.resolve('a'), 'b'); // 'ab'
await add(Promise.resolve('a'), Promise.resolve('b')); // 'ab'
+
add(1, 2); // 3
await add(1, Promise.resolve(2)); // 3
await add(Promise.resolve(1), 2); // 3
await add(Promise.resolve(1), Promise.resolve(2)); // 3

add('a', 'b'); // 'ab'
await add('a', Promise.resolve('b')); // 'ab'
await add(Promise.resolve('a'), 'b'); // 'ab'
await add(Promise.resolve('a'), Promise.resolve('b')); // 'ab'
+

Open Source Code

\ No newline at end of file diff --git a/docs/always/index.html b/docs/always/index.html index fda33f71..b574e648 100644 --- a/docs/always/index.html +++ b/docs/always/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function always<T>(value: T): (...args: any[]) => T;

Example

-
const alwaysFive = always(5);
alwaysFive(); // 5

const defaultToEmpty = always("");
await Promise.reject("error during operation").catch(defaultToEmpty); // ""

// with pipe
const excludeNegatives = false;
pipe(
[-1, 1, 2, 0 ,-3],
filter(excludeNegatives ? lt(0) : always(true)),
toArray,
); // [-1, 1, 2, 0 ,-3]
+
const alwaysFive = always(5);
alwaysFive(); // 5

const defaultToEmpty = always("");
await Promise.reject("error during operation").catch(defaultToEmpty); // ""

// with pipe
const excludeNegatives = false;
pipe(
[-1, 1, 2, 0 ,-3],
filter(excludeNegatives ? lt(0) : always(true)),
toArray,
); // [-1, 1, 2, 0 ,-3]
+

Open Source Code

\ No newline at end of file diff --git a/docs/append/index.html b/docs/append/index.html index d91a83e8..ebe1648a 100644 --- a/docs/append/index.html +++ b/docs/append/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = append(4, [1,2,3]);
iter.next() // {done: false, value: 1}
iter.next() // {done: false, value: 2}
iter.next() // {done: false, value: 3}
iter.next() // {done: false, value: 4}
iter.next() // {done: true, value: undefined}

// with pipe
pipe(
[1,2,3],
append(4),
toArray,
); // [1,2,3,4]

await pipe(
Promise.resolve([1, 2, 3]),
append(4),
toArray,
); // [1, 2, 3, 4]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],
toAsync,
append(4),
toArray,
); // [1, 2, 3, 4]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/apply/index.html b/docs/apply/index.html index 741f63e7..bd3b123e 100644 --- a/docs/apply/index.html +++ b/docs/apply/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function apply<F extends Arrow, T extends Parameters<F>>(f: F, args: T): ReturnType<typeof f>;

declare function apply<F extends Arrow, T extends Parameters<F>>(f: F): (args: T) => ReturnType<typeof f>;

Example

-
apply(Math.max, [1, 2, 3, 4, 5]); // 5

pipe(
repeat(10),
map(a => a * Math.random())
take(5),
apply(max)
);
+
apply(Math.max, [1, 2, 3, 4, 5]); // 5

pipe(
repeat(10),
map(a => a * Math.random())
take(5),
apply(max)
);
+

Open Source Code

\ No newline at end of file diff --git a/docs/average/index.html b/docs/average/index.html index 49a977de..a335eb51 100644 --- a/docs/average/index.html +++ b/docs/average/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function average<T extends Iterable<number> | AsyncIterable<number>>(iterable: T): ReturnValueType<T>;

Example

average([]); // NaN
average([1, 2, 3, 4, 5]); // 3
await average(toAsync([1, 2, 3, 4, 5])); // 3

// with pipe
pipe(
[1, 2, 3, 4, 5],
average,
); // 3
-

see pipe

+

see pipe

+

Open Source Code

\ No newline at end of file diff --git a/docs/chunk/index.html b/docs/chunk/index.html index 4f35b193..fad30c1a 100644 --- a/docs/chunk/index.html +++ b/docs/chunk/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = chunk(2, [1, 2, 3, 4]);
iter.next() // {done:false, value:[1, 2]}
iter.next() // {done:false, value:[3, 4]}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[1, 2, 3, 4],
chunk(2),
toArray,
); // [[1, 2],[3, 4]]

await pipe(
Promise.resolve([1, 2, 3 ,4]),
chunk(2),
toArray,
); // [[1, 2],[3, 4]]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],
toAsync,
chunk(2),
toArray,
); // [[1, 2],[3, 4]]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/compact/index.html b/docs/compact/index.html index 6a72ccf7..1327e61e 100644 --- a/docs/compact/index.html +++ b/docs/compact/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = compact([0, 1, undefined, 3, null]);
iter.next() // {done:false, value: 0}
iter.next() // {done:false, value: 1}
iter.next() // {done:false, value: 3}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[0, 1, undefined, 3, null],
compact,
toArray,
); // [0, 1, 3]

await pipe(
Promise.resolve([0, 1, undefined, 3, null]),
compact,
toArray,
); // [0, 1, 3]

// with toAsync
await pipe(
[Promise.resolve(0), Promise.resolve(1), Promise.resolve(undefined),
Promise.resolve(3), Promise.resolve(null)],
toAsync,
compact,
toArray,
); // [0, 1, 3]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/compactObject/index.html b/docs/compactObject/index.html index dd05cc77..2842e956 100644 --- a/docs/compactObject/index.html +++ b/docs/compactObject/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
export default function compactObject<T extends object>(obj: T): Merge<{
[K in Extract<keyof T, RequiredKeys<T>>]: Extract<NonNullableEntries<T>, [
K,
any
]>[1];
}, {
[K in Extract<keyof T, OptionalKeys<T>>]?: Extract<NonNullableEntries<T>, [
K,
any
]>[1];
}>;

Example

-
const compacted = compactObject({ a: 1, b: "b", c: null, d: undefined });
// {a: 1, b: "b"}
+
const compacted = compactObject({ a: 1, b: "b", c: null, d: undefined });
// {a: 1, b: "b"}
+

Open Source Code

\ No newline at end of file diff --git a/docs/compress/index.html b/docs/compress/index.html index 2400eaad..0f1f5aab 100644 --- a/docs/compress/index.html +++ b/docs/compress/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function compress<A, B>(selector: Array<A>, iterable: Iterable<B>): IterableIterator<B>;

declare function compress<A, B>(selector: Array<A>, iterable: AsyncIterable<B>): AsyncIterableIterator<B>;

declare function compress<A, B extends Iterable<unknown> | AsyncIterable<unknown>>(selector: Array<A>): (iterable: B) => ReturnIterableIteratorType<B>;

Example

const iter1 = compress([false,true,false,false,true],  [1, 2, 3, 4, 5]);
iter1.next(); // {value: 2, done:false}
iter1.next(); // {value: 5, done:false}
iter1.next(); // {value: undefined, done:true }

const iter2 = compress([1,0,0,1,0], "abcde");
iter2.next(); // {value: "a", done:false}
iter2.next(); // {value: "d", done:false}
iter2.next(); // {value: undefined, done:true }

// with pipe
pipe(
[1, 2, 3],
compress([false, true, true]),
toArray,
); // [2, 3]
-

see pipe, toArray

+

see pipe, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/concat/index.html b/docs/concat/index.html index f7f79254..dbaa58cd 100644 --- a/docs/concat/index.html +++ b/docs/concat/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = concat([1, 2], [3, 4]);
iter.next() // {done:false, value: 1}
iter.next() // {done:false, value: 2}
iter.next() // {done:false, value: 3}
iter.next() // {done:false, value: 4}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[3, 4],
concat([1, 2]),
toArray,
); // [1, 2, 3, 4]

await pipe(
Promise.resolve([3, 4]),
concat([1, 2]),
toArray,
); // [1, 2, 3, 4]

await pipe(
[Promise.resolve(3), Promise.resolve(4)],
toAsync,
concat([1, 2]),
toArray,
); // [1, 2, 3, 4]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/concurrent/index.html b/docs/concurrent/index.html index 9ed3075d..39da19ad 100644 --- a/docs/concurrent/index.html +++ b/docs/concurrent/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

await pipe(
[1, 2, 3, 4, 5, 6],
toAsync,
map((a) => delay(1000, a)),
concurrent(3),
each(console.log), // log 1, 2, 3, 4, 5, 6
); // 2 seconds

// evaluation
// ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐
// │ 1 │──│ 2 │──│ 3 │──│ 4 │──│ 5 │──│ 6 │
// └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘
// map │ │ │ │ │ │
// concurrent(3) (1) (1) (1) (2) (2) (2)
// │ │ │ │ │ │
// ▼ ▼ ▼ ▼ ▼ ▼

await pipe(
[1, 2, 3, 4, 5, 6],
toAsync,
map((a) => delay(1000, a)),
each(console.log), // log 1, 2, 3, 4, 5, 6
); // 6 seconds

// evaluation
// ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐
// │ 1 │──│ 2 │──│ 3 │──│ 4 │──│ 5 │──│ 6 │
// └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘
// map │ │ │ │ │ │
// (1) (2) (3) (4) (5) (6)
// │ │ │ │ │ │
// ▼ ▼ ▼ ▼ ▼ ▼

Try It

-

see pipe, toAsync, toArray each, map

+

see pipe, toAsync, toArray each, map

+

Open Source Code

\ No newline at end of file diff --git a/docs/consume/index.html b/docs/consume/index.html index 3cb20be9..cab84aad 100644 --- a/docs/consume/index.html +++ b/docs/consume/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function consume<A extends Iterable<unknown> | AsyncIterable<unknown>, B extends number>(iterator: A, n?: B): ReturnValueType<A, void>;

Example

-
const iterator = (function *(){
yield 1;
yield 2;
yield 3;
})();
consume(iterator, 2);
iterator.next(); // {value:3, done:false}
iterator.next(); // {value:undefined, done:true}

// with pipe
pipe(
range(10),
peek(updateApi),
concurrent(5),
consume,
);
+
const iterator = (function *(){
yield 1;
yield 2;
yield 3;
})();
consume(iterator, 2);
iterator.next(); // {value:3, done:false}
iterator.next(); // {value:undefined, done:true}

// with pipe
pipe(
range(10),
peek(updateApi),
concurrent(5),
consume,
);
+

Open Source Code

\ No newline at end of file diff --git a/docs/countBy/index.html b/docs/countBy/index.html index 91b363a7..64926e69 100644 --- a/docs/countBy/index.html +++ b/docs/countBy/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function countBy<A, B extends Key>(f: (a: A) => B, iterable: Iterable<A>): {
[K in B]: number;
};

declare function countBy<A, B extends Key>(f: (a: A) => B | Promise<B>, iterable: AsyncIterable<A>): Promise<{
[K in B]: number;
}>;

declare function countBy<A extends Iterable<unknown> | AsyncIterable<unknown>, B extends Key>(f: (a: IterableInfer<A>) => B | Promise<B>): (iterable: A) => ReturnValueType<A, {
[K in B]: number;
}>;

Example

const given = [
{ category: "clothes", desc: "good" },
{ category: "pants", desc: "bad" },
{ category: "shoes", desc: "not bad" },
{ category: "shoes", desc: "great" },
{ category: "pants", desc: "good" },
];

countBy((a) => a.category, given);
//{
// clothes: 1,
// pants: 2,
// shoes: 2,
// };
-

Try It

+

Try It

+

Open Source Code

\ No newline at end of file diff --git a/docs/curry/index.html b/docs/curry/index.html index fca31364..880c9502 100644 --- a/docs/curry/index.html +++ b/docs/curry/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function curry<F extends (...args: any[]) => any>(f: F): Curry<F>;

Example

-
const add = (a: number, b: number): number => a + b

const curried = curry(add)
const add10 = curried(10)
console.log(add10(5)) // 15
console.log(curried(3, 4)) // 7
+
const add = (a: number, b: number): number => a + b

const curried = curry(add)
const add10 = curried(10)
console.log(add10(5)) // 15
console.log(curried(3, 4)) // 7
+

Open Source Code

\ No newline at end of file diff --git a/docs/cycle/index.html b/docs/cycle/index.html index ac0ecead..655ede99 100644 --- a/docs/cycle/index.html +++ b/docs/cycle/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function cycle<A extends Iterable<unknown> | AsyncIterable<unknown>>(iter: A): ReturnIterableIteratorType<A>;

Example

-
const iter = cycle("abc")
iter.next(); // {value:"a", done: false}
iter.next(); // {value:"b", done: false}
iter.next(); // {value:"c", done: false}
iter.next(); // {value:"a", done: false}
iter.next(); // {value:"b", done: false}

// with pipe
pipe(
cycle([1,2,3,4]),
take(5),
toArray,
); // [1,2,3,4,1]
+
const iter = cycle("abc")
iter.next(); // {value:"a", done: false}
iter.next(); // {value:"b", done: false}
iter.next(); // {value:"c", done: false}
iter.next(); // {value:"a", done: false}
iter.next(); // {value:"b", done: false}

// with pipe
pipe(
cycle([1,2,3,4]),
take(5),
toArray,
); // [1,2,3,4,1]
+

Open Source Code

\ No newline at end of file diff --git a/docs/delay/index.html b/docs/delay/index.html index 0b28b44c..e0a9f09b 100644 --- a/docs/delay/index.html +++ b/docs/delay/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function delay(wait: number): Promise<void>;

declare function delay<T>(wait: number, value: T): Promise<T>;

Example

-
await delay(1000);
console.log('hello'); // after 1000 milliseconds log hello
+
await delay(1000);
console.log('hello'); // after 1000 milliseconds log hello
+

Open Source Code

\ No newline at end of file diff --git a/docs/difference/index.html b/docs/difference/index.html index 26ef4a1b..d54d3dda 100644 --- a/docs/difference/index.html +++ b/docs/difference/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function difference<T>(iterable1: Iterable<T>, iterable2: Iterable<T>): IterableIterator<T>;

declare function difference<T>(iterable1: AsyncIterable<T>, iterable2: Iterable<T>): AsyncIterableIterator<T>;

declare function difference<T>(iterable1: Iterable<T>, iterable2: AsyncIterable<T>): AsyncIterableIterator<T>;

declare function difference<T>(iterable1: AsyncIterable<T>, iterable2: AsyncIterable<T>): AsyncIterableIterator<T>;

declare function difference<A extends Iterable<unknown> | AsyncIterable<unknown>, B extends Iterable<unknown> | AsyncIterable<unknown>>(iterable1: A): (iterable2: B) => A extends AsyncIterable<unknown> ? AsyncIterableIterator<IterableInfer<B>> : B extends AsyncIterable<unknown> ? AsyncIterableIterator<IterableInfer<B>> : IterableIterator<IterableInfer<B>>;

Example

-
const iter = difference([2, 1], [2, 3, 4]);
iter.next(); // {value: 3, done:false}
iter.next(); // {value: 4, done:false}
iter.next(); // {value: undefined, done: true}
+
const iter = difference([2, 1], [2, 3, 4]);
iter.next(); // {value: 3, done:false}
iter.next(); // {value: 4, done:false}
iter.next(); // {value: undefined, done: true}
+

Open Source Code

\ No newline at end of file diff --git a/docs/differenceBy/index.html b/docs/differenceBy/index.html index 2fac3b1f..1087a24c 100644 --- a/docs/differenceBy/index.html +++ b/docs/differenceBy/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function differenceBy<A, B = unknown>(f: (a: A) => B, iterable1: Iterable<A>, iterable2: Iterable<A>): IterableIterator<A>;

declare function differenceBy<A, B = unknown>(f: (a: A) => B, iterable1: AsyncIterable<A>, iterable2: Iterable<A>): AsyncIterableIterator<A>;

declare function differenceBy<A, B = unknown>(f: (a: A) => B, iterable1: Iterable<A>, iterable2: AsyncIterable<A>): AsyncIterableIterator<A>;

declare function differenceBy<A, B = unknown>(f: (a: A) => B, iterable1: AsyncIterable<A>, iterable2: AsyncIterable<A>): AsyncIterableIterator<A>;

Example

-
const iter = differenceBy(a => a.x, [{ x: 1 }, { x: 4 }], [{ x: 1 },  { x: 2 },  { x: 3 }])
iter.next(); // {value: {x: 2}, done: false}
iter.next(); // {value: {x: 3}, done: false}
iter.next(); // {value: undefined, done: true}
+
const iter = differenceBy(a => a.x, [{ x: 1 }, { x: 4 }], [{ x: 1 },  { x: 2 },  { x: 3 }])
iter.next(); // {value: {x: 2}, done: false}
iter.next(); // {value: {x: 3}, done: false}
iter.next(); // {value: undefined, done: true}
+

Open Source Code

\ No newline at end of file diff --git a/docs/drop/index.html b/docs/drop/index.html index fe6bc59d..a31acd47 100644 --- a/docs/drop/index.html +++ b/docs/drop/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = drop(2, [1, 2, 3, 4]);
iter.next() // {done:false, value: 3}
iter.next() // {done:false, value: 4}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[1, 2, 3, 4],
drop(2),
toArray,
); // [3, 4]

await pipe(
Promise.resolve([1, 2, 3, 4]),
drop(2),
toArray,
); // [3, 4]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],
toAsync,
drop(2),
toArray,
); // [3, 4]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/dropRight/index.html b/docs/dropRight/index.html index 5373d6ed..b8e29332 100644 --- a/docs/dropRight/index.html +++ b/docs/dropRight/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function dropRight<A>(length: number, iterable: Iterable<A>): IterableIterator<A>;

declare function dropRight<A>(length: number, iterable: AsyncIterable<A>): AsyncIterableIterator<A>;

declare function dropRight<A extends Iterable<unknown> | AsyncIterable<unknown>>(length: number): (iterable: A) => ReturnIterableIteratorType<A>;

Example

const iter = dropRight(2, [1, 2, 3, 4]);
iter.next() // {done:false, value: 1}
iter.next() // {done:false, value: 2}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[1, 2, 3, 4],
dropRight(2),
toArray,
); // [1, 2]

pipe(
"abcde",
dropRight(2),
toArray,
); // ["a", "b", "c"]

await pipe(
Promise.resolve([1, 2, 3, 4]),
dropRight(2),
toArray,
); // [1, 2]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],
toAsync,
dropRight(2),
toArray,
); // [1, 2]
-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/dropUntil/index.html b/docs/dropUntil/index.html index 32f6b913..a3a96de1 100644 --- a/docs/dropUntil/index.html +++ b/docs/dropUntil/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function dropUntil<A, B = unknown>(f: (a: A) => B, iterable: Iterable<A>): IterableIterator<A>;

declare function dropUntil<A, B = unknown>(f: (a: A) => B, iterable: AsyncIterable<A>): AsyncIterableIterator<A>;

declare function dropUntil<A extends Iterable<unknown> | AsyncIterable<unknown>, B>(f: (a: IterableInfer<A>) => B): (iterable: A) => ReturnIterableIteratorType<A>;

Example

const iter = dropUntil((a) => a < 3, [1, 2, 3, 4, 5, 1, 2]);
iter.next(); // {done:false, value: 3}
iter.next(); // {done:false, value: 4}
iter.next(); // {done:false, value: 5}

// with pipe
pipe(
[1, 2, 3, 4, 5, 1, 2],
dropUntil((a) => a > 3),
toArray,
); // [5, 1, 2]

await pipe(
Promise.resolve([1, 2, 3, 4, 5, 1, 2]),
dropUntil((a) => a > 3),
toArray,
); // [5, 1, 2]

// if you want to use asynchronous callback
await pipe(
Promise.resolve([1, 2, 3, 4, 5, 1, 2]),
toAsync,
dropUntil(async (a) => a > 3),
toArray,
); // [5, 1, 2]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4),
Promise.resolve(5), Promise.resolve(1), Promise.resolve(2)],
toAsync,
dropUntil((a) => a > 3),
toArray,
); // [5, 1, 2]
-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/dropWhile/index.html b/docs/dropWhile/index.html index 0a9574e2..cde521df 100644 --- a/docs/dropWhile/index.html +++ b/docs/dropWhile/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function dropWhile<A, B = unknown>(f: (a: A) => B, iterable: Iterable<A>): IterableIterator<A>;

declare function dropWhile<A, B = unknown>(f: (a: A) => B, iterable: AsyncIterable<A>): AsyncIterableIterator<A>;

declare function dropWhile<A extends Iterable<unknown> | AsyncIterable<unknown>, B>(f: (a: IterableInfer<A>) => B): (iterable: A) => ReturnIterableIteratorType<A>;

Example

const iter = dropWhile((a) => a < 3, [1, 2, 3, 4, 5]);
iter.next(); // {done:false, value: 3}
iter.next(); // {done:false, value: 4}
iter.next(); // {done:false, value: 5}

// with pipe
pipe(
[1, 2, 3, 4, 5],
dropWhile((a) => a < 3),
toArray,
); // [3, 4, 5]

await pipe(
Promise.resolve([1, 2, 3, 4, 5]),
dropWhile((a) => a < 3),
toArray,
); // [3, 4, 5]

// if you want to use asynchronous callback
await pipe(
Promise.resolve([1, 2, 3, 4, 5]),
toAsync,
dropWhile(async (a) => a < 3),
toArray,
); // [3, 4, 5]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)],
toAsync,
dropWhile((a) => a < 3),
toArray,
); // [3, 4, 5]

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/each/index.html b/docs/each/index.html index 8ba0c4e8..905ed0d6 100644 --- a/docs/each/index.html +++ b/docs/each/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function each<A, B = unknown>(f: (a: A) => B, iterable: Iterable<A>): void;

declare function each<A, B = unknown>(f: (a: A) => B, iterable: AsyncIterable<A>): Promise<void>;

declare function each<A extends Iterable<unknown> | AsyncIterable<unknown>, B = unknown>(f: (a: IterableInfer<A>) => B): (iterable: A) => ReturnValueType<A, void>;

Example

each(console.log, [1, 2, 3]); // log 1, 2, 3
-

Try It

+

Try It

+

Open Source Code

\ No newline at end of file diff --git a/docs/entries/index.html b/docs/entries/index.html index d9a838f4..1112b7f1 100644 --- a/docs/entries/index.html +++ b/docs/entries/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function entries<T extends Record<string, any>>(obj: T): Generator<Entries<T, keyof T>, void>;

Example


[...entries({ a: 1, b: "2", c: true })]
// [["a", 1], ["b", "2"], ["c", true]]
-

see fromEntries

+

see fromEntries

+

Open Source Code

\ No newline at end of file diff --git a/docs/error-handling/index.html b/docs/error-handling/index.html index eb0eab62..996f9c4e 100644 --- a/docs/error-handling/index.html +++ b/docs/error-handling/index.html @@ -12,7 +12,7 @@ - + diff --git a/docs/every/index.html b/docs/every/index.html index ac96a5a3..44e3f91d 100644 --- a/docs/every/index.html +++ b/docs/every/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function every<A extends readonly []>(f: Arrow, iterable: A): true;

declare function every<A, B = unknown>(f: (a: A) => B, iterable: Iterable<A>): boolean;

declare function every<A, B = unknown>(f: (a: A) => B, iterable: AsyncIterable<A>): Promise<boolean>;

declare function every<A extends Iterable<unknown> | AsyncIterable<unknown>, B = unknown>(f: (a: IterableInfer<A>) => B): (a: A) => ReturnValueType<A, boolean>;

Example

every((a) => a % 2 === 0, [2, 4, 6, 8, 10]);
// true

every((a) => a % 2 === 0, [2, 4, 6, 7, 10]);
// false
-

Try It

+

Try It

+

Open Source Code

\ No newline at end of file diff --git a/docs/evolve/index.html b/docs/evolve/index.html index bc0eeb67..bd89fe54 100644 --- a/docs/evolve/index.html +++ b/docs/evolve/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function evolve<O extends Record<string, any>, T extends Transformation<O>>(transformation: T, obj: O): EvolveReturnType<O, T>;

declare function evolve<O extends Record<string, any>, T extends Transformation<O>>(transformation: T): (obj: O) => EvolveReturnType<O, T>;

Example

-
const add1String = (a: number) => String(a + 1);
const obj = { a: 1, b: 2, c: { d: 3, e: 4 }, f: true };
const transformation = {
a: add1String,
b: add1String,
c: (obj: { d: number; e: number }) =>
evolve({ d: add1String, e: add1String }, obj),
};
evolve(transformation, obj);
// { a: "2", b: "3", c: { d: "4", e: "5" }, f: true }
+
const add1String = (a: number) => String(a + 1);
const obj = { a: 1, b: 2, c: { d: 3, e: 4 }, f: true };
const transformation = {
a: add1String,
b: add1String,
c: (obj: { d: number; e: number }) =>
evolve({ d: add1String, e: add1String }, obj),
};
evolve(transformation, obj);
// { a: "2", b: "3", c: { d: "4", e: "5" }, f: true }
+

Open Source Code

\ No newline at end of file diff --git a/docs/filter/index.html b/docs/filter/index.html index 6a57c1e0..173478c3 100644 --- a/docs/filter/index.html +++ b/docs/filter/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = filter((a)=> a % 2 === 0, [0, 1, 2, 3, 4, 5, 6]);
iter.next() // {done:false, value: 0}
iter.next() // {done:false, value: 2}
iter.next() // {done:false, value: 4}
iter.next() // {done:false, value: 6}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[0, 1, 2, 3, 4, 5, 6],
filter(a => a % 2 === 0),
toArray,
); // [0, 2, 4, 6]

await pipe(
Promise.resolve([0, 1, 2, 3, 4, 5, 6]),
filter(a => a % 2 === 0),
toArray,
); // [0, 2, 4, 6]

// if you want to use asynchronous callback
await pipe(
Promise.resolve([0, 1, 2, 3, 4, 5, 6]),
toAsync,
filter(async a => a % 2 === 0),
toArray,
); // [0, 2, 4, 6]

// toAsync
await pipe(
[Promise.resolve(0), Promise.resolve(1), Promise.resolve(2), Promise.resolve(3),
Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],
toAsync,
filter(a => a % 2 === 0),
toArray,
); // [0, 2, 4, 6]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/find/index.html b/docs/find/index.html index 61d3f8b7..c5f2931d 100644 --- a/docs/find/index.html +++ b/docs/find/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function find<T>(f: (a: T) => unknown, iterable: Iterable<T>): T | undefined;

declare function find<T>(f: (a: T) => unknown, iterable: AsyncIterable<T>): Promise<T | undefined>;

declare function find<T extends Iterable<unknown> | AsyncIterable<unknown>>(f: (a: IterableInfer<T>) => unknown, iterable?: T): (iterable: T) => ReturnValueType<T, IterableInfer<T> | undefined>;

Example

find((a) => a === 2, [1, 2, 3, 4]); // 2

find((a) => a === "r", "marpple"); // 'r'
-

Try It

+

Try It

+

Open Source Code

\ No newline at end of file diff --git a/docs/findIndex/index.html b/docs/findIndex/index.html index 4bcf3b70..3b0b3d9f 100644 --- a/docs/findIndex/index.html +++ b/docs/findIndex/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function findIndex<T extends readonly []>(f: Arrow, iterable: T): -1;

declare function findIndex<T>(f: (a: T) => unknown, iterable: Iterable<T>): number;

declare function findIndex<T>(f: (a: T) => unknown, iterable: AsyncIterable<T>): Promise<number>;

declare function findIndex<T extends Iterable<unknown> | AsyncIterable<unknown>>(f: (a: IterableInfer<T>) => unknown, iterable?: T): (iterable: T) => ReturnValueType<T, number>;

Example

-
const arr = [{a:1}, {a:2}, {a:3}]
findIndex((obj) => obj.a === 1, arr); // 0
findIndex((obj) => obj.a === 2, arr); // 1
findIndex((obj) => obj.a === 4, arr); // -1
+
const arr = [{a:1}, {a:2}, {a:3}]
findIndex((obj) => obj.a === 1, arr); // 0
findIndex((obj) => obj.a === 2, arr); // 1
findIndex((obj) => obj.a === 4, arr); // -1
+

Open Source Code

\ No newline at end of file diff --git a/docs/flat/index.html b/docs/flat/index.html index a7e1ecd7..717e4a91 100644 --- a/docs/flat/index.html +++ b/docs/flat/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = flat([1,[2,3],[[4,5]]]);
iter.next() // {done:false, value: 1}
iter.next() // {done:false, value: 2}
iter.next() // {done:false, value: 3}
iter.next() // {done:false, value: [4, 5]}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[1,[2, 3],[[4, 5]]],
flat,
toArray,
); // [1, 2, 3, [4, 5]]

await pipe(
Promise.resolve([1,[2, 3],[[4, 5]]]),
flat,
toArray,
); // [1, 2, 3, [4, 5]]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/flatMap/index.html b/docs/flatMap/index.html index 3ef5a704..685cb93f 100644 --- a/docs/flatMap/index.html +++ b/docs/flatMap/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = flatMap(s => s.split(" "), ["It is", "a good", "day"]);
iter.next() // {done:false, value: "It"}
iter.next() // {done:false, value: "is"}
iter.next() // {done:false, value: "a"}
iter.next() // {done:false, value: "good"},
iter.next() // {done:false, value: "day"},
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
["It is", "a good", "day"],
flatMap(s => s.split(" ")),
toArray,
); // ["It", "is", "a", "good", "day"]

await pipe(
Promise.resolve(["It is", "a good", "day"]),
flatMap(s => s.split(" ")),
toArray,
); // ["It", "is", "a", "good", "day"]

// if you want to use asynchronous callback
await pipe(
Promise.resolve(["It is", "a good", "day"]),
toAsync,
flatMap(async (s) => s.split(" ")),
toArray,
); // ["It", "is", "a", "good", "day"]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/fromEntries/index.html b/docs/fromEntries/index.html index 12fee709..bf1e345f 100644 --- a/docs/fromEntries/index.html +++ b/docs/fromEntries/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function fromEntries<U extends [Key, any] | readonly [Key, any], T extends Iterable<U> | AsyncIterable<U>>(iterable: T): ReturnValueType<T, {
[K in IterableInfer<T> as K[0]]: K[1];
}>;

Example

const arr = [
["a", 1],
["b", true],
["c", "hello"],
["d", { d1: 1, d2: 3 }],
] as (
| ["a", number]
| ["b", boolean]
| ["c", string]
| ["d", { d1: number, d2: number; }]
)[];
fromEntries(arr); // { a: 1, b: true, c: 'hello', d: { d1: 1, d2: 3 } }
-

see entries

+

see entries

+

Open Source Code

\ No newline at end of file diff --git a/docs/function-composition/index.html b/docs/function-composition/index.html index de73f0e0..b6861e6e 100644 --- a/docs/function-composition/index.html +++ b/docs/function-composition/index.html @@ -12,7 +12,7 @@ - + diff --git a/docs/fx/index.html b/docs/fx/index.html index 415b5cf9..f26fae05 100644 --- a/docs/fx/index.html +++ b/docs/fx/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@ Signature:
declare function fx<T extends Iterable<unknown> | AsyncIterable<unknown>>(a: T): T extends Iterable<unknown> ? FxIterable<IterableInfer<T>> : FxAsyncIterable<IterableInfer<T>>;

Example

-
const syncArr1 = fx([1, 2, 3, 4])
.map((a) => a + 10)
.toArray(); // [11, 12, 13, 14]

// If you want to use another function that is not provided for the method, use `chain`.
const syncArr2 = fx([1, 2, 3, 4])
.chain(append(5))
.map((a) => a + 10)
.toArray(); // [11, 12, 13, 14, 15]

const asyncArr1 = await fx([1, 2, 3, 4])
.toAsync()
.map((a) => a + 10)
.toArray(); // [11, 12, 13, 14]

const asyncArr2 = await fx(toAsync([1, 2, 3, 4]))
.map((a) => a + 10)
.toArray(); // [11, 12, 13, 14]
+
const syncArr1 = fx([1, 2, 3, 4])
.map((a) => a + 10)
.toArray(); // [11, 12, 13, 14]

// If you want to use another function that is not provided for the method, use `chain`.
const syncArr2 = fx([1, 2, 3, 4])
.chain(append(5))
.map((a) => a + 10)
.toArray(); // [11, 12, 13, 14, 15]

const asyncArr1 = await fx([1, 2, 3, 4])
.toAsync()
.map((a) => a + 10)
.toArray(); // [11, 12, 13, 14]

const asyncArr2 = await fx(toAsync([1, 2, 3, 4]))
.map((a) => a + 10)
.toArray(); // [11, 12, 13, 14]
+

Open Source Code

\ No newline at end of file diff --git a/docs/getting-started/index.html b/docs/getting-started/index.html index 0e47b1dd..f41d4281 100644 --- a/docs/getting-started/index.html +++ b/docs/getting-started/index.html @@ -12,7 +12,7 @@ - + diff --git a/docs/groupBy/index.html b/docs/groupBy/index.html index 1d24c100..25783c9f 100644 --- a/docs/groupBy/index.html +++ b/docs/groupBy/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function groupBy<A extends Key>(f: (a: A) => A, iterable: Iterable<A>): {
[K in A]: K[];
};

declare function groupBy<A, B extends Key>(f: (a: A) => B, iterable: Iterable<A>): {
[K in B]: A[];
};

declare function groupBy<A extends Key>(f: (a: A) => A | Promise<A>, iterable: AsyncIterable<A>): Promise<{
[K in A]: K[];
}>;

declare function groupBy<A, B extends Key>(f: (a: A) => B | Promise<B>, iterable: AsyncIterable<A>): Promise<{
[K in B]: A[];
}>;

declare function groupBy<A extends Key, B extends Iterable<A> | AsyncIterable<A>>(f: (a: A) => A | Promise<A>): (iterable: B) => ReturnValueType<B, {
[K in A]: K[];
}>;

declare function groupBy<A extends object, B extends Key & A[keyof A]>(f: (a: A) => B, iterable: Iterable<A>): {
[K in B]: (A & {
[K2 in GetKeyOf<A, B>]: K;
})[];
};

declare function groupBy<A extends object, B extends Key & A[keyof A]>(f: (a: A) => B | Promise<B>, iterable: AsyncIterable<A>): Promise<{
[K in B]: (A & {
[K2 in GetKeyOf<A, B>]: K;
})[];
}>;

declare function groupBy<A extends Iterable<unknown> | AsyncIterable<unknown>, B extends Key>(f: (a: IterableInfer<A>) => B | Promise<B>): (iterable: A) => ReturnValueType<A, {
[K in B]: IterableInfer<A>[];
}>;

declare function groupBy<I extends Iterable<unknown> | AsyncIterable<unknown>, F extends (a: IterableInfer<I>) => any>(f: F): (iterable: I) => ReturnValueType<I, Equals<Awaited<ReturnType<F>>, IterableInfer<I>> extends 1 ? {
[key1 in Awaited<ReturnType<F>>]: key1[];
} : {
[key1 in Awaited<ReturnType<F>>]: (IterableInfer<I> & {
[key2 in GetKeyOf<Cast<IterableInfer<I>, object>, key1>]: key1;
})[];
}>;

Example

const given = [
{ category: "clothes", desc: "good" },
{ category: "pants", desc: "bad" },
{ category: "shoes", desc: "not bad" },
{ category: "shoes", desc: "great" },
{ category: "pants", desc: "good" },
];

groupBy((a) => a.category, given);
// {
// clothes: [{ category: "clothes", desc: "good" }],
// pants: [
// { category: "pants", desc: "bad" },
// { category: "pants", desc: "good" },
// ],
// shoes: [
// { category: "shoes", desc: "not bad" },
// { category: "shoes", desc: "great" },
// ],
// };
-

Try It

+

Try It

+

Open Source Code

\ No newline at end of file diff --git a/docs/gt/index.html b/docs/gt/index.html index 50cc2311..1b3f1d67 100644 --- a/docs/gt/index.html +++ b/docs/gt/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function gt(a: Date, b: Date): boolean;

declare function gt(a: Date): (b: Date) => boolean;

declare function gt(a: string, b: string): boolean;

declare function gt(a: number, b: number): boolean;

declare function gt(a: string): (b: string) => boolean;

declare function gt(a: number): (b: number) => boolean;

Example

-
gt(5, 1) // expected true
gt(1, 5) // expected false
gt("a", "b") // expected false
gt("b", "a") // expected true

filter(gt(5), [1, 2, 4, 5, 8, 9]) // Iterable<[1, 2, 4]>
filter(gt(1), [1, 2, 3, 4, 5]) // Iterable<[]>
filter(gt("b"), ["a", "b", "c"]) // Iterable<["a"]>
filter(gt("a"), ["a", "b"]) // Itreable<[]>
+
gt(5, 1) // expected true
gt(1, 5) // expected false
gt("a", "b") // expected false
gt("b", "a") // expected true

filter(gt(5), [1, 2, 4, 5, 8, 9]) // Iterable<[1, 2, 4]>
filter(gt(1), [1, 2, 3, 4, 5]) // Iterable<[]>
filter(gt("b"), ["a", "b", "c"]) // Iterable<["a"]>
filter(gt("a"), ["a", "b"]) // Itreable<[]>
+

Open Source Code

\ No newline at end of file diff --git a/docs/gte/index.html b/docs/gte/index.html index f222e0c2..4f7c7c18 100644 --- a/docs/gte/index.html +++ b/docs/gte/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function gte(a: Date, b: Date): boolean;

declare function gte(a: Date): (b: Date) => boolean;

declare function gte(a: string, b: string): boolean;

declare function gte(a: number, b: number): boolean;

declare function gte(a: string): (b: string) => boolean;

declare function gte(a: number): (b: number) => boolean;

Example

-
gte(5, 1) // expected true
gte(1, 1) // expected true
gte(1, 5) // expected false
gte("a", "b") // expected false
gte("b", "a") // expected true

filter(gte(5), [1, 2, 4, 5, 8, 9]) // Iterable<[1, 2, 4, 5]>
filter(gte(1), [2, 3, 4]) // Iterable<[]>
filter(gte("b"), ["a", "b", "c"]) // Iterable<["a", "b"]>
filter(gte("a"), ["b"]) // Itreable<[]>
+
gte(5, 1) // expected true
gte(1, 1) // expected true
gte(1, 5) // expected false
gte("a", "b") // expected false
gte("b", "a") // expected true

filter(gte(5), [1, 2, 4, 5, 8, 9]) // Iterable<[1, 2, 4, 5]>
filter(gte(1), [2, 3, 4]) // Iterable<[]>
filter(gte("b"), ["a", "b", "c"]) // Iterable<["a", "b"]>
filter(gte("a"), ["b"]) // Itreable<[]>
+

Open Source Code

\ No newline at end of file diff --git a/docs/handle-concurrency/index.html b/docs/handle-concurrency/index.html index ff55a416..a24487f5 100644 --- a/docs/handle-concurrency/index.html +++ b/docs/handle-concurrency/index.html @@ -12,7 +12,7 @@ - + diff --git a/docs/head/index.html b/docs/head/index.html index fd46fbe9..f3d6b09f 100644 --- a/docs/head/index.html +++ b/docs/head/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

head([1, 2, 3, 4, 5]); // 1

// with pipe
pipe(
[1, 2, 3, 4, 5],
head,
); // 1

await pipe(
Promise.resolve([1, 2, 3, 4, 5]),
head,
); // 1

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],
toAsync,
head,
); // 1

Try It

-

see pipe, toAsync

+

see pipe, toAsync

+

Open Source Code

\ No newline at end of file diff --git a/docs/how-to-debug/index.html b/docs/how-to-debug/index.html index a22995da..da6dbfbf 100644 --- a/docs/how-to-debug/index.html +++ b/docs/how-to-debug/index.html @@ -12,7 +12,7 @@ - + diff --git a/docs/identity/index.html b/docs/identity/index.html index 7f7bae34..585f3050 100644 --- a/docs/identity/index.html +++ b/docs/identity/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function identity<T>(a: T): T;

Example

-
identity(5); // 5
+
identity(5); // 5
+

Open Source Code

\ No newline at end of file diff --git a/docs/includes/index.html b/docs/includes/index.html index ca46210c..ac1bee6a 100644 --- a/docs/includes/index.html +++ b/docs/includes/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function includes<T>(value: unknown, iterable: Iterable<T>): boolean;

declare function includes<T extends readonly []>(value: unknown, iterable: T): false;

declare function includes<T, U extends T>(value: T, iterable: Iterable<U>): value is U;

declare function includes<T>(value: unknown, iterable: AsyncIterable<T>): Promise<boolean>;

declare function includes<T extends Iterable<unknown> | AsyncIterable<unknown>>(value: unknown): (iterable: T) => ReturnValueType<T, boolean>;

Example

-
includes('c', 'abcd'); // true
includes('e', 'abcd'); // false
includes(3, [1,2,3,4]); // true
includes(5, [1,2,3,4]); // false
+
includes('c', 'abcd'); // true
includes('e', 'abcd'); // false
includes(3, [1,2,3,4]); // true
includes(5, [1,2,3,4]); // false
+

Open Source Code

\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 7abce64c..f5e77717 100644 --- a/docs/index.html +++ b/docs/index.html @@ -12,7 +12,7 @@ - + diff --git a/docs/indexBy/index.html b/docs/indexBy/index.html index 63726d0f..f3d8442c 100644 --- a/docs/indexBy/index.html +++ b/docs/indexBy/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function indexBy<A extends Key>(f: (a: A) => A, iterable: Iterable<A>): {
[K in A]: K;
};

declare function indexBy<A, B extends Key>(f: (a: A) => B, iterable: Iterable<A>): {
[K in B]: A;
};

declare function indexBy<A extends Key>(f: (a: A) => A | Promise<A>, iterable: AsyncIterable<A>): Promise<{
[K in A]: K;
}>;

declare function indexBy<A, B extends Key>(f: (a: A) => B | Promise<B>, iterable: AsyncIterable<A>): Promise<{
[K in B]: A;
}>;

declare function indexBy<A extends object, B extends Key & A[keyof A]>(f: (a: A) => B, iterable: Iterable<A>): {
[K in B]: A & {
[K2 in GetKeyOf<A, B>]: K;
};
};

declare function indexBy<A extends object, B extends Key & A[keyof A]>(f: (a: A) => B | Promise<B>, iterable: AsyncIterable<A>): Promise<{
[K in B]: A & {
[K2 in GetKeyOf<A, B>]: K;
};
}>;

declare function indexBy<A extends Iterable<unknown> | AsyncIterable<unknown>, B extends Key>(f: (a: IterableInfer<A>) => B | Promise<B>): (iterable: A) => ReturnValueType<A, {
[K in B]: IterableInfer<A>;
}>;

declare function indexBy<I extends Iterable<unknown> | AsyncIterable<unknown>, F extends (a: IterableInfer<I>) => any>(f: F): (iterable: I) => ReturnValueType<I, Equals<Awaited<ReturnType<F>>, IterableInfer<I>> extends 1 ? {
[key1 in Awaited<ReturnType<F>>]: key1;
} : {
[key1 in Awaited<ReturnType<F>>]: IterableInfer<I> & {
[key2 in GetKeyOf<Cast<IterableInfer<I>, object>, key1>]: key1;
};
}>;

Example

const given = [
{ category: "clothes", desc: "good" },
{ category: "pants", desc: "bad" },
{ category: "shoes", desc: "not bad" },
];

indexBy(a => a.category, given);
// {
// clothes: { category: "clothes", desc: "good" },
// pants: { category: "pants", desc: "bad" },
// shoes: { category: "shoes", desc: "not bad" },
// };
-

Try It

+

Try It

+

Open Source Code

\ No newline at end of file diff --git a/docs/intersection/index.html b/docs/intersection/index.html index b948d726..d812eaec 100644 --- a/docs/intersection/index.html +++ b/docs/intersection/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function intersection<T>(iterable1: Iterable<T>, iterable2: Iterable<T>): IterableIterator<T>;

declare function intersection<T>(iterable1: AsyncIterable<T>, iterable2: Iterable<T>): AsyncIterableIterator<T>;

declare function intersection<T>(iterable1: Iterable<T>, iterable2: AsyncIterable<T>): AsyncIterableIterator<T>;

declare function intersection<T>(iterable1: AsyncIterable<T>, iterable2: AsyncIterable<T>): AsyncIterableIterator<T>;

declare function intersection<A extends Iterable<unknown> | AsyncIterable<unknown>, B extends Iterable<unknown> | AsyncIterable<unknown>>(iterable1: A): (iterable2: B) => A extends AsyncIterable<unknown> ? AsyncIterableIterator<IterableInfer<B>> : B extends AsyncIterable<unknown> ? AsyncIterableIterator<IterableInfer<B>> : IterableIterator<IterableInfer<B>>;

Example

-
const iter = intersection([2, 1], [2, 3, 4]);
iter.next(); // {value: 2, done:false}
iter.next(); // {value: undefined, done: true}
+
const iter = intersection([2, 1], [2, 3, 4]);
iter.next(); // {value: 2, done:false}
iter.next(); // {value: undefined, done: true}
+

Open Source Code

\ No newline at end of file diff --git a/docs/intersectionBy/index.html b/docs/intersectionBy/index.html index 6413a76e..dff291ab 100644 --- a/docs/intersectionBy/index.html +++ b/docs/intersectionBy/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function intersectionBy<A, B = unknown>(f: (a: A) => B, iterable1: Iterable<A>, iterable2: Iterable<A>): IterableIterator<A>;

declare function intersectionBy<A, B = unknown>(f: (a: A) => B, iterable1: AsyncIterable<A>, iterable2: Iterable<A>): AsyncIterableIterator<A>;

declare function intersectionBy<A, B = unknown>(f: (a: A) => B, iterable1: Iterable<A>, iterable2: AsyncIterable<A>): AsyncIterableIterator<A>;

declare function intersectionBy<A, B = unknown>(f: (a: A) => B, iterable1: AsyncIterable<A>, iterable2: AsyncIterable<A>): AsyncIterableIterator<A>;

Example

-
const iter = intersectionBy(a => a.x, [{ x: 1 }, { x: 4 }], [{ x: 1 },  { x: 2 },  { x: 3 }])
iter.next(); // {value: {x: 1, done: false}
iter.next(); // {value: undefined, done: true}
+
const iter = intersectionBy(a => a.x, [{ x: 1 }, { x: 4 }], [{ x: 1 },  { x: 2 },  { x: 3 }])
iter.next(); // {value: {x: 1, done: false}
iter.next(); // {value: undefined, done: true}
+

Open Source Code

\ No newline at end of file diff --git a/docs/isArray/index.html b/docs/isArray/index.html index 07005263..a984aa17 100644 --- a/docs/isArray/index.html +++ b/docs/isArray/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
isArray: <T>(a: T) => a is Include<T, unknown[] | readonly unknown[]>

Example

-
isArray([1, 2, 3]); // true
isArray(2); // false
+
isArray([1, 2, 3]); // true
isArray(2); // false
+

Open Source Code

\ No newline at end of file diff --git a/docs/isBoolean/index.html b/docs/isBoolean/index.html index 1cac9367..002193e3 100644 --- a/docs/isBoolean/index.html +++ b/docs/isBoolean/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
isBoolean: <T>(n: T) => n is Include<T, boolean>

Example

-
isBoolean(true); // true
isBoolean(null); // false
isBoolean("FxTS"); // false
+
isBoolean(true); // true
isBoolean(null); // false
isBoolean("FxTS"); // false
+

Open Source Code

\ No newline at end of file diff --git a/docs/isEmpty/index.html b/docs/isEmpty/index.html index 888e6fc6..f51a0984 100644 --- a/docs/isEmpty/index.html +++ b/docs/isEmpty/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
isEmpty: <T>(value: T) => boolean

Example

-
isEmpty({}) // true
isEmpty([]) // true
isEmpty(null) // true
isEmpty(undefined) // true
isEmpty("") // true
isEmpty(new Map()) // true
isEmpty(new Set()) // true

isEmpty(0) // false
isEmpty(false) // false
isEmpty(function(){}) // false
isEmpty(Symbol("")) // false
isEmpty(new Date()) // false
+
isEmpty({}) // true
isEmpty([]) // true
isEmpty(null) // true
isEmpty(undefined) // true
isEmpty("") // true
isEmpty(new Map()) // true
isEmpty(new Set()) // true

isEmpty(0) // false
isEmpty(false) // false
isEmpty(function(){}) // false
isEmpty(Symbol("")) // false
isEmpty(new Date()) // false
+

Open Source Code

\ No newline at end of file diff --git a/docs/isNil/index.html b/docs/isNil/index.html index 964c6130..cbe9de53 100644 --- a/docs/isNil/index.html +++ b/docs/isNil/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
isNil: <T>(a: T) => a is Include<T, null | undefined>

Example

-
isNil(1); // false
isNil('1'); // false
isNil(undefined); // true
isNil(null); // true
+
isNil(1); // false
isNil('1'); // false
isNil(undefined); // true
isNil(null); // true
+

Open Source Code

\ No newline at end of file diff --git a/docs/isNull/index.html b/docs/isNull/index.html index cd846337..952eaddf 100644 --- a/docs/isNull/index.html +++ b/docs/isNull/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
isNull: <T>(input: T) => input is Include<T, null>

Example

-
isNull(1); // false
isNull('1'); // false
isNull(undefined); // false
isNull(null); // true
+
isNull(1); // false
isNull('1'); // false
isNull(undefined); // false
isNull(null); // true
+

Open Source Code

\ No newline at end of file diff --git a/docs/isNumber/index.html b/docs/isNumber/index.html index 2092653d..9fa5c86d 100644 --- a/docs/isNumber/index.html +++ b/docs/isNumber/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
isNumber: <T>(n: T) => n is Include<T, number>

Example

-
isNumber(2); // true
isNumber("a"); // false
+
isNumber(2); // true
isNumber("a"); // false
+

Open Source Code

\ No newline at end of file diff --git a/docs/isObject/index.html b/docs/isObject/index.html index fa9a1823..7c86f435 100644 --- a/docs/isObject/index.html +++ b/docs/isObject/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
isObject: <T>(a: T) => a is Include<T, object>

Example

-
isObject({}); // true
isObject([1, 2, 3]); // true
isObject(() => {}); // true
isObject(null); // false
isObject(123); // false
+
isObject({}); // true
isObject([1, 2, 3]); // true
isObject(() => {}); // true
isObject(null); // false
isObject(123); // false
+

Open Source Code

\ No newline at end of file diff --git a/docs/isString/index.html b/docs/isString/index.html index bdbb9d22..f9f5982f 100644 --- a/docs/isString/index.html +++ b/docs/isString/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
isString: <T>(s: T) => s is Include<T, string>

Example

-
isString("a"); // true
isString(2); // false
+
isString("a"); // true
isString(2); // false
+

Open Source Code

\ No newline at end of file diff --git a/docs/isUndefined/index.html b/docs/isUndefined/index.html index 29eca09b..931e0c79 100644 --- a/docs/isUndefined/index.html +++ b/docs/isUndefined/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
isUndefined: <T>(a: T) => a is Include<T, undefined>

Example

-
isUndefined(undefined); // true
isUndefined(2); // false
+
isUndefined(undefined); // true
isUndefined(2); // false
+

Open Source Code

\ No newline at end of file diff --git a/docs/join/index.html b/docs/join/index.html index abdc2b12..1df599ae 100644 --- a/docs/join/index.html +++ b/docs/join/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function join<A>(sep: string, iterable: Iterable<A>): string;

declare function join<A extends readonly []>(sep: string, iterable: A): "";

declare function join<A>(sep: string, iterable: AsyncIterable<A>): Promise<string>;

declare function join<A extends Iterable<unknown> | AsyncIterable<unknown>>(sep: string): (iterable: A) => ReturnJoinType<A>;

Example

-
const joined = join('~', ['a', 'b', 'c']); // 'a~b~c'

// with pipe
pipe(
[1, 2, 3, 4],
map(a => a + 10),
filter(a => a % 2 === 0)
join('-'),
); // '12-14'

await pipe(
Promise.resolve([1, 2, 3, 4]),
join('-'),
); // '1-2-3-4'

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],
toAsync,
join('-'),
); // '1-2-3-4'
+
const joined = join('~', ['a', 'b', 'c']); // 'a~b~c'

// with pipe
pipe(
[1, 2, 3, 4],
map(a => a + 10),
filter(a => a % 2 === 0)
join('-'),
); // '12-14'

await pipe(
Promise.resolve([1, 2, 3, 4]),
join('-'),
); // '1-2-3-4'

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],
toAsync,
join('-'),
); // '1-2-3-4'
+

Open Source Code

\ No newline at end of file diff --git a/docs/juxt/index.html b/docs/juxt/index.html index b5edaf44..f27c3b10 100644 --- a/docs/juxt/index.html +++ b/docs/juxt/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function juxt<FS extends Array<Arrow>>(fs: readonly [...FS]): (...args: JuxtArgs<FS>) => JuxtReturnTypes<FS>;

Example

const range = juxt([Math.min, Math.max])(1, 2, 3, 4); // [1, 4]

// with pipe
const entries = (obj: { a: number; b: number }) =>
pipe(
[Object.keys, Object.values] as const,
juxt,
(f) => f(obj),
apply(zip),
toArray,
);

entries({ a: 1, b: 2 }); // [ ["a", 1], ["b", 2] ]
-

see pipe, apply

+

see pipe, apply

+

Open Source Code

\ No newline at end of file diff --git a/docs/keys/index.html b/docs/keys/index.html index 601950b1..e01b0c3f 100644 --- a/docs/keys/index.html +++ b/docs/keys/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function keys<T extends Record<string, any>>(obj: T): Generator<Extract<keyof T, string>, void, unknown>;

Example

-
[...keys({ a: 1, b: "2", c: true })]
// ["a", "b", "c"]
+
[...keys({ a: 1, b: "2", c: true })]
// ["a", "b", "c"]
+

Open Source Code

\ No newline at end of file diff --git a/docs/last/index.html b/docs/last/index.html index df23acd4..a115203b 100644 --- a/docs/last/index.html +++ b/docs/last/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

last([1, 2, 3, 4, 5]); // 5

// with pipe
pipe(
[1, 2, 3, 4, 5],
last,
); // 5

await pipe(
Promise.resolve([1, 2, 3, 4, 5]),
last,
); // 5

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],
toAsync,
last,
); // 3

Try It

-

see pipe, toAsync

+

see pipe, toAsync

+

Open Source Code

\ No newline at end of file diff --git a/docs/lazy-evaluation/index.html b/docs/lazy-evaluation/index.html index c6e0f117..5a9ec904 100644 --- a/docs/lazy-evaluation/index.html +++ b/docs/lazy-evaluation/index.html @@ -12,7 +12,7 @@ - + diff --git a/docs/lt/index.html b/docs/lt/index.html index 1da7ddc6..c6ff9e49 100644 --- a/docs/lt/index.html +++ b/docs/lt/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function lt(a: Date, b: Date): boolean;

declare function lt(a: Date): (b: Date) => boolean;

declare function lt(a: string, b: string): boolean;

declare function lt(a: number, b: number): boolean;

declare function lt(a: string): (b: string) => boolean;

declare function lt(a: number): (b: number) => boolean;

Example

-
lt(5, 1) // expected false
lt(1, 5) // expected true
lt("a", "b") // expected true
lt("b", "a") // expected false

filter(lt(5), [1, 2, 4, 5, 8, 9]) // Iterable<[8, 9]>
filter(lt(7), [5, 6, 7]) // Iterable<[]>
filter(lt("b"), ["a", "b", "c"]) // Iterable<["c"]>
filter(lt("e"), ["b", "c", "d"]) // Itreable<[]>
+
lt(5, 1) // expected false
lt(1, 5) // expected true
lt("a", "b") // expected true
lt("b", "a") // expected false

filter(lt(5), [1, 2, 4, 5, 8, 9]) // Iterable<[8, 9]>
filter(lt(7), [5, 6, 7]) // Iterable<[]>
filter(lt("b"), ["a", "b", "c"]) // Iterable<["c"]>
filter(lt("e"), ["b", "c", "d"]) // Itreable<[]>
+

Open Source Code

\ No newline at end of file diff --git a/docs/lte/index.html b/docs/lte/index.html index 443ecf4b..7b4561a3 100644 --- a/docs/lte/index.html +++ b/docs/lte/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function lte(a: Date, b: Date): boolean;

declare function lte(a: Date): (b: Date) => boolean;

declare function lte(a: string, b: string): boolean;

declare function lte(a: number, b: number): boolean;

declare function lte(a: string): (b: string) => boolean;

declare function lte(a: number): (b: number) => boolean;

Example

-
lte(5, 1) // expected false
lte(1, 1) // expected true
lte(1, 5) // expected true
lte("a", "b") // expected true
lte("b", "a") // expected false

filter(lte(5), [1, 2, 4, 5, 8, 9]) // Iterable<[5, 8, 9]>
filter(lte(9), [6, 7, 8]) // Iterable<[]>
filter(lte("b"), ["a", "b", "c"]) // Iterable<["b", "c"]>
filter(lte("e"), ["c", "d"]) // Itreable<[]>
+
lte(5, 1) // expected false
lte(1, 1) // expected true
lte(1, 5) // expected true
lte("a", "b") // expected true
lte("b", "a") // expected false

filter(lte(5), [1, 2, 4, 5, 8, 9]) // Iterable<[5, 8, 9]>
filter(lte(9), [6, 7, 8]) // Iterable<[]>
filter(lte("b"), ["a", "b", "c"]) // Iterable<["b", "c"]>
filter(lte("e"), ["c", "d"]) // Itreable<[]>
+

Open Source Code

\ No newline at end of file diff --git a/docs/map/index.html b/docs/map/index.html index a06e5c48..5c71ac9e 100644 --- a/docs/map/index.html +++ b/docs/map/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = map(a => a + 10, [1, 2, 3, 4]);
iter.next() // {done:false, value: 11}
iter.next() // {done:false, value: 12}
iter.next() // {done:false, value: 13}
iter.next() // {done:false, value: 14},
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[1, 2, 3, 4],
map(a => a + 10),
toArray,
); // [11, 12, 13, 14]

await pipe(
Promise.resolve([1, 2, 3, 4]),
map(a => a + 10),
toArray,
); // [11, 12, 13, 14]

// if you want to use asynchronous callback
await pipe(
Promise.resolve([1, 2, 3, 4]),
toAsync,
map(async (a) => a + 10),
toArray,
); // [11, 12, 13, 14]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],
toAsync,
map(a => a + 10),
toArray,
); // [11, 12, 13, 14]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/max/index.html b/docs/max/index.html index ad60f31d..a1610f92 100644 --- a/docs/max/index.html +++ b/docs/max/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function max<A extends Iterable<number> | AsyncIterable<number>>(iterable: A): ReturnValueType<A, number>;

Example

-
max([1, 3, 5]); // 5;
max([1, NaN, 2]); // NaN;
max([1, Infinity, 2]); // Infinity;
max([]); // -Infinity
+
max([1, 3, 5]); // 5;
max([1, NaN, 2]); // NaN;
max([1, Infinity, 2]); // Infinity;
max([]); // -Infinity
+

Open Source Code

\ No newline at end of file diff --git a/docs/memoize/index.html b/docs/memoize/index.html index bee5db66..506a3384 100644 --- a/docs/memoize/index.html +++ b/docs/memoize/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function memoize<F extends (...args: any[]) => any, K extends Parameters<F>[0], Return extends F & {
cache: K extends object ? WeakMap<K, ReturnType<F>> : Map<K, ReturnType<F>>;
}>(f: F): Return;

declare function memoize<F extends (...args: any[]) => any, Resolver extends (...args: Parameters<F>) => any, K extends ReturnType<Resolver>, Return extends F & {
cache: K extends object ? WeakMap<K, ReturnType<F>> : Map<K, ReturnType<F>>;
}>(f: F, resolver: Resolver): Return;

Example

-
const add10 = (a: number): number => a + 10;

const memoized = memoize(add10);
console.log(memoized(5)); // 15
console.log(memoized(10)) // 20
console.log(memoized(5)); // 15 (cached)

memoized.cache.clear(); // clear cache
console.log(memoized(5)); // 15 (no cache)
+
const add10 = (a: number): number => a + 10;

const memoized = memoize(add10);
console.log(memoized(5)); // 15
console.log(memoized(10)) // 20
console.log(memoized(5)); // 15 (cached)

memoized.cache.clear(); // clear cache
console.log(memoized(5)); // 15 (no cache)
+

Open Source Code

\ No newline at end of file diff --git a/docs/method-chaining/index.html b/docs/method-chaining/index.html index aeedf355..3143ac2f 100644 --- a/docs/method-chaining/index.html +++ b/docs/method-chaining/index.html @@ -12,7 +12,7 @@ - + diff --git a/docs/min/index.html b/docs/min/index.html index bdb17b82..eadd3e92 100644 --- a/docs/min/index.html +++ b/docs/min/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function min<A extends Iterable<number> | AsyncIterable<number>>(iterable: A): ReturnValueType<A, number>;

Example

-
min([1, 3, 5]); // 1;
min([1, NaN, 2]); // NaN;
min([1, Infinity, 3]); // 1;
min([1, -Infinity, 3]); // -Infinity;
min([]); // Infinity
+
min([1, 3, 5]); // 1;
min([1, NaN, 2]); // NaN;
min([1, Infinity, 3]); // 1;
min([1, -Infinity, 3]); // -Infinity;
min([]); // Infinity
+

Open Source Code

\ No newline at end of file diff --git a/docs/negate/index.html b/docs/negate/index.html index 1a5717b1..98c698b5 100644 --- a/docs/negate/index.html +++ b/docs/negate/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function negate<T>(predicate: (input: T) => boolean): (input: T) => boolean;

declare function negate<T, N extends T>(predicate: (input: T) => input is N): (input: T) => input is Exclude<T, N>;

Example

-
const isDefined: (input: string | undefined) => input is string = negate(isUndefined)<string | undefined>

const isDefined: (input: unknown) => boolean = negate((input) => input === undefined)
+
const isDefined: (input: string | undefined) => input is string = negate(isUndefined)<string | undefined>

const isDefined: (input: unknown) => boolean = negate((input) => input === undefined)
+

Open Source Code

\ No newline at end of file diff --git a/docs/noop/index.html b/docs/noop/index.html index 8e7e5ca4..ea1365b3 100644 --- a/docs/noop/index.html +++ b/docs/noop/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@ Returns:

void

Example

-
noop() // undefined
+
noop() // undefined
+

Open Source Code

\ No newline at end of file diff --git a/docs/not/index.html b/docs/not/index.html index b1aec366..646bf6b0 100644 --- a/docs/not/index.html +++ b/docs/not/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function not(a: unknown): boolean;

Example

not(true); // false
not(1); // false
not(NaN); // true
-

Try It

+

Try It

+

Open Source Code

\ No newline at end of file diff --git a/docs/nth/index.html b/docs/nth/index.html index 0aef0e1c..757eb69d 100644 --- a/docs/nth/index.html +++ b/docs/nth/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function nth(index: number, iterable: readonly []): undefined;

declare function nth<T>(index: number, iterable: Iterable<T>): T | undefined;

declare function nth<T>(index: number, iterable: AsyncIterable<T>): Promise<T | undefined>;

declare function nth<T extends Iterable<unknown> | AsyncIterable<unknown>>(index: number): (iterable: T) => ReturnValueType<T, IterableInfer<T> | undefined>;

Example

-
nth(2, [1,2,3,4]); // 3
nth(5, [1,2,3,4]); // undefined
nth(2, ['name', 'gender', 'age']); // 'age'
nth(3, ['name', 'gender', 'age']); // undefined
nth(2, 'abcdefg'); // 'c'
nth(10, 'abcdefg'); // undefined
+
nth(2, [1,2,3,4]); // 3
nth(5, [1,2,3,4]); // undefined
nth(2, ['name', 'gender', 'age']); // 'age'
nth(3, ['name', 'gender', 'age']); // undefined
nth(2, 'abcdefg'); // 'c'
nth(10, 'abcdefg'); // undefined
+

Open Source Code

\ No newline at end of file diff --git a/docs/omit/index.html b/docs/omit/index.html index 56aded86..2aff6f98 100644 --- a/docs/omit/index.html +++ b/docs/omit/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function omit<T extends object, U extends Iterable<keyof T>>(iterable: U, obj: T): Omit<T, IterableInfer<U>>;

declare function omit<T extends object, U extends Iterable<keyof T>>(iterable: U): (obj: T) => Omit<T, IterableInfer<U>>;

declare function omit<T extends object, U extends AsyncIterable<keyof T>>(iterable: U, obj: T): Promise<Omit<T, IterableInfer<U>>>;

declare function omit<T extends object, U extends AsyncIterable<keyof T>>(iterable: U): (obj: T) => Promise<Omit<T, IterableInfer<U>>>;

Example

const person = {
name: "james",
age: 40,
numberOfKids: 2,
team: "Software Development",
preferredLanguage: "Rust",
};

const dad = omit(["team", "preferredLanguage"], person);
// { name: "james", age: 40, numberOfKids: 2 }

const developer = omit(["age", "numberOfKids"], person);
// { name: "james", team: "Software Development", preferredLanguage: "Rust" }

// with pipe
pipe(
person,
omit(["team", "preferredLanguage"]),
);

// if you want to use AsyncIterable as the list of property names
const anonymous = await omit(toAsync(["name"] as const), person);
-

see pipe, toAsync, pick,

+

see pipe, toAsync, pick,

+

Open Source Code

\ No newline at end of file diff --git a/docs/omitBy/index.html b/docs/omitBy/index.html index 7517c47d..2aa62790 100644 --- a/docs/omitBy/index.html +++ b/docs/omitBy/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function omitBy<T extends object, F extends EntryPredicate<T>>(f: F, obj: T): Partial<T>;

declare function omitBy<T extends object, F extends EntryPredicate<T>>(f: F): (obj: T) => Partial<T>;

declare function omitBy<T extends object, F extends AsyncEntryPredicate<T>>(f: F, obj: T): Promise<Partial<T>>;

declare function omitBy<T extends object, F extends AsyncEntryPredicate<T>>(f: F): (obj: T) => Promise<Partial<T>>;

declare function omitBy<T extends object, F extends ConditionalAsyncEntryPredicate<T>>(f: F, obj: T): Partial<T> | Promise<Partial<T>>;

declare function omitBy<T extends object, F extends ConditionalAsyncEntryPredicate<T>>(f: F): (obj: T) => Partial<T> | Promise<Partial<T>>;

Example

const obj = { a: 1, b: "2", c: true };
omitBy(([key, value]) => key === "a" || value === true, obj); // { b: "2" }

// asynchronous predicate
await omitBy(async ([key, value]) => key === "a" || value === true, obj); // { b: "2" }

// Using with the `pipe` function
pipe(
obj,
omitBy(([key, value]) => key === "a" || value === true)
);

await pipe(
obj,
omitBy(async ([key, value]) => key === "a" || value === true)
);
-

see pipe, omit,

+

see pipe, omit,

+

Open Source Code

\ No newline at end of file diff --git a/docs/partition/index.html b/docs/partition/index.html index 5cabb270..55a42411 100644 --- a/docs/partition/index.html +++ b/docs/partition/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

partition((a) => a % 2 === 0, [1, 2, 3, 4, 5]); // [[2, 4], [1, 3, 5]]

// with pipe
pipe(
[1, 2, 3, 4, 5],
partition((a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]
);

await pipe(
Promise.resolve([1, 2, 3, 4, 5]),
partition((a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]
);

// if you want to use asynchronous callback
await pipe(
Promise.resolve([1, 2, 3, 4, 5]),
toAsync,
partition(async (a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]
);

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)],
toAsync,
partition((a) => a % 2 === 0), // [[2, 4], [1, 3, 5]]
);

Try It

-

see pipe, toAsync

+

see pipe, toAsync

+

Open Source Code

\ No newline at end of file diff --git a/docs/peek/index.html b/docs/peek/index.html index b3bd94e8..99c08e35 100644 --- a/docs/peek/index.html +++ b/docs/peek/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = peek(a => console.log(a), [1, 2, 3, 4]);
iter.next() // {done:false, value: 1} // log 1
iter.next() // {done:false, value: 2} // log 2
iter.next() // {done:false, value: 3} // log 3
iter.next() // {done:false, value: 4} // log 4

// with pipe
pipe(
[1, 2, 3, 4],
peek(a => console.log(a)),
toArray,
); // [1, 2, 3, 4] // log 1,2,3,4

await pipe(
Promise.resolve([1, 2, 3, 4]),
peek(a => console.log(a)),
toArray,
); // [1, 2, 3, 4] // log 1,2,3,4

// if you want to use asynchronous callback
await pipe(
Promise.resolve([1, 2, 3, 4]),
toAsync,
peek(async (a) => console.log(a)),
toArray,
); // [1, 2, 3, 4] // log 1,2,3,4

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],
toAsync,
peek(a => console.log(a)),
toArray,
); // [1, 2, 3, 4] // log 1,2,3,4

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/pick/index.html b/docs/pick/index.html index 49f5c270..92896b42 100644 --- a/docs/pick/index.html +++ b/docs/pick/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function pick<T extends object, U extends readonly []>(iterable: U, obj: T): Record<string, never>;

declare function pick<T extends object, U extends Iterable<keyof T>>(iterable: U, obj: T): Pick<T, IterableInfer<U>>;

declare function pick<T extends object, U extends Iterable<keyof T>>(iterable: U): (obj: T) => Pick<T, IterableInfer<U>>;

declare function pick<T extends object, U extends AsyncIterable<keyof T>>(iterable: U, obj: T): Promise<Pick<T, IterableInfer<U>>>;

declare function pick<T extends object, U extends AsyncIterable<keyof T>>(iterable: U): (obj: T) => Promise<Pick<T, IterableInfer<U>>>;

Example

const person = {
name: "james",
age: 40,
numberOfKids: 2,
team: "Software Development",
preferredLanguage: "Rust",
};

const dad = pick(["name", "age", "numberOfKids"], person);
// { name: "james", age: 40, numberOfKids: 2 }

const developer = pick(["name", "team", "preferredLanguage"], person);
// { name: "james", team: "Software Development", preferredLanguage: "Rust" }

// with pipe
pipe(
person,
pick(["name", "age", "numberOfKids"]),
);

// if you want to use AsyncIterable as the list of property names
const anonymousDeveloper = await pick(toAsync(["preferredLanguage"] as const), person);
-

see pipe, toAsync, omit,

+

see pipe, toAsync, omit,

+

Open Source Code

\ No newline at end of file diff --git a/docs/pickBy/index.html b/docs/pickBy/index.html index 04999044..299a1c2d 100644 --- a/docs/pickBy/index.html +++ b/docs/pickBy/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function pickBy<T extends object, F extends EntryPredicate<T>>(f: F, obj: T): Partial<T>;

declare function pickBy<T extends object, F extends EntryPredicate<T>>(f: F): (obj: T) => Partial<T>;

declare function pickBy<T extends object, F extends AsyncEntryPredicate<T>>(f: F, obj: T): Promise<Partial<T>>;

declare function pickBy<T extends object, F extends AsyncEntryPredicate<T>>(f: F): (obj: T) => Promise<Partial<T>>;

declare function pickBy<T extends object, F extends ConditionalAsyncEntryPredicate<T>>(f: F, obj: T): Partial<T> | Promise<Partial<T>>;

declare function pickBy<T extends object, F extends ConditionalAsyncEntryPredicate<T>>(f: F): (obj: T) => Partial<T> | Promise<Partial<T>>;

Example

const obj = { a: 1, b: "2", c: true };
pickBy(([key, value]) => key === "a" || value === true, obj); // { a: 1, c: true }

// asynchronous predicate
await pickBy(async ([key, value]) => key === "a" || value === true, obj); // { a: 1, c: true }

// Using with the `pipe` function
pipe(
obj,
pickBy(([key, value]) => key === "a" || value === true)
);

await pipe(
obj,
pickBy(async ([key, value]) => key === "a" || value === true)
);
-

see pipe, pick,

+

see pipe, pick,

+

Open Source Code

\ No newline at end of file diff --git a/docs/pipe/index.html b/docs/pipe/index.html index bbef70a3..a47cfbdc 100644 --- a/docs/pipe/index.html +++ b/docs/pipe/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

pipe(
[1, 2, 3, 4, 5],
map(a => a + 10),
filter(a => a % 2 === 0),
toArray,
); // [12, 14]

await pipe(
Promise.resolve([1, 2, 3, 4, 5]),
map(a => a + 10),
filter(a => a % 2 === 0),
toArray,
); // [12, 14]

// if you want to use asynchronous callback
await pipe(
Promise.resolve([1, 2, 3, 4, 5]),
toAsync,
map(async (a) => a + 10),
filter((a) => a % 2 === 0),
toArray,
); // [12, 14]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)],
toAsync,
map(a => a + 10),
filter(a => a % 2 === 0),
toArray,
); // [12, 14]

Try It

-

see pipe, toAsync, map, filter

+

see pipe, toAsync, map, filter

+

Open Source Code

\ No newline at end of file diff --git a/docs/pipeLazy/index.html b/docs/pipeLazy/index.html index 63dd30e8..3d5edae9 100644 --- a/docs/pipeLazy/index.html +++ b/docs/pipeLazy/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function pipeLazy<T1, R>(f1: (a: Awaited<T1>) => R): ((a: T1) => ReturnPipeType<[T1, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, R]>);

declare function pipeLazy<T1, T2, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => R): ((a: T1) => ReturnPipeType<[T1, T2, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, R]>);

declare function pipeLazy<T1, T2, T3, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, R]>);

declare function pipeLazy<T1, T2, T3, T4, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, T9, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => T9, f9: (a: Awaited<T9>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, T9, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => T9, f9: (a: Awaited<T9>) => T10, f10: (a: Awaited<T10>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => T9, f9: (a: Awaited<T9>) => T10, f10: (a: Awaited<T10>) => T11, f11: (a: Awaited<T11>) => T12, f12: (a: Awaited<T12>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => T9, f9: (a: Awaited<T9>) => T10, f10: (a: Awaited<T10>) => T11, f11: (a: Awaited<T11>) => T12, f12: (a: Awaited<T12>) => T13, f13: (a: Awaited<T13>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => T9, f9: (a: Awaited<T9>) => T10, f10: (a: Awaited<T10>) => T11, f11: (a: Awaited<T11>) => T12, f12: (a: Awaited<T12>) => T13, f13: (a: Awaited<T13>) => T14, f14: (a: Awaited<T14>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => T9, f9: (a: Awaited<T9>) => T10, f10: (a: Awaited<T10>) => T11, f11: (a: Awaited<T11>) => T12, f12: (a: Awaited<T12>) => T13, f13: (a: Awaited<T13>) => T14, f14: (a: Awaited<T14>) => T15, f15: (a: Awaited<T15>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => T9, f9: (a: Awaited<T9>) => T10, f10: (a: Awaited<T10>) => T11, f11: (a: Awaited<T11>) => T12, f12: (a: Awaited<T12>) => T13, f13: (a: Awaited<T13>) => T14, f14: (a: Awaited<T14>) => T15, f15: (a: Awaited<T15>) => T16, f16: (a: Awaited<T16>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => T9, f9: (a: Awaited<T9>) => T10, f10: (a: Awaited<T10>) => T11, f11: (a: Awaited<T11>) => T12, f12: (a: Awaited<T12>) => T13, f13: (a: Awaited<T13>) => T14, f14: (a: Awaited<T14>) => T15, f15: (a: Awaited<T15>) => T16, f16: (a: Awaited<T16>) => T17, f17: (a: Awaited<T17>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => T9, f9: (a: Awaited<T9>) => T10, f10: (a: Awaited<T10>) => T11, f11: (a: Awaited<T11>) => T12, f12: (a: Awaited<T12>) => T13, f13: (a: Awaited<T13>) => T14, f14: (a: Awaited<T14>) => T15, f15: (a: Awaited<T15>) => T16, f16: (a: Awaited<T16>) => T17, f17: (a: Awaited<T17>) => T18, f18: (a: Awaited<T18>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => T9, f9: (a: Awaited<T9>) => T10, f10: (a: Awaited<T10>) => T11, f11: (a: Awaited<T11>) => T12, f12: (a: Awaited<T12>) => T13, f13: (a: Awaited<T13>) => T14, f14: (a: Awaited<T14>) => T15, f15: (a: Awaited<T15>) => T16, f16: (a: Awaited<T16>) => T17, f17: (a: Awaited<T17>) => T18, f18: (a: Awaited<T18>) => T19, f19: (a: Awaited<T19>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R]>);

declare function pipeLazy<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R>(f1: (a: Awaited<T1>) => T2, f2: (a: Awaited<T2>) => T3, f3: (a: Awaited<T3>) => T4, f4: (a: Awaited<T4>) => T5, f5: (a: Awaited<T5>) => T6, f6: (a: Awaited<T6>) => T7, f7: (a: Awaited<T7>) => T8, f8: (a: Awaited<T8>) => T9, f9: (a: Awaited<T9>) => T10, f10: (a: Awaited<T10>) => T11, f11: (a: Awaited<T11>) => T12, f12: (a: Awaited<T12>) => T13, f13: (a: Awaited<T13>) => T14, f14: (a: Awaited<T14>) => T15, f15: (a: Awaited<T15>) => T16, f16: (a: Awaited<T16>) => T17, f17: (a: Awaited<T17>) => T18, f18: (a: Awaited<T18>) => T19, f19: (a: Awaited<T19>) => T20, f20: (a: Awaited<T20>) => R): ((a: T1) => ReturnPipeType<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R]>) & ((a: Promise<T1>) => ReturnPipeType<[Promise<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R]>);

Example

pipeLazy(
map(a => a + 10),
filter(a => a % 2 === 0),
toArray,
)([1, 2, 3, 4, 5]); // [12, 14]

await pipeLazy(
map(a => a + 10),
filter(a => a % 2 === 0),
toArray,
)(Promise.resolve([1, 2, 3, 4, 5])); // [12, 14]

// if you want to use asynchronous callback
await pipeLazy(
toAsync,
map(async (a) => a + 10),
filter((a) => a % 2 === 0),
toArray,
)(Promise.resolve([1, 2, 3, 4, 5])); // [12, 14]

// with toAsync
await pipeLazy(
toAsync,
map(a => a + 10),
filter(a => a % 2 === 0),
toArray,
)([Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4), Promise.resolve(5)]); // [12, 14]
-

see toAsync, map, filter

+

see toAsync, map, filter

+

Open Source Code

\ No newline at end of file diff --git a/docs/pluck/index.html b/docs/pluck/index.html index 99a7e900..826b9e03 100644 --- a/docs/pluck/index.html +++ b/docs/pluck/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function pluck<O extends object, K extends keyof O>(key: K, iterable: Iterable<O>): IterableIterator<O[K]>;

declare function pluck<O extends object, K extends keyof O>(key: K): (iterable: Iterable<O>) => IterableIterator<O[K]>;

declare function pluck<O extends object, K extends keyof O>(key: K, iterable: AsyncIterable<O>): AsyncIterableIterator<O[K]>;

declare function pluck<O extends object, K extends keyof O>(key: K): (iterable: AsyncIterable<O>) => AsyncIterableIterator<O[K]>;

Example

const iter = pluck('age', [{age:21}, {age:22}, {age:23}]);
iter.next(); // {done:false, value: 21}
iter.next(); // {done:false, value: 22}
iter.next(); // {done:false, value: 23}

// with pipe
pipe(
[{age:21}, {age:22}, {age:23}],
pluck('age'),
toArray,
); // [21, 22 ,23]

// if you want to use asynchronous callback
await pipe(
Promise.resolve([{age:21}, {age:22}, {age:23}]),
toAsync,
pluck('age'),
toArray,
); // [21, 22 ,23]

// with toAsync
await pipe(
[Promise.resolve({age:21}), Promise.resolve({age:22}), Promise.resolve({age:23})],
toAsync,
pluck('age'),
toArray,
); // [21, 22 ,23]
-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/prepend/index.html b/docs/prepend/index.html index 7659399c..8fcf6df1 100644 --- a/docs/prepend/index.html +++ b/docs/prepend/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = prepend(4, [1, 2, 3]);
iter.next() // {done:false, value: 4}
iter.next() // {done:false, value: 1}
iter.next() // {done:false, value: 2}
iter.next() // {done:false, value: 3}

// with pipe
pipe(
[1, 2, 3],
prepend(4),
toArray,
); // [4, 1, 2, 3]

await pipe(
Promise.resolve([1, 2, 3]),
prepend(4),
toArray,
); // [4, 1, 2, 3]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)],
toAsync,
prepend(4),
toArray,
); // [4, 1, 2, 3]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/prop/index.html b/docs/prop/index.html index bb0804b6..422d10f6 100644 --- a/docs/prop/index.html +++ b/docs/prop/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function prop<K extends Key, T>(key: K, obj: T): Prop<T, K>;

declare function prop<K extends Key>(key: K): <T>(obj: T) => Prop<T, K>;

Example

-
// get the `name` property from an object
const person = { name: "John", age: 30 };
const name = prop("name", person); // "John"

// with pipe
pipe(
person,
prop("name"),
);

// get the `address` property from an object that may be null or undefined
const maybePerson = null;
const address = prop("address", maybePerson); // undefined
+
// get the `name` property from an object
const person = { name: "John", age: 30 };
const name = prop("name", person); // "John"

// with pipe
pipe(
person,
prop("name"),
);

// get the `address` property from an object that may be null or undefined
const maybePerson = null;
const address = prop("address", maybePerson); // undefined
+

Open Source Code

\ No newline at end of file diff --git a/docs/props/index.html b/docs/props/index.html index f6f6842d..0a92b483 100644 --- a/docs/props/index.html +++ b/docs/props/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function props<K extends readonly Key[], T>(key: K, obj: T): PropsReturnType<K, T>;

declare function props<K extends readonly Key[]>(key: K): <T>(obj: T) => PropsReturnType<K, T>;

Example

-
// get the `name` and `age` properties from an object
const person = { name: "John", age: 30, address: "123 Main St" };
const [name, age, phone] = props(["name", "age", "phone"], person); // ["John", 30, undefined]

// with pipe
pipe(
person,
props(["name", "age", "phone"]),
);

// get the `address` and `phone` properties from an object that may be null or undefined
const maybePerson = null;
const [address, phone] = props(["address", "phone"], maybePerson); // [undefined, undefined]
+
// get the `name` and `age` properties from an object
const person = { name: "John", age: 30, address: "123 Main St" };
const [name, age, phone] = props(["name", "age", "phone"], person); // ["John", 30, undefined]

// with pipe
pipe(
person,
props(["name", "age", "phone"]),
);

// get the `address` and `phone` properties from an object that may be null or undefined
const maybePerson = null;
const [address, phone] = props(["address", "phone"], maybePerson); // [undefined, undefined]
+

Open Source Code

\ No newline at end of file diff --git a/docs/range/index.html b/docs/range/index.html index 00f5e6b5..b9bac0c3 100644 --- a/docs/range/index.html +++ b/docs/range/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = range(4);
iter.next() // {done:false, value: 0}
iter.next() // {done:false, value: 1}
iter.next() // {done:false, value: 2}
iter.next() // {done:false, value: 3}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
range(4),
toArray,
); // [0, 1, 2, 3]

pipe(
range(1, 4),
toArray,
); // [1, 2, 3]

// with toAsync
await pipe(
range(4),
toAsync,
toArray,
); // [0, 1, 2, 3]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/reduce/index.html b/docs/reduce/index.html index b47e81b3..6a62ca38 100644 --- a/docs/reduce/index.html +++ b/docs/reduce/index.html @@ -12,7 +12,7 @@ - + @@ -30,6 +30,7 @@

Example
await pipe(
Promise.resolve([1, 2, 3, 4]),
map((a) => a + 10),
filter(a => a % 2 === 0),
reduce(sum),
); // 26

// if you want to use asynchronous callback
await pipe(
Promise.resolve([1, 2, 3, 4]),
toAsync,
map(async (a) => a + 10),
filter(a => a % 2 === 0),
reduce(sum),
); // 26

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3), Promise.resolve(4)],
toAsync,
map(a => a + 10),
filter(a => a % 2 === 0),
reduce(sum),
); // 26

Try It

-

see pipe, toAsync, map, filter

+

see pipe, toAsync, map, filter

+

Open Source Code

\ No newline at end of file diff --git a/docs/reduceLazy/index.html b/docs/reduceLazy/index.html index 70e73b55..6694c03b 100644 --- a/docs/reduceLazy/index.html +++ b/docs/reduceLazy/index.html @@ -12,7 +12,7 @@ - + @@ -28,6 +28,7 @@

Example
await pipe(
[1, 2, 3, 4],
reduceLazy(async (a, b) => a + b, 5)
); // 15

AsyncIterable doesn't matter.

-
await pipe(
[1, 2, 3, 4],
toAsync,
reduceLazy((a, b) => a + b, 5)
); // 15
+
await pipe(
[1, 2, 3, 4],
toAsync,
reduceLazy((a, b) => a + b, 5)
); // 15
+

Open Source Code

\ No newline at end of file diff --git a/docs/reject/index.html b/docs/reject/index.html index f7453a97..b29388dd 100644 --- a/docs/reject/index.html +++ b/docs/reject/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = reject((a)=> a % 2 === 0, [0, 1, 2, 3, 4, 5, 6]);
iter.next() // {done:false, value: 1}
iter.next() // {done:false, value: 3}
iter.next() // {done:false, value: 5}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[0, 1, 2, 3, 4, 5, 6],
reject(a => a % 2 === 0),
toArray,
); // [1, 3, 5]

await pipe(
Promise.resolve([0, 1, 2, 3, 4, 5, 6]),
reject(a => a % 2 === 0),
toArray,
); // [1, 3, 5]

// if you want to use asynchronous callback
await pipe(
Promise.resolve([0, 1, 2, 3, 4, 5, 6]),
toAsync,
reject(async a => a % 2 === 0),
toArray,
); // [1, 3, 5]

// with toAsync
await pipe(
[Promise.resolve(0), Promise.resolve(1), Promise.resolve(2),
Promise.resolve(3), Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],
toAsync,
reject(a => a % 2 === 0),
toArray,
); // [1, 3, 5]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/repeat/index.html b/docs/repeat/index.html index 4dd2c730..307abd45 100644 --- a/docs/repeat/index.html +++ b/docs/repeat/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function repeat<T>(n: number, value: T): IterableIterator<T>;

declare function repeat<T>(n: number): (value: T) => IterableIterator<T>;

Example

-
const iter = repeat(2, 10);
iter.next(); // {value: 10, done:false}
iter.next(); // {value: 10, done:false}
iter.next(); // {value: undefined, done:true}

// with pipe
pipe(
repeat(2, 10),
toArray,
); // [10, 10]
+
const iter = repeat(2, 10);
iter.next(); // {value: 10, done:false}
iter.next(); // {value: 10, done:false}
iter.next(); // {value: undefined, done:true}

// with pipe
pipe(
repeat(2, 10),
toArray,
); // [10, 10]
+

Open Source Code

\ No newline at end of file diff --git a/docs/reverse/index.html b/docs/reverse/index.html index 058c6701..afaf37b9 100644 --- a/docs/reverse/index.html +++ b/docs/reverse/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function reverse<T extends Iterable<unknown> | AsyncIterable<unknown>>(iterable: T): ReturnIterableIteratorType<T>;

Example

const iter1 = reverse([1, 2, 3]);
iter1.next(); // {value: 3, done: false}
iter1.next(); // {value: 2, done: false}
iter1.next(); // {value: 1, done: false}
iter1.next(); // {value: undefined, done: true}

const iter2 = reverse("abc");
iter2.next(); // {value: "c", done: false}
iter2.next(); // {value: "b", done: false}
iter2.next(); // {value: "a", done: false}
iter2.next(); // {value: undefined, done: true}

// with pipe
pipe(
[1, 2, 3, 4, 5],
reverse,
toArray,
); // [5, 4, 3, 2, 1]

pipe(
"abcde",
reverse,
toArray,
); // "edcba"
-

see pipe toArray

+

see pipe toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/scan/index.html b/docs/scan/index.html index 3a23b2a3..fc5ff2c4 100644 --- a/docs/scan/index.html +++ b/docs/scan/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function scan<A>(f: (a: A, b: A) => A, iterable: Iterable<A>): IterableIterator<A>;

declare function scan<A extends readonly []>(f: Arrow, iterable: A): IterableIterator<never>;

declare function scan<A, B>(f: (a: B, b: A) => B, iterable: Iterable<A>): IterableIterator<B>;

declare function scan<A extends readonly [], B>(f: Arrow, seed: B, iterable: A): IterableIterator<B>;

declare function scan<A, B>(f: (a: B, b: A) => B, seed: B, iterable: Iterable<A>): IterableIterator<B>;

declare function scan<A>(f: (a: A, b: A) => A | Promise<A>, iterable: AsyncIterable<A>): AsyncIterableIterator<A>;

declare function scan<A, B>(f: (a: Awaited<B>, b: A) => B | Promise<B>, iterable: AsyncIterable<A>): AsyncIterableIterator<Awaited<B>>;

declare function scan<A, B>(f: (a: Awaited<B>, b: A) => B | Promise<B>, seed: B | Promise<B>, iterable: AsyncIterable<A>): AsyncIterableIterator<B>;

declare function scan<A extends Iterable<unknown> | AsyncIterable<unknown>, B>(f: (a: B, b: IterableInfer<A>) => B | Promise<B>): (iterable: A) => ReturnIterableIteratorType<A, B>;

declare function scan<A extends Iterable<unknown> | AsyncIterable<unknown>>(f: (a: IterableInfer<A>, b: IterableInfer<A>) => IterableInfer<A> | Promise<IterableInfer<A>>): (iterable: A) => ReturnIterableIteratorType<A, IterableInfer<A>>;

Example

-
const iter = scan((acc, cur) => acc * cur, 1, [1, 2, 3, 4 ]);
iter.next(); // {value: 1, done:false}
iter.next(); // {value: 1, done:false}
iter.next(); // {value: 2, done:false}
iter.next(); // {value: 6, done:false}
iter.next(); // {value: 24, done:false}
iter.next(); // {value: undefined, done: true}

// with pipe
pipe(
[1, 2, 3, 4],
scan((acc, cur) => acc * cur),
toArray,
); // [1, 2, 6, 24]
+
const iter = scan((acc, cur) => acc * cur, 1, [1, 2, 3, 4 ]);
iter.next(); // {value: 1, done:false}
iter.next(); // {value: 1, done:false}
iter.next(); // {value: 2, done:false}
iter.next(); // {value: 6, done:false}
iter.next(); // {value: 24, done:false}
iter.next(); // {value: undefined, done: true}

// with pipe
pipe(
[1, 2, 3, 4],
scan((acc, cur) => acc * cur),
toArray,
); // [1, 2, 6, 24]
+

Open Source Code

\ No newline at end of file diff --git a/docs/size/index.html b/docs/size/index.html index 68b89973..94a8ede7 100644 --- a/docs/size/index.html +++ b/docs/size/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function size<A extends Iterable<unknown> | AsyncIterable<unknown>>(iterable: A): ReturnValueType<A, number>;

Example

-
size([1, 2, 3, 4]); // 4
size("abcde"); // 5

await size(toAsync([1, 2, 3, 4])); // 4
+
size([1, 2, 3, 4]); // 4
size("abcde"); // 5

await size(toAsync([1, 2, 3, 4])); // 4
+

Open Source Code

\ No newline at end of file diff --git a/docs/slice/index.html b/docs/slice/index.html index 0662677e..3d14346a 100644 --- a/docs/slice/index.html +++ b/docs/slice/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function slice<T>(start: number, iterable: Iterable<T>): IterableIterator<T>;

declare function slice<T>(start: number, iterable: AsyncIterable<T>): AsyncIterableIterator<T>;

declare function slice<T>(start: number, end: number, iterable: Iterable<T>): IterableIterator<T>;

declare function slice<T>(start: number, end: number, iterable: AsyncIterable<T>): AsyncIterableIterator<T>;

declare function slice<A extends Iterable<unknown> | AsyncIterable<unknown>>(start: number): (iterable: A) => ReturnIterableIteratorType<A>;

declare function slice<A extends Iterable<unknown> | AsyncIterable<unknown>>(start: number, end: number): (iterable: A) => ReturnIterableIteratorType<A>;

Example

const iter1 = slice(1, 3, ['a', 'b', 'c', 'd', 'e']);
iter1.next(); // {value: 'b', done: false};
iter1.next(); // {value: 'c', done: false};
iter1.next(); // {value: undefined, done: true};

const iter2 = slice(3, ['a', 'b', 'c', 'd', 'e']);
iter2.next(); // {value: 'd', done: false};
iter2.next(); // {value: 'e', done: false};
iter2.next(); // {value: undefined, done: true};

const iter3 = slice(3, "abcde");
iter3.next(); // {value: 'd', done: false};
iter3.next(); // {value: 'e', done: false};
iter3.next(); // {value: undefined, done: true};

// with pipe
pipe(
[1, 2, 3, 4, 5],
slice(3),
toArray,
); // [4, 5]

pipe(
[1, 2, 3, 4, 5],
slice(1, 3),
toArray,
); // [2, 3]
-

see pipe, toArray

+

see pipe, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/some/index.html b/docs/some/index.html index 08ddfc64..d3560ee5 100644 --- a/docs/some/index.html +++ b/docs/some/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

some(a=> a, [null, 0, 1, false]); // true

// with pipe
pipe(
[{id:1, age: 27}, {id:2, age: 36}, {id:3, age: 42}],
map(user => user.age),
some(age => age > 40),
); // true

await pipe(
Promise.resolve([{id:1, age: 27}, {id:2, age: 36}, {id:3, age: 42}]),
map(user => user.age),
some(age => age > 40),
); // true

// with toAsync
await pipe(
[Promise.resolve({id:1, age: 27}), Promise.resolve({id:2, age: 36}), Promise.resolve({id:3, age: 42})],
toAsync,
map(user => user.age),
some(age => age > 40),
); // true

Try It

-

see pipe, toAsync, map

+

see pipe, toAsync, map

+

Open Source Code

\ No newline at end of file diff --git a/docs/sort/index.html b/docs/sort/index.html index 49334ae0..570dd574 100644 --- a/docs/sort/index.html +++ b/docs/sort/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function sort<T>(f: (a: T, b: T) => unknown, iterable: Iterable<T>): T[];

declare function sort(f: (a: any, b: any) => unknown, iterable: readonly []): any[];

declare function sort<T>(f: (a: T, b: T) => unknown, iterable: AsyncIterable<T>): Promise<T[]>;

declare function sort<T extends Iterable<unknown> | AsyncIterable<unknown>>(f: (a: IterableInfer<T>, b: IterableInfer<T>) => unknown): (iterable: T) => ReturnValueType<T, IterableInfer<T>[]>;

Example

-
sort((a, b) => a > b, [3, 4, 1, 2, 5, 2]); // [1, 2, 2, 3, 4, 5]
sort((a, b) => a > b, 'bcdaef); // ["a", "b", "c", "d", "e", "f"]
+
sort((a, b) => a > b, [3, 4, 1, 2, 5, 2]); // [1, 2, 2, 3, 4, 5]
sort((a, b) => a > b, 'bcdaef); // ["a", "b", "c", "d", "e", "f"]
+

Open Source Code

\ No newline at end of file diff --git a/docs/sortBy/index.html b/docs/sortBy/index.html index 1b1cac19..bedfb508 100644 --- a/docs/sortBy/index.html +++ b/docs/sortBy/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function sortBy<T>(f: (a: T) => unknown, iterable: Iterable<T>): T[];

declare function sortBy(f: (a: any) => unknown, iterable: readonly []): any[];

declare function sortBy<T>(f: (a: T) => unknown, iterable: AsyncIterable<T>): Promise<T[]>;

declare function sortBy<T extends Iterable<unknown> | AsyncIterable<unknown>>(f: (a: IterableInfer<T>) => unknown): (iterable: T) => ReturnValueType<T, IterableInfer<T>[]>;

Example

-
sortBy(a => a, [3, 4, 1, 2, 5, 2]);
// [1, 2, 2, 3, 4, 5]
sortBy((a) => a.id, [{id:4,name:'foo'}, {id:2,name:'bar'},{id:3, name:'lee'}]);
// [{id:2,name:'bar'}, {id:3, name:'lee'}, {id:4,name:'foo'}]
+
sortBy(a => a, [3, 4, 1, 2, 5, 2]);
// [1, 2, 2, 3, 4, 5]
sortBy((a) => a.id, [{id:4,name:'foo'}, {id:2,name:'bar'},{id:3, name:'lee'}]);
// [{id:2,name:'bar'}, {id:3, name:'lee'}, {id:4,name:'foo'}]
+

Open Source Code

\ No newline at end of file diff --git a/docs/split/index.html b/docs/split/index.html index 1ebc4781..c067dd4b 100644 --- a/docs/split/index.html +++ b/docs/split/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function split(sep: string, iterable: Iterable<string>): IterableIterator<string>;

declare function split(sep: string, iterable: AsyncIterable<string>): AsyncIterableIterator<string>;

declare function split<A extends Iterable<string> | AsyncIterable<string>>(sep: string): (iterable: A) => ReturnIterableIteratorType<A, string>;

Example

const iter = split(',', '1,2,3,4');
iter.next(); // 1
iter.next(); // 2
iter.next(); // 3
iter.next(); // 4
iter.next(); // undefined

// with pipe
pipe(
"1,2,3,4,5",
split(','),
toArray,
); // ["1", "2", "3", "4", "5"]
-

see pipe, toArray

+

see pipe, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/sum/index.html b/docs/sum/index.html index 3d710595..6f751af3 100644 --- a/docs/sum/index.html +++ b/docs/sum/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function sum<A extends Iterable<number> | AsyncIterable<number>>(iterable: A): A extends Iterable<number> ? number : A extends AsyncIterable<number> ? Promise<number> : never;

Example

-
sum([]); // 0
sum([1, 2, 3, 4]); // 10
await sum(toAsync([1, 2, 3, 4])); // 10
+
sum([]); // 0
sum([1, 2, 3, 4]); // 10
await sum(toAsync([1, 2, 3, 4])); // 10
+

Open Source Code

\ No newline at end of file diff --git a/docs/take/index.html b/docs/take/index.html index c75e1968..30a049da 100644 --- a/docs/take/index.html +++ b/docs/take/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = take(2, [0, 1, 2, 3, 4, 5, 6]);
iter.next() // {done:false, value: 0}
iter.next() // {done:false, value: 1}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[0, 1, 2, 3, 4, 5, 6],
take(2),
toArray,
); // [0, 1]

await pipe(
Promise.resolve([0, 1, 2, 3, 4, 5, 6]),
take(2),
toArray,
); // [0, 1]

// with toAsync
await pipe(
[Promise.resolve(0), Promise.resolve(1), Promise.resolve(2),
Promise.resolve(3), Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],
toAsync,
take(2),
toArray,
); // [0, 1]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/takeRight/index.html b/docs/takeRight/index.html index 89224057..d31dd8f3 100644 --- a/docs/takeRight/index.html +++ b/docs/takeRight/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function takeRight<A>(l: number, iterable: Iterable<A>): IterableIterator<A>;

declare function takeRight<A>(l: number, iterable: AsyncIterable<A>): AsyncIterableIterator<A>;

declare function takeRight<A extends Iterable<unknown> | AsyncIterable<unknown>>(l: number): (iterable: A) => ReturnIterableIteratorType<A>;

Example

const iter = takeRight(2, [0, 1, 2, 3, 4, 5, 6]);
iter.next() // {done:false, value: 5}
iter.next() // {done:false, value: 6}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[0, 1, 2, 3, 4, 5, 6],
takeRight(2),
toArray,
); // [5, 6]

await pipe(
Promise.resolve([0, 1, 2, 3, 4, 5, 6]),
takeRight(2),
toArray,
); // [5, 6]

// with toAsync
await pipe(
[Promise.resolve(0), Promise.resolve(1), Promise.resolve(2),
Promise.resolve(3), Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],
toAsync,
takeRight(2),
toArray,
); // [5, 6]
-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/takeUntil/index.html b/docs/takeUntil/index.html index efe84be4..7886263a 100644 --- a/docs/takeUntil/index.html +++ b/docs/takeUntil/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = takeUntil(a => a % 2 === 0, [1, 2, 3, 4, 5, 6]);
iter.next() // {done:false, value: 1}
iter.next() // {done:false, value: 2}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[1, 2, 3, 4, 5, 6],
takeUntil(a => a % 2 === 0),
toArray,
); // [1, 2]

await pipe(
Promise.resolve([1, 2, 3, 4, 5, 6]),
takeUntil(a => a % 2 === 0),
toArray,
); // [1, 2]

// if you want to use asynchronous callback
await pipe(
Promise.resolve([1, 2, 3, 4, 5, 6]),
toAsync,
takeUntil(async (a) => a % 2 === 0),
toArray,
); // [1, 2]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3),
Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],
toAsync,
takeUntil(a => a % 2 === 0),
toArray,
); // [1, 2]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/takeWhile/index.html b/docs/takeWhile/index.html index fa2fb65b..9101e134 100644 --- a/docs/takeWhile/index.html +++ b/docs/takeWhile/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = takeWhile(a => a < 3, [1, 2, 3, 4, 5, 6]);
iter.next() // {done:false, value: 1}
iter.next() // {done:false, value: 2}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[1, 2, 3, 4, 5, 6],
takeWhile(a => a < 3),
toArray,
); // [1, 2]

await pipe(
Promise.resolve([1, 2, 3, 4, 5, 6]),
takeWhile(a => a < 3),
toArray,
); // [1, 2]

// if you want to use asynchronous callback
await pipe(
Promise.resolve([1, 2, 3, 4, 5, 6]),
toAsync,
takeWhile(async (a) => a < 3),
toArray,
); // [1, 2]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(3),
Promise.resolve(4), Promise.resolve(5), Promise.resolve(6)],
toAsync,
takeWhile(a => a < 3),
toArray,
); // [1, 2]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/tap/index.html b/docs/tap/index.html index 1d3fb6d6..757ac4f4 100644 --- a/docs/tap/index.html +++ b/docs/tap/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function tap<T, U>(f: (arg: Awaited<T>) => U, v: T): U extends Promise<any> ? Promise<Awaited<T>> : T;

declare function tap<T, U>(f: (arg: Awaited<T>) => U): (v: T) => U extends Promise<any> ? Promise<Awaited<T>> : T;

Example

-
tap(console.log, [1,2,3,4,5])
// log [1, 2, 3, 4, 5]
// return [1, 2, 3, 4, 5]

tap(async (a) => console.log(a), [1,2,3,4,5]);
// log [1, 2, 3, 4, 5]
// return Promise<[1, 2, 3, 4, 5]>
+
tap(console.log, [1,2,3,4,5])
// log [1, 2, 3, 4, 5]
// return [1, 2, 3, 4, 5]

tap(async (a) => console.log(a), [1,2,3,4,5]);
// log [1, 2, 3, 4, 5]
// return Promise<[1, 2, 3, 4, 5]>
+

Open Source Code

\ No newline at end of file diff --git a/docs/throwError/index.html b/docs/throwError/index.html index d28055b1..0274518c 100644 --- a/docs/throwError/index.html +++ b/docs/throwError/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
throwError: <T, E extends Error>(toError: (input: T) => E) => (input: T) => never

Example

-
const result: never = pipe(
0,

throwError((input) => Error(`input is ${input}`)),

(input: never) => {
// unreachable point
},
);
+
const result: never = pipe(
0,

throwError((input) => Error(`input is ${input}`)),

(input: never) => {
// unreachable point
},
);
+

Open Source Code

\ No newline at end of file diff --git a/docs/throwIf/index.html b/docs/throwIf/index.html index f0581c7d..5b3e11a7 100644 --- a/docs/throwIf/index.html +++ b/docs/throwIf/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@ Signature:
declare function throwIf<T>(predicate: (input: T) => boolean, err?: (input: T) => unknown): (input: T) => T;

declare function throwIf<T, N extends T>(predicate: (input: T) => input is N, err?: (input: N) => unknown): (input: T) => Exclude<T, N>;

Example

-
 pipe(
fn(), // return type is string | undefined

throwIf(isUndefined, (err) => Error("return of fn() is undefined")),
// err is undefined, and it is return of fn

(input) => input, // input is string
)
+
 pipe(
fn(), // return type is string | undefined

throwIf(isUndefined, (err) => Error("return of fn() is undefined")),
// err is undefined, and it is return of fn

(input) => input, // input is string
)
+

Open Source Code

\ No newline at end of file diff --git a/docs/to-async/index.html b/docs/to-async/index.html index 2bdb5c4e..3afedaca 100644 --- a/docs/to-async/index.html +++ b/docs/to-async/index.html @@ -12,7 +12,7 @@ - + diff --git a/docs/toArray/index.html b/docs/toArray/index.html index e121c2b3..0c44143a 100644 --- a/docs/toArray/index.html +++ b/docs/toArray/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

pipe(
[1, 2, 3, 4, 5],
map(a => a + 10),
filter(a => a % 2 === 0),
toArray,
); // [12, 14]

await pipe(
Promise.resolve([1, 2, 3, 4, 5]),
map(a => a + 10),
filter(a => a % 2 === 0),
toArray,
); // [12, 14]

// if you want to use asynchronous callback
await pipe(
Promise.resolve([1, 2, 3, 4, 5]),
toAsync,
map(async (a) => a + 10),
filter(a => a % 2 === 0),
toArray,
); // [12, 14]

// with toAsync
await pipe(
[
Promise.resolve(1),
Promise.resolve(2),
Promise.resolve(3),
Promise.resolve(4),
Promise.resolve(5)
],
toAsync,
map((a) => a + 10),
filter((a) => a % 2 === 0),
toArray
);

Try It

-

see pipe, toAsync, map, filter

+

see pipe, toAsync, map, filter

+

Open Source Code

\ No newline at end of file diff --git a/docs/toAsync/index.html b/docs/toAsync/index.html index aa956a54..8f7824c0 100644 --- a/docs/toAsync/index.html +++ b/docs/toAsync/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

let acc = 0;
for await (const item of toAsync([1, 2, 3, 4, 5])) {
acc += item;
}
// acc: 15

// with pipe
await pipe(
[Promise.resolve(1),Promise.resolve(2),Promise.resolve(3)],
toAsync,
map(a => a + 10),
toArray, // [11, 12, 13]
);

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/unicodeToArray/index.html b/docs/unicodeToArray/index.html index 489c6b5c..0f68b2a1 100644 --- a/docs/unicodeToArray/index.html +++ b/docs/unicodeToArray/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function unicodeToArray(string: string): [] | RegExpMatchArray;

Example

-
 unicodeToArray('🙇‍♂️🤩😭'); // ['🙇‍♂️','🤩','😭'];
+
 unicodeToArray('🙇‍♂️🤩😭'); // ['🙇‍♂️','🤩','😭'];
+

Open Source Code

\ No newline at end of file diff --git a/docs/uniq/index.html b/docs/uniq/index.html index bbc7aa16..1081fb7b 100644 --- a/docs/uniq/index.html +++ b/docs/uniq/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = uniq([1, 2, 1, 3, 2]);
iter.next() // {done:false, value: 1}
iter.next() // {done:false, value: 2}
iter.next() // {done:false, value: 3}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[1, 2, 1, 3],
uniq,
toArray,
); // [1, 2, 3]

await pipe(
Promise.resolve([1, 2, 1, 3]),
uniq,
toArray,
); // [1, 2, 3]

// with toAsync
await pipe(
[Promise.resolve(1), Promise.resolve(2), Promise.resolve(1), Promise.resolve(3)],
toAsync,
uniq,
toArray,
); // [1, 2, 3]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/uniqBy/index.html b/docs/uniqBy/index.html index 3ae4b64c..4092eeac 100644 --- a/docs/uniqBy/index.html +++ b/docs/uniqBy/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = uniqBy(a => a.age, [{age: 21}, {age: 23}, {age: 21}, {age: 34}]);
iter.next() // {done:false, value: {age: 21}}
iter.next() // {done:false, value: {age: 23}}
iter.next() // {done:false, value: {age: 34}}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[{age: 21}, {age: 23}, {age: 21}, {age: 34}],
uniqBy(a => a.age),
toArray,
); // [{age: 21}, {age: 23}, {age: 34}]

await pipe(
Promise.resolve([{age: 21}, {age: 23}, {age: 21}, {age: 34}]),
uniqBy(a => a.age),
toArray,
); // [{age: 21}, {age: 23}, {age: 34}]

// if you want to use asynchronous callback
await pipe(
Promise.resolve([{age: 21}, {age: 23}, {age: 21}, {age: 34}]),
toAsync,
uniqBy(async (a) => a.age),
toArray,
); // [{age: 21}, {age: 23}, {age: 34}]

// toAsync
await pipe(
[Promise.resolve({age: 21}), Promise.resolve({age: 23}), Promise.resolve({age: 21}), Promise.resolve({age: 34})],
toAsync,
uniqBy(a => a.age),
toArray,
); // [{age: 21}, {age: 23}, {age: 34}]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/unless/index.html b/docs/unless/index.html index 6766cddb..4fb7b15c 100644 --- a/docs/unless/index.html +++ b/docs/unless/index.html @@ -12,7 +12,7 @@ - + @@ -22,6 +22,7 @@
declare function unless<T, U>(predicate: (input: T) => boolean, process: (input: T) => U): (input: T) => T | (U extends void ? undefined : U);

declare function unless<T, N extends T, U>(predicate: (input: T) => input is N, process: (input: Exclude<T, N>) => U): (input: T) => N | (U extends void ? undefined : U);

original input or result of process

Example

-
// it will return only string
const unlessIsString: (input: string | undefined) => string = unless(isString, (input) => {
throw Error("input is undefiend.")
});
+
// it will return only string
const unlessIsString: (input: string | undefined) => string = unless(isString, (input) => {
throw Error("input is undefiend.")
});
+

Open Source Code

\ No newline at end of file diff --git a/docs/values/index.html b/docs/values/index.html index c2ee5132..fdf282ff 100644 --- a/docs/values/index.html +++ b/docs/values/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function values<T extends Record<string, any>>(obj: T): Generator<T[Extract<keyof T, string>], void, unknown>;

Example

-
[...values({ a: 1, b: "2", c: true })]
// [1, "2", true]
+
[...values({ a: 1, b: "2", c: true })]
// [1, "2", true]
+

Open Source Code

\ No newline at end of file diff --git a/docs/zip/index.html b/docs/zip/index.html index d1edd62e..6e952a28 100644 --- a/docs/zip/index.html +++ b/docs/zip/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = zip([1, 2, 3, 4], [5, 6, 7, 8]);
iter.next() // {done:false, value: [1, 5]}
iter.next() // {done:false, value: [2, 6]}
iter.next() // {done:false, value: [3, 7]}
iter.next() // {done:false, value: [4, 8]}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
[5, 6, 7, 8],
zip([1, 2, 3, 4]),
toArray,
); // [[1, 5], [2, 6], [3, 7], [4, 8]]

await pipe(
Promise.resolve([5, 6, 7, 8]),
zip([1, 2, 3, 4]),
toArray,
); // [[1, 5], [2, 6], [3, 7], [4, 8]]

// with toAsync
await pipe(
[Promise.resolve(5), Promise.resolve(6), Promise.resolve(7), Promise.resolve(8)],
toAsync,
zip([1, 2, 3, 4]),
toArray,
); // [[1, 5], [2, 6], [3, 7], [4, 8]]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/docs/zipWith/index.html b/docs/zipWith/index.html index 183047e4..7319572f 100644 --- a/docs/zipWith/index.html +++ b/docs/zipWith/index.html @@ -12,7 +12,7 @@ - + @@ -21,6 +21,7 @@ Signature:
declare function zipWith<A, B, C>(f: (a: A, b: B) => C, iterable1: Iterable<A>, iterable2: Iterable<B>): IterableIterator<C>;

declare function zipWith<A, B, C>(f: (a: A, b: B) => C, iterable1: Iterable<A>, iterable2: AsyncIterable<B>): AsyncIterableIterator<C>;

declare function zipWith<A, B, C>(f: (a: A, b: B) => C, iterable1: AsyncIterable<A>, iterable2: Iterable<B>): AsyncIterableIterator<C>;

declare function zipWith<A, B, C>(f: (a: A, b: B) => C, iterable1: AsyncIterable<A>, iterable2: AsyncIterable<B>): AsyncIterableIterator<C>;

Example

-
const iter = zipWith((a,b) => [a,b], [1,2,3], ['a','b','c']);
iter.next(); // {value: [1, 'a'] , done: false}
iter.next(); // {value: [2, 'b'] , done: false}
iter.next(); // {value: [3, 'c'] , done: false}
iter.next(); // {value: undefined , done: true}
+
const iter = zipWith((a,b) => [a,b], [1,2,3], ['a','b','c']);
iter.next(); // {value: [1, 'a'] , done: false}
iter.next(); // {value: [2, 'b'] , done: false}
iter.next(); // {value: [3, 'c'] , done: false}
iter.next(); // {value: undefined , done: true}
+

Open Source Code

\ No newline at end of file diff --git a/docs/zipWithIndex/index.html b/docs/zipWithIndex/index.html index 61388b9f..5f032589 100644 --- a/docs/zipWithIndex/index.html +++ b/docs/zipWithIndex/index.html @@ -12,7 +12,7 @@ - + @@ -23,6 +23,7 @@

Example

const iter = zipWithIndex(["a", "b", "c", "d"]);
iter.next() // {done:false, value: [0, "a"]}
iter.next() // {done:false, value: [1, "b"]}
iter.next() // {done:false, value: [2, "c"]}
iter.next() // {done:false, value: [3, "d"]}
iter.next() // {done:true, value: undefined}

// with pipe
pipe(
["a", "b", "c", "d"],
zipWithIndex,
toArray,
); // [[0, "a"], [1, "b"], [2, "c"], [3, "d"]]

await pipe(
Promise.resolve(["a", "b", "c", "d"]),
zipWithIndex,
toArray,
); // [[0, "a"], [1, "b"], [2, "c"], [3, "d"]]

// with toAsync
await pipe(
[Promise.resolve("a"), Promise.resolve("b"), Promise.resolve("c"), Promise.resolve("d")],
toAsync,
zipWithIndex,
toArray,
); // [[0, "a"], [1, "b"], [2, "c"], [3, "d"]]

Try It

-

see pipe, toAsync, toArray

+

see pipe, toAsync, toArray

+

Open Source Code

\ No newline at end of file diff --git a/index.html b/index.html index 74d5789c..f3ef1e76 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@ - + diff --git a/search/index.html b/search/index.html index e04824b1..2c2aa988 100644 --- a/search/index.html +++ b/search/index.html @@ -12,7 +12,7 @@ - +