Skip to content

Commit

Permalink
fix: 添加 toDash 实用工具
Browse files Browse the repository at this point in the history
  • Loading branch information
cncolder committed Apr 24, 2020
1 parent ed72bf5 commit e971321
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export * from './react-vtree'
export * from './react-spring'
export * from './react-use-gesture'

export * from './react-window'
export * from './react-vtree'
9 changes: 9 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@ export function uuid(len = 8, radix = 16): string {

return value.join('')
}

/**
* 替换 camelCase 为 dashedCase.
*
* @see https://github.com/NervJS/taro/blob/next/packages/shared/src/utils.ts
*/
export function toDashed(s: string) {
return s.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()
}

0 comments on commit e971321

Please sign in to comment.