Created
March 20, 2018 00:00
-
-
Save Smithx10/c200923cbe7d602e2a82094300d7099d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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