mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Document Base.hyphenate()
This commit is contained in:
parent
bc759274a1
commit
c8f3f3be27
1 changed files with 4 additions and 1 deletions
|
@ -141,7 +141,7 @@ this.Base = Base.inject(/** @lends Base# */{
|
|||
},
|
||||
|
||||
/**
|
||||
* Camelizes the passed string: caps-lock -> capsLock
|
||||
* Camelizes the passed hyphenated string: caps-lock -> capsLock
|
||||
*/
|
||||
camelize: function(str) {
|
||||
return str.replace(/-(\w)/g, function(all, chr) {
|
||||
|
@ -149,6 +149,9 @@ this.Base = Base.inject(/** @lends Base# */{
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Converst camelized strings to hyphenated ones: CapsLock -> caps-lock
|
||||
*/
|
||||
hyphenate: function(str) {
|
||||
return str.replace(/[a-z][A-Z0-9]|[0-9][a-zA-Z]|[A-Z]{2}[a-z]/g,
|
||||
function(match) {
|
||||
|
|
Loading…
Reference in a new issue