]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/init-package-json/test/lib/common.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / init-package-json / test / lib / common.js
1 module.exports.drive = drive
2
3 var semver = require('semver')
4
5 function drive (input) {
6   var stdin = process.stdin
7   function emit (chunk, ms) {
8     setTimeout(function () {
9       stdin.emit('data', chunk)
10     }, ms)
11   }
12   if (semver.gte(process.versions.node, '0.11.0')) {
13     input.forEach(function (chunk) {
14       stdin.push(chunk)
15     })
16   } else {
17     stdin.once('readable', function () {
18       var ms = 0
19       input.forEach(function (chunk) {
20         emit(chunk, ms += 50)
21       })
22     })
23   }
24 }