github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/types/is_int.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_INT checks whether value is a int value.
    12  // @param {Any} value - Input value of arbitrary type.
    13  // @return {Boolean} - Returns true if value is int, otherwise false.
    14  func IsInt(_ 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.Int), nil
    22  }