2023-01-03 18:51:35 +00:00
|
|
|
import { identity } from "remeda";
|
|
|
|
|
|
|
|
import ifElse from "./ifElse.js";
|
|
|
|
import wrap from "./wrap.js";
|
|
|
|
|
2023-01-03 19:31:53 +00:00
|
|
|
export interface If {
|
2023-01-03 18:51:35 +00:00
|
|
|
(object, predicate, trueUpdates): unknown;
|
|
|
|
(predicate, trueUpdates): (unknown) => unknown;
|
|
|
|
}
|
|
|
|
|
|
|
|
function _if(object, predicate, trueUpdates) {
|
|
|
|
return ifElse(object, predicate, trueUpdates, identity);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default wrap(_if) as If;
|