Files
playlet-piped/playlet-lib/src/source/utils/ObjectUtils.bs
T
Brahim Hadricheandgithub-action linter bed8223e76 [Part 2] Innertube (#513)
* Parse author in videoRenderer

* Parse more fields

* Parse live badge

* playlist video count

* Parse more things

* parse playlists and albums

* More parsing work

* announcement and changelog

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2024-12-22 16:04:36 -05:00

26 lines
707 B
Plaintext

namespace ObjectUtils
function Dig(obj as object, keys as object) as object
if obj = invalid
return invalid
end if
for each key in keys
if (GetInterface(obj, "ifAssociativeArray") <> invalid) and (GetInterface(key, "ifString") <> invalid) and obj.DoesExist(key)
obj = obj[key]
continue for
end if
if (GetInterface(obj, "ifArray") <> invalid) and (GetInterface(key, "ifInt") <> invalid) and key >= 0 and key < obj.Count()
obj = obj[key]
continue for
end if
return invalid
end for
return obj
end function
end namespace