UNPKG

1.81 kBTypeScriptView Raw
1/// <reference types="node" />
2import * as querystring from 'querystring';
3export declare function normalize<T = {}, U = Function>(optionsOrCallback?: T | U, cb?: U): {
4 options: T;
5 callback: U;
6};
7/**
8 * Flatten an object into an Array of arrays, [[key, value], ..].
9 * Implements Object.entries() for Node.js <8
10 * @internal
11 */
12export declare function objectEntries<T>(obj: {
13 [key: string]: T;
14}): Array<[string, T]>;
15/**
16 * Encode `str` with encodeURIComponent, plus these
17 * reserved characters: `! * ' ( )`.
18 *
19 * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent| MDN: fixedEncodeURIComponent}
20 *
21 * @param {string} str The URI component to encode.
22 * @return {string} The encoded string.
23 */
24export declare function fixedEncodeURIComponent(str: string): string;
25/**
26 * URI encode `uri` for generating signed URLs, using fixedEncodeURIComponent.
27 *
28 * Encode every byte except `A-Z a-Z 0-9 ~ - . _`.
29 *
30 * @param {string} uri The URI to encode.
31 * @param [boolean=false] encodeSlash If `true`, the "/" character is not encoded.
32 * @return {string} The encoded string.
33 */
34export declare function encodeURI(uri: string, encodeSlash: boolean): string;
35/**
36 * Serialize an object to a URL query string using util.encodeURI(uri, true).
37 * @param {string} url The object to serialize.
38 * @return {string} Serialized string.
39 */
40export declare function qsStringify(qs: querystring.ParsedUrlQueryInput): string;
41export declare function objectKeyToLowercase<T>(object: {
42 [key: string]: T;
43}): {
44 [key: string]: T;
45};
46/**
47 * JSON encode str, with unicode \u+ representation.
48 * @param {object} obj The object to encode.
49 * @return {string} Serialized string.
50 */
51export declare function unicodeJSONStringify(obj: object): string;