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] make custom function easier #1981

Merged
merged 2 commits into from
Apr 2, 2020
Merged

[Port] make custom function easier #1981

merged 2 commits into from
Apr 2, 2020

Conversation

cosmicshuai
Copy link
Contributor

Fixes #1931

Make customized function in LG and expression easier by accepting just a lambda.

At the cost of expose FunctionTable instead of a generic IDictionary.

Now you can do

Expression.functions.add('contoso.sqrt', (args) => {
            let result = null;
            if (args[0] !== undefined ) {
                const inputFloat = parseFloat(args[0]);
                result = Math.sqrt(inputFloat);
            }

            return result;
        });

to add a new function

@coveralls
Copy link

coveralls commented Apr 2, 2020

Pull Request Test Coverage Report for Build 117193

  • 19 of 36 (52.78%) changed or added relevant lines in 3 files are covered.
  • 9 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.03%) to 81.55%

Changes Missing Coverage Covered Lines Changed/Added Lines %
libraries/adaptive-expressions/src/functionTable.ts 16 33 48.48%
Files with Coverage Reduction New Missed Lines %
libraries/botframework-streaming/src/webSocket/webSocketTransport.ts 2 80.65%
libraries/botframework-streaming/src/webSocket/webSocketServer.ts 7 66.67%
Totals Coverage Status
Change from base Build 117144: -0.03%
Covered Lines: 9344
Relevant Lines: 11040

💛 - Coveralls

@boydc2014 boydc2014 merged commit 83aea86 into master Apr 2, 2020
@boydc2014 boydc2014 deleted the shuwan/lg-customFunc branch April 2, 2020 13:53
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] make custom function easier
4 participants