Swiftpack.co - Package - philprime/Phrase
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

Phrase

CI Documentation codecov

Boolean expression evaluation purely written in Swift for macOS & Linux without any dependencies.

Usage

let expression = try Phrase("list != nil && list.count > 3")
expression.context = [
   "list": [1,2,3,4,5]
]
if try expression.evaluate() {
   ...
} else {
   ...
}

Operators

Prefix-Operators

Operators which require a succeeding node

  • !

Infix-Operators

Operators which require a preceding and a succeeding node

Logical:
  • &&
  • ||
Equaltiy:
  • ==
  • !=
Comparing:
  • >
  • >=
  • <
  • <=

Postfix-Operators

Operators which require a preceeding node

  • count

returns the element count of the preceeding array node

Github

link
Stars: 0

Related Packages

Releases

0.0.4 - 2020-07-27T21:02:50