smallex v0.2.3 Type
Type library.
Link to this section Summary
Link to this section Functions
Link to this function
float(value)
aa
Examples
iex> Type.float( nil )
"NaN"
iex> Type.float( "" )
"NaN"
iex> Type.float( "12.34567" )
"12.35"
iex> Type.float( "12.34444" )
"12.34"
iex> Type.float( 12.34567 )
"12.35"
iex> Type.float( 12.34444 )
"12.34"
Link to this function
is(map)
Type check
Examples
iex> Type.is( nil )
"nil"
iex> Type.is( "v1" )
"String"
iex> Type.is( "2" )
"Integer"
iex> Type.is( 2 )
"Integer"
iex> Type.is( "true" )
"Boolean"
iex> Type.is( true )
"Boolean"
iex> Type.is( "false" )
"Boolean"
iex> Type.is( false )
"Boolean"
iex> Type.is( "12.34" )
"Float"
iex> Type.is( 12.34 )
"Float"
iex> Type.is( %{ "cs" => "v1", "ci" => "2", "cb" => "true", "cf" => "12.34" } )
%{ "cs" => "String", "ci" => "Integer", "cb" => "Boolean", "cf" => "Float" }
iex> Type.is( %{ "cs" => "v1", "ci" => 2, "cb" => true, "cf" => 12.34 } )
%{ "cs" => "String", "ci" => "Integer", "cb" => "Boolean", "cf" => "Float" }
iex> Type.is( [ "v1", 2, true, 12.34 ] )
[ "String", "Integer", "Boolean", "Float" ]
Link to this function
is_boolean_string(value)
Link to this function
is_empty(arg1)
aa
Examples
iex> Type.is_empty( nil )
true
iex> Type.is_empty( "" )
true
iex> Type.is_empty( "abc" )
false
iex> Type.is_empty( 123 )
false
iex> Type.is_empty( 12.34 )
false
Link to this function
is_float_string_safe(value)
Link to this function
is_integer_string_safe(value)
Link to this function
to_number(value)
aa
Examples
iex> Type.to_number( nil )
nil
iex> Type.to_number( "123" )
123
iex> Type.to_number( "12.34" )
12.34
iex> Type.to_number( 123 )
123
iex> Type.to_number( 12.34 )
12.34
iex> Type.to_number( "" )
nil
iex> Type.to_number( "abc" )
nil