@ephox/katamari
Advanced tools
Comparing version 2.4.10 to 2.4.11
@@ -6,32 +6,32 @@ import { Option } from './Option'; | ||
declare type Comparator<T> = (a: T, b: T) => number; | ||
export declare const indexOf: <T = any>(xs: ReadonlyArray<T>, x: T) => Option<number>; | ||
export declare const contains: <T = any>(xs: ReadonlyArray<T>, x: T) => boolean; | ||
export declare const exists: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => boolean; | ||
export declare const indexOf: <T = any>(xs: readonly T[], x: T) => Option<number>; | ||
export declare const contains: <T = any>(xs: readonly T[], x: T) => boolean; | ||
export declare const exists: <T = any>(xs: readonly T[], pred: ArrayMorphism<T, boolean>) => boolean; | ||
export declare const range: <T = any>(num: number, f: Morphism<number, T>) => T[]; | ||
export declare const chunk: <T = any>(array: ReadonlyArray<T>, size: number) => T[][]; | ||
export declare const map: <T = any, U = any>(xs: ReadonlyArray<T>, f: ArrayMorphism<T, U>) => U[]; | ||
export declare const each: <T = any>(xs: ReadonlyArray<T>, f: ArrayMorphism<T, void>) => void; | ||
export declare const eachr: <T = any>(xs: ReadonlyArray<T>, f: ArrayMorphism<T, void>) => void; | ||
export declare const partition: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => { | ||
export declare const chunk: <T = any>(array: readonly T[], size: number) => T[][]; | ||
export declare const map: <T = any, U = any>(xs: readonly T[], f: ArrayMorphism<T, U>) => U[]; | ||
export declare const each: <T = any>(xs: readonly T[], f: ArrayMorphism<T, void>) => void; | ||
export declare const eachr: <T = any>(xs: readonly T[], f: ArrayMorphism<T, void>) => void; | ||
export declare const partition: <T = any>(xs: readonly T[], pred: ArrayMorphism<T, boolean>) => { | ||
pass: T[]; | ||
fail: T[]; | ||
}; | ||
export declare const filter: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => T[]; | ||
export declare const groupBy: <T = any>(xs: ReadonlyArray<T>, f: Morphism<T, any>) => T[][]; | ||
export declare const foldr: <T = any, U = any>(xs: ReadonlyArray<T>, f: Catamorphism<T, U>, acc: U) => U; | ||
export declare const foldl: <T = any, U = any>(xs: ReadonlyArray<T>, f: Catamorphism<T, U>, acc: U) => U; | ||
export declare const find: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => Option<T>; | ||
export declare const findIndex: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => Option<number>; | ||
export declare const flatten: <T = any>(xs: ReadonlyArray<ReadonlyArray<T> | T[]>) => T[]; | ||
export declare const bind: <T = any, U = any>(xs: ReadonlyArray<T>, f: ArrayMorphism<T, U[]>) => U[]; | ||
export declare const forall: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => boolean; | ||
export declare const equal: <T = any>(a1: ReadonlyArray<T>, a2: T[]) => boolean; | ||
export declare const reverse: <T = any>(xs: ReadonlyArray<T>) => T[]; | ||
export declare const difference: <T = any>(a1: ReadonlyArray<T>, a2: ReadonlyArray<T>) => T[]; | ||
export declare const mapToObject: <T = any, U = any>(xs: ReadonlyArray<T>, f: (x: T, i: number) => U) => Record<string, U>; | ||
export declare const filter: <T = any>(xs: readonly T[], pred: ArrayMorphism<T, boolean>) => T[]; | ||
export declare const groupBy: <T = any>(xs: readonly T[], f: Morphism<T, any>) => T[][]; | ||
export declare const foldr: <T = any, U = any>(xs: readonly T[], f: Catamorphism<T, U>, acc: U) => U; | ||
export declare const foldl: <T = any, U = any>(xs: readonly T[], f: Catamorphism<T, U>, acc: U) => U; | ||
export declare const find: <T = any>(xs: readonly T[], pred: ArrayMorphism<T, boolean>) => Option<T>; | ||
export declare const findIndex: <T = any>(xs: readonly T[], pred: ArrayMorphism<T, boolean>) => Option<number>; | ||
export declare const flatten: <T = any>(xs: readonly (readonly T[] | T[])[]) => T[]; | ||
export declare const bind: <T = any, U = any>(xs: readonly T[], f: ArrayMorphism<T, U[]>) => U[]; | ||
export declare const forall: <T = any>(xs: readonly T[], pred: ArrayMorphism<T, boolean>) => boolean; | ||
export declare const equal: <T = any>(a1: readonly T[], a2: T[]) => boolean; | ||
export declare const reverse: <T = any>(xs: readonly T[]) => T[]; | ||
export declare const difference: <T = any>(a1: readonly T[], a2: readonly T[]) => T[]; | ||
export declare const mapToObject: <T = any, U = any>(xs: readonly T[], f: (x: T, i: number) => U) => Record<string, U>; | ||
export declare const pure: <T = any>(x: T) => T[]; | ||
export declare const sort: <T = any>(xs: ReadonlyArray<T>, comparator?: Comparator<T>) => T[]; | ||
export declare const head: <T = any>(xs: ReadonlyArray<T>) => Option<T>; | ||
export declare const last: <T = any>(xs: ReadonlyArray<T>) => Option<T>; | ||
export declare const sort: <T = any>(xs: readonly T[], comparator?: Comparator<T>) => T[]; | ||
export declare const head: <T = any>(xs: readonly T[]) => Option<T>; | ||
export declare const last: <T = any>(xs: readonly T[]) => Option<T>; | ||
export declare const from: <T = any>(x: ArrayLike<T>) => T[]; | ||
export {}; |
@@ -23,2 +23,3 @@ import { Option } from './Option'; | ||
error: <T = any, E = any>(message: E) => Result<T, E>; | ||
fromOption: <T, E>(opt: Option<T>, err: E) => Result<T, E>; | ||
}; |
@@ -118,6 +118,10 @@ import * as Fun from './Fun'; | ||
}; | ||
var fromOption = function (opt, err) { | ||
return opt.fold(function () { return error(err); }, value); | ||
}; | ||
export var Result = { | ||
value: value, | ||
error: error | ||
error: error, | ||
fromOption: fromOption | ||
}; | ||
//# sourceMappingURL=Result.js.map |
{ | ||
"name": "@ephox/katamari", | ||
"version": "2.4.10", | ||
"version": "2.4.11", | ||
"description": "Basic data type library", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -159,5 +159,13 @@ import * as Fun from './Fun'; | ||
const fromOption = <T, E>(opt: Option<T>, err: E): Result<T, E> => { | ||
return opt.fold( | ||
() => error(err), | ||
value | ||
); | ||
}; | ||
export const Result = { | ||
value: value, | ||
error: error | ||
value, | ||
error, | ||
fromOption | ||
}; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
807822
446
13430