]> gerrit.simantics Code Review - simantics/district.git/blobdiff - 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
diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/init-package-json/test/lib/common.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/init-package-json/test/lib/common.js
new file mode 100644 (file)
index 0000000..de45089
--- /dev/null
@@ -0,0 +1,24 @@
+module.exports.drive = drive
+
+var semver = require('semver')
+
+function drive (input) {
+  var stdin = process.stdin
+  function emit (chunk, ms) {
+    setTimeout(function () {
+      stdin.emit('data', chunk)
+    }, ms)
+  }
+  if (semver.gte(process.versions.node, '0.11.0')) {
+    input.forEach(function (chunk) {
+      stdin.push(chunk)
+    })
+  } else {
+    stdin.once('readable', function () {
+      var ms = 0
+      input.forEach(function (chunk) {
+        emit(chunk, ms += 50)
+      })
+    })
+  }
+}