lukeed / obj-str

A tiny (96B) library for serializing Object values to Strings.
MIT License
249 stars 7 forks source link

ES Version #1

Closed RobinMalfait closed 7 years ago

RobinMalfait commented 7 years ago

What is the minimum version of ES that is required?

Because we can make that even more tiny like this:

export default (obj = {}) => Object.keys(obj).filter(k => obj[k]).join(' ');
lukeed commented 7 years ago

HI, thanks!

I had nearly this exact code at first, but it's much slower (18M op/s vs 4.6M op/s) because of the Object.keys. And, depending on how others configure their compiler, it can inflate to being more bytes anyway.

It's a bummer, huh? 😜

lukeed commented 7 years ago

With Node 8+, this becomes much faster. However, this is limited to actually using Node 8+ or waiting for browsers to adopt the changes.

That said, should you choose to go that route, I would still heavily recommend using @arr/filter.mutate instead of Array.p.filter directly.