UNPKG

web-dev-server

Version:

Node.js simple http server for common development or training purposes.

50 lines (49 loc) 2.56 kB
import { QueryStringCollectionRecord } from "./StringHelpers/QueryString/CollectionRecord"; import { QueryStringLastLevel } from "./StringHelpers/QueryString/LastLevel"; export declare class StringHelper { protected static readonly HTML_SPECIAL_CHARS: any; protected static readonly HTML_SPECIAL_CHARS_WITHOUT_AMP: any; static Trim(str: string, chars: string): string; static TrimLeft(str: string, chars: string): string; static TrimRight(str: string, chars: string): string; static DecodeUri(str: string): string; static Strtr(str: string, dic: any): string; /** * Convert special characters to HTML entities except ampersand `&`. * @see http://php.net/manual/en/function.htmlspecialchars.php * @param str */ static HtmlSpecialChars(str: string, includeAmpersand?: boolean): string; static HtmlEntitiesEncode(rawStr: string): string; static RawUrlDecode(str: string): string; static QueryStringEncode(obj: any, encodeAmp?: boolean): string; protected static encodeQueryStringRecursive(prefix: string, keys: string[], value: any, items: string[], level: number): void; static QueryStringDecode(str: string, autoRetype?: boolean): any; protected static queryStringDecodePrepareItems(str: string): string[]; protected static queryStringDecodeRetypeValue(itemRawValue: string): boolean | number | string | null | undefined; protected static queryStringDecodeExplodeKeyValue(itemRaw: string): string[]; protected static queryStringDecodeItemKeys(itemRawKey: string): string[]; protected static queryStringDecodeGetLastLevel(itemKeys: string[], result: any, collections: QueryStringCollectionRecord[], lastCollectionId: number): QueryStringLastLevel; protected static queryStringDecodeRetypeCollections(result: any, collections: QueryStringCollectionRecord[]): any; /** * Recognize if given string is JSON or not without JSON parsing. * @see https://www.ietf.org/rfc/rfc4627.txt * @param jsonStr * @return bool */ static IsJsonString(jsonStr: string): boolean; /** * Recognize if given string is query string without parsing. * It recognizes query strings like: * - `key1=value1` * - `key1=value1&` * - `key1=value1&key2=value2` * - `key1=value1&key2=value2&` * - `key1=&key2=value2` * - `key1=value&key2=` * - `key1=value&key2=&key3=` * ... * @param jsonStr */ static IsQueryString(queryStr: string): boolean; }