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

@fp51/foldable-helpers

Package Overview
Dependencies
Maintainers
4
Versions
290
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fp51/foldable-helpers - npm Package Compare versions

Comparing version 1.0.0-canary-d7abe4d-1614910060011 to 1.0.0-canary-d886646a36b7e277cbd756294e69546004beb252-1658110319397

dist/pipeable-7181e6e6.js

2

dist/createFold.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),e=require("./pipeable-657f8d92.js");exports.createFold=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];function o(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return function(o){var u=e.zip(n,t);return e.pipe(u,e.findFirst((function(e){return(0,r.__read(e,1)[0])(o)})),e.fromOption((function(){return new Error("No guard found to fold "+o)})),e.fold((function(r){throw r}),(function(e){var n=r.__read(e,2);return n[0],(0,n[1])(o)})))}}return o};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),e=require("./pipeable-7181e6e6.js");exports.createFold=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];function o(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return function(o){var u=e.zip(n,t);return e.pipe(u,e.findFirst((function(e){return(0,r.__read(e,1)[0])(o)})),e.fromOption((function(){return new Error("No guard found to fold ".concat(o))})),e.fold((function(r){throw r}),(function(e){var n=r.__read(e,2);return n[0],(0,n[1])(o)})))}}return o};

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("./pipeable-657f8d92.js");exports.createFoldObject=function(e){return function(t){return function(n){var o=Object.keys(e);return r.pipe(o,r.findFirst((function(r){return e[r](n)})),r.fromOption((function(){return new Error("No guard found to fold "+n)})),r.fold((function(r){throw r}),(function(r){return t[r](n)})))}}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./pipeable-7181e6e6.js");exports.createFoldObject=function(r){return function(t){return function(n){var o=Object.keys(r);return e.pipe(o,e.findFirst((function(e){return r[e](n)})),e.fromOption((function(){return new Error("No guard found to fold ".concat(n))})),e.fold((function(e){throw e}),(function(e){return t[e](n)})))}}};
import { Guard } from './types';
declare type NotGuard<A, B extends A> = (a: A) => a is Exclude<A, B>;
declare type GuardedType<Type> = Type extends (x: any) => x is infer T ? T : never;
/**
* Takes an array of guard parameters (so should have only one item)
* and return the first parameter converted to an intersection.
*
* @example
type Guards = ... // some guards
type GuardsParameters = Parameters\<Guards[number]\>;
type IntersectionOfInputTypes = InputParametersToIntersection<GuardsParameters>;
*
*/
declare type InputParametersToIntersection<Params> = (Params extends [any] ? (k: Params[0]) => void : never) extends (k: infer I) => void ? I : never;
export declare function not<A, B extends A>(guard: Guard<A, B>): NotGuard<A, B>;
export declare function and<Guards extends Guard<any, any>[]>(...guards: Guards): (t: ((Guards[number] extends (...args: infer P) => any ? P : never) extends [any] ? (k: ([any] & (Guards[number] extends (...args: infer P) => any ? P : never))[0]) => void : never) extends (k: infer I) => void ? I : never) => t is (((Guards[number] extends (...args: infer P) => any ? P : never) extends [any] ? (k: ([any] & (Guards[number] extends (...args: infer P) => any ? P : never))[0]) => void : never) extends (k: infer I) => void ? I : never) & (((Guards[number] extends (x: any) => x is infer T ? T : never) extends any ? (k: Guards[number] extends (x: any) => x is infer T ? T : never) => void : never) extends (k: infer I_1) => void ? I_1 : never);
export declare function or<Guards extends Guard<any, any>[]>(...guards: Guards): (t: ((Guards[number] extends (...args: infer P) => any ? P : never) extends [any] ? (k: ([any] & (Guards[number] extends (...args: infer P) => any ? P : never))[0]) => void : never) extends (k: infer I) => void ? I : never) => t is (((Guards[number] extends (...args: infer P) => any ? P : never) extends [any] ? (k: ([any] & (Guards[number] extends (...args: infer P) => any ? P : never))[0]) => void : never) extends (k: infer I) => void ? I : never) & (Guards[number] extends (x: any) => x is infer T ? T : never);
export declare function and<Guards extends Guard<any, any>[]>(...guards: Guards): (t: InputParametersToIntersection<Parameters<Guards[number]>>) => t is InputParametersToIntersection<Parameters<Guards[number]>> & ((GuardedType<Guards[number]> extends any ? (k: GuardedType<Guards[number]>) => void : never) extends (k: infer I) => void ? I : never);
export declare function or<Guards extends Guard<any, any>[]>(...guards: Guards): (t: InputParametersToIntersection<Parameters<Guards[number]>>) => t is InputParametersToIntersection<Parameters<Guards[number]>> & GuardedType<Guards[number]>;
export {};

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./guard.js"),r=require("./createFold.js"),t=require("./createFoldObject.js");require("tslib"),require("./pipeable-657f8d92.js"),exports.and=e.and,exports.not=e.not,exports.or=e.or,exports.createFold=r.createFold,exports.createFoldObject=t.createFoldObject;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./guard.js"),r=require("./createFold.js"),t=require("./createFoldObject.js");require("tslib"),require("./pipeable-7181e6e6.js"),exports.and=e.and,exports.not=e.not,exports.or=e.or,exports.createFold=r.createFold,exports.createFoldObject=t.createFoldObject;

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

