Skip to content

Commit 71160cd

Browse files
committed
added "construtor function to Functions
1 parent 31259d4 commit 71160cd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

IdrisScript/Functions.idr

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ hasOwnProperty prop fun = do
6262
||| Returns the name of a function.
6363
name : JSValue JSFunction -> IO String
6464
name fun = mkForeign (FFun "%0.name" [FPtr] FString) (unpack fun)
65+
66+
||| Returns the constructor of a function.
67+
constructor : JSValue JSFunction -> IO (JSValue JSFunction)
68+
constructor fun = do
69+
con <- mkForeign (FFun "%0.constructor" [FPtr] FPtr) (unpack fun)
70+
return $ MkJSFunction con

0 commit comments

Comments
 (0)