Skip to content

Added KindsOf method to Value type#37

Open
afinch7 wants to merge 2 commits intoaugustoroman:masterfrom
afinch7:master
Open

Added KindsOf method to Value type#37
afinch7 wants to merge 2 commits intoaugustoroman:masterfrom
afinch7:master

Conversation

@afinch7
Copy link

@afinch7 afinch7 commented Nov 30, 2018

Pretty simple stuff just added a KindsOf method for the Value type, and a KindList type with a method String.

Should allow for a little better error reporting from bound functions.

I.E.

func someBoundMethod(in v8.CallbackArgs) (*v8.Value, error) {
    if !in.Arg(0).IsKind(v8.KindString) {
	return nil, errors.New("Expected String type for arg 0 but got: " + in.Arg(0).KindsOf().String() + ".")
    }
} 

I would imagine there are other uses this is just the one that motivated me to make this pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments