DefinitelyTyped/types/pre-suf/index.d.ts
Piotr Błażejewicz (Peter Blazejewicz) a0a52a6a3d
feat(pre-suf): new type definition (#43866)
- declaration file
- tests

https://github.com/kaelzhang/node-pre-suf

Thanks!
2020-04-13 15:27:17 -07:00

28 lines
978 B
TypeScript

// Type definitions for pre-suf 1.1
// Project: https://github.com/kaelzhang/node-pre-suf#readme
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Manipulate strings with prefixes and suffixes.
*/
/**
* Ensures that the new string will have prefix at the beginning of str.
* If str does not begin with prefix, prefix will be added to the beggining of str.
*/
export function ensureLeading(str: string, prefix: string): string;
/**
* Removes the leading prefix of str.
*/
export function removeLeading(str: string, prefix: string): string;
/**
* Ensures that the new string will have suffix at the end of str.
* If str does not end with suffix, suffix will be added at the end of str.
*/
export function ensureEnding(str: string, suffix: string): string;
/**
* Removes the ending suffix of str.
*/
export function removeEnding(str: string, suffix: string): string;