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
// require Proxy API normalization polyfill because current V8's implementation doesn't support standardized API | |
const Reflect = require('harmony-reflect'); | |
function createProxy (action) { | |
// create the callable proxy | |
function _createCallableProxy (name) { | |
const methodNames = [ name ]; | |
return new Proxy(function () {}, { |
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
// npm install mongodb thunkify-wrap co | |
var mongo = require('mongodb'); | |
var t = require('thunkify-wrap'); | |
var co = require('co'); | |
co(function*(){ | |
var db = yield t(mongo.MongoClient.connect)('mongodb://127.0.0.1:27017/test'); | |
var items = db.collection('items'); | |
// cleanup |