* 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)
| 3893 | * @returns {boolean|Array} |
| 3894 | */ |
| 3895 | changed(key, value) { |
| 3896 | if (key === undefined) { |
| 3897 | if (this._changed.size > 0) { |
| 3898 | return Array.from(this._changed); |
| 3899 | } |
| 3900 | return false; |
| 3901 | } |
| 3902 | if (value === true) { |
| 3903 | this._changed.add(key); |
| 3904 | return this; |
| 3905 | } |
| 3906 | if (value === false) { |
| 3907 | this._changed.delete(key); |
| 3908 | return this; |
| 3909 | } |
| 3910 | return this._changed.has(key); |
| 3911 | } |
| 3912 | |
| 3913 | /** |
| 3914 | * Returns the previous value for key from `_previousDataValues`. |
no test coverage detected