* If changed is called with a string it will return a boolean indicating whether the value of that key in `dataValues` is different from the value in `_previousDataValues`. * * If changed is called without an argument, it will return an array of keys that have changed. * * If changed is
(key, value)
| 3767 | * @returns {boolean|Array} |
| 3768 | */ |
| 3769 | changed(key, value) { |
| 3770 | if (key === undefined) { |
| 3771 | if (this._changed.size > 0) { |
| 3772 | return Array.from(this._changed); |
| 3773 | } |
| 3774 | return false; |
| 3775 | } |
| 3776 | if (value === true) { |
| 3777 | this._changed.add(key); |
| 3778 | return this; |
| 3779 | } |
| 3780 | if (value === false) { |
| 3781 | this._changed.delete(key); |
| 3782 | return this; |
| 3783 | } |
| 3784 | return this._changed.has(key); |
| 3785 | } |
| 3786 | |
| 3787 | /** |
| 3788 | * Returns the previous value for key from `_previousDataValues`. |
no test coverage detected