github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/types/is_object.go (about)

     1  package types
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/MontFerret/ferret/pkg/runtime/core"
     7  	"github.com/MontFerret/ferret/pkg/runtime/values"
     8  	"github.com/MontFerret/ferret/pkg/runtime/values/types"
     9  )
    10  
    11  // IS_OBJECT checks whether value is an object value.
    12  // @param {Any} value - Input value of arbitrary type.
    13  // @return {Boolean} - Returns true if value is object, otherwise false.
    14  func IsObject(_ context.Context, args ...core.Value) (core.Value, error) {
    15  	err := core.ValidateArgs(args, 1, 1)
    16  
    17  	if err != nil {
    18  		return values.None, err
    19  	}
    20  
    21  	return isTypeof(args[0], types.Object), nil
    22  }