Initial commit
[yaffs-website] / node_modules / node-sass / src / create_string.cpp
1 #include <nan.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include "create_string.h"
5
6 char* create_string(Nan::MaybeLocal<v8::Value> maybevalue) {
7   v8::Local<v8::Value> value;
8   
9   if (maybevalue.ToLocal(&value)) {
10     if (value->IsNull() || !value->IsString()) {
11       return 0;
12     }
13   } else {
14     return 0;
15   }
16
17   v8::String::Utf8Value string(value);
18   char *str = (char *)malloc(string.length() + 1);
19   strcpy(str, *string);
20   return str;
21 }