CondJS
cond
is hosted at Github. mona
is a
public domain work, dedicated using
CC0 1.0. Feel free to do
whatever you want with it.
Quickstart
Install
$ npm install cond
or
$ bower install cond
Example
Execute the following in a browser session, with developer tools open, and follow the instructions:
var availableFlavors = "chocolate" "vanilla" "mint chocolate chip"; { if availableFlavors !== -1 return flavor + " ice cream ゲットー!"; else // Just like throw new Error("something"), but we provide a way // the user can recover from it. return cond; } console;console; // In the console, do: // > showRecoveries();// > recover(0, "chocolate"); // You can also access recoveries programmatically:console;
Introduction
cond
is a JavaScript implementation of
Common Lisp's condition system,
a system for handling errors and other conditions of interest that handles
signals at the call site, before the stack is unwound -- allowing you to repair
or alter what happens at the callsite, and continuing executing as if nothing
had been signaled/thrown.