mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
22 lines
389 B
C++
22 lines
389 B
C++
|
#pragma once
|
||
|
|
||
|
#include <nlohmann/json.hpp>
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
}
|