Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Port][Expression]Add stringOrValue built-in function #3282

Merged
merged 3 commits into from
Feb 8, 2021

Conversation

Danieladu
Copy link
Contributor

Fixes #3281

Description

Introduce a new built-in function that refers to smart interpolation.

The original requirements are:

  • when user input is a simple variable, like ${name} or ${age}, it should evaluate as a single variable and the return type is the variable type (int\float\string, it could vary)
  • when user input is text + variables, like ${age} is too big, it should evaluate as a string intepolation, and always return a string type

Samples:
stringOrValue('${2+3}') -> 5
stringOrValue('woof is ${3+5}') would produce 'woof is 8'.

Changes

Create a new function that can evaluate the value expression smartly.

@Danieladu Danieladu requested review from a team as code owners February 8, 2021 08:16
@coveralls
Copy link

coveralls commented Feb 8, 2021

Pull Request Test Coverage Report for Build 548915645

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.003%) to 84.807%

Files with Coverage Reduction New Missed Lines %
libraries/adaptive-expressions/src/triggerTrees/trigger.ts 2 62.79%
Totals Coverage Status
Change from base Build 548915417: -0.003%
Covered Lines: 18508
Relevant Lines: 20812

💛 - Coveralls

@joshgummersall joshgummersall merged commit 98ce44c into main Feb 8, 2021
@joshgummersall joshgummersall deleted the hond/stringOrValue branch February 8, 2021 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

port: [Expression]Add stringOrValue built-in function (#5138)
3 participants