es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
14 lines (13 loc) • 396 B
JavaScript
//#region src/compat/_internal/normalizeZero.ts
/**
* Normalizes `-0` to `0` to match Lodash, which normalizes `-0` to `+0` in the
* results of functions like `uniq`, `union`, and `difference`.
*
* @param value - The value to normalize.
* @returns The value with `-0` normalized to `0`.
*/
function normalizeZero(value) {
return value === 0 ? 0 : value;
}
//#endregion
export { normalizeZero };