package math

import "github.com/gohugoio/hugo/tpl/math"

Index

Functions

func DoArithmetic

func DoArithmetic(a, b interface{}, op rune) (interface{}, error)

DoArithmetic performs arithmetic operations (+,-,*,/) using reflection to determine the type of the two terms.

Types

type Namespace

type Namespace struct{}

Namespace provides template functions for the "math" namespace.

func New

func New() *Namespace

New returns a new instance of the math-namespaced template functions.

func (*Namespace) Add

func (ns *Namespace) Add(a, b interface{}) (interface{}, error)

func (*Namespace) Div

func (ns *Namespace) Div(a, b interface{}) (interface{}, error)

func (*Namespace) Log

func (ns *Namespace) Log(a interface{}) (float64, error)

func (*Namespace) Mod

func (ns *Namespace) Mod(a, b interface{}) (int64, error)

Mod returns a % b.

func (*Namespace) ModBool

func (ns *Namespace) ModBool(a, b interface{}) (bool, error)

ModBool returns the boolean of a % b. If a % b == 0, return true.

func (*Namespace) Mul

func (ns *Namespace) Mul(a, b interface{}) (interface{}, error)

func (*Namespace) Sub

func (ns *Namespace) Sub(a, b interface{}) (interface{}, error)

Source Files

init.go math.go

Version
v0.25.1
Published
Jul 10, 2017
Platform
linux/amd64
Imports
6 packages
Last checked
8 minutes ago

Tools for package owners.