summaryrefslogtreecommitdiffstats
path: root/node_modules/node-sass/src/create_string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/node-sass/src/create_string.cpp')
-rw-r--r--node_modules/node-sass/src/create_string.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/node_modules/node-sass/src/create_string.cpp b/node_modules/node-sass/src/create_string.cpp
new file mode 100644
index 0000000..27a496f
--- /dev/null
+++ b/node_modules/node-sass/src/create_string.cpp
@@ -0,0 +1,21 @@
+#include <nan.h>
+#include <stdlib.h>
+#include <string.h>
+#include "create_string.h"
+
+char* create_string(Nan::MaybeLocal<v8::Value> maybevalue) {
+ v8::Local<v8::Value> value;
+
+ if (maybevalue.ToLocal(&value)) {
+ if (value->IsNull() || !value->IsString()) {
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+
+ Nan::Utf8String string(value);
+ char *str = (char *)malloc(string.length() + 1);
+ strcpy(str, *string);
+ return str;
+}