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:
Check for an Error type explicitly
Consider using Object.getOwnPropertyNames instead and adding an additional check for arrays (array.length is nonenumerable).
I encountered unexpected behavior with the
isEmpty
function. The expected result when callingisEmpty(new Error("Error"))
isfalse
. However, it is currently returning true.radash version: 11.0.0 node version: v18.15.0
Reproducible code:
Cause: An
Error
does not have enumerable keys which means thatObject.keys(value).length
from typed.ts returns 0.Possible solutions:
Error
type explicitly