🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

github.com/nilcent/eval

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/nilcent/eval

v0.0.0-20221006132930-6217f8aa9b7a
Source
Go
Version published
Created
Source

eval

支持函数和判断等功能的表达式计算器.

Installation

go get -u github.com/NilCent/eval

quick start

package main

import (
	"github.com/NilCent/eval"
	"fmt"
)

func main() {
	i := eval.New()
	i.Do(`let fun = fn(x) {
		if (x > 10) {
			return x * 3;
		} else {
			return x * 5;
		}
	}`)
	a, _ := i.EvalInt("fun(5)")
	fmt.Println(a)
}

FAQs

Package last updated on 13 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts