This code is a fleshed-out version of the example [here][flux-docs]. Make sure to build Flux before running this example:
cd node_modules/flux
npm install
cd ../..
npm start
# For MacOS: | |
.DS_Store | |
# For TextMate | |
*.tmproj | |
tmtags | |
.tm_properties | |
# For emacs: | |
*~ |
> winston-mongodb@0.4.3 test /Users/leroy/repos/git/winston-mongodb | |
> vows test/*-test.js --spec | |
♢ winston-mongodb | |
An instance of the MongoDB Transport when passed valid options | |
✓ should have the proper methods defined | |
An instance of the MongoDB Transport the log() method when passed primitive metadata |
'use strict'; | |
var assert = require('assert'); | |
var fs = require('fs'); | |
var crypto = require('crypto'); | |
var stream = require('stream'); | |
var littleSha = crypto.createHash('sha256'); | |
var message = new Buffer('this is a small message'); |
'use strict'; | |
var crypto = require('crypto'); | |
var stream = require('stream'); | |
function radixId (radix, callback) { | |
crypto.randomBytes(4, function (err, buf) { | |
if (err) { return callback(err); } | |
try { |
body { padding-top: 70px; } |
# Prompt colors | |
RESET_COLOR="\[\e[0m\]" | |
RED="\[\e[31m\]" | |
GREEN="\[\e[32m\]" | |
YELLOW="\[\e[33m\]" | |
BLUE="\[\e[34m\]" | |
MAGENTA="\[\e[35m\]" | |
CYAN="\[\e[36m\]" | |
WHITE="\[\e[37m\]" | |
BOLD_GRAY="\[\e[30;1m\]" |
// `replaceTokens` is a modification of Crockford's `String.prototype.supplant` | |
// which takes works on an object/array (if given as the second argument) | |
// or a variable number of replacements. | |
module.exports = function replaceTokens (tmpl/*, replacements... */) { | |
var args = [].slice.call(arguments, 1); | |
if (args[0] != null && (Array.isArray(args[0]) || typeof args[0] === 'object')) { | |
args = args[0]; | |
} | |
return tmpl.replace(/\{([^{}]*)\}/g, function (match, index) { | |
var result = args[index]; |
'use strict'; | |
var fs = require('fs'); | |
var os = require('os'); | |
var vm = require('vm'); | |
var marked = require('marked'); | |
var argv = require('minimist')(process.argv.slice(2)); | |
var usage = function () { | |
var helpText = [ |
'use strict'; | |
var Promise = require('es6-promise'); | |
// See http://www.html5rocks.com/en/tutorials/es6/promises/ | |
module.exports = function sequencePromises (promises, transformFn) { | |
function identity (x) { return x; } | |
return promises.reduce(function (sequence, promise) { | |
return sequence.then(function () { | |
return promise; |