I'd like to use the $parser module of Angular inside an open source library I'm maintaining. The library is a templating engine for .docx . I would like to benefit from the filtering functionality, and also the parser in general (+ operations, dot syntax)
What would be the best way to have access to the module. given that my library should work in NodeJS?
I can already specify a parser like this:
doc.parser=function(expression) {
return {get:function(scope) {return scope[expression].toUpperCase() }
}
The parser first param is the expression you would like to parse (for example user.name), it returns an object with a get function that you can call, in the same philosophy as the $parser module. The parser I create for now is just a demo parser that shows that you can UPPERCASE all the values of the expression.
I'm seeking for a way to say: doc.parser=$parser(), or something like this, and that should work in NodeJS and in the browser.
I found that file: https://raw.githubusercontent.com/angular/angular.js/master/src/ng/parse.js that is responsible for the parsing, but it needs the $filter module, ...