Initial commit
[yaffs-website] / node_modules / node-sass / src / custom_function_bridge.cpp
1 #include <nan.h>
2 #include <stdexcept>
3 #include "custom_function_bridge.h"
4 #include "sass_types/factory.h"
5 #include "sass_types/value.h"
6
7 Sass_Value* CustomFunctionBridge::post_process_return_value(v8::Local<v8::Value> val) const {
8   SassTypes::Value *v_;
9   if ((v_ = SassTypes::Factory::unwrap(val))) {
10     return v_->get_sass_value();
11   } else {
12     return sass_make_error("A SassValue object was expected.");
13   }
14 }
15
16 std::vector<v8::Local<v8::Value>> CustomFunctionBridge::pre_process_args(std::vector<void*> in) const {
17   std::vector<v8::Local<v8::Value>> argv = std::vector<v8::Local<v8::Value>>();
18
19   for (void* value : in) {
20     argv.push_back(SassTypes::Factory::create(static_cast<Sass_Value*>(value))->get_js_object());
21   }
22
23   return argv;
24 }