Skip to content

Instantly share code, notes, and snippets.



Forked from Hanspagh/async.js
Last active Aug 27, 2015
What would you like to do?
function findOrCreate(id) {
return Promise.try(function() {
return db.find(id);
}).then(function(result) {
if (result == null) {
return db.create(id);
} else {
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment