try breaking up build-style pipeline into pipeable files

This commit is contained in:
Mike Morris
2014-07-08 18:28:00 -07:00
parent bc30a9b8cd
commit ab36059fda
8 changed files with 106 additions and 121 deletions

26
bin/stringify.js Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env node
'use strict';
var through = require('through2');
var fuzzer = require('fuzzer');
fuzzer.seed(0);
module.exports = function() {
return through.obj(function(chunk, env, callback) {
var json = JSON.parse(chunk.toString());
json.constants = Object.keys(json.constants).reduce(function(obj, key, index) {
var value = json.constants[key];
if (typeof value === 'string') {
obj[key] = fuzzer.mutate.string(value);
}
return obj;
}, {});
var data = JSON.stringify(json);
this.push(data);
callback();
});
};
// if (!module.parent) module.exports().pipe(process.stdout);