[node] Implement GeoJSON converter

This commit is contained in:
Bruno de Oliveira Abinader
2017-09-11 18:30:10 -04:00
parent cda418198f
commit e9914bf034
4 changed files with 15 additions and 23 deletions

View File

@@ -1,13 +1,15 @@
#include <mbgl/style/conversion/geojson.hpp>
#include <string>
namespace mbgl {
namespace style {
namespace conversion {
template <>
optional<GeoJSON> Converter<GeoJSON>::operator()(const v8::Local<v8::Value>&, Error& error) const {
error = { "not implemented" };
return {};
optional<GeoJSON> Converter<GeoJSON>::operator()(const v8::Local<v8::Value>& value, Error& error) const {
Nan::JSON JSON;
std::string string = *Nan::Utf8String(JSON.Stringify(value->ToObject()).ToLocalChecked());
return convert<GeoJSON>(string, error);
}
} // namespace conversion