types

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsArray

func IsArray(_ context.Context, args ...core.Value) (core.Value, error)

IsArray checks whether value is an array value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is array, otherwise false.

func IsBinary

func IsBinary(_ context.Context, args ...core.Value) (core.Value, error)

IsBinary checks whether value is a binary value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is binary, otherwise false.

func IsBool

func IsBool(_ context.Context, args ...core.Value) (core.Value, error)

IsBool checks whether value is a boolean value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is boolean, otherwise false.

func IsDateTime

func IsDateTime(_ context.Context, args ...core.Value) (core.Value, error)

IsDateTime checks whether value is a date time value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is date time, otherwise false.

func IsFloat

func IsFloat(_ context.Context, args ...core.Value) (core.Value, error)

IsFloat checks whether value is a float value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is float, otherwise false.

func IsHTMLDocument

func IsHTMLDocument(_ context.Context, args ...core.Value) (core.Value, error)

IsHTMLDocument checks whether value is a HTMLDocument value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is HTMLDocument, otherwise false.

func IsHTMLElement

func IsHTMLElement(_ context.Context, args ...core.Value) (core.Value, error)

IsHTMLElement checks whether value is a HTMLElement value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is HTMLElement, otherwise false.

func IsInt

func IsInt(_ context.Context, args ...core.Value) (core.Value, error)

IsInt checks whether value is a int value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is int, otherwise false.

func IsNaN

func IsNaN(_ context.Context, args ...core.Value) (core.Value, error)

IsNaN checks whether value is NaN. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is NaN, otherwise false.

func IsNone

func IsNone(_ context.Context, args ...core.Value) (core.Value, error)

IsNone checks whether value is a none value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is none, otherwise false.

func IsObject

func IsObject(_ context.Context, args ...core.Value) (core.Value, error)

IsObject checks whether value is an object value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is object, otherwise false.

func IsString

func IsString(_ context.Context, args ...core.Value) (core.Value, error)

IsString checks whether value is a string value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns true if value is string, otherwise false.

func NewLib

func NewLib() map[string]core.Function

func ToArray

func ToArray(ctx context.Context, args ...core.Value) (core.Value, error)

toArray takes an input value of any type and convert it into an array value. @param (Value) - Input value of arbitrary type. @returns (Array) None is converted to an empty array Boolean values, numbers and strings are converted to an array containing the original value as its single element Arrays keep their original value Objects / HTML nodes are converted to an array containing their attribute values as array elements.

func ToBool

func ToBool(_ context.Context, args ...core.Value) (core.Value, error)

ToBool takes an input value of any type and converts it into the appropriate boolean value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - None is converted to false Numbers are converted to true, except for 0, which is converted to false Strings are converted to true if they are non-empty, and to false otherwise Dates are converted to true if they are not zero, and to false otherwise Arrays are always converted to true (even if empty) Objects / HtmlNodes / Binary are always converted to true

func ToDateTime

func ToDateTime(_ context.Context, args ...core.Value) (core.Value, error)

ToDateTime takes an input value of any type and converts it into the appropriate date time value. @param value (Value) - Input value of arbitrary type. @returns (DateTime) - Parsed date time.

func ToFloat

func ToFloat(ctx context.Context, args ...core.Value) (core.Value, error)

ToFloat takes an input value of any type and convert it into a float value. @param value (Value) - Input value of arbitrary type. @returns (Float) - None and false are converted to the value 0 true is converted to 1 Numbers keep their original value Strings are converted to their numeric equivalent if the string contains a valid representation of a number. String values that do not contain any valid representation of a number will be converted to the number 0. An empty array is converted to 0, an array with one member is converted into the result of TO_NUMBER() for its sole member. An array with two or more members is converted to the number 0. An object / HTML node is converted to the number 0.

func ToInt

func ToInt(ctx context.Context, args ...core.Value) (core.Value, error)

ToInt takes an input value of any type and convert it into an integer value. @param value (Value) - Input value of arbitrary type. @returns (Int) - None and false are converted to the value 0 true is converted to 1 Numbers keep their original value Strings are converted to their numeric equivalent if the string contains a valid representation of a number. String values that do not contain any valid representation of a number will be converted to the number 0. An empty array is converted to 0, an array with one member is converted into the result of TO_NUMBER() for its sole member. An array with two or more members is converted to the number 0. An object / HTML node is converted to the number 0.

func ToString

func ToString(_ context.Context, args ...core.Value) (core.Value, error)

ToString takes an input value of any type and convert it into a string value. @param value (Value) - Input value of arbitrary type. @return (String) - String representation of a given value.

func TypeName

func TypeName(_ context.Context, args ...core.Value) (core.Value, error)

TypeName returns the data type name of value. @param value (Value) - Input value of arbitrary type. @returns (Boolean) - Returns string representation of a type.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL