mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-28 16:46:16 +02:00
c8825e9d8c
This is somewhat tricky.
19 lines
371 B
C++
19 lines
371 B
C++
#include "json-utils.hh"
|
|
|
|
namespace nix {
|
|
|
|
const nlohmann::json * get(const nlohmann::json & map, const std::string & key)
|
|
{
|
|
auto i = map.find(key);
|
|
if (i == map.end()) return nullptr;
|
|
return &*i;
|
|
}
|
|
|
|
nlohmann::json * get(nlohmann::json & map, const std::string & key)
|
|
{
|
|
auto i = map.find(key);
|
|
if (i == map.end()) return nullptr;
|
|
return &*i;
|
|
}
|
|
|
|
}
|