Last active
December 22, 2015 00:09
-
-
Save nickleefly/6387587 to your computer and use it in GitHub Desktop.
convert package.json into comma first
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
var fs = require('fs'); | |
var o = require('./package'); | |
var rs = require('stream').Readable; | |
var out = JSON.stringify(o, null, 2) | |
.split(/(,\n\s+)/) | |
.map(function (e, i) { | |
return i%2 ? '\n'+e.substring(4)+' ,' : e | |
}) | |
.join(''); | |
rs.pipe = function(dest) { | |
dest.write(out) | |
} | |
rs.pipe(process.stdout) | |
// rs.pipe(fs.createWriteStream('out.json')); |
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
var fs = require('fs'); | |
var o = require('./package'); | |
var Readable = require('stream').Readable; | |
var rs = new Readable; | |
var out = JSON.stringify(o, null, 2) | |
.split(/(,\n\s+)/) | |
.map(function (e, i) { | |
return i%2 ? '\n'+e.substring(4)+' ,' : e | |
}) | |
.join(''); | |
rs.push(out); | |
rs.push(null); | |
rs.pipe(process.stdout) | |
// rs.pipe(fs.createWriteStream('out.json')); |
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
{ | |
"name": "tuple-stream", | |
"version": "0.0.2", | |
"description": "zip together two streams into a single stream with aligned pairwise data", | |
"main": "index.js", | |
"dependencies": { | |
"through": "~2.3.4" | |
}, | |
"devDependencies": { | |
"tape": "~1.0.4", | |
"concat-stream": "~1.0.0", | |
"split": "~0.2.5" | |
}, | |
"scripts": { | |
"test": "tap test/*.js" | |
}, | |
"testling" : { | |
"files" : "test/*.js", | |
"browsers" : { | |
"ie" : [ 6, 7, 8, 9 ], | |
"ff" : [ 3.5, 10, 15.0 ], | |
"chrome" : [ 10, 22 ], | |
"safari" : [ 5.1 ], | |
"opera" : [ 12 ] | |
} | |
}, | |
"repository": { | |
"type": "git", | |
"url": "git://github.com/substack/tuple-stream.git" | |
}, | |
"homepage": "https://github.com/substack/tuple-stream", | |
"keywords": [ | |
"pair", | |
"pairwise", | |
"zip", | |
"stream" | |
], | |
"author": { | |
"name": "James Halliday", | |
"email": "[email protected]", | |
"url": "http://substack.net" | |
}, | |
"license": "MIT" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment