2.1.4 • Published 3 years ago

@floip/expression-evaluator v2.1.4

Weekly downloads
54
License
MIT
Repository
-
Last release
3 years ago

Flow Interoperability Project (FLOIP) Expression Evaluator

Introduction

The purpose of the project is to enable useful interoperability between Flow-based platforms, and to incentivize the joining of future software tools into an interoperable ecosystem. We will accomplish this through a set of open specifications, and a set of open-source toolsets that reduce barriers to adoption. The initial focus is on tools for mobile/web engagement, although the most basic layer of the specification is general and can represent non-mobile business logic.

What are Expressions?

While a flow paradigm is useful in representing control logic in an easy to understand manner for non-technical users, there is a need to both refer to variables collected within other parts of a flow and transform them in basic ways.

Further reading at Flow Specification Gitbook: Expressions

Basic Expression Evaluator Usage

The expression evaluator expects two arguments:

  • expression — a string containing a Flow Specification compatible expression within it.
  • context — an object whose values can be referenced by the provided expression.
import {EvaluatorFactory} from '@floip/expression-evaluator'

const expr = 'Hello @(first_word(contact.name))!'
const ctx = {
    contact: {name: 'Marshawn Lynch'}
}

EvaluatorFactory.create()
    .evaluate(expr, ctx) // 'Marshawn'
2.1.2

3 years ago

2.1.1

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.0

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.3.0

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago