mirror of
https://github.com/arthur-pbty/portfolio2023.git
synced 2026-06-11 11:21:04 +02:00
125 lines
3.4 KiB
TypeScript
125 lines
3.4 KiB
TypeScript
import { EncodeOptions } from 'he';
|
||
import { BytesOptions } from 'bytes';
|
||
export { default as toSlug } from 'slugify';
|
||
/**
|
||
* The method is a copy/paste from the "title-case" package. They have
|
||
* a dependency on "tslib", which I don't want.
|
||
*/
|
||
export declare function titleCase(input: string): string;
|
||
/**
|
||
* Define an irregular rule
|
||
*/
|
||
export declare function defineIrregularRule(singleValue: string, pluralValue: string): void;
|
||
/**
|
||
* Define uncountable rule
|
||
*/
|
||
export declare function defineUncountableRule(word: string): void;
|
||
/**
|
||
* Convert string to camelcase
|
||
*/
|
||
export declare function camelCase(value: string): string;
|
||
/**
|
||
* Convert string to snakecase
|
||
*/
|
||
export declare function snakeCase(value: string): string;
|
||
/**
|
||
* Convert string to dashcase
|
||
*/
|
||
export declare function dashCase(value: string, options?: {
|
||
capitalize?: boolean;
|
||
}): string;
|
||
/**
|
||
* Convert string to pascal case
|
||
*/
|
||
export declare function pascalCase(value: string): string;
|
||
/**
|
||
* Convert string to capital case
|
||
*/
|
||
export declare function capitalCase(value: string): string;
|
||
/**
|
||
* Convert string to sentence case
|
||
*/
|
||
export declare function sentenceCase(value: string): string;
|
||
/**
|
||
* Convert string to dot case
|
||
*/
|
||
export declare function dotCase(value: string): string;
|
||
/**
|
||
* Remove all sort of casing from the string
|
||
*/
|
||
export declare function noCase(value: string): string;
|
||
/**
|
||
* Pluralize a word
|
||
*/
|
||
export declare function pluralize(word: string): string;
|
||
/**
|
||
* Singularize a word
|
||
*/
|
||
export declare function singularize(word: string): string;
|
||
/**
|
||
* Truncate a sentence till a give limit of characters
|
||
*/
|
||
export declare function truncate(sentence: string, charactersLimit: number, options?: {
|
||
completeWords?: boolean;
|
||
suffix?: string;
|
||
}): string;
|
||
/**
|
||
* Same as truncate, but strips out the HTML
|
||
*/
|
||
export declare function excerpt(sentence: string, charactersLimit: number, options?: {
|
||
completeWords?: boolean;
|
||
suffix?: string;
|
||
}): string;
|
||
/**
|
||
* Condenses multiple whitespaces from a string
|
||
*/
|
||
export declare function condenseWhitespace(value: string): string;
|
||
/**
|
||
* Escape HTML entities
|
||
*/
|
||
export declare function escapeHTML(value: string, options?: {
|
||
encodeSymbols?: boolean;
|
||
}): string;
|
||
/**
|
||
* Encode symbols that aren’t printable ASCII symbols
|
||
*/
|
||
export declare function encodeSymbols(value: string, options?: EncodeOptions): string;
|
||
/**
|
||
* Convert array of values to a sentence
|
||
*/
|
||
export declare function toSentence(values: any[], options?: {
|
||
separator?: string;
|
||
pairSeparator?: string;
|
||
lastSeparator?: string;
|
||
}): string;
|
||
/**
|
||
* Convert a number to a human readable string
|
||
*/
|
||
export declare function prettyBytes(value: number, options?: BytesOptions): string;
|
||
/**
|
||
* Convert milliseconds to a human readable string
|
||
*/
|
||
export declare function prettyMs(value: number, options?: {
|
||
long: boolean;
|
||
}): string;
|
||
/**
|
||
* Find if a string is empty. Including any number of whitespaces
|
||
*/
|
||
export declare function isEmpty(value: string): boolean;
|
||
/**
|
||
* Ordinalize a give number or string
|
||
*/
|
||
export declare function ordinalize(value: string | number): string;
|
||
/**
|
||
* Converts unit expression to bytes
|
||
*/
|
||
export declare function toBytes(value: string | number): number;
|
||
/**
|
||
* Converts time expression to milliseconds
|
||
*/
|
||
export declare function toMs(value: string | number): number;
|
||
/**
|
||
* Generates a random string for a given size
|
||
*/
|
||
export declare function generateRandom(size: number): string;
|