UNPKG

@re621/zestyapi

Version:

Comprehensive JS wrapper for e621.net API

42 lines (41 loc) 1.54 kB
import UtilID from "./UtilID"; import UtilMath from "./UtilMath"; import UtilType, { PrimitiveType } from "./UtilType"; export default class Util { static Math: typeof UtilMath; static ID: typeof UtilID; static Type: typeof UtilType; /** Returns `true` if the environment is a browser window, `false` if it's a node process */ static readonly isBrowser: boolean; /** * Returns a Promise that resolves when the specified time elapses * @param {number} timeout Wait time (in ms) */ static sleep(timeout: number): Promise<void>; /** * URL-encodes the provided value * @param {string} value Original value * @returns {string} Encoded value */ static encode(value: PrimitiveType): string; /** * Iterates over an array, URL-encoding its elements * @param {PrimitiveType[]} array Original array * @returns {string[]} Encoded array */ static encodeArray(array: PrimitiveType[]): string[]; /** * Environment-independent implementation of BTOA. * Uses a native method in the browsers, falls back to Node alternative otherwise * @param {string} input Input string * @returns {string} Base64 output */ static btoa(input: string): string; /** * Environment-independent implementation of ATOB. * Uses a native method in the browsers, falls back to Node alternative otherwise * @param {string} input Base64 input * @returns {string} Output string */ static atob(input: string): string; }