Skip to content

Commit

Permalink
Reduce changes introduced
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronccasanova committed Apr 15, 2022
1 parent 568fbd9 commit 1757415
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import Shadows from './props.shadows.js'
import SVG from './props.svg.js'
import Zindex from './props.zindex.js'

const camelCase = (text) => {
text = text.replace(/[-]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))
const camelize = text => {
text = text.replace(/[-]+(.)?/g, (_, c) => c
? c.toUpperCase()
: '')
return text.substr(0, 1).toLowerCase() + text.substr(1)
}

Expand All @@ -22,7 +24,8 @@ const camelCase = (text) => {
* @returns {import("type-fest").CamelCasedPropertiesDeep<T>}
*/
const keysToCamelCase = (props) => {
for (var prop in props) props[camelCase(prop)] = props[prop]
for (var prop in props)
props[camelize(prop)] = props[prop]
return props
}

Expand Down

0 comments on commit 1757415

Please sign in to comment.