Sha256: 83f8a8eb130afcd20b6b7ca457f512fbb366914ac9d1bf9e32ab72ccd2caf682

Contents?: true

Size: 525 Bytes

Versions: 6

Compression:

Stored size: 525 Bytes

Contents

number = {}

local numberToMonth = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }
function number.toMonth(n)
  n = tonumber(n)
  return numberToMonth[n]
end

function number.tocurrency(n)
  return "$" .. number.commaSeperate(n)
end

function number.commaSeperate(n)
  local formatted = tostring(n)
  while true do  
    formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
    if k ==0 then break end
  end
  
  return formatted
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
candle-0.0.7 lib/candle/generators/lua/wax/lib/stdlib/ext/number.lua
candle-0.0.6 lib/candle/generators/lua/wax/lib/stdlib/ext/number.lua
candle-0.0.4 lib/candle/generators/lua/wax/lib/stdlib/ext/number.lua
candle-0.0.3 lib/candle/generators/lua/wax/lib/stdlib/ext/number.lua
candle-0.0.2 lib/candle/generators/lua/wax/lib/stdlib/ext/number.lua
candle-0.0.1 lib/candle/generators/lua/wax/lib/stdlib/ext/number.lua