UNPKG

axios-light-my-request-adapter

Version:
81 lines (80 loc) 2.95 kB
/// <reference types="node" /> /** * Determine if a value is an Array * * @param {Object} val The value to test * @returns {boolean} True if value is an Array, otherwise false */ export declare function isArray<T>(val: unknown): val is T[]; /** * Determine if a value is an Object * * @param {Object} val The value to test * @returns {boolean} True if value is an Object, otherwise false */ export declare function isObject(val: unknown): val is object; export declare const isDate: (thing: unknown) => thing is Date; /** * Determine if a value is a Function * * @param {Object} val The value to test * @returns {boolean} True if value is a Function, otherwise false */ export declare function isFunction(val: unknown): val is Function; /** * Determine if a value is a Stream * * @param {Object} val The value to test * @returns {boolean} True if value is a Stream, otherwise false */ export declare function isStream(val: unknown): boolean; declare interface Headers { [key: string]: string | number | boolean; } declare class FormData { getHeaders(userHeaders?: Headers): Headers; } /** * Determine if a value is a FormData * * @param {Object} thing The value to test * @returns {boolean} True if value is an FormData, otherwise false */ export declare function isFormData(thing: unknown): thing is FormData; /** * Determine if a value is a URLSearchParams object * @function * @param {Object} val The value to test * @returns {boolean} True if value is a URLSearchParams object, otherwise false */ export declare const isURLSearchParams: (thing: unknown) => thing is URLSearchParams; /** * Iterate over an Array or an Object invoking a function for each item. * * If `obj` is an Array callback will be called passing * the value, index, and complete array for each item. * * If 'obj' is an Object callback will be called passing * the value, key, and complete object for each property. * * @param {Object|Array} obj The object to iterate * @param {Function} fn The callback to invoke for each item */ export declare function forEach<T extends object>(obj: T | undefined, fn: (val: T[keyof T], key: keyof T, obj: T) => void): void; export declare function forEach<T extends S[], S>(obj: T | undefined, fn: (val: S, key: number, obj: T) => void): void; /** * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) * * @param {string} content with BOM * @return {string} content value without BOM */ export declare function stripBOM(content: string): string; /** * Resolve object with deep prototype chain to a flat object * @param {Object} sourceObj source object * @param {Object} [destObj] * @param {Function} [filter] * @returns {Object} */ export declare function toFlatObject(sourceObj: unknown, destObj: unknown, filter: (sourceObj: unknown, destObj: unknown) => boolean): unknown; export {};