@ephox/katamari
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -1,2 +0,16 @@ | ||
declare const _default: any; | ||
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; | ||
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; | ||
die: (msg: string) => () => never; | ||
apply: <T>(f: (...x: any[]) => T) => T; | ||
call: (f: (...x: any[]) => any) => void; | ||
never: (...x: any[]) => false; | ||
always: (...x: any[]) => true; | ||
}; | ||
export default _default; |
@@ -1,4 +0,13 @@ | ||
var noop = function () { }; | ||
var noop = function () { | ||
var x = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
x[_i] = arguments[_i]; | ||
} | ||
}; | ||
var noarg = function (f) { | ||
return function () { | ||
var x = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
x[_i] = arguments[_i]; | ||
} | ||
return f(); | ||
@@ -9,2 +18,6 @@ }; | ||
return function () { | ||
var x = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
x[_i] = arguments[_i]; | ||
} | ||
return fa(fb.apply(null, arguments)); | ||
@@ -26,2 +39,6 @@ }; | ||
var curry = function (f) { | ||
var x = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
x[_i - 1] = arguments[_i]; | ||
} | ||
// equivalent to arguments.slice(1) | ||
@@ -35,2 +52,6 @@ // starting at 1 because 0 is the f, makes things tricky. | ||
return function () { | ||
var x = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
x[_i] = arguments[_i]; | ||
} | ||
var newArgs = new Array(arguments.length); | ||
@@ -45,2 +66,6 @@ for (var j = 0; j < newArgs.length; j++) | ||
return function () { | ||
var x = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
x[_i] = arguments[_i]; | ||
} | ||
return !f.apply(null, arguments); | ||
@@ -47,0 +72,0 @@ }; |
@@ -75,3 +75,3 @@ import Fun from './Fun'; | ||
var getOrDie = function () { | ||
return Fun.die(message)(); | ||
return Fun.die(String(message))(); | ||
}; | ||
@@ -78,0 +78,0 @@ var or = function (opt) { |
{ | ||
"name": "@ephox/katamari", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "Basic data type library", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -1,5 +0,5 @@ | ||
var noop = function () { }; | ||
var noop = function (...x: any[]) { }; | ||
var noarg = function (f) { | ||
return function () { | ||
var noarg = function (f: Function) { | ||
return function (...x: any[]) { | ||
return f(); | ||
@@ -9,4 +9,6 @@ }; | ||
var compose = function (fa, fb) { | ||
return function () { | ||
type AnyFunction = (...x: any[]) => any; | ||
var compose = function (fa: AnyFunction, fb: AnyFunction): AnyFunction { | ||
return function (...x: any[]) { | ||
return fa(fb.apply(null, arguments)); | ||
@@ -16,3 +18,3 @@ }; | ||
var constant = function (value) { | ||
var constant = function <T>(value?: T): (...x: any[]) => T { | ||
return function () { | ||
@@ -23,7 +25,7 @@ return value; | ||
var identity = function (x) { | ||
var identity = function <T = any>(x?: T): T { | ||
return x; | ||
}; | ||
var tripleEquals = function(a, b) { | ||
var tripleEquals = function <T>(a: T, b: T): boolean { | ||
return a === b; | ||
@@ -33,3 +35,3 @@ }; | ||
// Don't use array slice(arguments), makes the whole function unoptimisable on Chrome | ||
var curry = function (f) { | ||
var curry = function (f, ...x: any[]): AnyFunction { | ||
// equivalent to arguments.slice(1) | ||
@@ -42,3 +44,3 @@ // starting at 1 because 0 is the f, makes things tricky. | ||
return function () { | ||
return function (...x: any[]) { | ||
var newArgs = new Array(arguments.length); | ||
@@ -52,4 +54,6 @@ for (var j = 0; j < newArgs.length; j++) newArgs[j] = arguments[j]; | ||
var not = function (f) { | ||
return function () { | ||
type PredicateFn = (...x: any[]) => boolean; | ||
var not = (f: PredicateFn): PredicateFn => { | ||
return function (...x: any[]) { | ||
return !f.apply(null, arguments); | ||
@@ -59,3 +63,3 @@ }; | ||
var die = function (msg) { | ||
var die = function (msg: string) { | ||
return function () { | ||
@@ -66,27 +70,27 @@ throw new Error(msg); | ||
var apply = function (f) { | ||
var apply = function <T>(f: (...x: any[]) => T): T { | ||
return f(); | ||
}; | ||
var call = function(f) { | ||
var call = function(f: AnyFunction) { | ||
f(); | ||
}; | ||
var never = constant(false); | ||
var always = constant(true); | ||
var never = constant<false>(false); | ||
var always = constant<true>(true); | ||
export default <any> { | ||
noop: noop, | ||
noarg: noarg, | ||
compose: compose, | ||
constant: constant, | ||
identity: identity, | ||
tripleEquals: tripleEquals, | ||
curry: curry, | ||
not: not, | ||
die: die, | ||
apply: apply, | ||
call: call, | ||
never: never, | ||
always: always | ||
export default { | ||
noop, | ||
noarg, | ||
compose, | ||
constant, | ||
identity, | ||
tripleEquals, | ||
curry, | ||
not, | ||
die, | ||
apply, | ||
call, | ||
never, | ||
always | ||
}; |
@@ -106,3 +106,3 @@ import Fun from './Fun'; | ||
var getOrDie = function (): T { | ||
return Fun.die(message)(); | ||
return Fun.die(String(message))(); | ||
}; | ||
@@ -109,0 +109,0 @@ |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
763164
13014
0