Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 912B

123456789101112131415161718192021222324252627282930313233343536373839
  1. var duplexer = require('duplexer')
  2. module.exports = function () {
  3. var streams = [].slice.call(arguments)
  4. , first = streams[0]
  5. , last = streams[streams.length - 1]
  6. , thepipe = duplexer(first, last)
  7. if(streams.length == 1)
  8. return streams[0]
  9. else if (!streams.length)
  10. throw new Error('connect called with empty args')
  11. //pipe all the streams together
  12. function recurse (streams) {
  13. if(streams.length < 2)
  14. return
  15. streams[0].pipe(streams[1])
  16. recurse(streams.slice(1))
  17. }
  18. recurse(streams)
  19. function onerror () {
  20. var args = [].slice.call(arguments)
  21. args.unshift('error')
  22. thepipe.emit.apply(thepipe, args)
  23. }
  24. //es.duplex already reemits the error from the first and last stream.
  25. //add a listener for the inner streams in the pipeline.
  26. for(var i = 1; i < streams.length - 1; i ++)
  27. streams[i].on('error', onerror)
  28. return thepipe
  29. }