22 lines
505 B
Plaintext
22 lines
505 B
Plaintext
namespace ObjectUtils
|
|
|
|
function Dig(obj as object, keys as object) as object
|
|
for each key in keys
|
|
if IsArray(obj) and IsInt(key) and key >= 0 and key < obj.Count()
|
|
obj = obj[key]
|
|
continue for
|
|
end if
|
|
|
|
if IsAssociativeArray(obj) and obj.DoesExist(key)
|
|
obj = obj[key]
|
|
continue for
|
|
end if
|
|
|
|
return invalid
|
|
end for
|
|
|
|
return obj
|
|
end function
|
|
|
|
end namespace
|