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

composable-functions

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

composable-functions - npm Package Compare versions

Comparing version 4.4.0 to 4.5.0

composable-functions-4.5.0.tgz

8

esm/combinators.js

@@ -203,3 +203,3 @@ import { composable, failure, fromSuccess, success } from './constructors.js';

/**
* Creates a new function that will apply a transformation over the list of Errors of a Failure from a given function. When the given function succeeds, its result is returned without changes.
* Creates a new function that will apply a transformation over the list of Errors of a Failure from a given function. When the given function succeeds, its result is returned without changes. The mapper receives the original input.
*

@@ -212,4 +212,4 @@ * @example

* const increment = ({ id }: { id: number }) => id + 1
* const incrementWithErrorSummary = mapErrors(increment, (result) => ({
* errors: [{ message: 'Errors count: ' + result.errors.length }],
* const incrementWithErrorSummary = mapErrors(increment, (result, {id}) => ({
* errors: [{ message: 'Errors count: ' + result.errors.length + ' for id: ' + String(id) }],
* }))

@@ -223,3 +223,3 @@ * ```

return success(res.data);
const mapped = await composable(mapper)(res.errors);
const mapped = await composable(mapper)(res.errors, ...args);
if (mapped.success) {

@@ -226,0 +226,0 @@ return failure(mapped.data);

{
"name": "composable-functions",
"version": "4.4.0",
"version": "4.5.0",
"description": "Types and functions to make composition easy and safe",

@@ -5,0 +5,0 @@ "author": "Seasoned",

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

/**
* Creates a new function that will apply a transformation over the list of Errors of a Failure from a given function. When the given function succeeds, its result is returned without changes.
* Creates a new function that will apply a transformation over the list of Errors of a Failure from a given function. When the given function succeeds, its result is returned without changes. The mapper receives the original input.
*

@@ -223,4 +223,4 @@ * @example

* const increment = ({ id }: { id: number }) => id + 1
* const incrementWithErrorSummary = mapErrors(increment, (result) => ({
* errors: [{ message: 'Errors count: ' + result.errors.length }],
* const incrementWithErrorSummary = mapErrors(increment, (result, {id}) => ({
* errors: [{ message: 'Errors count: ' + result.errors.length + ' for id: ' + String(id) }],
* }))

@@ -234,3 +234,3 @@ * ```

return (0, constructors_js_1.success)(res.data);
const mapped = await (0, constructors_js_1.composable)(mapper)(res.errors);
const mapped = await (0, constructors_js_1.composable)(mapper)(res.errors, ...args);
if (mapped.success) {

@@ -237,0 +237,0 @@ return (0, constructors_js_1.failure)(mapped.data);

@@ -145,3 +145,3 @@ import type { BranchReturn, CanComposeInParallel, CanComposeInSequence, Composable, MapParametersReturn, MergeObjects, PipeReturn, RecordToTuple, Result, SequenceReturn, UnpackData } from './types.js';

/**
* Creates a new function that will apply a transformation over the list of Errors of a Failure from a given function. When the given function succeeds, its result is returned without changes.
* Creates a new function that will apply a transformation over the list of Errors of a Failure from a given function. When the given function succeeds, its result is returned without changes. The mapper receives the original input.
*

@@ -154,8 +154,8 @@ * @example

* const increment = ({ id }: { id: number }) => id + 1
* const incrementWithErrorSummary = mapErrors(increment, (result) => ({
* errors: [{ message: 'Errors count: ' + result.errors.length }],
* const incrementWithErrorSummary = mapErrors(increment, (result, {id}) => ({
* errors: [{ message: 'Errors count: ' + result.errors.length + ' for id: ' + String(id) }],
* }))
* ```
*/
declare function mapErrors<Fn extends Function>(fn: Fn, mapper: (err: Error[]) => Error[] | Promise<Error[]>): Fn extends Internal.AnyFn ? Composable<Fn> : never;
declare function mapErrors<Fn extends Function>(fn: Fn, mapper: (err: Error[], ...originalInput: Parameters<Extract<Fn, Internal.AnyFn>>) => Error[] | Promise<Error[]>): Fn extends Internal.AnyFn ? Composable<Fn> : never;
/**

@@ -162,0 +162,0 @@ * Whenever you need to intercept inputs and a composable result without changing them you can use this function.

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