You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varValueTransformer=function(){this.displayName="String Case Transformer.";this.shortDescription="Change case of text to ALLCAPITALS,lowercase, Capitalize, trim white space and substring.";this.isEditingDisabled=true;this.infoUrl="https://github.com/SmartJSONEditor/PublicDocuments/wiki/ValueTransformer-StringTransforms";this.parameters=function(){varpopupDefaultValue=[{displayName: "UpperCase",value: "UpperCase"},{displayName: "LowerCase",value: "LowerCase"},{displayName: "Capitalize",value: "Capitalize"},{displayName: "Trim White Space",value: "TrimWhiteSpace"},{displayName: "Substring From Index",value: "SubstringFrom"},{displayName: "Substring To Index",value: "SubstringTo"},];vartypeUIParam={name: "type",type: "Popup",displayName: "Modification Type",description: "Select modification type.",defaultValue: popupDefaultValue};varindexUIParam={type: "Number",name: "index",displayName: "Index",description: "Define from or to index.",defaultValue: 0};return[typeUIParam,indexUIParam];}this.transform=function(inputValue,jsonValue,arrayIndex,parameters,info){vartype=(Array.isArray(parameters.type)==true) ? "UpperCase" : parameters.type;varsliceIndex=(parameters.index===undefined) ? 0 : parameters.index;varvalue=inputValue;if(type=="UpperCase"){value=inputValue.toUpperCase();}if(type=="LowerCase"){value=inputValue.toLowerCase();}if(type=="Capitalize"){vartemp=inputValue;temp=temp.replace(/\b\w/g,function(l){returnl.toUpperCase()});value=temp;}if(type=="TrimWhiteSpace"){value=inputValue.trim();}if(type=="SubstringFrom"){value=inputValue.slice(sliceIndex);}if(type=="SubstringTo"){value=inputValue.slice(0,sliceIndex);}returnvalue;};this.capitalizeFirstLetter=function(string){vartemp=string.trim();temp=temp.charAt(0).toUpperCase()+temp.slice(1);returntemp;}this.randomArrayIndex=function(count){returnMath.floor(Math.random()*count);}}functionsjeClass(){returnnewValueTransformer();}