summaryrefslogtreecommitdiff
path: root/src/node_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/node_util.cc')
-rw-r--r--src/node_util.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/node_util.cc b/src/node_util.cc
new file mode 100644
index 0000000000..cc86478e09
--- /dev/null
+++ b/src/node_util.cc
@@ -0,0 +1,38 @@
+#include "node.h"
+#include "v8.h"
+#include "env.h"
+#include "env-inl.h"
+
+namespace node {
+namespace util {
+
+using v8::Context;
+using v8::FunctionCallbackInfo;
+using v8::Local;
+using v8::Object;
+using v8::Value;
+
+static void IsMapIterator(const FunctionCallbackInfo<Value>& args) {
+ CHECK_EQ(1, args.Length());
+ args.GetReturnValue().Set(args[0]->IsMapIterator());
+}
+
+
+static void IsSetIterator(const FunctionCallbackInfo<Value>& args) {
+ CHECK_EQ(1, args.Length());
+ args.GetReturnValue().Set(args[0]->IsSetIterator());
+}
+
+
+void Initialize(Local<Object> target,
+ Local<Value> unused,
+ Local<Context> context) {
+ Environment* env = Environment::GetCurrent(context);
+ env->SetMethod(target, "isMapIterator", IsMapIterator);
+ env->SetMethod(target, "isSetIterator", IsSetIterator);
+}
+
+} // namespace util
+} // namespace node
+
+NODE_MODULE_CONTEXT_AWARE_BUILTIN(util, node::util::Initialize)