전체 글
-
자주 쓰는 Javascript 함수 모음Code 2019. 5. 30. 14:08
hyphenate, 하이픈 변환 ;(function(global){ global.hyphenate = function(_value) { // camelCase to hypen pattern, hyphenate(key) var cache = {}; var replacer = function(_match) { return '-' + _match[0].toLowerCase(); }; return cache[_value] || (cache[_value] = _value.replace(/([A-Z])/g, replacer)); } global.round = function(n) { // 소숫점 4자리 return Math.round(n * 10000) / 10000; } global.random = functio..
-