Strings
kagd edited this page Jan 10, 2013
·
1 revision
Collection of String methods
Titleize a string
-
str
- string you wish to have titled
Takes a JSON object and convert it to a readable sentence
-
str
- JSON string or plain object -
withKeys
- Boolean - should returned array contains keys
json = {
email: ["must be at least 6 characters", "must contain a number and a letter"]
}
withoutKeys = window.utilityBox.formatJSONErrors(json)
withKeys = window.utilityBox.formatJSONErrors(json, true)
Outputs
withoutKeys: ["email must be at least 6 characters and must contain a number and a letter"]
withKeys: [{email: "email must be at least 6 characters and must contain a number and a letter"}]