Skip to content

Commit 01d4694

Browse files
committed
Added string functions
1 parent ae87fec commit 01d4694

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

binding.gyp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
'src/tree.cc',
1717
'src/tree_entry.cc',
1818
'src/threads.cc'
19+
'src/functions/string.cc'
1920
],
2021
'todosources': [
2122
],

include/functions/string.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <v8.h>
2+
3+
#ifndef STRING_FUNCTIONS
4+
#define STRING_FUNCTIONS
5+
6+
std::string stringArgToString(const v8::Local<v8::Value> arg);
7+
8+
#endif

src/functions/string.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <v8.h>
2+
#include <string>
3+
4+
#include "../../include/functions/string.h"
5+
6+
std::string stringArgToString(const v8::Local<v8::Value> arg) {
7+
v8::String::Utf8Value param1(arg);
8+
return std::string(*param1);
9+
}

0 commit comments

Comments
 (0)