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

return-style

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

return-style - npm Package Compare versions

Comparing version 0.11.5 to 0.11.6

2

CHANGELOG.md

@@ -5,2 +5,4 @@ # Changelog

### [0.11.6](https://github.com/BlackGlory/return-style/compare/v0.11.5...v0.11.6) (2021-02-03)
### [0.11.5](https://github.com/BlackGlory/return-style/compare/v0.11.4...v0.11.5) (2021-02-02)

@@ -7,0 +9,0 @@

2

dist/es2015/index.umd.min.js

@@ -16,3 +16,3 @@ !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).ReturnStyle={})}(this,(function(t){"use strict";

***************************************************************************** */
function r(t,r,n,e){return new(n||(n=Promise))((function(i,o){function u(t){try{c(e.next(t))}catch(t){o(t)}}function s(t){try{c(e.throw(t))}catch(t){o(t)}}function c(t){var r;t.done?i(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(u,s)}c((e=e.apply(t,r||[])).next())}))}function n(t){var r="function"==typeof Symbol&&Symbol.iterator,n=r&&t[r],e=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function e(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,e=t[Symbol.asyncIterator];return e?e.call(t):(t=n(t),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(n){r[n]=t[n]&&function(r){return new Promise((function(e,i){(function(t,r,n,e){Promise.resolve(e).then((function(r){t({value:r,done:n})}),r)})(e,i,(r=t[n](r)).done,r.value)}))}}}function i(t,r){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return r.get(t)}function o(t,r,n){if(!r.has(t))throw new TypeError("attempted to set private field on non-instance");return r.set(t,n),n}function u(t){return r(this,void 0,void 0,(function*(){try{return[!0,yield t]}catch(t){return[!1,void 0]}}))}function s(t){return r(this,void 0,void 0,(function*(){try{return yield t,[!1,void 0]}catch(t){return[!0,t]}}))}function c(t){return r(this,void 0,void 0,(function*(){try{return yield t,!0}catch(t){return!1}}))}function d(t){return r(this,void 0,void 0,(function*(){try{return yield t,!1}catch(t){return!0}}))}var f,h,a,l,v;class y{static Ok(t){return m.of(t)}static Err(t){return w.of(t)}}class m extends y{constructor(t){super(),f.set(this,void 0),o(this,f,t)}static of(t){return new m(t)}isOk(){return!0}isErr(){return!1}onOk(t){return t(i(this,f)),m.of(i(this,f))}onErr(){return m.of(i(this,f))}orElse(){return m.of(i(this,f))}map(t){return m.of(t(i(this,f)))}get(){return i(this,f)}}f=new WeakMap;class w extends y{constructor(t){super(),h.set(this,void 0),o(this,h,t)}static of(t){return new w(t)}isOk(){return!1}isErr(){return!0}onOk(){return w.of(i(this,h))}onErr(t){return t(i(this,h)),w.of(i(this,h))}orElse(t){return m.of(t)}map(){return w.of(i(this,h))}get(){throw i(this,h)}}h=new WeakMap;class p{constructor(t){a.set(this,void 0),o(this,a,t)}static Ok(t){return g.of(t)}static Err(t){return E.of(t)}get then(){const t=i(this,a).then(t=>y.Ok(t),t=>y.Err(t));return t.then.bind(t)}onOk(t){return(()=>{r(this,void 0,void 0,(function*(){const[r,n]=yield u(i(this,a));r&&t(n)}))})(),new p(i(this,a))}onErr(t){return(()=>{r(this,void 0,void 0,(function*(){const[r,n]=yield s(i(this,a));r&&t(n)}))})(),new p(i(this,a))}isOk(){return r(this,void 0,void 0,(function*(){return yield c(i(this,a))}))}isErr(){return r(this,void 0,void 0,(function*(){return yield d(i(this,a))}))}orElse(t){return new p((()=>r(this,void 0,void 0,(function*(){try{return yield i(this,a)}catch(r){return t}})))())}map(t){return new p((()=>r(this,void 0,void 0,(function*(){const r=yield i(this,a);return t(r)})))())}get(){return r(this,void 0,void 0,(function*(){return yield i(this,a)}))}}a=new WeakMap;class g extends p{static of(t){return new g(t)}constructor(t){super(Promise.resolve(t))}}class E extends p{static of(t){return new E(t)}constructor(t){super(Promise.reject(t))}}class S{static Some(t){return P.of(t)}static None(){return b.of()}}class P extends S{constructor(t){super(),l.set(this,void 0),o(this,l,t)}static of(t){return new P(t)}isSome(){return!0}isNone(){return!1}onSome(t){return t(i(this,l)),P.of(i(this,l))}onNone(){return P.of(i(this,l))}orElse(){return P.of(i(this,l))}map(t){return P.of(t(i(this,l)))}filter(t){return t(i(this,l))?P.of(i(this,l)):b.of()}get(){return i(this,l)}}l=new WeakMap;class b extends S{static of(){return new b}constructor(){super()}isSome(){return!1}isNone(){return!0}onSome(){return b.of()}onNone(t){return t(),b.of()}orElse(t){return P.of(t)}map(){return b.of()}filter(){return b.of()}get(){throw new Error("Cannot get value from None")}}function x(t,r){const n=t();return r(n)?S.None():S.Some(n)}const O=Symbol();class k{constructor(t){v.set(this,void 0),o(this,v,t)}static Some(t){return N.of(t)}static None(){return R.of()}get then(){const t=i(this,v).then(t=>t===O?S.None():S.Some(t));return t.then.bind(t)}onSome(t){return(()=>{r(this,void 0,void 0,(function*(){const r=yield i(this,v);r!==O&&t(r)}))})(),new k(i(this,v))}onNone(t){return(()=>{r(this,void 0,void 0,(function*(){(yield i(this,v))===O&&t()}))})(),new k(i(this,v))}isSome(){return r(this,void 0,void 0,(function*(){return(yield i(this,v))!==O}))}isNone(){return r(this,void 0,void 0,(function*(){return(yield i(this,v))===O}))}orElse(t){return new k((()=>r(this,void 0,void 0,(function*(){const r=yield i(this,v);return r===O?t:r})))())}map(t){return new k((()=>r(this,void 0,void 0,(function*(){const r=yield i(this,v);return r===O?O:t(r)})))())}filter(t){return new k((()=>r(this,void 0,void 0,(function*(){const r=yield i(this,v);return r===O?O:t(r)?r:O})))())}get(){return r(this,void 0,void 0,(function*(){const t=yield i(this,v);if(t===O)throw new Error("Cannot get value from None");return t}))}}v=new WeakMap;class R extends k{static of(){return new R}constructor(){super(Promise.resolve(O))}}class N extends k{static of(t){return new N(t)}constructor(t){super(Promise.resolve(t))}}function A(t,n){return new k((()=>r(this,void 0,void 0,(function*(){const r=yield t;return n(r)?O:r})))())}t.getError=function(t){try{t()}catch(t){return t}},t.getErrorAsync=function(t){return r(this,void 0,void 0,(function*(){try{yield t()}catch(t){return t}}))},t.getErrorAsyncIterable=function(t){var n,i,o,u;return r(this,void 0,void 0,(function*(){try{try{for(n=e(t);!(i=yield n.next()).done;){i.value}}catch(t){o={error:t}}finally{try{i&&!i.done&&(u=n.return)&&(yield u.call(n))}finally{if(o)throw o.error}}}catch(t){return t}}))},t.getErrorPromise=function(t){return r(this,void 0,void 0,(function*(){try{yield t}catch(t){return t}}))},t.getErrorResult=function(t){try{return[void 0,t()]}catch(t){return[t,void 0]}},t.getErrorResultAsync=function(t){return r(this,void 0,void 0,(function*(){try{return[void 0,yield t()]}catch(t){return[t,void 0]}}))},t.getErrorResultPromise=function(t){return r(this,void 0,void 0,(function*(){try{return[void 0,yield t]}catch(t){return[t,void 0]}}))},t.getFailure=function(t){try{return t(),[!1,void 0]}catch(t){return[!0,t]}},t.getFailureAsync=function(t){return r(this,void 0,void 0,(function*(){try{return yield t(),[!1,void 0]}catch(t){return[!0,t]}}))},t.getFailurePromise=s,t.getResult=function(t){try{return t()}catch(t){return}},t.getResultAsync=function(t){return r(this,void 0,void 0,(function*(){try{return yield t()}catch(t){return}}))},t.getResultError=function(t){try{return[t(),void 0]}catch(t){return[void 0,t]}},t.getResultErrorAsync=function(t){return r(this,void 0,void 0,(function*(){try{return[yield t(),void 0]}catch(t){return[void 0,t]}}))},t.getResultErrorPromise=function(t){return r(this,void 0,void 0,(function*(){try{return[yield t,void 0]}catch(t){return[void 0,t]}}))},t.getResultPromise=function(t){return r(this,void 0,void 0,(function*(){try{return yield t}catch(t){return}}))},t.getSuccess=function(t){try{return[!0,t()]}catch(t){return[!1,void 0]}},t.getSuccessAsync=function(t){return r(this,void 0,void 0,(function*(){try{return[!0,yield t()]}catch(t){return[!1,void 0]}}))},t.getSuccessPromise=u,t.isFailure=function(t){try{return t(),!1}catch(t){return!0}},t.isFailureAsync=function(t){return r(this,void 0,void 0,(function*(){try{return yield t(),!1}catch(t){return!0}}))},t.isFailurePromise=d,t.isSuccess=function(t){try{return t(),!0}catch(t){return!1}},t.isSuccessAsync=function(t){return r(this,void 0,void 0,(function*(){try{return yield t(),!0}catch(t){return!1}}))},t.isSuccessPromise=c,t.toOptional=x,t.toOptionalPartial=function(t){return r=>x(r,t)},t.toOptionalPromise=A,t.toOptionalPromisePartial=function(t){return r=>A(r,t)},t.toResult=function(t){try{const r=t();return y.Ok(r)}catch(t){return y.Err(t)}},t.toResultAsync=function(t){try{const r=t();return new p(r)}catch(t){return p.Err(t)}},t.toResultPromise=function(t){return new p(t)},Object.defineProperty(t,"__esModule",{value:!0})}));
function r(t,r,n,e){return new(n||(n=Promise))((function(i,o){function u(t){try{c(e.next(t))}catch(t){o(t)}}function s(t){try{c(e.throw(t))}catch(t){o(t)}}function c(t){var r;t.done?i(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(u,s)}c((e=e.apply(t,r||[])).next())}))}function n(t){var r="function"==typeof Symbol&&Symbol.iterator,n=r&&t[r],e=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function e(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,e=t[Symbol.asyncIterator];return e?e.call(t):(t=n(t),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(n){r[n]=t[n]&&function(r){return new Promise((function(e,i){(function(t,r,n,e){Promise.resolve(e).then((function(r){t({value:r,done:n})}),r)})(e,i,(r=t[n](r)).done,r.value)}))}}}function i(t,r){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return r.get(t)}function o(t,r,n){if(!r.has(t))throw new TypeError("attempted to set private field on non-instance");return r.set(t,n),n}function u(t){return r(this,void 0,void 0,(function*(){try{return[!0,yield t]}catch(t){return[!1,void 0]}}))}function s(t){return r(this,void 0,void 0,(function*(){try{return yield t,[!1,void 0]}catch(t){return[!0,t]}}))}function c(t){return r(this,void 0,void 0,(function*(){try{return yield t,!0}catch(t){return!1}}))}function d(t){return r(this,void 0,void 0,(function*(){try{return yield t,!1}catch(t){return!0}}))}var f,h,a,l,v;class y{static Ok(t){return m.of(t)}static Err(t){return w.of(t)}}class m extends y{constructor(t){super(),f.set(this,void 0),o(this,f,t)}static of(t){return new m(t)}isOk(){return!0}isErr(){return!1}onOk(t){return t(i(this,f)),m.of(i(this,f))}onErr(){return m.of(i(this,f))}orElse(){return m.of(i(this,f))}map(t){return m.of(t(i(this,f)))}get(){return i(this,f)}}f=new WeakMap;class w extends y{constructor(t){super(),h.set(this,void 0),o(this,h,t)}static of(t){return new w(t)}isOk(){return!1}isErr(){return!0}onOk(){return w.of(i(this,h))}onErr(t){return t(i(this,h)),w.of(i(this,h))}orElse(t){return m.of(t)}map(){return w.of(i(this,h))}get(){throw i(this,h)}}h=new WeakMap;class p{constructor(t){a.set(this,void 0),o(this,a,t)}static Ok(t){return g.of(t)}static Err(t){return E.of(t)}get then(){const t=i(this,a).then((t=>y.Ok(t)),(t=>y.Err(t)));return t.then.bind(t)}onOk(t){return(()=>{r(this,void 0,void 0,(function*(){const[r,n]=yield u(i(this,a));r&&t(n)}))})(),new p(i(this,a))}onErr(t){return(()=>{r(this,void 0,void 0,(function*(){const[r,n]=yield s(i(this,a));r&&t(n)}))})(),new p(i(this,a))}isOk(){return r(this,void 0,void 0,(function*(){return yield c(i(this,a))}))}isErr(){return r(this,void 0,void 0,(function*(){return yield d(i(this,a))}))}orElse(t){return new p((()=>r(this,void 0,void 0,(function*(){try{return yield i(this,a)}catch(r){return t}})))())}map(t){return new p((()=>r(this,void 0,void 0,(function*(){const r=yield i(this,a);return t(r)})))())}get(){return r(this,void 0,void 0,(function*(){return yield i(this,a)}))}}a=new WeakMap;class g extends p{static of(t){return new g(t)}constructor(t){super(Promise.resolve(t))}}class E extends p{static of(t){return new E(t)}constructor(t){super(Promise.reject(t))}}class S{static Some(t){return P.of(t)}static None(){return b.of()}}class P extends S{constructor(t){super(),l.set(this,void 0),o(this,l,t)}static of(t){return new P(t)}isSome(){return!0}isNone(){return!1}onSome(t){return t(i(this,l)),P.of(i(this,l))}onNone(){return P.of(i(this,l))}orElse(){return P.of(i(this,l))}map(t){return P.of(t(i(this,l)))}filter(t){return t(i(this,l))?P.of(i(this,l)):b.of()}get(){return i(this,l)}}l=new WeakMap;class b extends S{static of(){return new b}constructor(){super()}isSome(){return!1}isNone(){return!0}onSome(){return b.of()}onNone(t){return t(),b.of()}orElse(t){return P.of(t)}map(){return b.of()}filter(){return b.of()}get(){throw new Error("Cannot get value from None")}}function x(t,r){const n=t();return r(n)?S.None():S.Some(n)}const O=Symbol();class k{constructor(t){v.set(this,void 0),o(this,v,t)}static Some(t){return N.of(t)}static None(){return R.of()}get then(){const t=i(this,v).then((t=>t===O?S.None():S.Some(t)));return t.then.bind(t)}onSome(t){return(()=>{r(this,void 0,void 0,(function*(){const r=yield i(this,v);r!==O&&t(r)}))})(),new k(i(this,v))}onNone(t){return(()=>{r(this,void 0,void 0,(function*(){(yield i(this,v))===O&&t()}))})(),new k(i(this,v))}isSome(){return r(this,void 0,void 0,(function*(){return(yield i(this,v))!==O}))}isNone(){return r(this,void 0,void 0,(function*(){return(yield i(this,v))===O}))}orElse(t){return new k((()=>r(this,void 0,void 0,(function*(){const r=yield i(this,v);return r===O?t:r})))())}map(t){return new k((()=>r(this,void 0,void 0,(function*(){const r=yield i(this,v);return r===O?O:t(r)})))())}filter(t){return new k((()=>r(this,void 0,void 0,(function*(){const r=yield i(this,v);return r===O?O:t(r)?r:O})))())}get(){return r(this,void 0,void 0,(function*(){const t=yield i(this,v);if(t===O)throw new Error("Cannot get value from None");return t}))}}v=new WeakMap;class R extends k{static of(){return new R}constructor(){super(Promise.resolve(O))}}class N extends k{static of(t){return new N(t)}constructor(t){super(Promise.resolve(t))}}function A(t,n){return new k((()=>r(this,void 0,void 0,(function*(){const r=yield t;return n(r)?O:r})))())}t.getError=function(t){try{t()}catch(t){return t}},t.getErrorAsync=function(t){return r(this,void 0,void 0,(function*(){try{yield t()}catch(t){return t}}))},t.getErrorAsyncIterable=function(t){var n,i,o,u;return r(this,void 0,void 0,(function*(){try{try{for(n=e(t);!(i=yield n.next()).done;){i.value}}catch(t){o={error:t}}finally{try{i&&!i.done&&(u=n.return)&&(yield u.call(n))}finally{if(o)throw o.error}}}catch(t){return t}}))},t.getErrorPromise=function(t){return r(this,void 0,void 0,(function*(){try{yield t}catch(t){return t}}))},t.getErrorResult=function(t){try{return[void 0,t()]}catch(t){return[t,void 0]}},t.getErrorResultAsync=function(t){return r(this,void 0,void 0,(function*(){try{return[void 0,yield t()]}catch(t){return[t,void 0]}}))},t.getErrorResultPromise=function(t){return r(this,void 0,void 0,(function*(){try{return[void 0,yield t]}catch(t){return[t,void 0]}}))},t.getFailure=function(t){try{return t(),[!1,void 0]}catch(t){return[!0,t]}},t.getFailureAsync=function(t){return r(this,void 0,void 0,(function*(){try{return yield t(),[!1,void 0]}catch(t){return[!0,t]}}))},t.getFailurePromise=s,t.getResult=function(t){try{return t()}catch(t){return}},t.getResultAsync=function(t){return r(this,void 0,void 0,(function*(){try{return yield t()}catch(t){return}}))},t.getResultError=function(t){try{return[t(),void 0]}catch(t){return[void 0,t]}},t.getResultErrorAsync=function(t){return r(this,void 0,void 0,(function*(){try{return[yield t(),void 0]}catch(t){return[void 0,t]}}))},t.getResultErrorPromise=function(t){return r(this,void 0,void 0,(function*(){try{return[yield t,void 0]}catch(t){return[void 0,t]}}))},t.getResultPromise=function(t){return r(this,void 0,void 0,(function*(){try{return yield t}catch(t){return}}))},t.getSuccess=function(t){try{return[!0,t()]}catch(t){return[!1,void 0]}},t.getSuccessAsync=function(t){return r(this,void 0,void 0,(function*(){try{return[!0,yield t()]}catch(t){return[!1,void 0]}}))},t.getSuccessPromise=u,t.isFailure=function(t){try{return t(),!1}catch(t){return!0}},t.isFailureAsync=function(t){return r(this,void 0,void 0,(function*(){try{return yield t(),!1}catch(t){return!0}}))},t.isFailurePromise=d,t.isSuccess=function(t){try{return t(),!0}catch(t){return!1}},t.isSuccessAsync=function(t){return r(this,void 0,void 0,(function*(){try{return yield t(),!0}catch(t){return!1}}))},t.isSuccessPromise=c,t.toOptional=x,t.toOptionalPartial=function(t){return r=>x(r,t)},t.toOptionalPromise=A,t.toOptionalPromisePartial=function(t){return r=>A(r,t)},t.toResult=function(t){try{const r=t();return y.Ok(r)}catch(t){return y.Err(t)}},t.toResultAsync=function(t){try{const r=t();return new p(r)}catch(t){return p.Err(t)}},t.toResultPromise=function(t){return new p(t)},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map

@@ -16,3 +16,3 @@ !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).ReturnStyle={})}(this,(function(t){"use strict";async function r(t){try{return[!0,await t]}catch(t){return[!1,void 0]}}async function n(t){try{return await t,[!1,void 0]}catch(t){return[!0,t]}}async function e(t){try{return await t,!0}catch(t){return!1}}async function s(t){try{return await t,!1}catch(t){return!0}}

***************************************************************************** */
function o(t,r){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return r.get(t)}function i(t,r,n){if(!r.has(t))throw new TypeError("attempted to set private field on non-instance");return r.set(t,n),n}var c,u,a,f,h;class y{static Ok(t){return w.of(t)}static Err(t){return l.of(t)}}class w extends y{constructor(t){super(),c.set(this,void 0),i(this,c,t)}static of(t){return new w(t)}isOk(){return!0}isErr(){return!1}onOk(t){return t(o(this,c)),w.of(o(this,c))}onErr(){return w.of(o(this,c))}orElse(){return w.of(o(this,c))}map(t){return w.of(t(o(this,c)))}get(){return o(this,c)}}c=new WeakMap;class l extends y{constructor(t){super(),u.set(this,void 0),i(this,u,t)}static of(t){return new l(t)}isOk(){return!1}isErr(){return!0}onOk(){return l.of(o(this,u))}onErr(t){return t(o(this,u)),l.of(o(this,u))}orElse(t){return w.of(t)}map(){return l.of(o(this,u))}get(){throw o(this,u)}}u=new WeakMap;class d{constructor(t){a.set(this,void 0),i(this,a,t)}static Ok(t){return m.of(t)}static Err(t){return p.of(t)}get then(){const t=o(this,a).then(t=>y.Ok(t),t=>y.Err(t));return t.then.bind(t)}onOk(t){return(async()=>{const[n,e]=await r(o(this,a));n&&t(e)})(),new d(o(this,a))}onErr(t){return(async()=>{const[r,e]=await n(o(this,a));r&&t(e)})(),new d(o(this,a))}async isOk(){return await e(o(this,a))}async isErr(){return await s(o(this,a))}orElse(t){return new d((async()=>{try{return await o(this,a)}catch(r){return t}})())}map(t){return new d((async()=>{const r=await o(this,a);return t(r)})())}async get(){return await o(this,a)}}a=new WeakMap;class m extends d{static of(t){return new m(t)}constructor(t){super(Promise.resolve(t))}}class p extends d{static of(t){return new p(t)}constructor(t){super(Promise.reject(t))}}class g{static Some(t){return v.of(t)}static None(){return E.of()}}class v extends g{constructor(t){super(),f.set(this,void 0),i(this,f,t)}static of(t){return new v(t)}isSome(){return!0}isNone(){return!1}onSome(t){return t(o(this,f)),v.of(o(this,f))}onNone(){return v.of(o(this,f))}orElse(){return v.of(o(this,f))}map(t){return v.of(t(o(this,f)))}filter(t){return t(o(this,f))?v.of(o(this,f)):E.of()}get(){return o(this,f)}}f=new WeakMap;class E extends g{static of(){return new E}constructor(){super()}isSome(){return!1}isNone(){return!0}onSome(){return E.of()}onNone(t){return t(),E.of()}orElse(t){return v.of(t)}map(){return E.of()}filter(){return E.of()}get(){throw new Error("Cannot get value from None")}}function P(t,r){const n=t();return r(n)?g.None():g.Some(n)}const S=Symbol();class k{constructor(t){h.set(this,void 0),i(this,h,t)}static Some(t){return R.of(t)}static None(){return O.of()}get then(){const t=o(this,h).then(t=>t===S?g.None():g.Some(t));return t.then.bind(t)}onSome(t){return(async()=>{const r=await o(this,h);r!==S&&t(r)})(),new k(o(this,h))}onNone(t){return(async()=>{await o(this,h)===S&&t()})(),new k(o(this,h))}async isSome(){return await o(this,h)!==S}async isNone(){return await o(this,h)===S}orElse(t){return new k((async()=>{const r=await o(this,h);return r===S?t:r})())}map(t){return new k((async()=>{const r=await o(this,h);return r===S?S:t(r)})())}filter(t){return new k((async()=>{const r=await o(this,h);return r===S?S:t(r)?r:S})())}async get(){const t=await o(this,h);if(t===S)throw new Error("Cannot get value from None");return t}}h=new WeakMap;class O extends k{static of(){return new O}constructor(){super(Promise.resolve(S))}}class R extends k{static of(t){return new R(t)}constructor(t){super(Promise.resolve(t))}}function N(t,r){return new k((async()=>{const n=await t;return r(n)?S:n})())}t.getError=function(t){try{t()}catch(t){return t}},t.getErrorAsync=async function(t){try{await t()}catch(t){return t}},t.getErrorAsyncIterable=async function(t){try{for await(const r of t);}catch(t){return t}},t.getErrorPromise=async function(t){try{await t}catch(t){return t}},t.getErrorResult=function(t){try{return[void 0,t()]}catch(t){return[t,void 0]}},t.getErrorResultAsync=async function(t){try{return[void 0,await t()]}catch(t){return[t,void 0]}},t.getErrorResultPromise=async function(t){try{return[void 0,await t]}catch(t){return[t,void 0]}},t.getFailure=function(t){try{return t(),[!1,void 0]}catch(t){return[!0,t]}},t.getFailureAsync=async function(t){try{return await t(),[!1,void 0]}catch(t){return[!0,t]}},t.getFailurePromise=n,t.getResult=function(t){try{return t()}catch(t){return}},t.getResultAsync=async function(t){try{return await t()}catch(t){return}},t.getResultError=function(t){try{return[t(),void 0]}catch(t){return[void 0,t]}},t.getResultErrorAsync=async function(t){try{return[await t(),void 0]}catch(t){return[void 0,t]}},t.getResultErrorPromise=async function(t){try{return[await t,void 0]}catch(t){return[void 0,t]}},t.getResultPromise=async function(t){try{return await t}catch(t){return}},t.getSuccess=function(t){try{return[!0,t()]}catch(t){return[!1,void 0]}},t.getSuccessAsync=async function(t){try{return[!0,await t()]}catch(t){return[!1,void 0]}},t.getSuccessPromise=r,t.isFailure=function(t){try{return t(),!1}catch(t){return!0}},t.isFailureAsync=async function(t){try{return await t(),!1}catch(t){return!0}},t.isFailurePromise=s,t.isSuccess=function(t){try{return t(),!0}catch(t){return!1}},t.isSuccessAsync=async function(t){try{return await t(),!0}catch(t){return!1}},t.isSuccessPromise=e,t.toOptional=P,t.toOptionalPartial=function(t){return r=>P(r,t)},t.toOptionalPromise=N,t.toOptionalPromisePartial=function(t){return r=>N(r,t)},t.toResult=function(t){try{const r=t();return y.Ok(r)}catch(t){return y.Err(t)}},t.toResultAsync=function(t){try{const r=t();return new d(r)}catch(t){return d.Err(t)}},t.toResultPromise=function(t){return new d(t)},Object.defineProperty(t,"__esModule",{value:!0})}));
function o(t,r){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return r.get(t)}function i(t,r,n){if(!r.has(t))throw new TypeError("attempted to set private field on non-instance");return r.set(t,n),n}var c,u,a,f,h;class y{static Ok(t){return w.of(t)}static Err(t){return l.of(t)}}class w extends y{constructor(t){super(),c.set(this,void 0),i(this,c,t)}static of(t){return new w(t)}isOk(){return!0}isErr(){return!1}onOk(t){return t(o(this,c)),w.of(o(this,c))}onErr(){return w.of(o(this,c))}orElse(){return w.of(o(this,c))}map(t){return w.of(t(o(this,c)))}get(){return o(this,c)}}c=new WeakMap;class l extends y{constructor(t){super(),u.set(this,void 0),i(this,u,t)}static of(t){return new l(t)}isOk(){return!1}isErr(){return!0}onOk(){return l.of(o(this,u))}onErr(t){return t(o(this,u)),l.of(o(this,u))}orElse(t){return w.of(t)}map(){return l.of(o(this,u))}get(){throw o(this,u)}}u=new WeakMap;class d{constructor(t){a.set(this,void 0),i(this,a,t)}static Ok(t){return m.of(t)}static Err(t){return p.of(t)}get then(){const t=o(this,a).then((t=>y.Ok(t)),(t=>y.Err(t)));return t.then.bind(t)}onOk(t){return(async()=>{const[n,e]=await r(o(this,a));n&&t(e)})(),new d(o(this,a))}onErr(t){return(async()=>{const[r,e]=await n(o(this,a));r&&t(e)})(),new d(o(this,a))}async isOk(){return await e(o(this,a))}async isErr(){return await s(o(this,a))}orElse(t){return new d((async()=>{try{return await o(this,a)}catch(r){return t}})())}map(t){return new d((async()=>{const r=await o(this,a);return t(r)})())}async get(){return await o(this,a)}}a=new WeakMap;class m extends d{static of(t){return new m(t)}constructor(t){super(Promise.resolve(t))}}class p extends d{static of(t){return new p(t)}constructor(t){super(Promise.reject(t))}}class g{static Some(t){return v.of(t)}static None(){return E.of()}}class v extends g{constructor(t){super(),f.set(this,void 0),i(this,f,t)}static of(t){return new v(t)}isSome(){return!0}isNone(){return!1}onSome(t){return t(o(this,f)),v.of(o(this,f))}onNone(){return v.of(o(this,f))}orElse(){return v.of(o(this,f))}map(t){return v.of(t(o(this,f)))}filter(t){return t(o(this,f))?v.of(o(this,f)):E.of()}get(){return o(this,f)}}f=new WeakMap;class E extends g{static of(){return new E}constructor(){super()}isSome(){return!1}isNone(){return!0}onSome(){return E.of()}onNone(t){return t(),E.of()}orElse(t){return v.of(t)}map(){return E.of()}filter(){return E.of()}get(){throw new Error("Cannot get value from None")}}function P(t,r){const n=t();return r(n)?g.None():g.Some(n)}const S=Symbol();class k{constructor(t){h.set(this,void 0),i(this,h,t)}static Some(t){return R.of(t)}static None(){return O.of()}get then(){const t=o(this,h).then((t=>t===S?g.None():g.Some(t)));return t.then.bind(t)}onSome(t){return(async()=>{const r=await o(this,h);r!==S&&t(r)})(),new k(o(this,h))}onNone(t){return(async()=>{await o(this,h)===S&&t()})(),new k(o(this,h))}async isSome(){return await o(this,h)!==S}async isNone(){return await o(this,h)===S}orElse(t){return new k((async()=>{const r=await o(this,h);return r===S?t:r})())}map(t){return new k((async()=>{const r=await o(this,h);return r===S?S:t(r)})())}filter(t){return new k((async()=>{const r=await o(this,h);return r===S?S:t(r)?r:S})())}async get(){const t=await o(this,h);if(t===S)throw new Error("Cannot get value from None");return t}}h=new WeakMap;class O extends k{static of(){return new O}constructor(){super(Promise.resolve(S))}}class R extends k{static of(t){return new R(t)}constructor(t){super(Promise.resolve(t))}}function N(t,r){return new k((async()=>{const n=await t;return r(n)?S:n})())}t.getError=function(t){try{t()}catch(t){return t}},t.getErrorAsync=async function(t){try{await t()}catch(t){return t}},t.getErrorAsyncIterable=async function(t){try{for await(const r of t);}catch(t){return t}},t.getErrorPromise=async function(t){try{await t}catch(t){return t}},t.getErrorResult=function(t){try{return[void 0,t()]}catch(t){return[t,void 0]}},t.getErrorResultAsync=async function(t){try{return[void 0,await t()]}catch(t){return[t,void 0]}},t.getErrorResultPromise=async function(t){try{return[void 0,await t]}catch(t){return[t,void 0]}},t.getFailure=function(t){try{return t(),[!1,void 0]}catch(t){return[!0,t]}},t.getFailureAsync=async function(t){try{return await t(),[!1,void 0]}catch(t){return[!0,t]}},t.getFailurePromise=n,t.getResult=function(t){try{return t()}catch(t){return}},t.getResultAsync=async function(t){try{return await t()}catch(t){return}},t.getResultError=function(t){try{return[t(),void 0]}catch(t){return[void 0,t]}},t.getResultErrorAsync=async function(t){try{return[await t(),void 0]}catch(t){return[void 0,t]}},t.getResultErrorPromise=async function(t){try{return[await t,void 0]}catch(t){return[void 0,t]}},t.getResultPromise=async function(t){try{return await t}catch(t){return}},t.getSuccess=function(t){try{return[!0,t()]}catch(t){return[!1,void 0]}},t.getSuccessAsync=async function(t){try{return[!0,await t()]}catch(t){return[!1,void 0]}},t.getSuccessPromise=r,t.isFailure=function(t){try{return t(),!1}catch(t){return!0}},t.isFailureAsync=async function(t){try{return await t(),!1}catch(t){return!0}},t.isFailurePromise=s,t.isSuccess=function(t){try{return t(),!0}catch(t){return!1}},t.isSuccessAsync=async function(t){try{return await t(),!0}catch(t){return!1}},t.isSuccessPromise=e,t.toOptional=P,t.toOptionalPartial=function(t){return r=>P(r,t)},t.toOptionalPromise=N,t.toOptionalPromisePartial=function(t){return r=>N(r,t)},t.toResult=function(t){try{const r=t();return y.Ok(r)}catch(t){return y.Err(t)}},t.toResultAsync=function(t){try{const r=t();return new d(r)}catch(t){return d.Err(t)}},t.toResultPromise=function(t){return new d(t)},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map
{
"name": "return-style",
"version": "0.11.5",
"version": "0.11.6",
"description": "Non-intrusively convert the result of any function or promise to the user's desired style.",

@@ -80,5 +80,5 @@ "keywords": [

"tscpaths": "^0.0.9",
"tslib": "^2.1.0",
"typescript": "^4.1.3"
},
"dependencies": {}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc