Allow converting Array
This commit is contained in:
parent
ad207eeabb
commit
f310222ce1
2 changed files with 24 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "native_mate/compat.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
using v8::Array;
|
||||
using v8::Boolean;
|
||||
using v8::External;
|
||||
using v8::Function;
|
||||
|
@ -195,6 +196,20 @@ bool Converter<Local<External> >::FromV8(Isolate* isolate,
|
|||
return true;
|
||||
}
|
||||
|
||||
Local<Value> Converter<Local<Array> >::ToV8(Isolate* isolate,
|
||||
Local<Array> val) {
|
||||
return val;
|
||||
}
|
||||
|
||||
bool Converter<Local<Array> >::FromV8(Isolate* isolate,
|
||||
v8::Local<Value> val,
|
||||
Local<Array>* out) {
|
||||
if (!val->IsArray())
|
||||
return false;
|
||||
*out = Local<Array>::Cast(val);
|
||||
return true;
|
||||
}
|
||||
|
||||
Local<Value> Converter<Local<Value> >::ToV8(Isolate* isolate,
|
||||
Local<Value> val) {
|
||||
return val;
|
||||
|
|
|
@ -156,6 +156,15 @@ struct Converter<v8::Local<v8::External> > {
|
|||
v8::Local<v8::External>* out);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Converter<v8::Local<v8::Array> > {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Array> val);
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
v8::Local<v8::Array>* out);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Converter<v8::Local<v8::Value> > {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
|
|
Loading…
Reference in a new issue