/** * Copyright 2022, SumUp Ltd. * 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. */ /** * Calls each function in an array with the arguments it receives. * Falsy functions are ignored. */ export declare function eachFn(fns: (undefined | ((...args: Args) => unknown))[]): (...args: Args) => void; /** * Checks whether an array, object, or string is empty or whether the value is * falsy. */ export declare function isEmpty(value: unknown): boolean; /** * Clamps a value within a range of values between a minimum and maximum limit. */ export declare function clamp(value: number, min: number, max: number): number; type Fn = (...args: Args) => void; /** * Creates a debounced function that delays invoking the provided function until after * the specified wait time has elapsed since the last time it was invoked. */ export declare function debounce(fn: Fn, wait: number): Fn; /** * Triggers a function at most once in a given amount of time. */ export declare function throttle(fn: Fn, timeout: number): Fn; /** * Splits an array into chunks of the specified length. */ export declare function chunk(array: T[], chunkSize: number): T[][]; /** * Returns the last item in an array. */ export declare function last(array: undefined | null): undefined; export declare function last(array: T[]): T; /** * Increases or decreases a value by an offset and loops back around to stay * within a given range. */ export declare function shiftInRange(value: number, // must be in range offset: number, // positive or negative min: number, // inclusive max: number): number; export {};