Skip to content

Instantly share code, notes, and snippets.

@Smithx10
Created March 20, 2018 00:00
Show Gist options
  • Save Smithx10/c200923cbe7d602e2a82094300d7099d to your computer and use it in GitHub Desktop.
Save Smithx10/c200923cbe7d602e2a82094300d7099d to your computer and use it in GitHub Desktop.
function
Recipes()
{
this.recipes = {};
}
Recipes.prototype.getRecipe(name) = function
getRecipe(name)
{
if (this.recipes[name] === undefined) {
var err = new Error('recipe "' + name + '" not found');
err.reason = 'NOT_FOUND';
return (err);
}
return (this.recipes[name]);
};
Recipes.prototype.createRecipe = function
createRecipe(name, size)
{
var recipe = this.getRecipe(name);
if (recipe instanceof Error) {
/*
* XXX Use the error condition somehow.
*/
return;
}
/*
* XXX Do work on "recipe"...
*/
};
// async
function
Recipes()
{
this.recipes = {};
}
Recipes.prototype.getRecipe(name) = function
getRecipe(name)
{
if (this.recipes[name] === undefined) {
var err = new Error('recipe "' + name + '" not found');
err.reason = 'NOT_FOUND';
return (err);
}
return (this.recipes[name]);
};
Recipes.prototype.createRecipe = function
createRecipe(name, size)
{
var recipe = this.getRecipe(name);
if (recipe instanceof Error) {
/*
* XXX Use the error condition somehow.
*/
return;
}
/*
* XXX Do work on "recipe"...
*/
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment