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.

readme.markdown 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Split (matcher)
  2. [![build status](https://secure.travis-ci.org/dominictarr/split.png)](http://travis-ci.org/dominictarr/split)
  3. Break up a stream and reassemble it so that each line is a chunk. matcher may be a `String`, or a `RegExp`
  4. Example, read every line in a file ...
  5. ``` js
  6. fs.createReadStream(file)
  7. .pipe(split())
  8. .on('data', function (line) {
  9. //each chunk now is a seperate line!
  10. })
  11. ```
  12. `split` takes the same arguments as `string.split` except it defaults to '/\r?\n/' instead of ',', and the optional `limit` paremeter is ignored.
  13. [String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split)
  14. `split` takes an optional options object on it's third argument.
  15. ``` js
  16. split(matcher, mapper, options)
  17. ```
  18. Valid options:
  19. * maxLength - The maximum buffer length without seeing a newline or `matcher`,
  20. if a single line exceeds this, the split stream will emit an error.
  21. ``` js
  22. split(JSON.parse, null, { maxLength: 2})
  23. ```
  24. ## keep matched splitter
  25. As with `Array#split`, if you split by a regular expression with a matching group,
  26. the matches will be retained in the collection.
  27. ```
  28. stdin
  29. .pipe(split(/(\r?\n)/))
  30. ... //lines + separators.
  31. ```
  32. # NDJ - Newline Delimited Json
  33. `split` accepts a function which transforms each line.
  34. ``` js
  35. fs.createReadStream(file)
  36. .pipe(split(JSON.parse))
  37. .on('data', function (obj) {
  38. //each chunk now is a a js object
  39. })
  40. .on('error', function (err) {
  41. //syntax errors will land here
  42. //note, this ends the stream.
  43. })
  44. ```
  45. # License
  46. MIT