import{__read as r}from"tslib";import{z as n,p as t,f as o,a as u,b as a}from"./pipeable-3bdaadc5.js";function f(){for(var f=[],e=0;e<arguments.length;e++)f[e]=arguments[e];function i(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return function(i){var c=n(f,e);return t(c,a((function(n){return(0,r(n,1)[0])(i)})),u((function(){return new Error("No guard found to fold "+i)})),o((function(r){throw r}),(function(n){var t=r(n,2);return t[0],(0,t[1])(i)})))}}return i}export{f as createFold};
import{__read as r}from"tslib";import{z as n,p as t,f as o,a as u,b as a}from"./pipeable-649419ca.js";function f(){for(var f=[],e=0;e<arguments.length;e++)f[e]=arguments[e];function i(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return function(i){var c=n(f,e);return t(c,a((function(n){return(0,r(n,1)[0])(i)})),u((function(){return new Error("No guard found to fold ".concat(i))})),o((function(r){throw r}),(function(n){var t=r(n,2);return t[0],(0,t[1])(i)})))}}return i}export{f as createFold};

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

import{p as n,f as r,a as t,b as o}from"./pipeable-3bdaadc5.js";function u(u){return function(e){return function(f){var a=Object.keys(u);return n(a,o((function(n){return u[n](f)})),t((function(){return new Error("No guard found to fold "+f)})),r((function(n){throw n}),(function(n){return e[n](f)})))}}}export{u as createFoldObject};
import{p as n,f as r,a as t,b as o}from"./pipeable-649419ca.js";function u(u){return function(e){return function(c){var f=Object.keys(u);return n(f,o((function(n){return u[n](c)})),t((function(){return new Error("No guard found to fold ".concat(c))})),r((function(n){throw n}),(function(n){return e[n](c)})))}}}export{u as createFoldObject};
import { Guard } from './types';
declare type NotGuard<A, B extends A> = (a: A) => a is Exclude<A, B>;
declare type GuardedType<Type> = Type extends (x: any) => x is infer T ? T : never;
/**
* Takes an array of guard parameters (so should have only one item)
* and return the first parameter converted to an intersection.
*
* @example
type Guards = ... // some guards
type GuardsParameters = Parameters\<Guards[number]\>;
type IntersectionOfInputTypes = InputParametersToIntersection<GuardsParameters>;
*
*/
declare type InputParametersToIntersection<Params> = (Params extends [any] ? (k: Params[0]) => void : never) extends (k: infer I) => void ? I : never;
export declare function not<A, B extends A>(guard: Guard<A, B>): NotGuard<A, B>;
export declare function and<Guards extends Guard<any, any>[]>(...guards: Guards): (t: ((Guards[number] extends (...args: infer P) => any ? P : never) extends [any] ? (k: ([any] & (Guards[number] extends (...args: infer P) => any ? P : never))[0]) => void : never) extends (k: infer I) => void ? I : never) => t is (((Guards[number] extends (...args: infer P) => any ? P : never) extends [any] ? (k: ([any] & (Guards[number] extends (...args: infer P) => any ? P : never))[0]) => void : never) extends (k: infer I) => void ? I : never) & (((Guards[number] extends (x: any) => x is infer T ? T : never) extends any ? (k: Guards[number] extends (x: any) => x is infer T ? T : never) => void : never) extends (k: infer I_1) => void ? I_1 : never);
export declare function or<Guards extends Guard<any, any>[]>(...guards: Guards): (t: ((Guards[number] extends (...args: infer P) => any ? P : never) extends [any] ? (k: ([any] & (Guards[number] extends (...args: infer P) => any ? P : never))[0]) => void : never) extends (k: infer I) => void ? I : never) => t is (((Guards[number] extends (...args: infer P) => any ? P : never) extends [any] ? (k: ([any] & (Guards[number] extends (...args: infer P) => any ? P : never))[0]) => void : never) extends (k: infer I) => void ? I : never) & (Guards[number] extends (x: any) => x is infer T ? T : never);
export declare function and<Guards extends Guard<any, any>[]>(...guards: Guards): (t: InputParametersToIntersection<Parameters<Guards[number]>>) => t is InputParametersToIntersection<Parameters<Guards[number]>> & ((GuardedType<Guards[number]> extends any ? (k: GuardedType<Guards[number]>) => void : never) extends (k: infer I) => void ? I : never);
export declare function or<Guards extends Guard<any, any>[]>(...guards: Guards): (t: InputParametersToIntersection<Parameters<Guards[number]>>) => t is InputParametersToIntersection<Parameters<Guards[number]>> & GuardedType<Guards[number]>;
export {};

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

export{and,not,or}from"./guard.js";export{createFold}from"./createFold.js";export{createFoldObject}from"./createFoldObject.js";import"tslib";import"./pipeable-3bdaadc5.js";
export{and,not,or}from"./guard.js";export{createFold}from"./createFold.js";export{createFoldObject}from"./createFoldObject.js";import"tslib";import"./pipeable-649419ca.js";
{
"name": "@fp51/foldable-helpers",
"version": "1.0.0-canary-d7abe4d-1614910060011",
"version": "1.0.0-canary-d886646a36b7e277cbd756294e69546004beb252-1658110319397",
"description": "Typescript helpers to fold on sum types",

@@ -35,5 +35,5 @@ "main": "dist/index.js",

"@fp51/eslint-config-jest": "^1.0.0",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.1.0",
"@types/jest": "^26.0.20",
"@rollup/plugin-commonjs": "^21.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@types/jest": "^27.0.0",
"eslint": "^7.18.0",

@@ -44,7 +44,7 @@ "jest": "^26.6.3",

"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"rollup-plugin-typescript2": "^0.31.0",
"ts-jest": "^26.4.4",
"tsd": "^0.14.0",
"tsd": "^0.19.0",
"tslib": "^2.1.0",
"typedoc": "^0.20.28",
"typedoc": "^0.22.3",
"typescript": "^4.0.5"

@@ -51,0 +51,0 @@ },

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