github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/types/type_name.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  )
     9  
    10  // TYPENAME returns the data type name of value.
    11  // @param {Any} value - Input value of arbitrary type.
    12  // @return {Boolean} - Returns string representation of a type.
    13  func TypeName(_ context.Context, args ...core.Value) (core.Value, error) {
    14  	err := core.ValidateArgs(args, 1, 1)
    15  
    16  	if err != nil {
    17  		return values.None, err
    18  	}
    19  
    20  	return values.NewString(args[0].Type().String()), nil
    21  }