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