Socket
Socket
Sign inDemoInstall

@effect/data

Package Overview
Dependencies
0
Maintainers
3
Versions
79
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.18.5 to 0.18.6

13

Either.d.ts

@@ -382,2 +382,15 @@ /**

/**
* Returns `self` if it is a `Right` or `that` otherwise.
*
* @param self - The input `Either` value to check and potentially return.
* @param that - A function that takes the error value from `self` (if it's a `Left`) and returns a new `Either` value.
*
* @category error handling
* @since 1.0.0
*/
export declare const orElse: {
<E1, E2, B>(that: (e1: E1) => Either<E2, B>): <A>(self: Either<E1, A>) => Either<E2, A | B>;
<E1, A, E2, B>(self: Either<E1, A>, that: (e1: E1) => Either<E2, B>): Either<E2, A | B>;
};
/**
* @category combining

@@ -384,0 +397,0 @@ * @since 1.0.0

15

Either.js

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

});
exports.try = exports.right = exports.reverse = exports.merge = exports.match = exports.mapLeft = exports.mapBoth = exports.map = exports.left = exports.isRight = exports.isLeft = exports.isEither = exports.getRight = exports.getOrUndefined = exports.getOrThrowWith = exports.getOrThrow = exports.getOrNull = exports.getOrElse = exports.getLeft = exports.getEquivalence = exports.gen = exports.fromOption = exports.fromNullable = exports.flatMap = exports.all = exports.TypeId = void 0;
exports.try = exports.right = exports.reverse = exports.orElse = exports.merge = exports.match = exports.mapLeft = exports.mapBoth = exports.map = exports.left = exports.isRight = exports.isLeft = exports.isEither = exports.getRight = exports.getOrUndefined = exports.getOrThrowWith = exports.getOrThrow = exports.getOrNull = exports.getOrElse = exports.getLeft = exports.getEquivalence = exports.gen = exports.fromOption = exports.fromNullable = exports.flatMap = exports.all = exports.TypeId = void 0;
var Equivalence = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Equivalence"));

@@ -324,6 +324,17 @@ var _Function = /*#__PURE__*/require("@effect/data/Function");

/**
* Returns `self` if it is a `Right` or `that` otherwise.
*
* @param self - The input `Either` value to check and potentially return.
* @param that - A function that takes the error value from `self` (if it's a `Left`) and returns a new `Either` value.
*
* @category error handling
* @since 1.0.0
*/
exports.getOrThrow = getOrThrow;
const orElse = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => isLeft(self) ? that(self.left) : right(self.right));
/**
* @category combining
* @since 1.0.0
*/
exports.getOrThrow = getOrThrow;
exports.orElse = orElse;
const flatMap = /*#__PURE__*/(0, _Function.dual)(2, (self, f) => isLeft(self) ? left(self.left) : f(self.right));

@@ -330,0 +341,0 @@ /**

2

package.json
{
"name": "@effect/data",
"version": "0.18.5",
"version": "0.18.6",
"description": "Functional programming in TypeScript",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -474,2 +474,20 @@ /**

/**
* Returns `self` if it is a `Right` or `that` otherwise.
*
* @param self - The input `Either` value to check and potentially return.
* @param that - A function that takes the error value from `self` (if it's a `Left`) and returns a new `Either` value.
*
* @category error handling
* @since 1.0.0
*/
export const orElse: {
<E1, E2, B>(that: (e1: E1) => Either<E2, B>): <A>(self: Either<E1, A>) => Either<E2, A | B>
<E1, A, E2, B>(self: Either<E1, A>, that: (e1: E1) => Either<E2, B>): Either<E2, A | B>
} = dual(
2,
<E1, A, E2, B>(self: Either<E1, A>, that: (e1: E1) => Either<E2, B>): Either<E2, A | B> =>
isLeft(self) ? that(self.left) : right(self.right)
)
/**
* @category combining

@@ -476,0 +494,0 @@ * @since 1.0.0

@@ -56,7 +56,16 @@ /**

/**
* Concatenates two strings at the type level.
*
* @since 1.0.0
*/
export type Concat<A extends string, B extends string> = `${A}${B}`
/**
* Concatenates two strings at runtime.
*
* @since 1.0.0
*/
export const concat: {
(that: string): (self: string) => string
(self: string, that: string): string
<B extends string>(that: B): <A extends string>(self: A) => Concat<A, B>
<A extends string, B extends string>(self: A, that: B): Concat<A, B>
} = dual(2, (self: string, that: string): string => self + that)

@@ -73,3 +82,3 @@

*/
export const toUpperCase = (self: string): string => self.toUpperCase()
export const toUpperCase = <S extends string>(self: S): Uppercase<S> => self.toUpperCase() as Uppercase<S>

