diff options
author | 2023-05-09 21:47:18 -0700 | |
---|---|---|
committer | 2023-05-09 21:47:18 -0700 | |
commit | 1e8b9258b2ac77f6db1b42ce82928fed86ffc77d (patch) | |
tree | b51e89e810de5877817ede5ec7075e4ec7957259 /src/bun.js/bindings/bindings.cpp | |
parent | c7c5dc14384f81a2d245870d2848c0512193690d (diff) | |
download | bun-1e8b9258b2ac77f6db1b42ce82928fed86ffc77d.tar.gz bun-1e8b9258b2ac77f6db1b42ce82928fed86ffc77d.tar.zst bun-1e8b9258b2ac77f6db1b42ce82928fed86ffc77d.zip |
Expose bindings for `Map`
Diffstat (limited to 'src/bun.js/bindings/bindings.cpp')
-rw-r--r-- | src/bun.js/bindings/bindings.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index 0d4416535..b0078503b 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -90,6 +90,7 @@ #include "DOMFormData.h" #include "JSDOMFormData.h" #include "ZigGeneratedClasses.h" +#include "JavaScriptCore/JSMapInlines.h" template<typename UWSResponse> static void copyToUWS(WebCore::FetchHeaders* headers, UWSResponse* res) @@ -4121,3 +4122,31 @@ CPP_DECL WebCore__DOMFormData* WebCore__DOMFormData__fromJS(JSC__JSValue JSValue { return WebCoreCast<WebCore::JSDOMFormData, WebCore__DOMFormData>(JSValue1); } + +#pragma mark - JSC::JSMap + +CPP_DECL JSC__JSValue JSC__JSMap__create(JSC__JSGlobalObject* arg0) +{ + JSC::JSMap* map = JSC::JSMap::create(arg0->vm(), arg0->mapStructure()); + return JSC::JSValue::encode(map); +} +CPP_DECL JSC__JSValue JSC__JSMap__get_(JSC__JSMap* map, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2) +{ + JSC::JSValue value = JSC::JSValue::decode(JSValue2); + + return JSC::JSValue::encode(map->get(arg1, value)); +} +CPP_DECL bool JSC__JSMap__has(JSC__JSMap* map, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2) +{ + JSC::JSValue value = JSC::JSValue::decode(JSValue2); + return map->has(arg1, value); +} +CPP_DECL bool JSC__JSMap__remove(JSC__JSMap* map, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2) +{ + JSC::JSValue value = JSC::JSValue::decode(JSValue2); + return map->remove(arg1, value); +} +CPP_DECL void JSC__JSMap__set(JSC__JSMap* map, JSC__JSGlobalObject* arg1, JSC__JSValue JSValue2, JSC__JSValue JSValue3) +{ + map->set(arg1, JSC::JSValue::decode(JSValue2), JSC::JSValue::decode(JSValue3)); +} |