Welcome to mirror list, hosted at ThFree Co, Russian Federation.

create_string.cpp « src « node-sass « node_modules - github.com/austingebauer/devise.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 27a496f7a02ee09e68d7104553e07233cdb48ee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}