@@ -85,3 +94,3 @@ /**

*/
export const toLowerCase = (self: string): string => self.toLowerCase()
export const toLowerCase = <T extends string>(self: T): Lowercase<T> => self.toLowerCase() as Lowercase<T>

@@ -93,2 +102,32 @@ /**

*
* assert.deepStrictEqual(pipe('abc', S.capitalize), 'Abc')
*
* @since 1.0.0
*/
export const capitalize = <T extends string>(self: T): Capitalize<T> => {
if (self.length === 0) return self as Capitalize<T>
return (toUpperCase(self[0]) + self.slice(1)) as Capitalize<T>
}
/**
* @example
* import * as S from '@effect/data/String'
* import { pipe } from '@effect/data/Function'
*
* assert.deepStrictEqual(pipe('ABC', S.uncapitalize), 'aBC')
*
* @since 1.0.0
*/
export const uncapitalize = <T extends string>(self: T): Uncapitalize<T> => {
if (self.length === 0) return self as Uncapitalize<T>
return (toLowerCase(self[0]) + self.slice(1)) as Uncapitalize<T>
}
/**
* @example
* import * as S from '@effect/data/String'
* import { pipe } from '@effect/data/Function'
*
* assert.deepStrictEqual(pipe('abc', S.replace('b', 'd')), 'adc')

@@ -102,2 +141,7 @@ *

/**
* @since 1.0.0
*/
export type Trim<A extends string> = TrimEnd<TrimStart<A>>
/**
* @example

@@ -110,5 +154,14 @@ * import * as S from '@effect/data/String'

*/
export const trim = (self: string): string => self.trim()
export const trim = <A extends string>(self: A): Trim<A> => self.trim() as Trim<A>
/**
* @since 1.0.0
*/
export type TrimStart<A extends string> = A extends ` ${infer B}` ? TrimStart<B>
: A extends `\n${infer B}` ? TrimStart<B>
: A extends `\t${infer B}` ? TrimStart<B>
: A extends `\r${infer B}` ? TrimStart<B>
: A
/**
* @example

@@ -121,5 +174,14 @@ * import * as S from '@effect/data/String'

*/
export const trimStart = (self: string): string => self.trimStart()
export const trimStart = <A extends string>(self: A): TrimStart<A> => self.trimStart() as TrimStart<A>
/**
* @since 1.0.0
*/
export type TrimEnd<A extends string> = A extends `${infer B} ` ? TrimEnd<B>
: A extends `${infer B}\n` ? TrimEnd<B>
: A extends `${infer B}\t` ? TrimEnd<B>
: A extends `${infer B}\r` ? TrimEnd<B>
: A
/**
* @example

@@ -132,3 +194,3 @@ * import * as S from '@effect/data/String'

*/
export const trimEnd = (self: string): string => self.trimEnd()
export const trimEnd = <A extends string>(self: A): TrimEnd<A> => self.trimEnd() as TrimEnd<A>

@@ -135,0 +197,0 @@ /**

@@ -46,7 +46,15 @@ /**

/**
* Concatenates two strings at the type level.
*
* @since 1.0.0
*/
export type Concat<A extends string, B extends string> = `${A}${B}`;
/**
* Concatenates two strings at runtime.
*
* @since 1.0.0
*/
export declare const concat: {
(that: string): (self: string) => string;
(self: string, that: string): string;
<B extends string>(that: B): <A extends string>(self: A) => Concat<A, B>;
<A extends string, B extends string>(self: A, that: B): Concat<A, B>;
};

