A better port of ActiveSupport Inflector to JS