expect-more
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -10,5 +10,2 @@ /** | ||
*/ | ||
export declare const endsWith: { | ||
(otherString: string, value: any): boolean; | ||
(otherString: string): (value: any) => boolean; | ||
}; | ||
export declare const endsWith: import("./lib/curry2").CurriedFn2<string>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var is_non_empty_string_1 = require("./is-non-empty-string"); | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
/** | ||
@@ -16,3 +16,3 @@ * Asserts that ${value} is a string whose trailing characters are equal to ${otherString}. | ||
*/ | ||
exports.endsWith = curry_1.curry(function (otherString, value) { | ||
exports.endsWith = curry2_1.curry2(function (otherString, value) { | ||
return is_non_empty_string_1.isNonEmptyString(value) && | ||
@@ -19,0 +19,0 @@ is_non_empty_string_1.isNonEmptyString(otherString) && |
@@ -166,4 +166,4 @@ "use strict"; | ||
var permutation_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
@@ -182,4 +182,4 @@ if (!isDeepNode(node)) return [3 /*break*/, 2]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
_c.sent(); | ||
_c.label = 2; | ||
case 2: return [2 /*return*/]; | ||
@@ -186,0 +186,0 @@ } |
@@ -13,5 +13,2 @@ /** | ||
*/ | ||
export declare const hasMember: { | ||
(ownKeyName: string, value: any): boolean; | ||
(ownKeyName: string): (value: any) => boolean; | ||
}; | ||
export declare const hasMember: import("./lib/curry2").CurriedFn2<any>; |
@@ -6,3 +6,3 @@ "use strict"; | ||
var is_walkable_1 = require("./is-walkable"); | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
/** | ||
@@ -20,2 +20,4 @@ * Asserts that ${value} has a property of the given name, even if the value of | ||
*/ | ||
exports.hasMember = curry_1.curry(function (ownKeyName, value) { return is_string_1.isString(ownKeyName) && is_walkable_1.isWalkable(value) && ownKeyName in value; }); | ||
exports.hasMember = curry2_1.curry2(function (ownKeyName, value) { | ||
return is_string_1.isString(ownKeyName) && is_walkable_1.isWalkable(value) && ownKeyName in value; | ||
}); |
@@ -13,5 +13,2 @@ /** | ||
*/ | ||
export declare const isAfter: { | ||
(otherDate: Date, value: any): boolean; | ||
(otherDate: Date): (value: any) => boolean; | ||
}; | ||
export declare const isAfter: import("./lib/curry2").CurriedFn2<Date>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var is_date_1 = require("./is-date"); | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
/** | ||
@@ -19,2 +19,4 @@ * Asserts that ${value} is a valid instance of `Date` whose value occurs after | ||
*/ | ||
exports.isAfter = curry_1.curry(function (otherDate, value) { return is_date_1.isDate(value) && is_date_1.isDate(otherDate) && value.getTime() > otherDate.getTime(); }); | ||
exports.isAfter = curry2_1.curry2(function (otherDate, value) { | ||
return is_date_1.isDate(value) && is_date_1.isDate(otherDate) && value.getTime() > otherDate.getTime(); | ||
}); |
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
export declare const isArrayOfBooleans: (value: any) => value is boolean[]; | ||
export declare const isArrayOfBooleans: (value: unknown) => value is boolean[]; |
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
export declare const isArrayOfNumbers: (value: any) => value is number[]; | ||
export declare const isArrayOfNumbers: (value: unknown) => value is number[]; |
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
export declare const isArrayOfObjects: (value: any) => value is Record<any, any>[]; | ||
export declare const isArrayOfObjects: <T extends any[] = any[]>(value: unknown) => value is T; |
@@ -12,5 +12,2 @@ /** | ||
*/ | ||
export declare const isArrayOfSize: { | ||
(size: number, value: any): value is any[]; | ||
(size: number): (value: any) => value is any[]; | ||
}; | ||
export declare const isArrayOfSize: import("./lib/curry2").CurriedFn2<any[]>; |
@@ -6,3 +6,3 @@ "use strict"; | ||
var is_number_1 = require("./is-number"); | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
/** | ||
@@ -19,2 +19,4 @@ * Asserts that ${value} is an `Array` containing ${size} number of values. | ||
*/ | ||
exports.isArrayOfSize = curry_1.curry(function (size, value) { return is_array_1.isArray(value) && is_number_1.isNumber(size) && value.length === size; }); | ||
exports.isArrayOfSize = curry2_1.curry2(function (size, value) { | ||
return is_array_1.isArray(value) && is_number_1.isNumber(size) && value.length === size; | ||
}); |
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
export declare const isArrayOfStrings: (value: any) => value is string[]; | ||
export declare const isArrayOfStrings: (value: unknown) => value is string[]; |
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export declare const isArray: (value: any) => value is any[]; | ||
export declare const isArray: <CallTimeType = any[]>(value: unknown) => value is CallTimeType; |
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export declare const isAsyncFunction: (value: any) => value is (...args: any[]) => Promise<any>; | ||
export declare const isAsyncFunction: <CallTimeType = (...args: any[]) => Promise<any>>(value: unknown) => value is CallTimeType; |
@@ -13,5 +13,2 @@ /** | ||
*/ | ||
export declare const isBefore: { | ||
(otherDate: Date, value: any): boolean; | ||
(otherDate: Date): (value: any) => boolean; | ||
}; | ||
export declare const isBefore: import("./lib/curry2").CurriedFn2<Date>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var is_after_1 = require("./is-after"); | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
/** | ||
@@ -19,2 +19,4 @@ * Asserts that ${value} is a valid instance of `Date` whose value occurs before | ||
*/ | ||
exports.isBefore = curry_1.curry(function (otherDate, value) { return is_after_1.isAfter(value, otherDate); }); | ||
exports.isBefore = curry2_1.curry2(function (otherDate, value) { | ||
return is_after_1.isAfter(value, otherDate); | ||
}); |
@@ -12,2 +12,2 @@ /** | ||
*/ | ||
export declare const isBoolean: (value: any) => value is boolean; | ||
export declare const isBoolean: <CallTimeType = boolean>(value: unknown) => value is CallTimeType; |
@@ -12,2 +12,2 @@ /** | ||
*/ | ||
export declare const isCalculable: (value: any) => boolean; | ||
export declare const isCalculable: <T = any>(value: any) => value is T; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isDate: (value: any) => value is Date; | ||
export declare const isDate: <CallTimeType = Date>(value: unknown) => value is CallTimeType; |
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export declare const isDecimalNumber: (value: any) => boolean; | ||
export declare const isDecimalNumber: (value: unknown) => value is number; |
@@ -11,5 +11,2 @@ /** | ||
*/ | ||
export declare const isDivisibleBy: { | ||
(otherNumber: number, value: any): boolean; | ||
(otherNumber: number): (value: any) => boolean; | ||
}; | ||
export declare const isDivisibleBy: import("./lib/curry2").CurriedFn2<number>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var is_number_1 = require("./is-number"); | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
/** | ||
@@ -17,2 +17,4 @@ * Asserts that ${value} is a `Number` which results in a whole number when | ||
*/ | ||
exports.isDivisibleBy = curry_1.curry(function (otherNumber, value) { return is_number_1.isNumber(value) && is_number_1.isNumber(otherNumber) && value % otherNumber === 0; }); | ||
exports.isDivisibleBy = curry2_1.curry2(function (otherNumber, value) { | ||
return is_number_1.isNumber(value) && is_number_1.isNumber(otherNumber) && value % otherNumber === 0; | ||
}); |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isEmptyArray: (value: any) => boolean; | ||
export declare const isEmptyArray: <T extends [] = []>(value: unknown) => value is T; |
@@ -13,3 +13,5 @@ "use strict"; | ||
*/ | ||
var isEmptyArray = function (value) { return is_array_of_size_1.isArrayOfSize(0, value); }; | ||
var isEmptyArray = function (value) { | ||
return is_array_of_size_1.isArrayOfSize(0, value); | ||
}; | ||
exports.isEmptyArray = isEmptyArray; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isEmptyObject: (value: any) => boolean; | ||
export declare const isEmptyObject: <T extends unknown = any>(value: unknown) => value is T; |
@@ -14,3 +14,5 @@ "use strict"; | ||
*/ | ||
var isEmptyObject = function (value) { return is_object_1.isObject(value) && keys_1.keys(value).length === 0; }; | ||
var isEmptyObject = function (value) { | ||
return is_object_1.isObject(value) && keys_1.keys(value).length === 0; | ||
}; | ||
exports.isEmptyObject = isEmptyObject; |
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
export declare const isEmptyString: (value: any) => boolean; | ||
export declare const isEmptyString: (value: unknown) => value is ""; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isEvenNumber: (value: any) => boolean; | ||
export declare const isEvenNumber: (value: unknown) => value is number; |
@@ -14,3 +14,5 @@ "use strict"; | ||
*/ | ||
var isEvenNumber = function (value) { return is_number_1.isNumber(value) && is_divisible_by_1.isDivisibleBy(2, value); }; | ||
var isEvenNumber = function (value) { | ||
return is_number_1.isNumber(value) && is_divisible_by_1.isDivisibleBy(2, value); | ||
}; | ||
exports.isEvenNumber = isEvenNumber; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isFalse: (value: any) => value is false; | ||
export declare const isFalse: (value: unknown) => value is false; |
@@ -0,1 +1,2 @@ | ||
import { AnyFn } from './typings'; | ||
/** | ||
@@ -9,2 +10,2 @@ * Asserts that ${value} is a `Function`. | ||
*/ | ||
export declare const isFunction: <T extends (...args: any[]) => any>(value: any) => value is T; | ||
export declare const isFunction: <T extends AnyFn = AnyFn>(value: unknown) => value is T; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isGeneratorFunction: (value: any) => value is Generator<unknown, any, unknown>; | ||
export declare const isGeneratorFunction: <CallTimeType = Generator<unknown, any, unknown>>(value: unknown) => value is CallTimeType; |
@@ -12,5 +12,2 @@ /** | ||
*/ | ||
export declare const isGreaterThanOrEqualTo: { | ||
(otherNumber: number, value: any): boolean; | ||
(otherNumber: number): (value: any) => boolean; | ||
}; | ||
export declare const isGreaterThanOrEqualTo: import("./lib/curry2").CurriedFn2<number>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var is_number_1 = require("./is-number"); | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
/** | ||
@@ -18,2 +18,4 @@ * Asserts that ${value} is greater than or equal to ${otherNumber}. | ||
*/ | ||
exports.isGreaterThanOrEqualTo = curry_1.curry(function (otherNumber, value) { return is_number_1.isNumber(value) && is_number_1.isNumber(otherNumber) && value >= otherNumber; }); | ||
exports.isGreaterThanOrEqualTo = curry2_1.curry2(function (otherNumber, value) { | ||
return is_number_1.isNumber(value) && is_number_1.isNumber(otherNumber) && value >= otherNumber; | ||
}); |
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export declare const isIso8601: (value: any) => boolean; | ||
export declare const isIso8601: (value: unknown) => value is string; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isJsonString: (value: any) => boolean; | ||
export declare const isJsonString: (value: unknown) => value is string; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.isJsonString = void 0; | ||
var is_string_1 = require("./is-string"); | ||
/** | ||
@@ -14,3 +15,3 @@ * Asserts that ${value} is a `String` of valid JSON. | ||
try { | ||
return JSON.parse(value) !== null; | ||
return is_string_1.isString(value) && JSON.parse(value) !== null; | ||
} | ||
@@ -17,0 +18,0 @@ catch (err) { |
@@ -11,5 +11,2 @@ /** | ||
*/ | ||
export declare const isLessThanOrEqualTo: { | ||
(otherNumber: number, value: any): boolean; | ||
(otherNumber: number): (value: any) => boolean; | ||
}; | ||
export declare const isLessThanOrEqualTo: import("./lib/curry2").CurriedFn2<number>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var is_number_1 = require("./is-number"); | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
/** | ||
@@ -17,2 +17,4 @@ * Asserts that ${value} is less than or equal to ${otherNumber}. | ||
*/ | ||
exports.isLessThanOrEqualTo = curry_1.curry(function (otherNumber, value) { return is_number_1.isNumber(value) && is_number_1.isNumber(otherNumber) && value <= otherNumber; }); | ||
exports.isLessThanOrEqualTo = curry2_1.curry2(function (otherNumber, value) { | ||
return is_number_1.isNumber(value) && is_number_1.isNumber(otherNumber) && value <= otherNumber; | ||
}); |
@@ -13,5 +13,2 @@ /** | ||
*/ | ||
export declare const isLongerThan: { | ||
(otherStringOrArray: string | any[], value: any): boolean; | ||
(otherStringOrArray: string | any[]): (value: any) => boolean; | ||
}; | ||
export declare const isLongerThan: import("./lib/curry2").CurriedFn2<string | any[]>; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.isLongerThan = void 0; | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
var is_indexed_list_1 = require("./lib/is-indexed-list"); | ||
@@ -18,3 +18,3 @@ /** | ||
*/ | ||
exports.isLongerThan = curry_1.curry(function (otherStringOrArray, value) { | ||
exports.isLongerThan = curry2_1.curry2(function (otherStringOrArray, value) { | ||
return is_indexed_list_1.isIndexedList(value) && | ||
@@ -21,0 +21,0 @@ is_indexed_list_1.isIndexedList(otherStringOrArray) && |
@@ -14,6 +14,2 @@ /** | ||
*/ | ||
export declare const isNear: { | ||
(otherNumber: number, epsilon: number, value: any): boolean; | ||
(otherNumber: number, epsilon: number): (value: any) => boolean; | ||
(otherNumber: number): (epsilon: number, value: any) => boolean; | ||
}; | ||
export declare const isNear: import("./lib/curry3").CurriedFn3<number>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var is_within_range_1 = require("./is-within-range"); | ||
var curry_1 = require("./lib/curry"); | ||
var curry3_1 = require("./lib/curry3"); | ||
/** | ||
@@ -20,4 +20,4 @@ * Asserts that ${value} is a number within the given acceptable distance from | ||
*/ | ||
exports.isNear = curry_1.curry(function (otherNumber, epsilon, value) { | ||
exports.isNear = curry3_1.curry3(function (otherNumber, epsilon, value) { | ||
return is_within_range_1.isWithinRange(otherNumber - epsilon, otherNumber + epsilon, value); | ||
}); |
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export declare const isNonEmptyArray: (value: any) => boolean; | ||
export declare const isNonEmptyArray: <T extends any[] = any[]>(value: unknown) => value is T; |
@@ -14,3 +14,5 @@ "use strict"; | ||
*/ | ||
var isNonEmptyArray = function (value) { return is_array_1.isArray(value) && value.length > 0; }; | ||
var isNonEmptyArray = function (value) { | ||
return is_array_1.isArray(value) && value.length > 0; | ||
}; | ||
exports.isNonEmptyArray = isNonEmptyArray; |
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
export declare const isNonEmptyObject: (value: any) => boolean; | ||
export declare const isNonEmptyObject: <T = any>(value: unknown) => value is T; |
@@ -16,3 +16,5 @@ "use strict"; | ||
*/ | ||
var isNonEmptyObject = function (value) { return is_object_1.isObject(value) && keys_1.keys(value).length > 0; }; | ||
var isNonEmptyObject = function (value) { | ||
return is_object_1.isObject(value) && keys_1.keys(value).length > 0; | ||
}; | ||
exports.isNonEmptyObject = isNonEmptyObject; |
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export declare const isNonEmptyString: (value: any) => boolean; | ||
export declare const isNonEmptyString: (value: unknown) => value is string; |
@@ -14,3 +14,5 @@ "use strict"; | ||
*/ | ||
var isNonEmptyString = function (value) { return is_string_1.isString(value) && value.length > 0; }; | ||
var isNonEmptyString = function (value) { | ||
return is_string_1.isString(value) && value.length > 0; | ||
}; | ||
exports.isNonEmptyString = isNonEmptyString; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isNull: (value: any) => value is null; | ||
export declare const isNull: <CallTimeType = null>(value: unknown) => value is CallTimeType; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isNumber: (value: any) => value is number; | ||
export declare const isNumber: (value: unknown) => value is number; |
@@ -9,5 +9,2 @@ /** | ||
*/ | ||
export declare const isObject: (value: any) => value is { | ||
[key: string]: any; | ||
[key: number]: any; | ||
}; | ||
export declare const isObject: <CallTimeType = any>(value: unknown) => value is CallTimeType; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isOddNumber: (value: any) => boolean; | ||
export declare const isOddNumber: (value: unknown) => value is number; |
@@ -14,3 +14,5 @@ "use strict"; | ||
*/ | ||
var isOddNumber = function (value) { return is_number_1.isNumber(value) && !is_divisible_by_1.isDivisibleBy(2, value); }; | ||
var isOddNumber = function (value) { | ||
return is_number_1.isNumber(value) && !is_divisible_by_1.isDivisibleBy(2, value); | ||
}; | ||
exports.isOddNumber = isOddNumber; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isRegExp: (value: any) => value is RegExp; | ||
export declare const isRegExp: <CallTimeType = RegExp>(value: unknown) => value is CallTimeType; |
@@ -13,5 +13,2 @@ /** | ||
*/ | ||
export declare const isSameLengthAs: { | ||
(otherStringOrArray: string | any[], value: any): boolean; | ||
(otherStringOrArray: string | any[]): (value: any) => boolean; | ||
}; | ||
export declare const isSameLengthAs: import("./lib/curry2").CurriedFn2<string | any[]>; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.isSameLengthAs = void 0; | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
var is_indexed_list_1 = require("./lib/is-indexed-list"); | ||
@@ -18,3 +18,3 @@ /** | ||
*/ | ||
exports.isSameLengthAs = curry_1.curry(function (otherStringOrArray, value) { | ||
exports.isSameLengthAs = curry2_1.curry2(function (otherStringOrArray, value) { | ||
return is_indexed_list_1.isIndexedList(value) && | ||
@@ -21,0 +21,0 @@ is_indexed_list_1.isIndexedList(otherStringOrArray) && |
@@ -13,5 +13,2 @@ /** | ||
*/ | ||
export declare const isShorterThan: { | ||
(otherStringOrArray: string | any[], value: any): boolean; | ||
(otherStringOrArray: string | any[]): (value: any) => boolean; | ||
}; | ||
export declare const isShorterThan: import("./lib/curry2").CurriedFn2<string | any[]>; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.isShorterThan = void 0; | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
var is_indexed_list_1 = require("./lib/is-indexed-list"); | ||
@@ -18,3 +18,3 @@ /** | ||
*/ | ||
exports.isShorterThan = curry_1.curry(function (otherStringOrArray, value) { | ||
exports.isShorterThan = curry2_1.curry2(function (otherStringOrArray, value) { | ||
return is_indexed_list_1.isIndexedList(value) && | ||
@@ -21,0 +21,0 @@ is_indexed_list_1.isIndexedList(otherStringOrArray) && |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isString: (value: any) => value is string; | ||
export declare const isString: <CallTimeType = string>(value: unknown) => value is CallTimeType; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isTrue: (value: any) => value is true; | ||
export declare const isTrue: (value: unknown) => value is true; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isUndefined: (value: any) => value is undefined; | ||
export declare const isUndefined: <CallTimeType = undefined>(value: unknown) => value is CallTimeType; |
@@ -14,2 +14,2 @@ /** | ||
*/ | ||
export declare const isValidDate: (value: any) => value is Date; | ||
export declare const isValidDate: (value: unknown) => value is Date; |
@@ -18,3 +18,5 @@ "use strict"; | ||
*/ | ||
var isValidDate = function (value) { return is_date_1.isDate(value) && !isNaN(value.getTime()); }; | ||
var isValidDate = function (value) { | ||
return is_date_1.isDate(value) && !isNaN(value.getTime()); | ||
}; | ||
exports.isValidDate = isValidDate; |
@@ -12,2 +12,2 @@ /** | ||
*/ | ||
export declare const isVisibleString: (value: any) => boolean; | ||
export declare const isVisibleString: (value: unknown) => value is string; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isWalkable: (value: any) => boolean; | ||
export declare const isWalkable: <T = any>(value: unknown) => value is T; |
@@ -14,3 +14,5 @@ "use strict"; | ||
*/ | ||
var isWalkable = function (value) { return !is_null_1.isNull(value) && !is_undefined_1.isUndefined(value); }; | ||
var isWalkable = function (value) { | ||
return !is_null_1.isNull(value) && !is_undefined_1.isUndefined(value); | ||
}; | ||
exports.isWalkable = isWalkable; |
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
export declare const isWhitespace: (value: any) => boolean; | ||
export declare const isWhitespace: (value: unknown) => value is string; |
@@ -15,3 +15,5 @@ "use strict"; | ||
*/ | ||
var isWhitespace = function (value) { return is_string_1.isString(value) && value.search(/\S/) === -1; }; | ||
var isWhitespace = function (value) { | ||
return is_string_1.isString(value) && value.search(/\S/) === -1; | ||
}; | ||
exports.isWhitespace = isWhitespace; |
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare const isWholeNumber: (value: any) => boolean; | ||
export declare const isWholeNumber: (value: unknown) => value is number; |
@@ -14,6 +14,2 @@ /** | ||
*/ | ||
export declare const isWithinRange: { | ||
(floor: number, ceiling: number, value: any): boolean; | ||
(floor: number, ceiling: number): (value: any) => boolean; | ||
(floor: number): (ceiling: number, value: any) => boolean; | ||
}; | ||
export declare const isWithinRange: import("./lib/curry3").CurriedFn3<number>; |
@@ -6,3 +6,3 @@ "use strict"; | ||
var is_less_than_or_equal_to_1 = require("./is-less-than-or-equal-to"); | ||
var curry_1 = require("./lib/curry"); | ||
var curry3_1 = require("./lib/curry3"); | ||
/** | ||
@@ -21,4 +21,4 @@ * Asserts that ${value} is a `Number` which is both greater than or equal to | ||
*/ | ||
exports.isWithinRange = curry_1.curry(function (floor, ceiling, value) { | ||
exports.isWithinRange = curry3_1.curry3(function (floor, ceiling, value) { | ||
return is_less_than_or_equal_to_1.isLessThanOrEqualTo(ceiling, value) && is_greater_than_or_equal_to_1.isGreaterThanOrEqualTo(floor, value); | ||
}); |
@@ -1,1 +0,1 @@ | ||
export declare const every: any; | ||
export declare const every: import("./curry2").CurriedFn2<any[]>; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.every = void 0; | ||
var curry_1 = require("./curry"); | ||
exports.every = curry_1.curry(function (fn, array) { | ||
var curry2_1 = require("./curry2"); | ||
exports.every = curry2_1.curry2(function (fn, array) { | ||
for (var i = 0, len = array.length; i < len; i++) { | ||
@@ -7,0 +7,0 @@ if (fn(array[i]) === false) { |
@@ -1,1 +0,1 @@ | ||
export declare const getType: (value: any) => string; | ||
export declare const getType: (value: unknown) => string; |
@@ -1,1 +0,1 @@ | ||
export declare const hasType: <T>(type: string) => (value: any) => value is T; | ||
export declare const hasType: <T>(type: string) => <CallTimeType = T>(value: unknown) => value is CallTimeType; |
@@ -5,5 +5,7 @@ "use strict"; | ||
var get_type_1 = require("./get-type"); | ||
var hasType = function (type) { return function (value) { | ||
return get_type_1.getType(value) === "[object " + type + "]"; | ||
}; }; | ||
var hasType = function (type) { | ||
return function (value) { | ||
return get_type_1.getType(value) === "[object " + type + "]"; | ||
}; | ||
}; | ||
exports.hasType = hasType; |
@@ -1,1 +0,1 @@ | ||
export declare const isIndexedList: (value: any) => boolean; | ||
export declare const isIndexedList: (value: unknown) => value is string | any[]; |
@@ -6,3 +6,5 @@ "use strict"; | ||
var is_string_1 = require("../is-string"); | ||
var isIndexedList = function (value) { return is_string_1.isString(value) || is_array_1.isArray(value); }; | ||
var isIndexedList = function (value) { | ||
return is_string_1.isString(value) || is_array_1.isArray(value); | ||
}; | ||
exports.isIndexedList = isIndexedList; |
@@ -10,5 +10,2 @@ /** | ||
*/ | ||
export declare const startsWith: { | ||
(otherString: string, value: any): boolean; | ||
(otherString: string): (value: any) => boolean; | ||
}; | ||
export declare const startsWith: import("./lib/curry2").CurriedFn2<string>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
var is_non_empty_string_1 = require("./is-non-empty-string"); | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
/** | ||
@@ -16,3 +16,3 @@ * Assert value is a string whose leading characters are equal to `other`. | ||
*/ | ||
exports.startsWith = curry_1.curry(function (otherString, value) { | ||
exports.startsWith = curry2_1.curry2(function (otherString, value) { | ||
return is_non_empty_string_1.isNonEmptyString(value) && | ||
@@ -19,0 +19,0 @@ is_non_empty_string_1.isNonEmptyString(otherString) && |
@@ -0,1 +1,2 @@ | ||
import type { AnyFn } from './typings'; | ||
/** | ||
@@ -9,2 +10,2 @@ * Asserts that ${value} is a `Function` which throws when invoked. | ||
*/ | ||
export declare const throwsAnyError: (value: any) => boolean; | ||
export declare const throwsAnyError: <T extends AnyFn = AnyFn>(value: T) => value is T; |
@@ -0,1 +1,2 @@ | ||
import { AnyFn } from './typings'; | ||
/** | ||
@@ -12,5 +13,2 @@ * Asserts that ${value} is a `Function` which throws an `Error` of the given | ||
*/ | ||
export declare const throwsErrorOfType: { | ||
(typeName: string, value: any): boolean; | ||
(typeName: string): (value: any) => boolean; | ||
}; | ||
export declare const throwsErrorOfType: import("./lib/curry2").CurriedFn2<AnyFn>; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.throwsErrorOfType = void 0; | ||
var curry_1 = require("./lib/curry"); | ||
var curry2_1 = require("./lib/curry2"); | ||
/** | ||
@@ -16,3 +16,3 @@ * Asserts that ${value} is a `Function` which throws an `Error` of the given | ||
*/ | ||
exports.throwsErrorOfType = curry_1.curry(function (typeName, value) { | ||
exports.throwsErrorOfType = curry2_1.curry2(function (typeName, value) { | ||
try { | ||
@@ -19,0 +19,0 @@ value(); |
@@ -0,4 +1,5 @@ | ||
export declare type AnyFn = (...args: any[]) => any; | ||
export declare type Collection = any[] | Record<any, any>; | ||
export declare type Reducer = (memo: any, value: any, key: number | string, collection: Collection) => any; | ||
export declare type UnaryBoolFn = (value: any) => boolean; | ||
export declare type VoidFn = () => void; | ||
export declare type UnaryBoolFn = (value: any) => boolean; | ||
export declare type Reducer = (memo: any, value: any, key: number | string, collection: Collection) => any; |
{ | ||
"name": "expect-more", | ||
"description": "Curried JavaScript Type Testing Library with Zero Dependencies", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"author": "Jamie Mason <jamie@foldleft.io> (https://github.com/JamieMason)", | ||
@@ -20,3 +20,3 @@ "bugs": "https://github.com/JamieMason/expect-more/issues", | ||
"typings": "./dist/index.d.ts", | ||
"gitHead": "1244630dd30fa36c6a1b0c9bc1bbeed273cad57f" | ||
"gitHead": "6063eea3c43c5596f7d89f6f1ca18f879d55ce99" | ||
} |
146
README.md
@@ -20,6 +20,6 @@ # expect-more | ||
```js | ||
```ts | ||
import { endsWith, isWithinRange } from 'expect-more'; | ||
endsWith('Script', 'JavaScript'); | ||
const result: boolean = endsWith('Script', 'JavaScript'); | ||
// => true | ||
@@ -42,79 +42,107 @@ | ||
- `isBoolean: (value: any) => boolean` | ||
- `isFalse: (value: any) => boolean` | ||
- `isNull: (value: any) => boolean` | ||
- `isRegExp: (value: any) => boolean` | ||
- `isTrue: (value: any) => boolean` | ||
- `isUndefined: (value: any) => boolean` | ||
```ts | ||
export declare const isBoolean: (value: unknown) => value is boolean; | ||
export declare const isFalse: (value: unknown) => value is false; | ||
export declare const isNull: (value: unknown) => value is null; | ||
export declare const isRegExp: (value: unknown) => value is RegExp; | ||
export declare const isTrue: (value: unknown) => value is true; | ||
export declare const isUndefined: (value: unknown) => value is undefined; | ||
``` | ||
### Functions | ||
- `isAsyncFunction: (value: any) => boolean` | ||
- `isFunction: (value: any) => boolean` | ||
- `isGeneratorFunction: (value: any) => boolean` | ||
- `throwsAnyError: (value: () => void) => boolean` | ||
- `throwsErrorOfType: (typeName: string, value: () => void) => boolean` | ||
```ts | ||
export declare const isAsyncFunction: <T = (...args: any[]) => Promise<any>>( | ||
value: unknown, | ||
) => value is T; | ||
export declare const isFunction: <T = (...args: any[]) => any>(value: unknown) => value is T; | ||
export declare const isGeneratorFunction: <T = Generator>(value: unknown) => value is T; | ||
export declare const throwsAnyError: <T = (...args: any[]) => any>(value: unknown) => value is T; | ||
export declare const throwsErrorOfType: <T = (...args: any[]) => any>( | ||
typeName: string, | ||
value: unknown, | ||
) => value is T; | ||
``` | ||
### Objects | ||
- `hasMember: (memberName: string, value: any) => boolean` | ||
- `isEmptyObject: (value: any) => boolean` | ||
- `isNonEmptyObject: (value: any) => boolean` | ||
- `isObject: (value: any) => boolean` | ||
- `isWalkable: (value: any) => boolean` | ||
```ts | ||
export declare const hasMember: <T = any>(memberName: string, value: unknown) => value is T; | ||
export declare const isEmptyObject: <T = any>(value: unknown) => value is T; | ||
export declare const isNonEmptyObject: <T = any>(value: unknown) => value is T; | ||
export declare const isObject: <T = any>(value: unknown) => value is T; | ||
export declare const isWalkable: <T = any>(value: unknown) => value is T; | ||
``` | ||
### Arrays | ||
- `isArray: (value: any) => boolean` | ||
- `isArrayOfBooleans: (value: any) => boolean` | ||
- `isArrayOfNumbers: (value: any) => boolean` | ||
- `isArrayOfObjects: (value: any) => boolean` | ||
- `isArrayOfSize: (size: number, value: any) => boolean` | ||
- `isArrayOfStrings: (value: any) => boolean` | ||
- `isEmptyArray: (any) => boolean` | ||
- `isNonEmptyArray: (value: any) => boolean` | ||
```ts | ||
export declare const isArray: <T extends any[] = any[]>(value: unknown) => value is T; | ||
export declare const isArrayOfBooleans: (value: unknown) => value is boolean[]; | ||
export declare const isArrayOfNumbers: (value: unknown) => value is number[]; | ||
export declare const isArrayOfObjects: <T extends any[] = any[]>(value: unknown) => value is T; | ||
export declare const isArrayOfSize: <T extends any[] = any[]>( | ||
size: number, | ||
value: unknown, | ||
) => value is T; | ||
export declare const isArrayOfStrings: (value: unknown) => value is string[]; | ||
export declare const isEmptyArray: <T extends [] = []>(any) => value is T; | ||
export declare const isNonEmptyArray: <T extends any[] = any[]>(value: unknown) => value is T; | ||
``` | ||
### Dates | ||
- `isAfter: (other: Date, value: any) => boolean` | ||
- `isBefore: (other: Date, value: any) => boolean` | ||
- `isDate: (value: any) => boolean` | ||
- `isValidDate: (value: any) => boolean` | ||
```ts | ||
export declare const isAfter: (other: Date, value: unknown) => value is Date; | ||
export declare const isBefore: (other: Date, value: unknown) => value is Date; | ||
export declare const isDate: (value: unknown) => value is Date; | ||
export declare const isValidDate: (value: unknown) => value is Date; | ||
``` | ||
### Numbers | ||
- `isCalculable: (value: any) => boolean` | ||
- `isDecimalNumber: (value: any) => boolean` | ||
- `isDivisibleBy: (other: number, value: any) => boolean` | ||
- `isEvenNumber: (value: any) => boolean` | ||
- `isGreaterThanOrEqualTo: (other: number, value: any) => boolean` | ||
- `isLessThanOrEqualTo: (other: number, value: any) => boolean` | ||
- `isNear: (other: number, epsilon: number, value: any) => boolean` | ||
- `isNumber: (value: any) => boolean` | ||
- `isOddNumber: (value: any) => boolean` | ||
- `isWholeNumber: (value: any) => boolean` | ||
- `isWithinRange: (floor: number, ceiling: number, value: any) => boolean` | ||
```ts | ||
export declare const isCalculable: (value: unknown) => value is number; | ||
export declare const isDecimalNumber: (value: unknown) => value is number; | ||
export declare const isDivisibleBy: (other: number, value: unknown) => value is number; | ||
export declare const isEvenNumber: (value: unknown) => value is number; | ||
export declare const isGreaterThanOrEqualTo: (other: number, value: unknown) => value is number; | ||
export declare const isLessThanOrEqualTo: (other: number, value: unknown) => value is number; | ||
export declare const isNear: (other: number, epsilon: number, value: unknown) => value is number; | ||
export declare const isNumber: (value: unknown) => value is number; | ||
export declare const isOddNumber: (value: unknown) => value is number; | ||
export declare const isWholeNumber: (value: unknown) => value is number; | ||
export declare const isWithinRange: ( | ||
floor: number, | ||
ceiling: number, | ||
value: unknown, | ||
) => value is number; | ||
``` | ||
### Strings | ||
- `endsWith: (other: string, value: any) => boolean` | ||
- `isEmptyString: (value: any) => boolean` | ||
- `isIso8601: (value: any) => boolean` | ||
- `isJsonString: (value: any) => boolean` | ||
- `isLongerThan: (other: string, value: any) => boolean` | ||
- `isNonEmptyString: (value: any) => boolean` | ||
- `isSameLengthAs: (other: string, value: any) => boolean` | ||
- `isShorterThan: (other: string, value: any) => boolean` | ||
- `isString: (value: any) => boolean` | ||
- `isVisibleString: (value: any) => boolean` | ||
- `isWhitespace: (value: any) => boolean` | ||
- `startsWith: (other: string, value: any) => boolean` | ||
```ts | ||
export declare const endsWith: (other: string, value: unknown) => value is number; | ||
export declare const isEmptyString: (value: unknown) => value is number; | ||
export declare const isIso8601: (value: unknown) => value is number; | ||
export declare const isJsonString: (value: unknown) => value is number; | ||
export declare const isLongerThan: (other: string, value: unknown) => value is number; | ||
export declare const isNonEmptyString: (value: unknown) => value is number; | ||
export declare const isSameLengthAs: (other: string, value: unknown) => value is number; | ||
export declare const isShorterThan: (other: string, value: unknown) => value is number; | ||
export declare const isString: (value: unknown) => value is number; | ||
export declare const isVisibleString: (value: unknown) => value is number; | ||
export declare const isWhitespace: (value: unknown) => value is number; | ||
export declare const startsWith: (other: string, value: unknown) => value is number; | ||
``` | ||
## API: `expect-more/gen` | ||
- `withMissingBranches: (value: object | any[]) => Generator` | ||
- `withMissingLeaves: (value: object | any[]) => Generator` | ||
- `withMissingNodes: (value: object | any[]) => Generator` | ||
- `withNullBranches: (value: object | any[]) => Generator` | ||
- `withNullLeaves: (value: object | any[]) => Generator` | ||
- `withNullNodes: (value: object | any[]) => Generator` | ||
```ts | ||
export declare const withMissingBranches: (value: object | any[]) => Generator; | ||
export declare const withMissingLeaves: (value: object | any[]) => Generator; | ||
export declare const withMissingNodes: (value: object | any[]) => Generator; | ||
export declare const withNullBranches: (value: object | any[]) => Generator; | ||
export declare const withNullLeaves: (value: object | any[]) => Generator; | ||
export declare const withNullNodes: (value: object | any[]) => Generator; | ||
``` |
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
141
2206
147
97819