{"version":3,"sources":["../src/stringEndsWith.js"],"names":["stringEndsWithValidator","end","length","TypeError","validator","stringEndsWith","props","propName","componentName","propValue","rest","stringError","string","endsWith","isRequired","requiredStringEndsWith"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEe,SAASA,uBAAT,CAAiCC,GAAjC,EAAsC;AACnD,MAAI,OAAOA,GAAP,KAAe,QAAf,IAA2BA,GAAG,CAACC,MAAJ,KAAe,CAA9C,EAAiD;AAC/C,UAAM,IAAIC,SAAJ,CAAc,gCAAd,CAAN;AACD;;AAED,MAAMC,SAAS,GAAG,SAASC,cAAT,CAAwBC,KAAxB,EAA+BC,QAA/B,EAAyCC,aAAzC,EAAiE;AAAA,QAC7DC,SAD6D,GAC/CH,KAD+C,CACxEC,QADwE;;AAGjF,QAAIE,SAAS,IAAI,IAAjB,EAAuB;AACrB,aAAO,IAAP;AACD;;AALgF,sCAANC,IAAM;AAANA,MAAAA,IAAM;AAAA;;AAOjF,QAAMC,WAAW,GAAGC,iCAAON,KAAP,EAAcC,QAAd,EAAwBC,aAAxB,SAA0CE,IAA1C,EAApB;;AACA,QAAIC,WAAJ,EAAiB;AACf,aAAOA,WAAP;AACD;;AAED,QAAI,CAACF,SAAS,CAACI,QAAV,CAAmBZ,GAAnB,CAAD,IAA4BQ,SAAS,CAACP,MAAV,IAAoBD,GAAG,CAACC,MAAxD,EAAgE;AAC9D,aAAO,IAAIC,SAAJ,WAAiBK,aAAjB,eAAmCD,QAAnC,kCAAkEN,GAAlE,QAAP;AACD;;AACD,WAAO,IAAP;AACD,GAhBD;;AAkBAG,EAAAA,SAAS,CAACU,UAAV,GAAuB,SAASC,sBAAT,GAAyC;AAC9D,QAAMJ,WAAW,GAAGC,kBAAOE,UAAP,oCAApB;;AACA,QAAIH,WAAJ,EAAiB;AACf,aAAOA,WAAP;AACD;;AACD,WAAOP,SAAS,MAAT,mBAAP;AACD,GAND;;AAQA,SAAO,+BAAcA,SAAd,4BAA4CH,GAA5C,EAAP;AACD","sourcesContent":["import { string } from 'prop-types';\nimport wrapValidator from './helpers/wrapValidator';\n\nexport default function stringEndsWithValidator(end) {\n if (typeof end !== 'string' || end.length === 0) {\n throw new TypeError('a non-empty string is required');\n }\n\n const validator = function stringEndsWith(props, propName, componentName, ...rest) {\n const { [propName]: propValue } = props;\n\n if (propValue == null) {\n return null;\n }\n\n const stringError = string(props, propName, componentName, ...rest);\n if (stringError) {\n return stringError;\n }\n\n if (!propValue.endsWith(end) || propValue.length <= end.length) {\n return new TypeError(`${componentName}: ${propName} does not end with \"${end}\"`);\n }\n return null;\n };\n\n validator.isRequired = function requiredStringEndsWith(...args) {\n const stringError = string.isRequired(...args);\n if (stringError) {\n return stringError;\n }\n return validator(...args);\n };\n\n return wrapValidator(validator, `stringEndsWith: ${end}`);\n}\n"],"file":"stringEndsWith.js"}