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

Weird constraint parser error #152

Open
Azuri opened this issue Apr 8, 2015 · 1 comment
Open

Weird constraint parser error #152

Azuri opened this issue Apr 8, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@Azuri
Copy link

Azuri commented Apr 8, 2015

var flow = require('nools').flow('flow', function(flow){
   flow.rule('rule', { scope:{ Math:Math } }, [Number, 'n', 'Math.floor(n*n) > 10'], function(facts){
       //...
   });
});

flow.getSession(Math.PI).match().then(function(){ });

Throws

Error: Invalid expression 'Math.floor(n*n) > 10'    
@DevSide
Copy link
Collaborator

DevSide commented Oct 3, 2016

You're right, there is a problem here.

Until this gets done, programmatically with a custom constraint, you can do:

[Number, 'n', function(facts){
  return Math.floor( facts.n *  facts.n) > 10
}]

@DevSide DevSide added the bug label Oct 4, 2016
@DevSide DevSide added this to the v0.4.3 milestone Oct 5, 2016
@DevSide DevSide self-assigned this Oct 6, 2016
@DevSide DevSide modified the milestones: v0.5.0, v0.4.3 Oct 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants