houdini/app/javascript/legacy/common/ff-form-validation/lib/readable-prop.es6

13 lines
265 B
Text
Raw Normal View History

2019-11-06 20:36:28 +00:00
// License: LGPL-3.0-or-later
// "email_address" => "email address"
// "emailAddress" => "email address"
module.exports = str =>
str
.replace('_', ' ')
.replace(/([a-z])([A-Z])/g, '$1 $2')
.replace(/\b([A-Z]+)([A-Z])([a-z])/, '$1 $2$3')
.toLowerCase()