Initial ES modules support
This commit is contained in:
+10
-2
@@ -1,5 +1,13 @@
|
||||
import {
|
||||
__rt_number_to_string,
|
||||
__rt_string_char_code_at,
|
||||
__rt_string_concat,
|
||||
__rt_string_from_char_code,
|
||||
__rt_string_slice,
|
||||
} from "jsrt:native";
|
||||
|
||||
// Converts any value to a string, like the spec's ToString
|
||||
function String(x) {
|
||||
export function String(x) {
|
||||
switch (typeof x) {
|
||||
case "string": return x;
|
||||
case "number": return __rt_number_to_string(x);
|
||||
@@ -109,7 +117,7 @@ function clampIndex(i, len) {
|
||||
}
|
||||
|
||||
// An index where a negative value counts from the end, clamped to [0, len]
|
||||
function relativeIndex(i, len) {
|
||||
export function relativeIndex(i, len) {
|
||||
return clampIndex(i < 0 ? i + len : i, len);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user