String.prototype.format을 common.js로 이동

This commit is contained in:
2018-02-11 00:13:11 +09:00
parent 6052b3c577
commit d49803baed
2 changed files with 12 additions and 7 deletions
+12
View File
@@ -50,6 +50,18 @@ function convertSet(arr) {
return result;
}
/**
* {0}, {1}, {2}형태로 포맷해주는 함수
*/
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return (typeof args[number] != 'undefined') ? args[number] : match;
});
};
/**
* 게임내에서 지원하는 color type만 선택할 수 있도록 해주는 함수
* @param {string} color #AAAAAA 또는 AAAAAA 형태로 작성된 RGB hex color string
-7
View File
@@ -1,11 +1,4 @@
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return (typeof args[number] != 'undefined') ? args[number] : match;
});
};
function reloadWorldMap(option){