View Source Avatador.Helpers (avatador v0.1.0)

Helper functions for Avatador.

Link to this section Summary

Functions

Generate the initials for a String.

Convert a hash to Integer.

Convert a hash to List.

Hash a string.

Capitalize a String based on provided cap_option

Convert a value to Boolean.

Convert a value to Float.

Convert a value to Integer.

Convert a value to String.

Link to this section Functions

Link to this function

generate_initials(string)

View Source (since 0.1.0)

Generate the initials for a String.

Link to this function

hash_to_integer(hash)

View Source (since 0.1.0)

Convert a hash to Integer.

Link to this function

hash_to_list(hash)

View Source (since 0.1.0)

Convert a hash to List.

Link to this function

hash_value(string)

View Source (since 0.1.0)

Hash a string.

Link to this function

maybe_capitalize(string, arg2)

View Source (since 0.1.0)

Capitalize a String based on provided cap_option

  • 1 for all uppercase
  • 2 for all lowercase
  • 3 for leaving such as provided
Link to this function

to_boolean(arg1)

View Source (since 0.1.0)

Convert a value to Boolean.

"true", true, "1", 1 returns true "false", false, "0", 0 returns false

Link to this function

to_float(value)

View Source (since 0.1.0)

Convert a value to Float.

Only converts Float, Integer, and Binary values. All else returns 0.0.

Link to this function

to_integer(value)

View Source (since 0.1.0)

Convert a value to Integer.

Only converts Float, Integer, and Binary values. All else returns 0.

Link to this function

to_string(value)

View Source (since 0.1.0)

Convert a value to String.

Only converts Float, Integer, and Binary values. nil returns nil, all else returns "" (empty string).