JS: Types for chr(), .indexOf(), .slice()

This commit is contained in:
Willy-JL
2024-10-16 11:52:44 +01:00
parent 75be03be68
commit f5e4b4bef4
+21
View File
@@ -56,6 +56,15 @@ declare const __filepath: string;
*/
declare function load(path: string): any;
/**
* @brief Return 1-byte string whose ASCII code is the integer `n`
*
* If `n` is not numeric or outside of `0-255` range, `null` is returned
*
* @param n The ASCII code to convert to string
*/
declare function chr(n: number): string | null;
/**
* @brief mJS Foreign Pointer type
*
@@ -189,6 +198,18 @@ declare class String {
* See `charCodeAt`
*/
at(index: number): number;
/**
* @brief Return index of first occurence of substr within the string or `-1` if not found
* @param substr The string to search for
* @param fromIndex The index to start searching from
*/
indexOf(substr: string, fromIndex?: number): number;
/**
* @brief Return a substring between two indices
* @param start The index to start substring at
* @param end The index to end substring at
*/
slice(start: number, end?: number): string;
}
declare class Boolean { }