Skip to content

mcmcgrath13/DotMaps.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DotMaps

Build Status

A wrapper for dictionaries that allows dot notation indexing as well as traditional bracket indexing.

dict = Dict("a"=>1, "b"=>2, "c" => Dict("d"=>3))
dm = DotMap(dict)

dm.c.d # returns 3
dm.c.e = 5
dm["c"].e # returns 5

DotMap.todict(dm, keys_as_strings=true) # returns Dict("a"=>1, "b"=>2, "c" => Dict("d"=>3, "e"=>5))
DotMap.todict(dm) # returns Dict(:a=>1, :b=>2, :c => Dict(:d=>3, :e=>5))

NOTE This is not as performative as using normal dictionaries, but is nice for accessing deeply nested dictionary structures, such as large config/yaml/json files.