{"version":3,"file":"with-check-new-value-is-not-equal.cjs","sources":["../src/utils/with-check-new-value-is-not-equal.ts"],"sourcesContent":["import { isNil } from 'ramda';\n\nfunction isValueEqual(currentValue: string, newValue: string) {\n  return currentValue === newValue;\n}\n\ntype Event = any;\ntype onChangeEventHandler = (...event: Event[]) => void;\n\nexport function withCheckNewValueIsNotEqual(\n  currentValue: string,\n  isValueEqualFunction: (a: string, b: string) => boolean = isValueEqual,\n) {\n  return (onChange: onChangeEventHandler) => {\n    return (e: Event) => {\n      const newValue = Object.hasOwn(e?.target, 'value') ? e.target.value : e;\n      if (isNil(newValue) && isNil(currentValue)) return;\n      if (isValueEqualFunction(newValue, currentValue)) return;\n      onChange(e);\n    };\n  };\n}\n"],"names":["isValueEqual","currentValue","newValue","withCheckNewValueIsNotEqual","isValueEqualFunction","onChange","e","isNil"],"mappings":"0JAEA,SAASA,EAAaC,EAAsBC,EAAkB,CAC5D,OAAOD,IAAiBC,CAC1B,CAKgB,SAAAC,EACdF,EACAG,EAA0DJ,EAC1D,CACA,OAAQK,GACEC,GAAa,CACb,MAAAJ,EAAW,OAAO,OAAOI,GAAA,YAAAA,EAAG,OAAQ,OAAO,EAAIA,EAAE,OAAO,MAAQA,EAClEC,QAAML,CAAQ,GAAKK,EAAAA,MAAMN,CAAY,GACrCG,EAAqBF,EAAUD,CAAY,GAC/CI,EAASC,CAAC,CAAA,CAGhB"}