"use strict"
Object.defineProperty(exports, "__esModule", { value: true })
exports.modifySome = void 0
const Option_1 = require("../Option")
const modify_1 = require("./modify")
/**
 * Atomically modifies the `FiberRef` with the specified partial function, which computes
 * a return value for the modification if the function is defined in the current value
 * otherwise it returns a default value.
 * This is a more powerful version of `updateSome`.
 */
function modifySome(defaultValue) {
  return (f) =>
    (0, modify_1.modify)((v) =>
      (0, Option_1.getOrElse_)(f(v), () => [defaultValue(), v])
    )
}
exports.modifySome = modifySome
//# sourceMappingURL=modifySome.js.map
