Esempio n. 1
0
func (ctx *Context) NewRegExpFromValues(parameters []*Value) (*Object, error) {
	errVal := ctx.newErrorValue()

	ret := C.JSObjectMakeRegExp(ctx.ref,
		C.size_t(len(parameters)), &parameters[0].ref,
		&errVal.ref)
	if errVal.ref != nil {
		return nil, errVal
	}
	return ctx.newObject(ret), nil
}
Esempio n. 2
0
func (ctx *Context) NewRegExp(regex string) (*Object, error) {
	errVal := ctx.newErrorValue()

	param := ctx.NewStringValue(regex)

	ret := C.JSObjectMakeRegExp(ctx.ref,
		C.size_t(1), &param.ref,
		&errVal.ref)
	if errVal.ref != nil {
		return nil, errVal
	}
	return ctx.newObject(ret), nil
}