ts-utls
Version:
Utilities for TypeScript library
60 lines • 1.93 kB
TypeScript
/**
* Put the first letter of a sentence in upper case
*
* @param {string} s - The sentence to capitalize
* @returns the capitalized string
*/
export declare const capitalize: (s: string) => string;
/**
* Returns the byte array from the passed hexadecimal string, or an empty buffer if failed
*
* @param {string} s - The hexadecimal string representation
* @returns the corresponding byte array
*/
export declare const fromHex: (s: string) => Buffer;
/**
* Compute the equivalent of Java's hashCode for the passed string
*
* @param {string} s - The string to use
* @returns the hashCode
*/
export declare const hashCode: (s: string) => number;
/**
* Reverse the order of the characters in the passed string
*
* @param {string} s - The string to use
* @returns the reversed string
*/
export declare const reverse: (s: string) => string;
/**
* Shuffle the characters of the passed string
*
* @param {string} s - The string to use
* @returns the shuffled string
* @see http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
*/
export declare const shuffle: (s: string) => string;
/**
* Split a camel case string into a sequence of words, eg. MyCamelCaseWord => My Camel Case Word
*
* @param {string} s - The camel case string to use
* @returns the sentence
*/
export declare const splitCamelCaseWords: (s: string) => string;
/**
* Build the hexadecimal string representation of the passed byte array
*
* @param {Buffer} b - The byte array array to use
* @returns the hexadecimal string
*/
export declare const toHex: (b: Buffer) => string;
/**
* Applies the XOR function to two strings in the sense that each charCode are XORed
*
* @param {string} s1 - The first string to use
* @param {string} s2 - The second string
* @returns the XORed result
* @throws strings must be of the same size
*/
export declare const xor: (s1: string, s2: string) => string;
//# sourceMappingURL=string.d.ts.map