0.0.9 • Published 9 years ago

mystreams v0.0.9

Weekly downloads
8
License
ISC
Repository
github
Last release
9 years ago

MyStreams

npm install mystreams
var { streamAsyncCall, transform, splitArray, enrich, groupBy, splitKeyValue } = require('mystreams');

var git = function(cmd, parsers, cb) {
  //... 
};

streamAsyncCall(
  git, // async function
  `diff-tree --raw -r ${argv.tree1} ${argv.tree2}${argv.filter ? ' -- \'' + argv.filter + '\''  : ''}`, //arg1
  [git.mappers.parseDiffOutput] //arg2
).pipe(
  splitArray()
).pipe(
  enrich(
    [x => !!x.newSha, x => git.getBlob.bind(git, x.newSha), (err, v, x) => (x.newBlob = v, x)],
    [x => !!x.oldSha, x => git.getBlob.bind(git, x.oldSha), (err, v, x) => (x.oldBlob = v, x)]
  )
).pipe(
  // ...
).pipe(
  groupBy(x => x.key, v => v.blob)
).pipe(
  splitKeyValue()
).pipe(
  enrich([ x => true, x => git.makeTree.bind(git, x.value), (err, v, x) => (x.sha = v, x) ])
).pipe(
  groupBy(x => 'root', v => ({name: v.key, type: 'tree', sha: v.sha}))
).pipe(
  enrich([ x => true, x => git.makeTree.bind(git, x.root), (err, v, x) => (x.sha = v, x) ])
).pipe(
  transform(x => x.sha)
).pipe(
  process.stdout
);
0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.1

9 years ago