Skip to content

Conversation

staltz
Copy link
Contributor

@staltz staltz commented May 3, 2021

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

I tested and deployed this change in staltz/strip-markdown-oneline@347709e too

Closes #5

@wooorm
Copy link
Member

wooorm commented May 3, 2021

See #5 (comment).

But if this was causing an exception, then I do think unknown nodes (such as break) should be ignored and handled gracefully

@staltz
Copy link
Contributor Author

staltz commented May 3, 2021

Perhaps this PR could be generalized so that nodes that don't have the required fields would be ignored.

@wooorm
Copy link
Member

wooorm commented May 3, 2021

Yeah. I think if you do:

children = ('length' in node ? node : node.children) || []

on what was L28 that’d work fine?

@wooorm
Copy link
Member

wooorm commented May 3, 2021

And a test of the form:

t.equal(toString(u('foo')), '', 'should support voids')

@staltz
Copy link
Contributor Author

staltz commented May 4, 2021

Good morning @wooorm! I updated this PR according to your suggestions :)

@wooorm wooorm changed the title Handle nodes of type break Fix support for void nodes May 4, 2021
@wooorm wooorm merged commit 37c315f into syntax-tree:main May 4, 2021
@wooorm wooorm added the 💪 phase/solved Post is done label May 4, 2021
@wooorm
Copy link
Member

wooorm commented May 4, 2021

Good morning André! 🌞 Thanks, released in 3.0.1!

@staltz staltz deleted the patch-1 branch May 4, 2021 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 phase/solved Post is done

Development

Successfully merging this pull request may close these issues.

"break" nodes not handled and cause a TypeError exception

2 participants