@ephox/katamari
Advanced tools
Comparing version 2.1.10 to 2.1.11
import { Option } from './Option'; | ||
declare type Morphism<T, U> = (a: T) => U; | ||
declare type Catamorphism<T, U> = (acc: U, x: T) => U; | ||
declare type ArrayMorphism<T, U> = (x: T, i: number, xs: ReadonlyArray<T>) => U; | ||
declare type Comparator<T> = (a: T, b: T) => number; | ||
declare const _default: { | ||
map: <T = any, U = any>(xs: ReadonlyArray<T>, f: (x: T, i: number, xs: ReadonlyArray<T>) => U) => U[]; | ||
each: <T = any>(xs: ReadonlyArray<T>, f: (x: T, i: number, xs: ReadonlyArray<T>) => void) => void; | ||
eachr: <T = any>(xs: ReadonlyArray<T>, f: (x: T, i: number, xs: ReadonlyArray<T>) => void) => void; | ||
partition: <T = any>(xs: ReadonlyArray<T>, pred: (x: T, i: number, xs: ReadonlyArray<T>) => boolean) => { | ||
map: <T = any, U = any>(xs: ReadonlyArray<T>, f: ArrayMorphism<T, U>) => U[]; | ||
each: <T = any>(xs: ReadonlyArray<T>, f: ArrayMorphism<T, void>) => void; | ||
eachr: <T = any>(xs: ReadonlyArray<T>, f: ArrayMorphism<T, void>) => void; | ||
partition: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => { | ||
pass: T[]; | ||
fail: T[]; | ||
}; | ||
filter: <T = any>(xs: ReadonlyArray<T>, pred: (x: T, i: number, xs: ReadonlyArray<T>) => boolean) => T[]; | ||
groupBy: <T = any>(xs: ReadonlyArray<T>, f: (a: T) => any) => T[][]; | ||
filter: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => T[]; | ||
groupBy: <T = any>(xs: ReadonlyArray<T>, f: Morphism<T, any>) => T[][]; | ||
indexOf: <T = any>(xs: ReadonlyArray<T>, x: T) => Option<number>; | ||
foldr: <T = any, U = any>(xs: ReadonlyArray<T>, f: (acc: U, x: T) => U, acc: U) => U; | ||
foldl: <T = any, U = any>(xs: ReadonlyArray<T>, f: (acc: U, x: T) => U, acc: U) => U; | ||
find: <T = any>(xs: ReadonlyArray<T>, pred: (x: T, i: number, xs: ReadonlyArray<T>) => boolean) => Option<T>; | ||
findIndex: <T = any>(xs: ReadonlyArray<T>, pred: (x: T, i: number, xs: ReadonlyArray<T>) => boolean) => Option<number>; | ||
foldr: <T = any, U = any>(xs: ReadonlyArray<T>, f: Catamorphism<T, U>, acc: U) => U; | ||
foldl: <T = any, U = any>(xs: ReadonlyArray<T>, f: Catamorphism<T, U>, acc: U) => U; | ||
find: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => Option<T>; | ||
findIndex: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => Option<number>; | ||
flatten: <T = any>(xs: ReadonlyArray<ReadonlyArray<T> | T[]>) => T[]; | ||
bind: <T = any, U = any>(xs: ReadonlyArray<T>, f: (x: T, i: number, xs: ReadonlyArray<T>) => U[]) => U[]; | ||
forall: <T = any>(xs: ReadonlyArray<T>, pred: (x: T, i: number, xs: ReadonlyArray<T>) => boolean) => boolean; | ||
exists: <T = any>(xs: ReadonlyArray<T>, pred: (x: T, i: number, xs: ReadonlyArray<T>) => boolean) => boolean; | ||
bind: <T = any, U = any>(xs: ReadonlyArray<T>, f: ArrayMorphism<T, U[]>) => U[]; | ||
forall: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => boolean; | ||
exists: <T = any>(xs: ReadonlyArray<T>, pred: ArrayMorphism<T, boolean>) => boolean; | ||
contains: <T = any>(xs: ReadonlyArray<T>, x: T) => boolean; | ||
@@ -28,4 +32,4 @@ equal: <T = any>(a1: ReadonlyArray<T>, a2: T[]) => boolean; | ||
pure: <T = any>(x: T) => T[]; | ||
sort: <T = any>(xs: ReadonlyArray<T>, comparator?: (a: T, b: T) => number) => T[]; | ||
range: <T = any>(num: number, f: (a: number) => T) => T[]; | ||
sort: <T = any>(xs: ReadonlyArray<T>, comparator?: Comparator<T>) => T[]; | ||
range: <T = any>(num: number, f: Morphism<number, T>) => T[]; | ||
head: <T = any>(xs: ReadonlyArray<T>) => Option<T>; | ||
@@ -32,0 +36,0 @@ last: <T = any>(xs: ReadonlyArray<T>) => Option<T>; |
@@ -0,13 +1,15 @@ | ||
declare type AnyFunction = (...x: any[]) => any; | ||
declare type PredicateFn = (...x: any[]) => boolean; | ||
declare const _default: { | ||
noop: (...x: any[]) => void; | ||
noarg: (f: Function) => (...x: any[]) => any; | ||
compose: (fa: (...x: any[]) => any, fb: (...x: any[]) => any) => (...x: any[]) => any; | ||
compose: (fa: AnyFunction, fb: AnyFunction) => AnyFunction; | ||
constant: <T>(value?: T) => (...x: any[]) => T; | ||
identity: <T = any>(x: T) => T; | ||
tripleEquals: <T>(a: T, b: T) => boolean; | ||
curry: (f: any, ...x: any[]) => (...x: any[]) => any; | ||
not: (f: (...x: any[]) => boolean) => (...x: any[]) => boolean; | ||
curry: (f: any, ...x: any[]) => AnyFunction; | ||
not: (f: PredicateFn) => PredicateFn; | ||
die: (msg: string) => () => never; | ||
apply: <T>(f: (...x: any[]) => T) => T; | ||
call: (f: (...x: any[]) => any) => void; | ||
call: (f: AnyFunction) => void; | ||
never: (...x: any[]) => false; | ||
@@ -14,0 +16,0 @@ always: (...x: any[]) => true; |
@@ -1,2 +0,11 @@ | ||
declare const _default: any; | ||
declare const _default: { | ||
isString: (value: any) => value is string; | ||
isObject: (value: any) => value is object; | ||
isArray: (value: any) => value is any[]; | ||
isNull: (value: any) => value is null; | ||
isBoolean: (value: any) => value is boolean; | ||
isUndefined: (value: any) => value is undefined; | ||
isFunction: (value: any) => value is Function; | ||
isNumber: (value: any) => value is number; | ||
}; | ||
export default _default; |
{ | ||
"name": "@ephox/katamari", | ||
"version": "2.1.10", | ||
"version": "2.1.11", | ||
"description": "Basic data type library", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -1,2 +0,2 @@ | ||
var typeOf = function(x) { | ||
var typeOf = function(x: any) { | ||
if (x === null) return 'null'; | ||
@@ -9,4 +9,4 @@ var t = typeof x; | ||
var isType = function (type) { | ||
return function (value) { | ||
var isType = function (type: string) { | ||
return function (value: any) { | ||
return typeOf(value) === type; | ||
@@ -16,11 +16,11 @@ }; | ||
export default <any> { | ||
isString: isType('string'), | ||
isObject: isType('object'), | ||
isArray: isType('array'), | ||
isNull: isType('null'), | ||
isBoolean: isType('boolean'), | ||
isUndefined: isType('undefined'), | ||
isFunction: isType('function'), | ||
isNumber: isType('number') | ||
export default { | ||
isString: <(value: any) => value is string>isType('string'), | ||
isObject: <(value: any) => value is object>isType('object'), | ||
isArray: <(value: any) => value is Array<any>>isType('array'), | ||
isNull: <(value: any) => value is null>isType('null'), | ||
isBoolean: <(value: any) => value is boolean>isType('boolean'), | ||
isUndefined: <(value: any) => value is undefined>isType('undefined'), | ||
isFunction: <(value: any) => value is Function>isType('function'), | ||
isNumber: <(value: any) => value is number>isType('number') | ||
}; |
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
772591
13217