es_array

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array interface {
	// Returns first entry of the array.
	// Returns Null es_value.Value (not nil) when the array is empty.
	First() es_value.Value

	// Returns last entry of the array.
	// Returns Null es_value.Value (not nil) when the array is empty.
	Last() es_value.Value

	// Returns first n entries.
	Left(n int) Array

	// Returns first elements while the f returns true.
	LeftWhile(f func(v es_value.Value) bool) Array

	// Returns last n entries.
	Right(n int) Array

	// Returns last elements while the f returns true.
	RightWhile(f func(v es_value.Value) bool) Array

	// Returns size of the array.
	Size() int

	// Reverse order
	Reverse() Array

	// Returns true if an array is empty.
	IsEmpty() bool

	// Counts the number of entries in the array which satisfy a condition.
	Count(f func(v es_value.Value) bool) int

	// Returns an entry of given index.
	// Returns Null es_value.Value (not nil) when the index is out of range.
	At(i int) es_value.Value

	// Return entries in array.
	Entries() []es_value.Value

	// Returns unique values
	Unique() Array

	// Returns joined array of other and this instance.
	Append(other Array) Array

	// Returns unique intersect entries of other and this array.
	Intersection(other Array) Array

	// Returns unique union entries of other and this array.
	Union(other Array) Array

	// Returns an array removing all occurrences of entries in other.
	Diff(other Array) Array

	// Returns sorted array
	Sort() Array

	// Returns array in []string
	AsStringArray() []string

	// Returns array in []Number
	AsNumberArray() []es_number.Number

	// Returns array in []interface{}
	AsInterfaceArray() []interface{}

	// es_value.Value#Hash and es_value.Value map
	HashMap() map[string]es_value.Value

	// Create a new array containing the values returned by the function
	Map(f func(v es_value.Value) es_value.Value) Array

	// For each values
	Each(f func(v es_value.Value))
}

func Empty

func Empty() Array

func NewByFileInfo

func NewByFileInfo(entries ...os.FileInfo) Array

func NewByHashValueMap

func NewByHashValueMap(entries map[string]es_value.Value) Array

func NewByInterface

func NewByInterface(entries ...interface{}) Array

func NewByString

func NewByString(entries ...string) Array

func NewByValue

func NewByValue(entries ...es_value.Value) Array

Jump to

Keyboard shortcuts

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