diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-11-24 20:57:41 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-11-24 20:57:41 -0500 |
| commit | 612561818f907f0f9988247c82ec158ba4494986 (patch) | |
| tree | 8bbc773dad7a6364cbdb8aed2ef4cab04854f49a /StoneIsland/platforms/ios/www/js/vendor/util.js | |
| parent | d548a7d02ce6349ca9a820b6824e4374b759812b (diff) | |
build
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/vendor/util.js')
| -rw-r--r-- | StoneIsland/platforms/ios/www/js/vendor/util.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/StoneIsland/platforms/ios/www/js/vendor/util.js b/StoneIsland/platforms/ios/www/js/vendor/util.js index 8a58a84c..23f55d4c 100644 --- a/StoneIsland/platforms/ios/www/js/vendor/util.js +++ b/StoneIsland/platforms/ios/www/js/vendor/util.js @@ -24,6 +24,17 @@ function rgba_string (rgb,a) { return "rgba(" + rgb.map(Math.round).join(",") + function hex_string (rgb) { return "#" + rgb.map(Math.round).map(function(n){ var s = n.toString(16); return s.length == 1 ? "0"+s : s }).join("") } function parse_rgba_string (s) { return s.match(/(\d+)/g).slice(0,3) } +function title_case (str) { + return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); +} +function pluralize (n,s,ss) { return n + " " + s + ( n == 1 ? "" : (ss || "s") ) } +function as_cash(n){ + var cents = ((n*100) % 100); + if (cents < 10) { cents = "0" + (cents|0) } + else { cents = cents|0 } + return "$" + (n|0) + "." + cents +} + var E = Math.E var PI = Math.PI var PHI = (1+Math.sqrt(5))/2 @@ -41,6 +52,7 @@ function rand(n){ return (Math.random()*n) } function randint(n){ return rand(n)|0 } function randrange(a,b){ return a + rand(b-a) } function choice(a){ return a[randint(a.length)] } +function noop(){} function range(m,n,s){ var a = [] |
