stdlib

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuiltinModules = map[string]map[string]objects.Object{
	"math":  mathModule,
	"os":    osModule,
	"text":  textModule,
	"times": timesModule,
	"rand":  randModule,
	"fmt":   fmtModule,
	"json":  jsonModule,
}

BuiltinModules are builtin type standard library modules.

View Source
var SourceModules = map[string]string{
	"enum": `export {
  // all returns true if the given function fn evaluates to a truthy value on
  // all of the items in the enumerable.
  all: func(enumerable, fn) {
    for k, v in enumerable {
      if !fn(k, v) {
        return false
      }
    }
    return true
  },
  // any returns true if the given function fn evaluates to a truthy value on
  // any of the items in the enumerable.
  any: func(enumerable, fn) {
    for k, v in enumerable {
      if fn(k, v) {
        return true
      }
    }
    return false
  },
  // chunk returns an array of elements split into groups the length of size.
  // If the enumerable can't be split evenly, the final chunk will be the
  // remaining elements.
  chunk: func(enumerable, size) {
    numElements := len(enumerable)

    if !numElements {
      return []
    }
    
    res := []
    idx := 0
    for idx < numElements {
      res = append(res, enumerable[idx:idx+size])
      idx += size
    }
    return res
  }
}
`,
}

SourceModules are source type standard library modules.

Functions

func AllModuleNames added in v1.10.1

func AllModuleNames() []string

AllModuleNames returns a list of all default module names.

func FuncAFFRF

func FuncAFFRF(fn func(float64, float64) float64) objects.CallableFunc

FuncAFFRF transform a function of 'func(float64, float64) float64' signature into CallableFunc type.

func FuncAFIRB

func FuncAFIRB(fn func(float64, int) bool) objects.CallableFunc

FuncAFIRB transform a function of 'func(float64, int) bool' signature into CallableFunc type.

func FuncAFIRF

func FuncAFIRF(fn func(float64, int) float64) objects.CallableFunc

FuncAFIRF transform a function of 'func(float64, int) float64' signature into CallableFunc type.

func FuncAFRB

func FuncAFRB(fn func(float64) bool) objects.CallableFunc

FuncAFRB transform a function of 'func(float64) bool' signature into CallableFunc type.

func FuncAFRF

func FuncAFRF(fn func(float64) float64) objects.CallableFunc

FuncAFRF transform a function of 'func(float64) float64' signature into CallableFunc type.

func FuncAFRI

func FuncAFRI(fn func(float64) int) objects.CallableFunc

FuncAFRI transform a function of 'func(float64) int' signature into CallableFunc type.

func FuncAI64R

func FuncAI64R(fn func(int64)) objects.CallableFunc

FuncAI64R transform a function of 'func(int64)' signature into CallableFunc type.

func FuncAI64RI64

func FuncAI64RI64(fn func(int64) int64) objects.CallableFunc

FuncAI64RI64 transform a function of 'func(int64) int64' signature into CallableFunc type.

func FuncAIFRF

func FuncAIFRF(fn func(int, float64) float64) objects.CallableFunc

FuncAIFRF transform a function of 'func(int, float64) float64' signature into CallableFunc type.

func FuncAIIRE

func FuncAIIRE(fn func(int, int) error) objects.CallableFunc

FuncAIIRE transform a function of 'func(int, int) error' signature into CallableFunc type.

func FuncAIR

func FuncAIR(fn func(int)) objects.CallableFunc

FuncAIR transform a function of 'func(int)' signature into CallableFunc type.

func FuncAIRF

func FuncAIRF(fn func(int) float64) objects.CallableFunc

FuncAIRF transform a function of 'func(int) float64' signature into CallableFunc type.

func FuncAIRIs

func FuncAIRIs(fn func(int) []int) objects.CallableFunc

FuncAIRIs transform a function of 'func(int) []int' signature into CallableFunc type.

func FuncAIRS

func FuncAIRS(fn func(int) string) objects.CallableFunc

FuncAIRS transform a function of 'func(int) string' signature into CallableFunc type.

func FuncAIRSsE

func FuncAIRSsE(fn func(int) ([]string, error)) objects.CallableFunc

FuncAIRSsE transform a function of 'func(int) ([]string, error)' signature into CallableFunc type.

func FuncAR

func FuncAR(fn func()) objects.CallableFunc

FuncAR transform a function of 'func()' signature into CallableFunc type.

func FuncARB

func FuncARB(fn func() bool) objects.CallableFunc

FuncARB transform a function of 'func() bool' signature into CallableFunc type.

func FuncARE

func FuncARE(fn func() error) objects.CallableFunc

FuncARE transform a function of 'func() error' signature into CallableFunc type.

func FuncARF

