
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
github.com/regel/expr
Expr package provides an engine that can compile and evaluate math expressions. An expression is a one-liner that returns a value (mostly, but not limited to, float64 and []float64). It is designed for simplicity, speed and safety.
The purpose of the package is to allow users to use expressions for fast vector math operations. It is a perfect candidate for the foundation of a time series database and machine learning feature engineering. The idea is to let configure things in a dynamic way without recompile of a program:
# Get a new vector from the addition of cos() and sin() of other variables
cos(X) + 0.33 * sin(Y)
# Get a new norm vector from vector X
(X - nanmin(X)) / (nanmax(X) - nanmin(X))
out, err := expr.Compile(`name + age`)
// err: invalid operation + (mismatched types string and int)
// | name + age
// | .....^
abs
, acos
, acosh
, asin
, asinh
, atan
, atanh
, cbrt
, ceil
, cos
, cosh
, erf
, erfc
, erfcinv
, erfinv
, exp
, exp2
, expm1
, floor
, gamma
, j0
, j1
, log
, log10
, log1p
, log2
, logb
, round
, roundtoeven
, sin
, sinh
, sqrt
, tan
, tanh
, trunc
, y0
, y1
, maximum
, minimum
, mod
, pow
, remainder
, nanmin
, nanmax
, nanmean
, nanstd
, nansum
, nanprod
.
2 * (nanmean(Scores) - minimum(Elevation, Temp))
go get github.com/regel/expr
package main
import (
"fmt"
"github.com/regel/expr"
"github.com/regel/expr/ast"
)
func main() {
code := `1 + (sum(Features) / 2)`
program, err := expr.Compile(code)
if err != nil {
panic(err)
}
env := &ast.Env{
"Features": []float64{0.5, 1.0, 1.5},
}
output, err := expr.Run(program, env)
if err != nil {
panic(err)
}
fmt.Printf("%v\n", output)
}
FAQs
Unknown package
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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.