warscript
Version:
A typescript library for Warcraft III using Warpack.
107 lines (106 loc) • 3.37 kB
TypeScript
/** @noSelfInFile */
declare global {
interface String {
/**
* If this string starts with the given prefix, returns a copy of this string with the prefix removed.
* Otherwise, returns this string.
*/
removePrefix(prefix: string): string;
}
namespace string {
/**
* If the string starts with the given prefix, returns a copy of the string with the prefix removed.
* Otherwise, returns the string.
*/
function removePrefix(string: string, prefix: string): string;
}
}
declare global {
namespace string {
/**
* If the string ends with the given suffix, returns a copy of the string with the suffix removed.
* Otherwise, returns the string.
*/
function removeSuffix(string: string, prefix: string): string;
}
interface String {
/**
* If this string ends with the given suffix, returns a copy of this string with the suffix removed.
* Otherwise, returns this string.
*/
removeSuffix(suffix: string): string;
}
}
declare global {
interface String {
/**
* Parses the string as a number and returns the result or null if the string is not a valid representation of a number.
*/
toNumberOrNull(): number | undefined;
}
namespace string {
/**
* Parses the string as a number and returns the result or null if the string is not a valid representation of a number.
*/
function toNumberOrNull(string: string): number | undefined;
}
}
declare global {
interface String {
/**
* Parses the string as a number and returns the result.
*/
toNumber(): number;
}
namespace string {
/**
* Parses the string as a number and returns the result.
*/
function toNumber(string: string): number;
}
}
declare global {
interface String {
/**
* Returns index of the last character matching the given predicate,
* or -1 if the char sequence does not contain such character.
*/
indexOfLast(predicate: (char: string) => boolean): number;
}
namespace string {
/**
* Returns index of the last character matching the given predicate,
* or -1 if the char sequence does not contain such character.
*/
function indexOfLast(string: string, predicate: (char: string) => boolean): number;
}
}
declare global {
interface String {
/**
* Returns `true` if this string is empty or consists solely of whitespace characters.
*/
isBlank(): boolean;
}
namespace string {
/**
* Returns `true` if this string is empty or consists solely of whitespace characters.
*/
function isBlank(string: string): boolean;
}
}
declare global {
interface String {
/**
* Returns `true` if this string is not empty and contains some characters except of whitespace characters.
*/
isNotBlank(): boolean;
}
namespace string {
/**
* Returns `true` if this string is not empty and contains some characters except of whitespace characters.
*/
function isNotBlank(string: string): boolean;
}
}
export {};