import { must } from "../../../shared/src/must.js";
function isMutatorDefinition(f) {
  return typeof f === "object" && f !== null && f["~"] === "MutatorDefinition";
}
function defineMutator(validatorOrMutator, mutator) {
  let validator;
  let actualMutator;
  if ("~standard" in validatorOrMutator) {
    validator = validatorOrMutator;
    actualMutator = must(mutator);
  } else {
    validator = void 0;
    actualMutator = validatorOrMutator;
  }
  const mutatorDefinition = {
    "fn": actualMutator,
    "validator": validator,
    "~": "MutatorDefinition"
  };
  return mutatorDefinition;
}
function defineMutatorWithType() {
  return defineMutator;
}
function isMutator(value) {
  return typeof value === "function" && typeof value.mutatorName === "string" && typeof value.fn === "function";
}
export {
  defineMutator,
  defineMutatorWithType,
  isMutator,
  isMutatorDefinition
};
//# sourceMappingURL=mutator.js.map
