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

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

@DTrejo

Description

@DTrejo

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions