( updater: Updater<TPrevious, TResult> | NonNullableUpdater<TPrevious, TResult>, previous: TPrevious, )
| 202 | * Accepts either a literal value or a function of the previous value. |
| 203 | */ |
| 204 | export function functionalUpdate<TPrevious, TResult = TPrevious>( |
| 205 | updater: Updater<TPrevious, TResult> | NonNullableUpdater<TPrevious, TResult>, |
| 206 | previous: TPrevious, |
| 207 | ): TResult { |
| 208 | if (isFunction(updater)) { |
| 209 | return updater(previous) |
| 210 | } |
| 211 | |
| 212 | return updater |
| 213 | } |
| 214 | |
| 215 | const hasOwn = Object.prototype.hasOwnProperty |
| 216 | const isEnumerable = Object.prototype.propertyIsEnumerable |
no test coverage detected