diff --git a/until-each-right/docs/types/index.d.ts b/until-each-right/docs/types/index.d.ts index 3b3b56a7..3c0a21e3 100644 --- a/until-each-right/docs/types/index.d.ts +++ b/until-each-right/docs/types/index.d.ts @@ -35,7 +35,7 @@ type NullaryPredicate = () => boolean; * @param value - collection value * @returns boolean indicating whether an element in a collection passes a test */ -type UnaryPredicate = ( value: any ) => boolean; +type UnaryPredicate = ( value: T ) => boolean; /** * Checks whether an element in a collection passes a test. @@ -44,7 +44,7 @@ type UnaryPredicate = ( value: any ) => boolean; * @param index - collection index * @returns boolean indicating whether an element in a collection passes a test */ -type BinaryPredicate = ( value: any, index: number ) => boolean; +type BinaryPredicate = ( value: T, index: number ) => boolean; /** * Checks whether an element in a collection passes a test. @@ -54,7 +54,7 @@ type BinaryPredicate = ( value: any, index: number ) => boolean; * @param collection - input collection * @returns boolean indicating whether an element in a collection passes a test */ -type TernaryPredicate = ( value: any, index: number, collection: Collection ) => boolean; // tslint-disable-line max-line-length +type TernaryPredicate = ( value: T, index: number, collection: Collection ) => boolean; // tslint-disable-line max-line-length /** * Checks whether an element in a collection passes a test. @@ -64,7 +64,7 @@ type TernaryPredicate = ( value: any, index: number, collection: Collection ) => * @param collection - input collection * @returns boolean indicating whether an element in a collection passes a test */ -type Predicate = NullaryPredicate | UnaryPredicate | BinaryPredicate | TernaryPredicate; // tslint-disable-line max-line-length +type Predicate = NullaryPredicate | UnaryPredicate | BinaryPredicate | TernaryPredicate; // tslint-disable-line max-line-length /** * Function invoked for each collection element until test condition is true. @@ -76,7 +76,7 @@ type Nullary = () => void; * * @param value - collection value */ -type Unary = ( value: any ) => void; +type Unary = ( value: T ) => void; /** * Function invoked for each collection element until test condition is true. @@ -84,7 +84,7 @@ type Unary = ( value: any ) => void; * @param value - collection value * @param index - collection index */ -type Binary = ( value: any, index: number ) => void; +type Binary = ( value: T, index: number ) => void; /** * Function invoked for each collection element until test condition is true. @@ -93,7 +93,7 @@ type Binary = ( value: any, index: number ) => void; * @param index - collection index * @param collection - input collection */ -type Ternary = ( value: any, index: number, collection: Collection ) => void; +type Ternary = ( value: T, index: number, collection: Collection ) => void; // tslint-disable-line max-line-length /** * Function invoked for each collection element until test condition is true. @@ -102,7 +102,7 @@ type Ternary = ( value: any, index: number, collection: Collection ) => void; * @param index - collection index * @param collection - input collection */ -type Callback = Nullary | Unary | Binary | Ternary; +type Callback = Nullary | Unary | Binary | Ternary; /** * Until a test condition is true, invokes a function once for each element in a collection, iterating from right to left. @@ -136,7 +136,7 @@ type Callback = Nullary | Unary | Binary | Ternary; * * untilEachRight( arr, predicate, log ); */ -declare function untilEachRight( collection: Collection, predicate: Predicate, fcn: Callback, thisArg?: any ): Collection; // tslint-disable-line max-line-length +declare function untilEachRight( collection: Collection, predicate: Predicate, fcn: Callback, thisArg?: any ): Collection; // tslint-disable-line max-line-length // EXPORTS // diff --git a/until-each-right/docs/types/test.ts b/until-each-right/docs/types/test.ts index 439ab101..5a11fbb9 100644 --- a/until-each-right/docs/types/test.ts +++ b/until-each-right/docs/types/test.ts @@ -18,54 +18,72 @@ import untilEachRight = require( './index' ); -const log = ( v: any, index: number ): void => { - console.log( `${index}: ${v}` ); -}; +/** +* Test function. +* +* @param v - value +* @param index - index +*/ +function fcn( v: number, index: number ): void { + if ( v !== v ) { + throw new Error( 'beep' ); + } + if ( index !== index ) { + throw new Error( 'beep' ); + } +} + +/** +* Test function. +* +* @param v - value +* @returns result +*/ +function isnan( v: number ): boolean { + return ( v !== v ); +} -const isNotNaN = ( v: number ): boolean => { - return ( v === v ); -}; // TESTS // // The function returns the input collection... { - untilEachRight( [ 0, 1, 1, NaN, 2 ], isNotNaN, log ); // $ExpectType Collection - untilEachRight( [ -1, 1, 2 ], isNotNaN, log, {} ); // $ExpectType Collection + untilEachRight( [ 0, 1, 1, NaN, 2 ], isnan, fcn ); // $ExpectType Collection + untilEachRight( [ -1, 1, 2 ], isnan, fcn, {} ); // $ExpectType Collection } // The compiler throws an error if the function is provided a first argument which is not a collection... { - untilEachRight( 2, isNotNaN, log ); // $ExpectError - untilEachRight( false, isNotNaN, log ); // $ExpectError - untilEachRight( true, isNotNaN, log ); // $ExpectError - untilEachRight( {}, isNotNaN, log ); // $ExpectError + untilEachRight( 2, isnan, fcn ); // $ExpectError + untilEachRight( false, isnan, fcn ); // $ExpectError + untilEachRight( true, isnan, fcn ); // $ExpectError + untilEachRight( {}, isnan, fcn ); // $ExpectError } // The compiler throws an error if the function is provided a second argument which is not a function... { - untilEachRight( [ 0, 1, 1, NaN, 2 ], 2, log ); // $ExpectError - untilEachRight( [ 0, 1, 1, NaN, 2 ], false, log ); // $ExpectError - untilEachRight( [ 0, 1, 1, NaN, 2 ], true, log ); // $ExpectError - untilEachRight( [ 0, 1, 1, NaN, 2 ], 'abc', log ); // $ExpectError - untilEachRight( [ 0, 1, 1, NaN, 2 ], {}, log ); // $ExpectError - untilEachRight( [ 0, 1, 1, NaN, 2 ], [], log ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], 2, fcn ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], false, fcn ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], true, fcn ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], 'abc', fcn ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], {}, fcn ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], [], fcn ); // $ExpectError } // The compiler throws an error if the function is provided a third argument which is not a function... { - untilEachRight( [ 0, 1, 1, NaN, 2 ], isNotNaN, 2 ); // $ExpectError - untilEachRight( [ 0, 1, 1, NaN, 2 ], isNotNaN, false ); // $ExpectError - untilEachRight( [ 0, 1, 1, NaN, 2 ], isNotNaN, true ); // $ExpectError - untilEachRight( [ 0, 1, 1, NaN, 2 ], isNotNaN, 'abc' ); // $ExpectError - untilEachRight( [ 0, 1, 1, NaN, 2 ], isNotNaN, {} ); // $ExpectError - untilEachRight( [ 0, 1, 1, NaN, 2 ], isNotNaN, [] ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], isnan, 2 ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], isnan, false ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], isnan, true ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], isnan, 'abc' ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], isnan, {} ); // $ExpectError + untilEachRight( [ 0, 1, 1, NaN, 2 ], isnan, [] ); // $ExpectError } // The compiler throws an error if the function is provided an invalid number of arguments... { untilEachRight(); // $ExpectError untilEachRight( [ 1, 2, 3 ] ); // $ExpectError - untilEachRight( [ 1, 2, 3 ], isNotNaN ); // $ExpectError - untilEachRight( [ 1, 2, 3 ], isNotNaN, log, {}, 3 ); // $ExpectError + untilEachRight( [ 1, 2, 3 ], isnan ); // $ExpectError + untilEachRight( [ 1, 2, 3 ], isnan, fcn, {}, 3 ); // $ExpectError } diff --git a/until-each/docs/types/index.d.ts b/until-each/docs/types/index.d.ts index f0c79626..ed42fa5b 100644 --- a/until-each/docs/types/index.d.ts +++ b/until-each/docs/types/index.d.ts @@ -35,7 +35,7 @@ type NullaryPredicate = () => boolean; * @param value - collection value * @returns boolean indicating whether an element in a collection passes a test */ -type UnaryPredicate = ( value: any ) => boolean; +type UnaryPredicate = ( value: T ) => boolean; /** * Checks whether an element in a collection passes a test. @@ -44,7 +44,7 @@ type UnaryPredicate = ( value: any ) => boolean; * @param index - collection index * @returns boolean indicating whether an element in a collection passes a test */ -type BinaryPredicate = ( value: any, index: number ) => boolean; +type BinaryPredicate = ( value: T, index: number ) => boolean; /** * Checks whether an element in a collection passes a test. @@ -54,7 +54,7 @@ type BinaryPredicate = ( value: any, index: number ) => boolean; * @param collection - input collection * @returns boolean indicating whether an element in a collection passes a test */ -type TernaryPredicate = ( value: any, index: number, collection: Collection ) => boolean; // tslint-disable-line max-line-length +type TernaryPredicate = ( value: T, index: number, collection: Collection ) => boolean; // tslint-disable-line max-line-length /** * Checks whether an element in a collection passes a test. @@ -64,7 +64,7 @@ type TernaryPredicate = ( value: any, index: number, collection: Collection ) => * @param collection - input collection * @returns boolean indicating whether an element in a collection passes a test */ -type Predicate = NullaryPredicate | UnaryPredicate | BinaryPredicate | TernaryPredicate; // tslint-disable-line max-line-length +type Predicate = NullaryPredicate | UnaryPredicate | BinaryPredicate | TernaryPredicate; // tslint-disable-line max-line-length /** * Function invoked for each collection element until test condition is true. @@ -76,7 +76,7 @@ type Nullary = () => void; * * @param value - collection value */ -type Unary = ( value: any ) => void; +type Unary = ( value: T ) => void; /** * Function invoked for each collection element until test condition is true. @@ -84,7 +84,7 @@ type Unary = ( value: any ) => void; * @param value - collection value * @param index - collection index */ -type Binary = ( value: any, index: number ) => void; +type Binary = ( value: T, index: number ) => void; /** * Function invoked for each collection element until test condition is true. @@ -93,7 +93,7 @@ type Binary = ( value: any, index: number ) => void; * @param index - collection index * @param collection - input collection */ -type Ternary = ( value: any, index: number, collection: Collection ) => void; +type Ternary = ( value: T, index: number, collection: Collection ) => void; // tslint-disable-line max-line-length /** * Function invoked for each collection element until test condition is true. @@ -102,7 +102,7 @@ type Ternary = ( value: any, index: number, collection: Collection ) => void; * @param index - collection index * @param collection - input collection */ -type Callback = Nullary | Unary | Binary | Ternary; +type Callback = Nullary | Unary | Binary | Ternary; /** * Until a test condition is true, invokes a function once for each element in a collection. @@ -134,7 +134,7 @@ type Callback = Nullary | Unary | Binary | Ternary; * * untilEach( arr, predicate, log ); */ -declare function untilEach( collection: Collection, predicate: Predicate, fcn: Callback, thisArg?: any ): Collection; // tslint-disable-line max-line-length +declare function untilEach( collection: Collection, predicate: Predicate, fcn: Callback, thisArg?: any ): Collection; // tslint-disable-line max-line-length // EXPORTS // diff --git a/until-each/docs/types/test.ts b/until-each/docs/types/test.ts index 753d0bb7..48332835 100644 --- a/until-each/docs/types/test.ts +++ b/until-each/docs/types/test.ts @@ -18,54 +18,72 @@ import untilEach = require( './index' ); -const log = ( v: any, index: number ): void => { - console.log( `${index}: ${v}` ); -}; +/** +* Test function. +* +* @param v - value +* @param index - index +*/ +function fcn( v: number, index: number ): void { + if ( v !== v ) { + throw new Error( 'beep' ); + } + if ( index !== index ) { + throw new Error( 'beep' ); + } +} + +/** +* Test function. +* +* @param v - value +* @returns result +*/ +function isnan( v: number ): boolean { + return ( v !== v ); +} -const isNotNaN = ( v: number ): boolean => { - return ( v === v ); -}; // TESTS // // The function returns the input collection... { - untilEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, log ); // $ExpectType Collection - untilEach( [ -1, 1, 2 ], isNotNaN, log, {} ); // $ExpectType Collection + untilEach( [ 0, 1, 1, NaN, 2 ], isnan, fcn ); // $ExpectType Collection + untilEach( [ -1, 1, 2 ], isnan, fcn, {} ); // $ExpectType Collection } // The compiler throws an error if the function is provided a first argument which is not a collection... { - untilEach( 2, isNotNaN, log ); // $ExpectError - untilEach( false, isNotNaN, log ); // $ExpectError - untilEach( true, isNotNaN, log ); // $ExpectError - untilEach( {}, isNotNaN, log ); // $ExpectError + untilEach( 2, isnan, fcn ); // $ExpectError + untilEach( false, isnan, fcn ); // $ExpectError + untilEach( true, isnan, fcn ); // $ExpectError + untilEach( {}, isnan, fcn ); // $ExpectError } // The compiler throws an error if the function is provided a second argument which is not a function... { - untilEach( [ 0, 1, 1, NaN, 2 ], 2, log ); // $ExpectError - untilEach( [ 0, 1, 1, NaN, 2 ], false, log ); // $ExpectError - untilEach( [ 0, 1, 1, NaN, 2 ], true, log ); // $ExpectError - untilEach( [ 0, 1, 1, NaN, 2 ], 'abc', log ); // $ExpectError - untilEach( [ 0, 1, 1, NaN, 2 ], {}, log ); // $ExpectError - untilEach( [ 0, 1, 1, NaN, 2 ], [], log ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], 2, fcn ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], false, fcn ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], true, fcn ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], 'abc', fcn ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], {}, fcn ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], [], fcn ); // $ExpectError } // The compiler throws an error if the function is provided a third argument which is not a function... { - untilEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, 2 ); // $ExpectError - untilEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, false ); // $ExpectError - untilEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, true ); // $ExpectError - untilEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, 'abc' ); // $ExpectError - untilEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, {} ); // $ExpectError - untilEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, [] ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], isnan, 2 ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], isnan, false ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], isnan, true ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], isnan, 'abc' ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], isnan, {} ); // $ExpectError + untilEach( [ 0, 1, 1, NaN, 2 ], isnan, [] ); // $ExpectError } // The compiler throws an error if the function is provided an invalid number of arguments... { untilEach(); // $ExpectError untilEach( [ 1, 2, 3 ] ); // $ExpectError - untilEach( [ 1, 2, 3 ], isNotNaN ); // $ExpectError - untilEach( [ 1, 2, 3 ], isNotNaN, log, {}, 3 ); // $ExpectError + untilEach( [ 1, 2, 3 ], isnan ); // $ExpectError + untilEach( [ 1, 2, 3 ], isnan, fcn, {}, 3 ); // $ExpectError } diff --git a/while-each-right/docs/types/test.ts b/while-each-right/docs/types/test.ts index fd6942bd..f2a59033 100644 --- a/while-each-right/docs/types/test.ts +++ b/while-each-right/docs/types/test.ts @@ -18,18 +18,31 @@ import whileEachRight = require( './index' ); -const fcn = ( v: number, index: number ): void => { +/** +* Test function. +* +* @param v - value +* @param index - index +*/ +function fcn( v: number, index: number ): void { if ( v !== v ) { throw new Error( 'beep' ); } if ( index !== index ) { throw new Error( 'beep' ); } -}; +} -const isnan = ( v: number ): boolean => { +/** +* Test function. +* +* @param v - value +* @returns result +*/ +function isnan( v: number ): boolean { return ( v !== v ); -}; +} + // TESTS // diff --git a/while-each/docs/types/index.d.ts b/while-each/docs/types/index.d.ts index 6ad92152..d6621835 100644 --- a/while-each/docs/types/index.d.ts +++ b/while-each/docs/types/index.d.ts @@ -16,7 +16,7 @@ * limitations under the License. */ -// TypeScript Version: 2.0 +// TypeScript Version: 4.1 /// @@ -35,7 +35,7 @@ type NullaryPredicate = () => boolean; * @param value - collection value * @returns boolean indicating whether an element in a collection passes a test */ -type UnaryPredicate = ( value: any ) => boolean; +type UnaryPredicate = ( value: T ) => boolean; /** * Checks whether an element in a collection passes a test. @@ -44,7 +44,7 @@ type UnaryPredicate = ( value: any ) => boolean; * @param index - collection index * @returns boolean indicating whether an element in a collection passes a test */ -type BinaryPredicate = ( value: any, index: number ) => boolean; +type BinaryPredicate = ( value: T, index: number ) => boolean; /** * Checks whether an element in a collection passes a test. @@ -54,7 +54,7 @@ type BinaryPredicate = ( value: any, index: number ) => boolean; * @param collection - input collection * @returns boolean indicating whether an element in a collection passes a test */ -type TernaryPredicate = ( value: any, index: number, collection: Collection ) => boolean; // tslint-disable-line max-line-length +type TernaryPredicate = ( value: T, index: number, collection: Collection ) => boolean; // tslint-disable-line max-line-length /** * Checks whether an element in a collection passes a test. @@ -64,7 +64,7 @@ type TernaryPredicate = ( value: any, index: number, collection: Collection ) => * @param collection - input collection * @returns boolean indicating whether an element in a collection passes a test */ -type Predicate = NullaryPredicate | UnaryPredicate | BinaryPredicate | TernaryPredicate; // tslint-disable-line max-line-length +type Predicate = NullaryPredicate | UnaryPredicate | BinaryPredicate | TernaryPredicate; // tslint-disable-line max-line-length /** * Function invoked for each collection element passing a test. @@ -76,7 +76,7 @@ type Nullary = () => void; * * @param value - collection value */ -type Unary = ( value: any ) => void; +type Unary = ( value: T ) => void; /** * Function invoked for each collection element passing a test. @@ -84,7 +84,7 @@ type Unary = ( value: any ) => void; * @param value - collection value * @param index - collection index */ -type Binary = ( value: any, index: number ) => void; +type Binary = ( value: T, index: number ) => void; /** * Function invoked for each collection element passing a test. @@ -93,7 +93,7 @@ type Binary = ( value: any, index: number ) => void; * @param index - collection index * @param collection - input collection */ -type Ternary = ( value: any, index: number, collection: Collection ) => void; +type Ternary = ( value: T, index: number, collection: Collection ) => void; // tslint-disable-line max-line-length /** * Function invoked for each collection element passing a test. @@ -102,7 +102,7 @@ type Ternary = ( value: any, index: number, collection: Collection ) => void; * @param index - collection index * @param collection - input collection */ -type Callback = Nullary | Unary | Binary | Ternary; +type Callback = Nullary | Unary | Binary | Ternary; /** * While a test condition is true, invokes a function once for each element in a collection. @@ -134,7 +134,7 @@ type Callback = Nullary | Unary | Binary | Ternary; * * whileEach( arr, predicate, log ); */ -declare function whileEach( collection: Collection, predicate: Predicate, fcn: Callback, thisArg?: any ): Collection; // tslint-disable-line max-line-length +declare function whileEach( collection: Collection, predicate: Predicate, fcn: Callback, thisArg?: any ): Collection; // tslint-disable-line max-line-length // EXPORTS // diff --git a/while-each/docs/types/test.ts b/while-each/docs/types/test.ts index 5fda235f..d97f834b 100644 --- a/while-each/docs/types/test.ts +++ b/while-each/docs/types/test.ts @@ -18,54 +18,72 @@ import whileEach = require( './index' ); -const log = ( v: any, index: number ): void => { - console.log( `${index}: ${v}` ); -}; +/** +* Test function. +* +* @param v - value +* @param index - index +*/ +function fcn( v: number, index: number ): void { + if ( v !== v ) { + throw new Error( 'beep' ); + } + if ( index !== index ) { + throw new Error( 'beep' ); + } +} + +/** +* Test function. +* +* @param v - value +* @returns result +*/ +function isnan( v: number ): boolean { + return ( v !== v ); +} -const isNotNaN = ( v: number ): boolean => { - return ( v === v ); -}; // TESTS // // The function returns the input collection... { - whileEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, log ); // $ExpectType Collection - whileEach( [ -1, 1, 2 ], isNotNaN, log, {} ); // $ExpectType Collection + whileEach( [ 0, 1, 1, NaN, 2 ], isnan, fcn ); // $ExpectType Collection + whileEach( [ -1, 1, 2 ], isnan, fcn, {} ); // $ExpectType Collection } // The compiler throws an error if the function is provided a first argument which is not a collection... { - whileEach( 2, isNotNaN, log ); // $ExpectError - whileEach( false, isNotNaN, log ); // $ExpectError - whileEach( true, isNotNaN, log ); // $ExpectError - whileEach( {}, isNotNaN, log ); // $ExpectError + whileEach( 2, isnan, fcn ); // $ExpectError + whileEach( false, isnan, fcn ); // $ExpectError + whileEach( true, isnan, fcn ); // $ExpectError + whileEach( {}, isnan, fcn ); // $ExpectError } // The compiler throws an error if the function is provided a second argument which is not a function... { - whileEach( [ 0, 1, 1, NaN, 2 ], 2, log ); // $ExpectError - whileEach( [ 0, 1, 1, NaN, 2 ], false, log ); // $ExpectError - whileEach( [ 0, 1, 1, NaN, 2 ], true, log ); // $ExpectError - whileEach( [ 0, 1, 1, NaN, 2 ], 'abc', log ); // $ExpectError - whileEach( [ 0, 1, 1, NaN, 2 ], {}, log ); // $ExpectError - whileEach( [ 0, 1, 1, NaN, 2 ], [], log ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], 2, fcn ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], false, fcn ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], true, fcn ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], 'abc', fcn ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], {}, fcn ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], [], fcn ); // $ExpectError } // The compiler throws an error if the function is provided a third argument which is not a function... { - whileEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, 2 ); // $ExpectError - whileEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, false ); // $ExpectError - whileEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, true ); // $ExpectError - whileEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, 'abc' ); // $ExpectError - whileEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, {} ); // $ExpectError - whileEach( [ 0, 1, 1, NaN, 2 ], isNotNaN, [] ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], isnan, 2 ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], isnan, false ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], isnan, true ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], isnan, 'abc' ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], isnan, {} ); // $ExpectError + whileEach( [ 0, 1, 1, NaN, 2 ], isnan, [] ); // $ExpectError } // The compiler throws an error if the function is provided an invalid number of arguments... { whileEach(); // $ExpectError whileEach( [ 1, 2, 3 ] ); // $ExpectError - whileEach( [ 1, 2, 3 ], isNotNaN ); // $ExpectError - whileEach( [ 1, 2, 3 ], isNotNaN, log, {}, 3 ); // $ExpectError + whileEach( [ 1, 2, 3 ], isnan ); // $ExpectError + whileEach( [ 1, 2, 3 ], isnan, fcn, {}, 3 ); // $ExpectError }