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

gamla

Package Overview
Dependencies
Maintainers
0
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gamla - npm Package Compare versions

Comparing version 91.0.0 to 93.0.0

2

esm/src/array.d.ts

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

import { AsyncFunction, Func, ParamOf } from "./typing.js";
import type { AsyncFunction, Func, ParamOf } from "./typing.js";
export declare const anymap: <F extends Func>(f: F) => (xs: ParamOf<F>[]) => F extends AsyncFunction ? Promise<boolean> : boolean;

@@ -3,0 +3,0 @@ export declare const any: <T>(a: T[]) => boolean;

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

import { AnyAsync, AsyncFunction, Func, Last, ParamOf, ReturnTypeUnwrapped, UnaryFnUntyped } from "./typing.js";
import type { AnyAsync, AsyncFunction, Func, Last, ParamOf, ReturnTypeUnwrapped, UnaryFnUntyped } from "./typing.js";
type UnaryFn<A, R> = (a: A) => R;

@@ -12,2 +12,3 @@ type Res<F> = F extends UnaryFn<any, infer R> ? R : never;

declare const pipeWithoutStack: <Fs extends Func[]>(...fs: ValidPipe<Fs>) => Pipeline<Fs>;
export declare const errorBoundry: <F extends Func>(f: F) => F;
export declare const pipe: typeof pipeWithoutStack;

@@ -14,0 +15,0 @@ type Reversed<Tuple> = Tuple extends [infer Head, ...infer Rest] ? [...Reversed<Rest>, Head] : [];

