node-replay icon indicating copy to clipboard operation
node-replay copied to clipboard

Empty header, when trimmed of whitespace, causes matching error

Open DTrejo opened this issue 5 years ago • 0 comments

Related: #153

An error where you can't slice on null will happen if your editor trims the whitespace off an empty header, like so:

-x-i-am-an-empty-header: 
+x-i-am-an-empty-header:

Here's the relevant line in catalog.js:

      if (line === '') continue;

      var _line$match$slice = line.match(/^(.*?)\:\s+(.*)$/).slice(1), // ← here
          _line$match$slice2 = (0, _slicedToArray3.default)(_line$match$slice, 2);

Solution(s)

  • [hack] add a space at the end and don't let your editor trim it, and make sure you commit it with git.
  • someone submits a PR to let the regex default to empty string for the second match group

Thanks for Replay!

DTrejo avatar Apr 06 '20 22:04 DTrejo