Sha256: 1c38d1916b59596ff2e43cd9b263f1c1ec641387ba34512de5134aabc060be85
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
_ = require "underscore" module.exports = util = {} #_.extend(util, inflections: require("inflection"), string:require("underscore.string")) util.chunk = (data, size)-> _.chain(data).groupBy((element, index)-> Math.floor(index/size)).toArray().value() # util.classify = (string, forceSingular = true)-> # string = util.singularize(string) if forceSingular # classified = util.string.capitalize(util.string.camelize(string)) # classified # A safe way of arriving at a value from a string # that does not use eval #util.resolve = (string, root)-> # parts = string.split('.') # _(parts).reduce (memo,part)-> # memo[part] # , root util.read = (value)-> if _.isFunction(value) then value() else value util.wordsForNumber = (number)-> number = 0 if number is 0 number = number - 1 if number > 1 [ "one" "two" "three" "four" "five" "six" "seven" "eight" "nine" "ten" "eleven" "twelve" "thirteen" "fourteen" "fifteen" "sixteen" "seventeen" ][number]
Version data entries
3 entries across 3 versions & 1 rubygems