mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -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) {
|
camelize: function(str) {
|
||||||
return str.replace(/-(\w)/g, function(all, chr) {
|
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) {
|
hyphenate: function(str) {
|
||||||
return str.replace(/[a-z][A-Z0-9]|[0-9][a-zA-Z]|[A-Z]{2}[a-z]/g,
|
return str.replace(/[a-z][A-Z0-9]|[0-9][a-zA-Z]|[A-Z]{2}[a-z]/g,
|
||||||
function(match) {
|
function(match) {
|
||||||
|
|
Loading…
Reference in a new issue