From f5e4b4bef483c8dda13fee181df250f36ed48b6a Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:52:44 +0100 Subject: [PATCH] JS: Types for chr(), .indexOf(), .slice() --- applications/system/js_app/types/global.d.ts | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/applications/system/js_app/types/global.d.ts b/applications/system/js_app/types/global.d.ts index b3e4aac33..01a8fbcef 100644 --- a/applications/system/js_app/types/global.d.ts +++ b/applications/system/js_app/types/global.d.ts @@ -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 { }