{"version":3,"sources":["../src/stringStartsWith.js"],"names":["stringStartsWithValidator","start","length","TypeError","validator","stringStartsWith","props","propName","componentName","propValue","rest","stringError","string","startsWith","isRequired","requiredStringStartsWith"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEe,SAASA,yBAAT,CAAmCC,KAAnC,EAA0C;AACvD,MAAI,OAAOA,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,CAACC,MAAN,KAAiB,CAAlD,EAAqD;AACnD,UAAM,IAAIC,SAAJ,CAAc,gCAAd,CAAN;AACD;;AAED,MAAMC,SAAS,GAAG,SAASC,gBAAT,CAA0BC,KAA1B,EAAiCC,QAAjC,EAA2CC,aAA3C,EAAmE;AAAA,QAC/DC,SAD+D,GACjDH,KADiD,CAC1EC,QAD0E;;AAGnF,QAAIE,SAAS,IAAI,IAAjB,EAAuB;AACrB,aAAO,IAAP;AACD;;AALkF,sCAANC,IAAM;AAANA,MAAAA,IAAM;AAAA;;AAOnF,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,UAAV,CAAqBZ,KAArB,CAAD,IAAgCQ,SAAS,CAACP,MAAV,IAAoBD,KAAK,CAACC,MAA9D,EAAsE;AACpE,aAAO,IAAIC,SAAJ,WAAiBK,aAAjB,eAAmCD,QAAnC,oCAAoEN,KAApE,QAAP;AACD;;AACD,WAAO,IAAP;AACD,GAhBD;;AAkBAG,EAAAA,SAAS,CAACU,UAAV,GAAuB,SAASC,wBAAT,GAA2C;AAChE,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,8BAA8CH,KAA9C,EAAP;AACD","sourcesContent":["import { string } from 'prop-types';\nimport wrapValidator from './helpers/wrapValidator';\n\nexport default function stringStartsWithValidator(start) {\n if (typeof start !== 'string' || start.length === 0) {\n throw new TypeError('a non-empty string is required');\n }\n\n const validator = function stringStartsWith(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.startsWith(start) || propValue.length <= start.length) {\n return new TypeError(`${componentName}: ${propName} does not start with \"${start}\"`);\n }\n return null;\n };\n\n validator.isRequired = function requiredStringStartsWith(...args) {\n const stringError = string.isRequired(...args);\n if (stringError) {\n return stringError;\n }\n return validator(...args);\n };\n\n return wrapValidator(validator, `stringStartsWith: ${start}`);\n}\n"],"file":"stringStartsWith.js"}