#pragma once

#include "nlohmann/json.hpp"

namespace nsUtils
{
    template <typename T>
    bool IsWithinTol(T Offset, T Tol)
    {
        if (Offset > Tol || Offset < -Tol)
        {
            return false;
        }

        return true;
    }

    template <typename T>
    inline void getValue(const nlohmann::json& j, const std::string& fieldname, T& value)
    {
        if (j.contains(fieldname))
        {
            j.at(fieldname).get_to(value);
        }
    }
}