Check whether the value of a Dinero object is zero.
Copy linkParameters
Name | Type | Description | Required |
---|---|---|---|
dineroObject | Dinero<TAmount> | The Dinero object to check. | Yes |
Copy linkCode examples
Copy linkCheck a zero object
import { dinero, isZero } from 'dinero.js';
import { USD } from '@dinero.js/currencies';
const d = dinero({ amount: 0, currency: USD });
isZero(d); // true
Copy linkCheck a non-zero object
import { dinero, isZero } from 'dinero.js';
import { USD } from '@dinero.js/currencies';
const d = dinero({ amount: 100, currency: USD });
isZero(d); // false