Comment

Matthias

Hi there!

Instead of using Number() on both includes-results, you can just use "itemB.labels.includes('foo') - itemA.labels.includes('foo')".

This works because minus will convert both sides to a number anyway before subtracting.

Best regards

Replies

mail@peterbe.com

You're right! I had forgotten about that. I updated the blog post.
Truth be told, I'm not sure it's an improvement because it feels like a quirk whereas casting to a number type feels a bit more "commonstream".