Hello,
i've created a module named 'missmatch'. It allows to match arbitrarily nested JavaScript values against patterns and bind values in those patterns to variables (which can be used in a handler function). It's inspired by the built-in pattern matching of languages like Haskell or OCaml. It's written purely in JavaScript and can be used with node.js or in a browser. The pattern compiler does not use eval (or the Function constructor).
It exports three functions, match, matchJSON and compile (which lets you compile a pattern to a matching-function). There is a README and some usage examples on the repo:
It can be installed with:
npm install missmatch
(optional) npm test missmatch
Hope someone finds this useful :)
Regards,
Peter
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en