From 7197368c6d9e36696d23d33ec603701789da329d Mon Sep 17 00:00:00 2001 From: renaesop Date: Mon, 6 Feb 2017 16:54:11 +0800 Subject: [PATCH] Add Converter>::ToV8 --- native_mate/converter.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/native_mate/converter.h b/native_mate/converter.h index ebb6273789d0..02e79b8d8b03 100644 --- a/native_mate/converter.h +++ b/native_mate/converter.h @@ -281,6 +281,15 @@ struct Converter > { } return true; } + static v8::Local ToV8(v8::Isolate* isolate, + const std::map& val) { + v8::Local result = v8::Object::New(isolate); + for (auto i = val.begin(); i != val.end(); i++) { + result->Set(Converter::ToV8(isolate, i->first), + Converter::ToV8(isolate, i->second)); + } + return result; + } }; // Convenience functions that deduce T.