Socket
Socket
Sign inDemoInstall

github.com/NilCent/eval

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/NilCent/eval


Version published

Readme

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

Last updated on 06 Oct 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc