"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateSomeAndGet = void 0;
const Option_1 = require("../Option");
const modify_1 = require("./modify");
/**
 * Atomically modifies the `FiberRef` with the specified partial function.
 * If the function is undefined on the current value it returns the old value
 * without changing it.
 */
function updateSomeAndGet(f) {
    return (0, modify_1.modify)((v) => {
        const result = (0, Option_1.getOrElse_)(f(v), () => v);
        return [result, result];
    });
}
exports.updateSomeAndGet = updateSomeAndGet;
//# sourceMappingURL=updateSomeAndGet.js.map