Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Empty header, when trimmed of whitespace, causes matching error #172

Open
DTrejo opened this issue Apr 6, 2020 · 0 comments
Open

Empty header, when trimmed of whitespace, causes matching error #172

DTrejo opened this issue Apr 6, 2020 · 0 comments

Comments

@DTrejo
Copy link

DTrejo commented Apr 6, 2020

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant