New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/Jacalz/eval

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/Jacalz/eval

  • v1.0.1-0.20230117135256-70762a43ec9b
  • Source
  • Go
  • Socket score

Version published
Created
Source

eval

A minimalistic math parser for Go. It implements the shunting-yard-algorithm and allows to parse math from strings.

Work in progress

The current implementation requires spaces between each math token and does not support trigionometric functions yet.

Example

The library can be used as illustrated below:

package main

import (
	"fmt"

	"github.com/jacalz/eval"
)

func main() {
	input := "( 6 - 2 * ( 6 / 3 ) ) ^ 3"
	
	result, err := eval.Evaluate(input)
	if err != nil {
		panic(err)
	}

	fmt.Println(result)
}

A more elaborate example can be found in the example folder.

FAQs

Package last updated on 17 Jan 2023

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc