UNPKG

ryuu.js

Version:

Ryuu JavaScript Utility Library

43 lines (42 loc) 1.77 kB
import { QueryParams, RequestOptions } from '../models/interfaces/request'; /** * Checks if the HTTP status code represents a successful response (2xx). * * @param status - The HTTP status code to check. * @returns True if status is between 200 and 299, otherwise false. */ export declare function isSuccess(status: number): boolean; /** * Determines if the given origin is a verified and allowed domain. * * @param origin - The origin URL to verify. * @returns True if the origin is HTTPS and matches the whitelist, but not the blacklist. */ export declare function isVerifiedOrigin(origin: string): boolean; /** * Parses the current window's query string into an object of key-value pairs. * * @returns An object containing query parameters as key-value pairs. */ export declare function getQueryParams(): QueryParams; /** * Sets the Accept header on the headers object based on the data format if the URL matches a data endpoint. * * @param headers - The headers object to set the Accept header on. * @param url - The request URL. * @param options - Optional request options that may specify a format. */ export declare function setFormatHeaders(headers: Record<string, string>, url: string, options?: RequestOptions): void; /** * Generates a unique identifier using the crypto API if available, otherwise falls back to a random string. * * @returns A unique identifier as a string. */ export declare function generateUniqueId(): string; /** * Detects if the current device is running iOS using reliable detection methods. * Uses a multi-factor approach to avoid false positives while removing brittle screen dimension checks. * * @returns True if the device is running iOS, false otherwise. */ export declare function isIOS(): boolean;