Last active
March 28, 2016 18:17
-
-
Save bcomnes/e7d30edee5a530b5e997 to your computer and use it in GitHub Desktop.
mafintosh patterns
This file contains hidden or 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
| // Optional options followed by callback | |
| Hyperlog.prototype.get = function (key, opts, cb) { | |
| if (!opts) opts = {} | |
| if (typeof opts === 'function') { | |
| cb = opts | |
| opts = {} | |
| } | |
| var self = this | |
| } | |
This file contains hidden or 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
| // Optional options | |
| // `new` keyword safetey | |
| var Hyperlog = function (db, opts) { | |
| if (!(this instanceof Hyperlog)) return new Hyperlog(db, opts) | |
| if (!opts) opts = {} | |
| } |
This file contains hidden or 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
| @mafintosh │ JSON_voorhees: i put in env.USERPROFILE + .conf.rc on win |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Modular testing patterns:
https://github.com/maxogden/dat/tree/e4bba923b18f5092ec46d58dd645d853836264f5/test
https://github.com/maxogden/dat/blob/e4bba923b18f5092ec46d58dd645d853836264f5/test/run.js