diff options
author | Ben Radford <benradf@users.noreply.github.com> | 2023-07-11 09:38:34 +0100 |
---|---|---|
committer | Ben Radford <benradf@users.noreply.github.com> | 2023-07-11 09:38:34 +0100 |
commit | 25b20b4ad23d05d9a1e9daf105d33b7b68e4435b (patch) | |
tree | 18a5255ce272403ccfd34ab0aaad7135aed50a02 /src/libutil/json-utils.cc | |
parent | 754ced4a3f6d3d8865ba78a2e503776d7bd6c04f (diff) | |
parent | 4a880c3cc085841a1537040405bc142fefffd7ff (diff) |
Merge remote-tracking branch 'origin/master' into best-effort-supplementary-groups
Diffstat (limited to 'src/libutil/json-utils.cc')
-rw-r--r-- | src/libutil/json-utils.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libutil/json-utils.cc b/src/libutil/json-utils.cc new file mode 100644 index 000000000..d7220e71d --- /dev/null +++ b/src/libutil/json-utils.cc @@ -0,0 +1,19 @@ +#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; +} + +} |