Last active
December 11, 2015 01:08
-
-
Save calvinmetcalf/4520785 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
add: (doc, cb = ()-> true) -> | |
unless "_id" of doc | |
@db.post doc, cb | |
else if "_id" of doc and doc._id.slice(0,8) != "_design/" | |
@db.put doc, cb | |
else if doc.length | |
@db.bulkDocs doc, cb | |
get: (id, cb = ()-> true) -> | |
@db.get id, cb | |
remove: (id, cb = ()-> true) -> | |
@get id, (err, doc) => | |
@db.remove doc, cb unless err | |
cb("err") if err |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment