New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

f-box-core

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

f-box-core - npm Package Compare versions

Comparing version 0.1.12 to 0.1.13

2

dist/index.js

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

(function(u,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(u=typeof globalThis<"u"?globalThis:u||self,g(u["f-box-core"]={}))})(this,function(u){"use strict";const g=t=>{const s=c=>g(c(t)),o=function(c){const a=this.getValue();return c.map(p=>a(p))},i=c=>c(t);return{isBox:!0,map:s,apply:o,flatMap:i,getValue:()=>t,"<$>":s,"<*>":o,">>=":i}},H=t=>(t==null?void 0:t.isBox)===!0,J={pack:g,isBox:H},E=t=>{let s=t;const o=new Map,i=[],b=()=>{o.forEach(n=>n(s))},c=()=>s,a=n=>{typeof n=="function"?s=n(s):s=n,b()},p=n=>{const r=E(n(s)),h=y(B=>{r.setValue(n(B))});return r.detachHandlers.push(()=>$(h)),r},e=n=>{let r=n(s);const h=E(r.getValue()),w=y(O=>{r.detach(),r=n(O),h.setValue(r.getValue());const D=r.subscribe(F=>{h.setValue(F)});h.detachHandlers.push(()=>r.unsubscribe(D))});h.detachHandlers.push(()=>$(w));const z=r.subscribe(O=>{h.setValue(O)});return h.detachHandlers.push(()=>r.unsubscribe(z)),h},f=function(n){const r=E(this.getValue()(n.getValue())),h=()=>r.setValue(this.getValue()(n.getValue())),B=[this.subscribe(h),n.subscribe(h)];return r.detachHandlers.push(()=>{this.unsubscribe(B[0]),n.unsubscribe(B[1])}),r},y=n=>{const r=Math.random().toString(36).substr(2,9);return o.set(r,n),r},$=n=>{o.delete(n)};return{isRBox:!0,getValue:c,setValue:a,map:p,flatMap:e,apply:f,"<$>":p,">>=":e,"<*>":f,subscribe:y,unsubscribe:$,unsubscribeAll:()=>{o.clear()},detach:()=>{i.forEach(n=>n()),i.length=0},detachHandlers:i}},P=t=>s=>{t.setValue(s)},A={pack:E,set:P,isRBox:t=>t&&typeof t=="object"&&t.isRBox===!0},d={isMaybe:!0,map:()=>d,apply:()=>d,flatMap:()=>d,getValue:()=>null,orElse:t=>t,getOrElse:t=>t,match:(t,s)=>s(),"<$>":()=>d,"<*>":()=>d,">>=":()=>d,"<?>":t=>t,"<|>":t=>t},K=t=>N(t)?V():k(t),V=()=>d,k=t=>{const s=e=>K(e(t)),o=function(e){if(x(this)||x(e))return V();const f=this.getValue();return e.map(y=>f(y))},i=e=>e(t),b=()=>t,c=e=>k(t),a=e=>t;return{isMaybe:!0,map:s,apply:o,flatMap:i,getValue:b,orElse:c,getOrElse:a,match:(e,f)=>e(t),"<$>":s,"<*>":o,">>=":i,"<?>":c,"<|>":a}},N=t=>t==null,T=t=>t&&typeof t=="object"&&t.isMaybe===!0,x=t=>T(t)&&t===V(),C={pack:K,just:k,nothing:V,isNone:N,isMaybe:T,isNothing:x,isJust:t=>T(t)&&t!==V()},l=t=>({isEither:!0,map:()=>l(t),apply:()=>l(t),flatMap:()=>l(t),getValue:()=>t,orElse:s=>s,getOrElse:s=>s,match:(s,o)=>s(t),"<$>":()=>l(t),"<*>":()=>l(t),">>=":()=>l(t),"<?>":s=>s,"<|>":s=>s}),M=t=>{const s=e=>M(e(t)),o=function(e){if(_(this)||_(e))return e;const f=this.getValue();return e.map(y=>f(y))},i=e=>e(t),b=()=>t,c=e=>M(t),a=e=>t;return{isEither:!0,map:s,apply:o,flatMap:i,getValue:b,orElse:c,getOrElse:a,match:(e,f)=>f(t),"<$>":s,"<*>":o,">>=":i,"<?>":c,"<|>":a}},I=M,R=t=>t==null,j=t=>t&&typeof t=="object"&&t.isEither===!0,_=t=>j(t)&&t.match(s=>!R(s),()=>!1),L={pack:I,right:M,left:l,isNone:R,isEither:j,isLeft:_,isRight:t=>j(t)&&t.match(()=>!1,s=>!R(s))},m=t=>{const s=c=>m(()=>t().then(c)),o=c=>m(()=>t().then(a=>c(a).run())),i=function(c){return m(()=>this.run().then(a=>typeof a!="function"?Promise.reject(new TypeError("fn is not a function")):c.run().then(p=>a(p))))};return{isTask:!0,map:s,flatMap:o,apply:i,run:t,"<$>":s,"<*>":i,">>=":o}},S=(t,s)=>m(()=>Promise.resolve().then(()=>t()).catch(o=>Promise.resolve(s(o)))),q={from:m,pack:t=>m(()=>Promise.resolve(t)),tryCatch:S,tryTask:t=>S(t,s=>Promise.reject(s)),isTask:t=>(t==null?void 0:t.isTask)===!0};u.Box=J,u.Either=L,u.Maybe=C,u.RBox=A,u.Task=q,u.isBox=H,u.set=P,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
(function(a,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(a=typeof globalThis<"u"?globalThis:a||self,y(a["f-box-core"]={}))})(this,function(a){"use strict";const y=t=>{const s=r=>y(r(t)),o=function(r){const u=this.getValue();return r.map(l=>u(l))},c=r=>r(t);return{isBox:!0,map:s,apply:o,flatMap:c,getValue:()=>t,"<$>":s,"<*>":o,">>=":c}},O=t=>(t==null?void 0:t.isBox)===!0,L={pack:y,isBox:O},B=t=>{let s=t;const o=new Map,c=[],g=()=>{o.forEach(n=>n(s))},r=()=>s,u=n=>{typeof n=="function"?s=n(s):s=n,g()},l=n=>{const i=B(n(s)),h=b(V=>{i.setValue(n(V))});return i.detachHandlers.push(()=>_(h)),i},e=n=>{let i=n(s);const h=B(i.getValue()),z=b($=>{i.detach(),i=n($),h.setValue(i.getValue());const F=i.subscribe(G=>{h.setValue(G)});h.detachHandlers.push(()=>i.unsubscribe(F))});h.detachHandlers.push(()=>_(z));const D=i.subscribe($=>{h.setValue($)});return h.detachHandlers.push(()=>i.unsubscribe(D)),h},p=function(n){const i=B(this.getValue()(n.getValue())),h=()=>i.setValue(this.getValue()(n.getValue())),V=[this.subscribe(h),n.subscribe(h)];return i.detachHandlers.push(()=>{this.unsubscribe(V[0]),n.unsubscribe(V[1])}),i},b=n=>{const i=Math.random().toString(36).substr(2,9);return o.set(i,n),i},_=n=>{o.delete(n)};return{isRBox:!0,getValue:r,setValue:u,map:l,flatMap:e,apply:p,"<$>":l,">>=":e,"<*>":p,subscribe:b,unsubscribe:_,unsubscribeAll:()=>{o.clear()},detach:()=>{c.forEach(n=>n()),c.length=0},detachHandlers:c}},H=t=>s=>{t.setValue(s)},S={pack:B,set:H,isRBox:t=>t&&typeof t=="object"&&t.isRBox===!0},d={isMaybe:!0,isJust:!1,isNothing:!0,map:()=>d,apply:()=>d,flatMap:()=>d,getValue:()=>null,orElse:t=>t,getOrElse:t=>t,match:(t,s)=>s(),"<$>":()=>d,"<*>":()=>d,">>=":()=>d,"<?>":t=>t,"<|>":t=>t},P=t=>R(t)?M():k(t),M=()=>d,k=t=>{const s=e=>P(e(t)),o=function(e){if(x(this)||x(e))return M();const p=this.getValue();return e.map(b=>p(b))},c=e=>e(t),g=()=>t,r=e=>k(t),u=e=>t;return{isMaybe:!0,isJust:!0,isNothing:!1,map:s,apply:o,flatMap:c,getValue:g,orElse:r,getOrElse:u,match:(e,p)=>e(t),"<$>":s,"<*>":o,">>=":c,"<?>":r,"<|>":u}},R=t=>t==null,T=t=>typeof t!="object"||R(t)||!("isMaybe"in t)?!1:t.isMaybe===!0,A=t=>T(t)&&t.isJust,x=t=>T(t)&&t.isNothing,C={pack:P,just:k,nothing:M,isNone:R,isMaybe:T,isNothing:x,isJust:A},f=t=>({isEither:!0,isLeft:!0,isRight:!1,map:()=>f(t),apply:()=>f(t),flatMap:()=>f(t),getValue:()=>t,orElse:s=>s,getOrElse:s=>s,match:(s,o)=>s(t),"<$>":()=>f(t),"<*>":()=>f(t),">>=":()=>f(t),"<?>":s=>s,"<|>":s=>s}),E=t=>{const s=e=>E(e(t)),o=function(e){if(N(this))return f(this.getValue());if(N(e))return f(e.getValue());const p=this.getValue();return e.map(b=>p(b))},c=e=>e(t),g=()=>t,r=e=>E(t),u=e=>t;return{isEither:!0,isLeft:!1,isRight:!0,map:s,apply:o,flatMap:c,getValue:g,orElse:r,getOrElse:u,match:(e,p)=>p(t),"<$>":s,"<*>":o,">>=":c,"<?>":r,"<|>":u}},I=E,J=t=>t==null,j=t=>typeof t!="object"||J(t)||!("isEither"in t)?!1:t.isEither===!0,N=t=>j(t)&&t.isLeft,q={pack:I,right:E,left:f,isNone:J,isEither:j,isLeft:N,isRight:t=>j(t)&&t.isRight},m=t=>{const s=r=>m(()=>t().then(r)),o=r=>m(()=>t().then(u=>r(u).run())),c=function(r){return m(()=>this.run().then(u=>typeof u!="function"?Promise.reject(new TypeError("fn is not a function")):r.run().then(l=>u(l))))};return{isTask:!0,map:s,flatMap:o,apply:c,run:t,"<$>":s,"<*>":c,">>=":o}},K=(t,s)=>m(()=>Promise.resolve().then(()=>t()).catch(o=>Promise.resolve(s(o)))),w={from:m,pack:t=>m(()=>Promise.resolve(t)),tryCatch:K,tryTask:t=>K(t,s=>Promise.reject(s)),isTask:t=>(t==null?void 0:t.isTask)===!0};a.Box=L,a.Either=q,a.Maybe=C,a.RBox=S,a.Task=w,a.isBox=O,a.set=H,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});

@@ -1,5 +0,1 @@

/**
* Represents a value that might be an error (Left) or a valid result (Right).
* エラー(Left)または有効な結果(Right)の値を表現します。
*/
type None = null | undefined | void;

@@ -10,3 +6,3 @@ /**

*/
export type Either<L, R> = Left<L> | Right<L, R>;
export type Either<L, R> = Left<L, R> | Right<L, R>;
/**

@@ -16,4 +12,6 @@ * Represents a `Left` value, encapsulating an error or invalid result.

*/
export type Left<L> = {
export type Left<L, R> = {
readonly isEither: true;
readonly isLeft: true;
readonly isRight: false;
/**

@@ -24,3 +22,3 @@ * Ignores the provided function and returns itself since there is no valid value.

*/
readonly map: <U>(_fn: (value: any) => U) => Left<L>;
readonly map: <U>(_fn: (value: R) => U) => Left<L, U>;
/**

@@ -33,3 +31,3 @@ * Ignores the provided function and returns itself since there is no valid value.

*/
readonly "<$>": <U>(_fn: (value: any) => U) => Left<L>;
readonly "<$>": <U>(_fn: (value: R) => U) => Left<L, U>;
/**

@@ -56,3 +54,3 @@ * Ignores the provided function and boxed value, returning itself since there is no valid value.

*/
readonly flatMap: <U>(_fn: (value: any) => Either<L, U>) => Left<L>;
readonly flatMap: <U>(_fn: (value: R) => Either<L, U>) => Left<L, U>;
/**

@@ -65,3 +63,3 @@ * Ignores the provided function, returning itself since there is no valid value.

*/
readonly ">>=": <U>(_fn: (value: any) => Either<L, U>) => Left<L>;
readonly ">>=": <U>(_fn: (value: R) => Either<L, U>) => Left<L, U>;
/**

@@ -106,3 +104,3 @@ * Gets the value inside the `Left`.

*/
readonly match: <U>(onLeft: (value: L) => U, _onRight: (value: any) => U) => U;
readonly match: <U>(onLeft: (value: L) => U, _onRight: (value: R) => U) => U;
};

@@ -115,2 +113,4 @@ /**

readonly isEither: true;
readonly isLeft: false;
readonly isRight: true;
/**

@@ -206,8 +206,8 @@ * Applies a function to the value inside the `Right` and returns a new `Either`.

readonly right: <L, R>(value: R) => Right<L, R>;
readonly left: <L>(value: L) => Left<L>;
readonly isNone: (value: any) => value is None;
readonly isEither: <L, R>(value: any) => value is Either<L, R>;
readonly isLeft: <L, R>(value: Either<L, R>) => value is Left<L>;
readonly left: <L, R>(value: L) => Left<L, R>;
readonly isNone: (value: unknown) => value is None;
readonly isEither: <L, R>(value: unknown) => value is Either<L, R>;
readonly isLeft: <L, R>(value: Either<L, R>) => value is Left<L, R>;
readonly isRight: <L, R>(value: Either<L, R>) => value is Right<L, R>;
};
export {};

@@ -17,2 +17,4 @@ /**

readonly isMaybe: true;
readonly isJust: true;
readonly isNothing: false;
/**

@@ -109,2 +111,4 @@ * Applies a function to the value inside the `Just` and returns a new `Maybe`.

readonly isMaybe: true;
readonly isJust: false;
readonly isNothing: true;
/**

@@ -115,3 +119,3 @@ * Returns itself since there is no value to map.

*/
readonly map: <U>(_fn: (value: any) => U) => Nothing;
readonly map: <U>(_fn: (value: never) => U) => Nothing;
/**

@@ -124,3 +128,3 @@ * Returns itself since there is no value.

*/
readonly "<$>": <U>(_fn: (value: any) => U) => Nothing;
readonly "<$>": <U>(_fn: (value: never) => U) => Nothing;
/**

@@ -147,3 +151,3 @@ * Returns itself since there is no value to apply.

*/
readonly flatMap: <U>(_fn: (value: any) => Maybe<U>) => Nothing;
readonly flatMap: <U>(_fn: (value: never) => Maybe<U>) => Nothing;
/**

@@ -156,3 +160,3 @@ * Returns itself since there is no value to flatMap.

*/
readonly ">>=": <U>(_fn: (value: any) => Maybe<U>) => Nothing;
readonly ">>=": <U>(_fn: (value: never) => Maybe<U>) => Nothing;
/**

@@ -197,3 +201,3 @@ * Always returns `null` for a `Nothing` type.

*/
readonly match: <U>(_onJust: (value: any) => U, onNothing: () => U) => U;
readonly match: <U>(_onJust: (value: never) => U, onNothing: () => U) => U;
};

@@ -208,7 +212,7 @@ /**

readonly nothing: () => Nothing;
readonly isNone: (value: any) => value is None;
readonly isMaybe: <T>(value: any) => value is Maybe<T>;
readonly isNone: (value: unknown) => value is None;
readonly isMaybe: <T>(value: unknown) => value is Maybe<T>;
readonly isNothing: <T>(value: Maybe<T>) => value is Nothing;
readonly isJust: <T>(value: any) => value is Just<T>;
readonly isJust: <T>(value: Maybe<T>) => value is Just<T>;
};
export {};
{
"name": "f-box-core",
"version": "0.1.12",
"version": "0.1.13",
"description": "Put your data in a box, and suddenly it's easier to handle, transform, and use however you need.",

@@ -5,0 +5,0 @@ "type": "module",

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