UNPKG

@leronixlabs/nanite

Version:

Base64 String to JSON converter.

37 lines (36 loc) 776 B
// src/JSONTools.ts function ReturnAsJsonObject(Input) { return JSON.parse(Input); } function IsValidJSON(Input) { try { JSON.parse(Input); return true; } catch { return false; } } function GetSpecificChildValueFromJSON(Input, Target) { if (!IsValidJSON(Input)) return void 0; if (!Target || Target === "") { return void 0; } const JsonObject = ReturnAsJsonObject(Input); if (JsonObject[Target]) return JsonObject[Target]; else return void 0; } function GetValueTypeFromChild(Input, Target) { const GetChild = GetSpecificChildValueFromJSON(Input, Target); if (!GetChild) return void 0; return typeof GetChild; } export { GetSpecificChildValueFromJSON, GetValueTypeFromChild, IsValidJSON, ReturnAsJsonObject };