@@ -11,3 +11,3 @@ import { reverse } from "./array.js";

};
const errorBoundry = (f) => {
export const errorBoundry = (f) => {
const location = currentLocation(4);

@@ -14,0 +14,0 @@ const augment = augmentException(location);

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

import { AnyAsync, Func, ParamOf, ReturnTypeUnwrapped } from "./typing.js";
import type { AnyAsync, Func, ParamOf, ReturnTypeUnwrapped } from "./typing.js";
export declare const ifElse: <Predicate extends Func, If extends Func, Else extends Func>(predicate: Predicate, fTrue: If, fFalse: Else) => (...x: Parameters<Predicate>) => [Predicate, If, Else] extends (Predicate extends import("./typing.js").AsyncFunction ? any : If extends import("./typing.js").AsyncFunction ? any : Else extends import("./typing.js").AsyncFunction ? any : never) ? Promise<ReturnTypeUnwrapped<If> | ReturnTypeUnwrapped<Else>> : ReturnType<If> | ReturnType<Else>;

@@ -3,0 +3,0 @@ type WhenUnless<Predicate extends Func, Resolver extends Func> = (...params: Parameters<Predicate>) => true extends AnyAsync<[Predicate, Resolver]> ? Promise<ParamOf<Predicate> | ReturnTypeUnwrapped<Resolver>> : ParamOf<Predicate> | ReturnType<Resolver>;

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

import { AsyncFunction, Func, ReturnTypeUnwrapped } from "./typing.js";
import type { AsyncFunction, Func, ReturnTypeUnwrapped } from "./typing.js";
export declare const sideLog: <T>(x: T) => T;

@@ -6,3 +6,3 @@ export declare const logAround: <F extends Func>(f: F) => F;

export declare const logBefore: <F extends Func>(f: F) => F;
export declare const timeit: <F extends Func>(handler: (elapsed: number, args: Parameters<F>, result: ReturnTypeUnwrapped<F>) => void, f: F) => F;
export declare const timeit: <F extends Func>(handler: (elapsedMilliseconds: number, args: Parameters<F>, result: ReturnTypeUnwrapped<F>) => void, f: F) => F;
export declare const assert: <T>(condition: (_: T) => boolean | Promise<boolean>, errorMessage: string) => (x: T) => [(x: T) => [(x: T) => T, (_: T) => boolean | Promise<boolean>] extends infer T_1 ? T_1 extends [(x: T) => T, (_: T) => boolean | Promise<boolean>] ? T_1 extends import("./typing.js").AnyAsync<T_1> ? Promise<{ [i in keyof T_1]: ReturnTypeUnwrapped<T_1[i]>; }> : { [i_1 in keyof T_1]: ReturnTypeUnwrapped<T_1[i_1]>; } : never : never, ([value, passed]: any) => any] extends infer T_2 ? T_2 extends [(x: T) => [(x: T) => T, (_: T) => boolean | Promise<boolean>] extends infer T_3 ? T_3 extends [(x: T) => T, (_: T) => boolean | Promise<boolean>] ? T_3 extends import("./typing.js").AnyAsync<T_3> ? Promise<{ [i_2 in keyof T_3]: ReturnTypeUnwrapped<T_3[i_2]>; }> : { [i_3 in keyof T_3]: ReturnTypeUnwrapped<T_3[i_3]>; } : never : never, ([value, passed]: any) => any] ? T_2 extends import("./typing.js").AnyAsync<T_2> ? Promise<ReturnTypeUnwrapped<import("./typing.js").Last<T_2>>> : ReturnType<import("./typing.js").Last<T_2>> : never : never;

@@ -9,0 +9,0 @@ export declare const coerce: <T>(x: T | null | undefined) => T;

@@ -81,5 +81,3 @@ import { pipe } from "./composition.js";

return isPromise(result)
? result.catch((e) => {
return fallback(e, ...x);
})
? result.catch((e) => fallback(e, ...x))
: result;

@@ -101,2 +99,3 @@ }

catch (e) {
// @ts-ignore-error This code has a distinct type of `Error` (doesn't trigger in node)
if (e.id === id)

@@ -130,2 +129,3 @@ return fallback(...xs);

catch (e) {
// @ts-ignore-error This code has a distinct type of `Error` (doesn't trigger in node)
if (e.id === id)

@@ -141,3 +141,3 @@ return fallback(e.payload);

const e = makeErrorWithId(id);
// @ts-expect-error changes the typing of `Error`
// @ts-expect-error This code has a distinct type of `Error`
e.payload = value;

@@ -144,0 +144,0 @@ throw e;

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

import { AsyncFunction, Func, ParamOf } from "./typing.js";
import type { AsyncFunction, Func, ParamOf } from "./typing.js";
export declare const filter: <F extends Func>(f: F) => (_: ParamOf<F>[]) => F extends AsyncFunction ? Promise<ParamOf<F>[]> : ParamOf<F>[];

@@ -3,0 +3,0 @@ export declare const find: <F extends Func>(predicate: F) => (xs: ParamOf<F>[]) => F extends AsyncFunction ? Promise<ParamOf<F> | undefined> : ParamOf<F> | undefined;

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

import { AsyncFunction, ElementOf } from "./typing.js";
import type { AsyncFunction, ElementOf } from "./typing.js";
type Executor<TaskInput, Output> = (_: TaskInput[]) => Promise<Output>;

@@ -3,0 +3,0 @@ /**

@@ -91,3 +91,3 @@ import sjcl from "sjcl";

});
export const timeout = timeoutHelper(new Error(`Timed out`));
export const timeout = timeoutHelper(new Error("Timed out"));
export const conditionalRetry =

@@ -106,3 +106,3 @@ // deno-lint-ignore no-explicit-any

`Failed after ${times} retries. Last error:\n${asError.message}`;
if (!predicate(e))
if (!predicate(asError))
throw asError;

@@ -109,0 +109,0 @@ return sleep(waitMs).then(() => conditionalRetry(predicate)(waitMs, times - 1, f)(...x));

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

import { AnyAsync, Func, ParamOf, ReturnTypeUnwrapped, Union } from "./typing.js";
import type { AnyAsync, Func, ParamOf, ReturnTypeUnwrapped, Union } from "./typing.js";
type Results<Functions extends Func[]> = {

@@ -3,0 +3,0 @@ [i in keyof Functions]: ReturnTypeUnwrapped<Functions[i]>;

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

import { AsyncFunction } from "./typing.js";
import type { AsyncFunction } from "./typing.js";
export declare const keepTryingEvery50ms: (f: () => boolean | Promise<boolean>) => Promise<void>;

@@ -3,0 +3,0 @@ export declare const sequentialized: <Function_1 extends AsyncFunction>(f: Function_1) => (...args: Parameters<Function_1>) => Promise<unknown>;

@@ -1,4 +0,6 @@

import { AsyncFunction, Unary, UnaryFnUntyped } from "./typing.js";
export declare const map: <F extends UnaryFnUntyped>(f: F) => (xs: Parameters<F>[0][]) => F extends AsyncFunction ? Promise<Awaited<ReturnType<F>>[]> : ReturnType<F>[];
import type { AsyncFunction, Unary, UnaryFnUntyped } from "./typing.js";
declare const mapWithoutStack: <F extends UnaryFnUntyped>(f: F) => (xs: Parameters<F>[0][]) => F extends AsyncFunction ? Promise<Awaited<ReturnType<F>>[]> : ReturnType<F>[];
export declare const map: typeof mapWithoutStack;
export declare const each: <F extends UnaryFnUntyped>(f: F) => (xs: Parameters<F>[0][]) => F extends AsyncFunction ? Promise<void> : void;
export declare const mapCat: <T, G>(f: Unary<T, G>) => (x: T[]) => G;
export {};

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

import { pipe } from "./composition.js";
import { errorBoundry, pipe } from "./composition.js";
import { reduce } from "./reduce.js";
import { isPromise } from "./promise.js";
export const map = (f) => (xs) => {
const mapWithoutStack = (f) => (xs) => {
const results = [];

@@ -12,2 +12,3 @@ for (const x of xs) {

};
export const map = (...fs) => errorBoundry(mapWithoutStack(...fs));
export const each = (f) =>

@@ -14,0 +15,0 @@ // @ts-expect-error ts cannot reason about this

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

import { AsyncFunction, ElementOf, Func, ParamOf, Reducer, ReturnTypeUnwrapped, Unary } from "./typing.js";
import type { AsyncFunction, ElementOf, Func, ParamOf, Reducer, ReturnTypeUnwrapped, Unary } from "./typing.js";
export declare const wrapObject: <V>(key: string) => (value: V) => {

@@ -3,0 +3,0 @@ [x: string]: V;

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

import { Func } from "./typing.js";
import type { Func } from "./typing.js";
export declare const letIn: <T, Output>(value: T, constructor: (input: T) => Output) => Output;

@@ -3,0 +3,0 @@ export declare const not: (x: any) => boolean;

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

import { AsyncFunction, Func, ParamOf, ReturnTypeUnwrapped } from "./typing.js";
import type { AsyncFunction, Func, ParamOf, ReturnTypeUnwrapped } from "./typing.js";
export declare const reduce: <Function_1 extends (state: any, element: any) => any>(reducer: Function_1, initial: () => ReturnTypeUnwrapped<Function_1>) => (xs: Parameters<Function_1>[1][]) => ReturnType<Function_1>;
export declare const min: <F extends Func>(key: F) => (xs: ParamOf<F>[]) => F extends AsyncFunction ? Promise<ParamOf<F>> : ParamOf<F>;
export declare const max: <F extends Func>(key: F) => (xs: ParamOf<F>[]) => F extends AsyncFunction ? Promise<ParamOf<F>> : ParamOf<F>;
{
"name": "gamla",
"version": "91.0.0",
"version": "93.0.0",
"description": "Functional programming with async and type safety",

@@ -5,0 +5,0 @@ "repository": {

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

import { AsyncFunction, Func, ParamOf } from "./typing.js";
import type { AsyncFunction, Func, ParamOf } from "./typing.js";
export declare const anymap: <F extends Func>(f: F) => (xs: ParamOf<F>[]) => F extends AsyncFunction ? Promise<boolean> : boolean;

@@ -3,0 +3,0 @@ export declare const any: <T>(a: T[]) => boolean;

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

import { AnyAsync, AsyncFunction, Func, Last, ParamOf, ReturnTypeUnwrapped, UnaryFnUntyped } from "./typing.js";
import type { AnyAsync, AsyncFunction, Func, Last, ParamOf, ReturnTypeUnwrapped, UnaryFnUntyped } from "./typing.js";
type UnaryFn<A, R> = (a: A) => R;

@@ -12,2 +12,3 @@ type Res<F> = F extends UnaryFn<any, infer R> ? R : never;

declare const pipeWithoutStack: <Fs extends Func[]>(...fs: ValidPipe<Fs>) => Pipeline<Fs>;
export declare const errorBoundry: <F extends Func>(f: F) => F;
export declare const pipe: typeof pipeWithoutStack;

@@ -14,0 +15,0 @@ type Reversed<Tuple> = Tuple extends [infer Head, ...infer Rest] ? [...Reversed<Rest>, Head] : [];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.thunk = exports.identity = exports.always = exports.applyTo = exports.wrapSideEffect = exports.sideEffect = exports.complement = exports.before = exports.after = exports.compose = exports.pipe = void 0;
exports.thunk = exports.identity = exports.always = exports.applyTo = exports.wrapSideEffect = exports.sideEffect = exports.complement = exports.before = exports.after = exports.compose = exports.pipe = exports.errorBoundry = void 0;
const array_js_1 = require("./array.js");

@@ -39,5 +39,6 @@ const operator_js_1 = require("./operator.js");

};
exports.errorBoundry = errorBoundry;
const pipe = (...fs) =>
// @ts-ignore-error error in deno but not in node
errorBoundry(pipeWithoutStack(...fs));
(0, exports.errorBoundry)(pipeWithoutStack(...fs));
exports.pipe = pipe;

@@ -44,0 +45,0 @@ const compose = (...fs) =>

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

import { AnyAsync, Func, ParamOf, ReturnTypeUnwrapped } from "./typing.js";
import type { AnyAsync, Func, ParamOf, ReturnTypeUnwrapped } from "./typing.js";
export declare const ifElse: <Predicate extends Func, If extends Func, Else extends Func>(predicate: Predicate, fTrue: If, fFalse: Else) => (...x: Parameters<Predicate>) => [Predicate, If, Else] extends (Predicate extends import("./typing.js").AsyncFunction ? any : If extends import("./typing.js").AsyncFunction ? any : Else extends import("./typing.js").AsyncFunction ? any : never) ? Promise<ReturnTypeUnwrapped<If> | ReturnTypeUnwrapped<Else>> : ReturnType<If> | ReturnType<Else>;

@@ -3,0 +3,0 @@ type WhenUnless<Predicate extends Func, Resolver extends Func> = (...params: Parameters<Predicate>) => true extends AnyAsync<[Predicate, Resolver]> ? Promise<ParamOf<Predicate> | ReturnTypeUnwrapped<Resolver>> : ParamOf<Predicate> | ReturnType<Resolver>;

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

import { AsyncFunction, Func, ReturnTypeUnwrapped } from "./typing.js";
import type { AsyncFunction, Func, ReturnTypeUnwrapped } from "./typing.js";
export declare const sideLog: <T>(x: T) => T;

@@ -6,3 +6,3 @@ export declare const logAround: <F extends Func>(f: F) => F;

export declare const logBefore: <F extends Func>(f: F) => F;
export declare const timeit: <F extends Func>(handler: (elapsed: number, args: Parameters<F>, result: ReturnTypeUnwrapped<F>) => void, f: F) => F;
export declare const timeit: <F extends Func>(handler: (elapsedMilliseconds: number, args: Parameters<F>, result: ReturnTypeUnwrapped<F>) => void, f: F) => F;
export declare const assert: <T>(condition: (_: T) => boolean | Promise<boolean>, errorMessage: string) => (x: T) => [(x: T) => [(x: T) => T, (_: T) => boolean | Promise<boolean>] extends infer T_1 ? T_1 extends [(x: T) => T, (_: T) => boolean | Promise<boolean>] ? T_1 extends import("./typing.js").AnyAsync<T_1> ? Promise<{ [i in keyof T_1]: ReturnTypeUnwrapped<T_1[i]>; }> : { [i_1 in keyof T_1]: ReturnTypeUnwrapped<T_1[i_1]>; } : never : never, ([value, passed]: any) => any] extends infer T_2 ? T_2 extends [(x: T) => [(x: T) => T, (_: T) => boolean | Promise<boolean>] extends infer T_3 ? T_3 extends [(x: T) => T, (_: T) => boolean | Promise<boolean>] ? T_3 extends import("./typing.js").AnyAsync<T_3> ? Promise<{ [i_2 in keyof T_3]: ReturnTypeUnwrapped<T_3[i_2]>; }> : { [i_3 in keyof T_3]: ReturnTypeUnwrapped<T_3[i_3]>; } : never : never, ([value, passed]: any) => any] ? T_2 extends import("./typing.js").AnyAsync<T_2> ? Promise<ReturnTypeUnwrapped<import("./typing.js").Last<T_2>>> : ReturnType<import("./typing.js").Last<T_2>> : never : never;

@@ -9,0 +9,0 @@ export declare const coerce: <T>(x: T | null | undefined) => T;

@@ -91,5 +91,3 @@ "use strict";

return (0, promise_js_1.isPromise)(result)
? result.catch((e) => {
return fallback(e, ...x);
})
? result.catch((e) => fallback(e, ...x))
: result;

@@ -113,2 +111,3 @@ }

catch (e) {
// @ts-ignore-error This code has a distinct type of `Error` (doesn't trigger in node)
if (e.id === id)

@@ -144,2 +143,3 @@ return fallback(...xs);

catch (e) {
// @ts-ignore-error This code has a distinct type of `Error` (doesn't trigger in node)
if (e.id === id)

@@ -156,3 +156,3 @@ return fallback(e.payload);

const e = makeErrorWithId(id);
// @ts-expect-error changes the typing of `Error`
// @ts-expect-error This code has a distinct type of `Error`
e.payload = value;

@@ -159,0 +159,0 @@ throw e;

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

import { AsyncFunction, Func, ParamOf } from "./typing.js";
import type { AsyncFunction, Func, ParamOf } from "./typing.js";
export declare const filter: <F extends Func>(f: F) => (_: ParamOf<F>[]) => F extends AsyncFunction ? Promise<ParamOf<F>[]> : ParamOf<F>[];

@@ -3,0 +3,0 @@ export declare const find: <F extends Func>(predicate: F) => (xs: ParamOf<F>[]) => F extends AsyncFunction ? Promise<ParamOf<F> | undefined> : ParamOf<F> | undefined;

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

import { AsyncFunction, ElementOf } from "./typing.js";
import type { AsyncFunction, ElementOf } from "./typing.js";
type Executor<TaskInput, Output> = (_: TaskInput[]) => Promise<Output>;

@@ -3,0 +3,0 @@ /**

@@ -99,3 +99,3 @@ "use strict";

});
exports.timeout = timeoutHelper(new Error(`Timed out`));
exports.timeout = timeoutHelper(new Error("Timed out"));
const conditionalRetry =

@@ -114,3 +114,3 @@ // deno-lint-ignore no-explicit-any

`Failed after ${times} retries. Last error:\n${asError.message}`;
if (!predicate(e))
if (!predicate(asError))
throw asError;

@@ -117,0 +117,0 @@ return (0, time_js_1.sleep)(waitMs).then(() => (0, exports.conditionalRetry)(predicate)(waitMs, times - 1, f)(...x));

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

import { AnyAsync, Func, ParamOf, ReturnTypeUnwrapped, Union } from "./typing.js";
import type { AnyAsync, Func, ParamOf, ReturnTypeUnwrapped, Union } from "./typing.js";
type Results<Functions extends Func[]> = {

@@ -3,0 +3,0 @@ [i in keyof Functions]: ReturnTypeUnwrapped<Functions[i]>;

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

import { AsyncFunction } from "./typing.js";
import type { AsyncFunction } from "./typing.js";
export declare const keepTryingEvery50ms: (f: () => boolean | Promise<boolean>) => Promise<void>;

@@ -3,0 +3,0 @@ export declare const sequentialized: <Function_1 extends AsyncFunction>(f: Function_1) => (...args: Parameters<Function_1>) => Promise<unknown>;

@@ -1,4 +0,6 @@

import { AsyncFunction, Unary, UnaryFnUntyped } from "./typing.js";
export declare const map: <F extends UnaryFnUntyped>(f: F) => (xs: Parameters<F>[0][]) => F extends AsyncFunction ? Promise<Awaited<ReturnType<F>>[]> : ReturnType<F>[];
import type { AsyncFunction, Unary, UnaryFnUntyped } from "./typing.js";
declare const mapWithoutStack: <F extends UnaryFnUntyped>(f: F) => (xs: Parameters<F>[0][]) => F extends AsyncFunction ? Promise<Awaited<ReturnType<F>>[]> : ReturnType<F>[];
export declare const map: typeof mapWithoutStack;
export declare const each: <F extends UnaryFnUntyped>(f: F) => (xs: Parameters<F>[0][]) => F extends AsyncFunction ? Promise<void> : void;
export declare const mapCat: <T, G>(f: Unary<T, G>) => (x: T[]) => G;
export {};

@@ -7,3 +7,3 @@ "use strict";

const promise_js_1 = require("./promise.js");
const map = (f) => (xs) => {
const mapWithoutStack = (f) => (xs) => {
const results = [];

@@ -16,2 +16,3 @@ for (const x of xs) {

};
const map = (...fs) => (0, composition_js_1.errorBoundry)(mapWithoutStack(...fs));
exports.map = map;

@@ -18,0 +19,0 @@ const each = (f) =>

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

import { AsyncFunction, ElementOf, Func, ParamOf, Reducer, ReturnTypeUnwrapped, Unary } from "./typing.js";
import type { AsyncFunction, ElementOf, Func, ParamOf, Reducer, ReturnTypeUnwrapped, Unary } from "./typing.js";
export declare const wrapObject: <V>(key: string) => (value: V) => {

@@ -3,0 +3,0 @@ [x: string]: V;

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

import { Func } from "./typing.js";
import type { Func } from "./typing.js";
export declare const letIn: <T, Output>(value: T, constructor: (input: T) => Output) => Output;

@@ -3,0 +3,0 @@ export declare const not: (x: any) => boolean;

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

import { AsyncFunction, Func, ParamOf, ReturnTypeUnwrapped } from "./typing.js";
import type { AsyncFunction, Func, ParamOf, ReturnTypeUnwrapped } from "./typing.js";
export declare const reduce: <Function_1 extends (state: any, element: any) => any>(reducer: Function_1, initial: () => ReturnTypeUnwrapped<Function_1>) => (xs: Parameters<Function_1>[1][]) => ReturnType<Function_1>;
export declare const min: <F extends Func>(key: F) => (xs: ParamOf<F>[]) => F extends AsyncFunction ? Promise<ParamOf<F>> : ParamOf<F>;
export declare const max: <F extends Func>(key: F) => (xs: ParamOf<F>[]) => F extends AsyncFunction ? Promise<ParamOf<F>> : ParamOf<F>;

Sorry, the diff of this file is too big to display

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