Skip to content

Instantly share code, notes, and snippets.



Last active Nov 29, 2015
What would you like to do?
pamatcher demo

pamatcher is a pattern matching library for JavaScript iterators. Example of use in browser.

<!DOCTYPE html>
<meta charset="utf-8">
<title>pamatcher demo</title>
<script src=""></script>
<script type="text/javascript">
System.import('npm:pamatcher').then(function(pamatcher) {
var matcher = pamatcher(
(i) => i < 10,
{ repeat: (i) => i%2==0 },
(i) => i > 10
var result = matcher.test([1, 4, 8, 44, 55]);
if(result) {
document.write("Pattern matches!");
} else {
document.write("Pattern doesn't match.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.