sodiray / radash

Functional utility library - modern, simple, typed, powerful
https://radash-docs.vercel.app
MIT License
4.18k stars 167 forks source link

Incorrect Return Value for `isEmpty(new Error())` #333

Open Petri-Oosthuizen opened 1 year ago

Petri-Oosthuizen commented 1 year ago

I encountered unexpected behavior with the isEmpty function. The expected result when calling isEmpty(new Error("Error")) is false. However, it is currently returning true.

radash version: 11.0.0 node version: v18.15.0

Reproducible code:

import { isEmpty } from "radash";

console.log(isEmpty(new Error("Error")));

Cause: An Error does not have enumerable keys which means that Object.keys(value).length from typed.ts returns 0.

Possible solutions: