/*
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// TypeScript Version: 4.1
///
import { TypedIterator, TypedIterableIterator } from '@stdlib/types/iter';
// Define a union type representing both iterable and non-iterable iterators:
type Iterator = TypedIterator | TypedIterableIterator;
/**
* Checks whether an iterated value passes a test.
*
* @returns boolean indicating whether an iterated value passes a test
*/
type Nullary = ( this: U ) => boolean;
/**
* Checks whether an iterated value passes a test.
*
* @param value - iterated value
* @returns boolean indicating whether an iterated value passes a test
*/
type Unary = ( this: U, value: T ) => boolean;
/**
* Checks whether an iterated value passes a test.
*
* @param value - iterated value
* @param index - iteration index
* @returns boolean indicating whether an iterated value passes a test
*/
type Binary = ( this: U, value: T, index: number ) => boolean;
/**
* Checks whether an iterated value passes a test.
*
* @param value - iterated value
* @param index - iteration index
* @returns boolean indicating whether an iterated value passes a test
*/
type Predicate = Nullary | Unary | Binary;
/**
* Returns an iterator which cumulatively tests whether at least one iterated value passes a test implemented by a predicate function.
*
* @param iterator - source iterator
* @param predicate - predicate function
* @param thisArg - execution context
* @returns iterator
*
* @example
* var array2iterator = require( '@stdlib/array/to-iterator' );
*
* function isPositive( v ) {
* return ( v > 0 );
* }
*
* var it = iterCuAnyBy( array2iterator( [ 0, 0, 0, 1, 0 ] ), isPositive );
*
* var v = it.next().value;
* // returns false
*
* v = it.next().value;
* // returns false
*
* v = it.next().value;
* // returns false
*
* v = it.next().value;
* // returns true
*
* v = it.next().value;
* // returns true
*/
declare function iterCuAnyBy( iterator: Iterator, predicate: Predicate, thisArg?: ThisParameterType> ): Iterator;
// EXPORTS //
export = iterCuAnyBy ;