UNPKG

3.05 kBTypeScriptView Raw
1/// <reference types="node" />
2/// <reference types="node" />
3/// <reference types="node" />
4import * as querystring from 'querystring';
5import { PassThrough } from 'stream';
6export declare function normalize<T = {}, U = Function>(optionsOrCallback?: T | U, cb?: U): {
7 options: T;
8 callback: U;
9};
10/**
11 * Flatten an object into an Array of arrays, [[key, value], ..].
12 * Implements Object.entries() for Node.js <8
13 * @internal
14 */
15export declare function objectEntries<T>(obj: {
16 [key: string]: T;
17}): Array<[string, T]>;
18/**
19 * Encode `str` with encodeURIComponent, plus these
20 * reserved characters: `! * ' ( )`.
21 *
22 * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent| MDN: fixedEncodeURIComponent}
23 *
24 * @param {string} str The URI component to encode.
25 * @return {string} The encoded string.
26 */
27export declare function fixedEncodeURIComponent(str: string): string;
28/**
29 * URI encode `uri` for generating signed URLs, using fixedEncodeURIComponent.
30 *
31 * Encode every byte except `A-Z a-Z 0-9 ~ - . _`.
32 *
33 * @param {string} uri The URI to encode.
34 * @param [boolean=false] encodeSlash If `true`, the "/" character is not encoded.
35 * @return {string} The encoded string.
36 */
37export declare function encodeURI(uri: string, encodeSlash: boolean): string;
38/**
39 * Serialize an object to a URL query string using util.encodeURI(uri, true).
40 * @param {string} url The object to serialize.
41 * @return {string} Serialized string.
42 */
43export declare function qsStringify(qs: querystring.ParsedUrlQueryInput): string;
44export declare function objectKeyToLowercase<T>(object: {
45 [key: string]: T;
46}): {
47 [key: string]: T;
48};
49/**
50 * JSON encode str, with unicode \u+ representation.
51 * @param {object} obj The object to encode.
52 * @return {string} Serialized string.
53 */
54export declare function unicodeJSONStringify(obj: object): string;
55/**
56 * Converts the given objects keys to snake_case
57 * @param {object} obj object to convert keys to snake case.
58 * @returns {object} object with keys converted to snake case.
59 */
60export declare function convertObjKeysToSnakeCase(obj: object): object;
61/**
62 * Formats the provided date object as a UTC ISO string.
63 * @param {Date} dateTimeToFormat date object to be formatted.
64 * @param {boolean} includeTime flag to include hours, minutes, seconds in output.
65 * @param {string} dateDelimiter delimiter between date components.
66 * @param {string} timeDelimiter delimiter between time components.
67 * @returns {string} UTC ISO format of provided date obect.
68 */
69export declare function formatAsUTCISO(dateTimeToFormat: Date, includeTime?: boolean, dateDelimiter?: string, timeDelimiter?: string): string;
70export declare class PassThroughShim extends PassThrough {
71 private shouldEmitReading;
72 private shouldEmitWriting;
73 _read(size: number): void;
74 _write(chunk: never, encoding: BufferEncoding, callback: (error?: Error | null | undefined) => void): void;
75 _final(callback: (error?: Error | null | undefined) => void): void;
76}