func FuncARF(fn func() float64) objects.CallableFunc

FuncARF transform a function of 'func() float64' signature into CallableFunc type.

func FuncARI

func FuncARI(fn func() int) objects.CallableFunc

FuncARI transform a function of 'func() int' signature into CallableFunc type.

func FuncARI64

func FuncARI64(fn func() int64) objects.CallableFunc

FuncARI64 transform a function of 'func() int64' signature into CallableFunc type.

func FuncARIsE

func FuncARIsE(fn func() ([]int, error)) objects.CallableFunc

FuncARIsE transform a function of 'func() ([]int, error)' signature into CallableFunc type.

func FuncARS

func FuncARS(fn func() string) objects.CallableFunc

FuncARS transform a function of 'func() string' signature into CallableFunc type.

func FuncARSE

func FuncARSE(fn func() (string, error)) objects.CallableFunc

FuncARSE transform a function of 'func() (string, error)' signature into CallableFunc type.

func FuncARSs

func FuncARSs(fn func() []string) objects.CallableFunc

FuncARSs transform a function of 'func() []string' signature into CallableFunc type.

func FuncARYE

func FuncARYE(fn func() ([]byte, error)) objects.CallableFunc

FuncARYE transform a function of 'func() ([]byte, error)' signature into CallableFunc type.

func FuncASI64RE

func FuncASI64RE(fn func(string, int64) error) objects.CallableFunc

FuncASI64RE transform a function of 'func(string, int64) error' signature into CallableFunc type.

func FuncASIIRE

func FuncASIIRE(fn func(string, int, int) error) objects.CallableFunc

FuncASIIRE transform a function of 'func(string, int, int) error' signature into CallableFunc type.

func FuncASIRS

func FuncASIRS(fn func(string, int) string) objects.CallableFunc

FuncASIRS transform a function of 'func(string, int) string' signature into CallableFunc type.

func FuncASRE

func FuncASRE(fn func(string) error) objects.CallableFunc

FuncASRE transform a function of 'func(string) error' signature into CallableFunc type. User function will return 'true' if underlying native function returns nil.

func FuncASRIE

func FuncASRIE(fn func(string) (int, error)) objects.CallableFunc

FuncASRIE transform a function of 'func(string) (int, error)' signature into CallableFunc type.

func FuncASRS

func FuncASRS(fn func(string) string) objects.CallableFunc

FuncASRS transform a function of 'func(string) string' signature into CallableFunc type. User function will return 'true' if underlying native function returns nil.

func FuncASRSE

func FuncASRSE(fn func(string) (string, error)) objects.CallableFunc

FuncASRSE transform a function of 'func(string) (string, error)' signature into CallableFunc type. User function will return 'true' if underlying native function returns nil.

func FuncASRSs

func FuncASRSs(fn func(string) []string) objects.CallableFunc

FuncASRSs transform a function of 'func(string) []string' signature into CallableFunc type.

func FuncASSIRSs

func FuncASSIRSs(fn func(string, string, int) []string) objects.CallableFunc

FuncASSIRSs transform a function of 'func(string, string, int) []string' signature into CallableFunc type.

func FuncASSRB

func FuncASSRB(fn func(string, string) bool) objects.CallableFunc

FuncASSRB transform a function of 'func(string, string) bool' signature into CallableFunc type.

func FuncASSRE

func FuncASSRE(fn func(string, string) error) objects.CallableFunc

FuncASSRE transform a function of 'func(string, string) error' signature into CallableFunc type. User function will return 'true' if underlying native function returns nil.

func FuncASSRI

func FuncASSRI(fn func(string, string) int) objects.CallableFunc

FuncASSRI transform a function of 'func(string, string) int' signature into CallableFunc type.

func FuncASSRS

func FuncASSRS(fn func(string, string) string) objects.CallableFunc

FuncASSRS transform a function of 'func(string, string) string' signature into CallableFunc type.

func FuncASSRSs

func FuncASSRSs(fn func(string, string) []string) objects.CallableFunc

FuncASSRSs transform a function of 'func(string, string) []string' signature into CallableFunc type.

func FuncASsSRS

func FuncASsSRS(fn func([]string, string) string) objects.CallableFunc

FuncASsSRS transform a function of 'func([]string, string) string' signature into CallableFunc type.

func FuncAYRIE

func FuncAYRIE(fn func([]byte) (int, error)) objects.CallableFunc

FuncAYRIE transform a function of 'func([]byte) (int, error)' signature into CallableFunc type.

func GetModuleMap added in v1.18.0

func GetModuleMap(names ...string) *objects.ModuleMap

GetModuleMap returns the module map that includes all modules for the given module names.

Types

This section is empty.

Jump to

Keyboard shortcuts

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