1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-03-21 21:47:43 +02:00
ferret/pkg/stdlib/html/xpath_selector.go

21 lines
561 B
Go
Raw Normal View History

package html
import (
"context"
"github.com/MontFerret/ferret/pkg/drivers"
"github.com/MontFerret/ferret/pkg/runtime/core"
"github.com/MontFerret/ferret/pkg/runtime/values"
)
// X returns QuerySelector of XPath kind.
// @param {String} expression - XPath expression.
// @return {Any} - Returns QuerySelector of XPath kind.
func XPathSelector(_ context.Context, args ...core.Value) (core.Value, error) {
if err := core.ValidateArgs(args, 1, 1); err != nil {
return values.None, err
}
return drivers.NewXPathSelector(values.ToString(args[0])), nil
}