summaryrefslogtreecommitdiff
path: root/src/js.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/js.c')
-rw-r--r--src/js.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/js.c b/src/js.c
index c1a2a85d..e69a5ecf 100644
--- a/src/js.c
+++ b/src/js.c
@@ -332,4 +332,12 @@ js_array_iterator_next(js_array_iterator *iter, JSValueRef *exc)
return JSObjectGetPropertyAtIndex(iter->ctx, iter->array, iter->current_index++, exc);
}
+JSObjectRef
+js_value_to_function(JSContextRef ctx, JSValueRef val, JSValueRef *exc)
+{
+ JSObjectRef ret = JSValueToObject(ctx, val, exc);
+ if (ret != NULL && JSObjectIsFunction(ctx, ret))
+ return ret;
+ return NULL;
+}