binding compiler

This commit is contained in:
Asaki Yuki 2026-01-07 10:46:18 +07:00
parent bb9b300d6f
commit 4d5f81f7e5
8 changed files with 188 additions and 15 deletions

View file

@ -2,6 +2,10 @@ declare global {
interface Map<K, V> {
toJSON(): Record<string, V>
}
interface Array<T> {
lastItem(): T
}
}
Map.prototype.toJSON = function () {
@ -9,3 +13,7 @@ Map.prototype.toJSON = function () {
this.forEach((value, key) => (obj[key] = value))
return obj
}
Array.prototype.lastItem = function () {
return this[this.length - 1]
}