- SJ
Hi, this is a small follow-up for #52.
This adds support for objects/classes that provide a custom `toString()` method, matching the shape discussed in the issue. Normal object maps still use the existing key/value handling when the object has the default `Object.prototype.toString`.
I know this may not be the right tradeoff for `clsx`. In my local build, the output changed from 239 -> 277 B for `dist/clsx.mjs`, 245 -> 281 B for `dist/clsx.js`, and 305 -> 340 B for `dist/clsx.min.js`. If that size/perf tradeoff is not desirable, please feel free to close this PR.
I used Node 20.20.2 for tests and bench. On my local Node 22.22.0 setup, the existing `uvu -r esm` test command fails before reaching this change.
## Testing
- `npx -y node@20.20.2 node_modules/.bin/uvu -r esm test` - `npm run build` - `npx -y node@20.20.2 bench`
Refs #52