@@ -62,3 +70,3 @@ /**

*/
export declare const toUpperCase: (self: string) => string;
export declare const toUpperCase: <S extends string>(self: S) => Uppercase<S>;
/**

@@ -73,3 +81,3 @@ * @example

*/
export declare const toLowerCase: (self: string) => string;
export declare const toLowerCase: <T extends string>(self: T) => Lowercase<T>;
/**

@@ -80,2 +88,22 @@ * @example

*
* assert.deepStrictEqual(pipe('abc', S.capitalize), 'Abc')
*
* @since 1.0.0
*/
export declare const capitalize: <T extends string>(self: T) => Capitalize<T>;
/**
* @example
* import * as S from '@effect/data/String'
* import { pipe } from '@effect/data/Function'
*
* assert.deepStrictEqual(pipe('ABC', S.uncapitalize), 'aBC')
*
* @since 1.0.0
*/
export declare const uncapitalize: <T extends string>(self: T) => Uncapitalize<T>;
/**
* @example
* import * as S from '@effect/data/String'
* import { pipe } from '@effect/data/Function'
*
* assert.deepStrictEqual(pipe('abc', S.replace('b', 'd')), 'adc')

@@ -87,2 +115,6 @@ *

/**
* @since 1.0.0
*/
export type Trim<A extends string> = TrimEnd<TrimStart<A>>;
/**
* @example

@@ -95,4 +127,8 @@ * import * as S from '@effect/data/String'

*/
export declare const trim: (self: string) => string;
export declare const trim: <A extends string>(self: A) => TrimEnd<TrimStart<A>>;
/**
* @since 1.0.0
*/
export type TrimStart<A extends string> = A extends ` ${infer B}` ? TrimStart<B> : A extends `\n${infer B}` ? TrimStart<B> : A extends `\t${infer B}` ? TrimStart<B> : A extends `\r${infer B}` ? TrimStart<B> : A;
/**
* @example

@@ -105,4 +141,8 @@ * import * as S from '@effect/data/String'

*/
export declare const trimStart: (self: string) => string;
export declare const trimStart: <A extends string>(self: A) => TrimStart<A>;
/**
* @since 1.0.0
*/
export type TrimEnd<A extends string> = A extends `${infer B} ` ? TrimEnd<B> : A extends `${infer B}\n` ? TrimEnd<B> : A extends `${infer B}\t` ? TrimEnd<B> : A extends `${infer B}\r` ? TrimEnd<B> : A;
/**
* @example

@@ -115,3 +155,3 @@ * import * as S from '@effect/data/String'

*/
export declare const trimEnd: (self: string) => string;
export declare const trimEnd: <A extends string>(self: A) => TrimEnd<A>;
/**

@@ -118,0 +158,0 @@ * @example

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

});
exports.trimStart = exports.trimEnd = exports.trim = exports.toUpperCase = exports.toLowerCase = exports.toLocaleUpperCase = exports.toLocaleLowerCase = exports.takeRight = exports.takeLeft = exports.substring = exports.stripMarginWith = exports.stripMargin = exports.startsWith = exports.split = exports.slice = exports.search = exports.replaceAll = exports.replace = exports.repeat = exports.padStart = exports.padEnd = exports.normalize = exports.matchAll = exports.match = exports.localeCompare = exports.linesWithSeparators = exports.length = exports.lastIndexOf = exports.isString = exports.isNonEmpty = exports.isEmpty = exports.indexOf = exports.includes = exports.endsWith = exports.empty = exports.concat = exports.codePointAt = exports.charCodeAt = exports.charAt = exports.at = exports.Order = exports.Equivalence = void 0;
exports.uncapitalize = exports.trimStart = exports.trimEnd = exports.trim = exports.toUpperCase = exports.toLowerCase = exports.toLocaleUpperCase = exports.toLocaleLowerCase = exports.takeRight = exports.takeLeft = exports.substring = exports.stripMarginWith = exports.stripMargin = exports.startsWith = exports.split = exports.slice = exports.search = exports.replaceAll = exports.replace = exports.repeat = exports.padStart = exports.padEnd = exports.normalize = exports.matchAll = exports.match = exports.localeCompare = exports.linesWithSeparators = exports.length = exports.lastIndexOf = exports.isString = exports.isNonEmpty = exports.isEmpty = exports.indexOf = exports.includes = exports.endsWith = exports.empty = exports.concat = exports.codePointAt = exports.charCodeAt = exports.charAt = exports.capitalize = exports.at = exports.Order = exports.Equivalence = void 0;
var equivalence = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Equivalence"));

@@ -60,2 +60,4 @@ var _Function = /*#__PURE__*/require("@effect/data/Function");

/**
* Concatenates two strings at runtime.
*
* @since 1.0.0

@@ -92,2 +94,30 @@ */

*
* assert.deepStrictEqual(pipe('abc', S.capitalize), 'Abc')
*
* @since 1.0.0
*/
exports.toLowerCase = toLowerCase;
const capitalize = self => {
if (self.length === 0) return self;
return toUpperCase(self[0]) + self.slice(1);
};
/**
* @example
* import * as S from '@effect/data/String'
* import { pipe } from '@effect/data/Function'
*
* assert.deepStrictEqual(pipe('ABC', S.uncapitalize), 'aBC')
*
* @since 1.0.0
*/
exports.capitalize = capitalize;
const uncapitalize = self => {
if (self.length === 0) return self;
return toLowerCase(self[0]) + self.slice(1);
};
/**
* @example
* import * as S from '@effect/data/String'
* import { pipe } from '@effect/data/Function'
*
* assert.deepStrictEqual(pipe('abc', S.replace('b', 'd')), 'adc')

@@ -97,3 +127,3 @@ *

*/
exports.toLowerCase = toLowerCase;
exports.uncapitalize = uncapitalize;
const replace = (searchValue, replaceValue) => self => self.replace(searchValue, replaceValue);

@@ -100,0 +130,0 @@ /**

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc