var caseOne = [
{"name":"Felicity", "gender":"F", ... ... ,"type":"Admin"},
{"name":"Tony", "gender":"M", ... ... ,"type":""},
.
.
.
.
{"name":"Super Man", "gender":"M", ... ... ,"type":""},
{"name":"Wonder Women", "gender":"F", ... ... ,"type":""},
{"name":"Hulk", "gender":"M", ... ... ,"type":"User"},
{"name":"Loky", "gender":"M", ... ... ,"type":"User"},
{"name":"Thore", "gender":"M", ... ... ,"type":"Admin"}
];
var caseTwo = [
{"name":"Felicity", "gender":"F", ... ... ,"type":"Admin"},
{"name":"Tony", "gender":"M", ... ... ,"type":""},
.
.
.
.
{"name":"Super Man", "gender":"M", ... ... ,"type":""},
{"name":"Wonder Women", "gender":"F", ... ... ,"type":""},
{"name":"Hulk", "gender":"M", ... ... ,"type":"User"},
{"name":"Loky", "gender":"M", ... ... ,"type":"User"},
{"name":"Thore", "gender":"M", ... ... ,"type":"Admin"},
{"name":"Bat man", "gender":"M", ... ... ,"type":""}
];
I have an array structure similar to the above examples. I am looking for assistance in extracting all records that appear after the last occurrence of "type":""
. In this scenario, it should return the last 3 records from caseOne
and 0 records from caseTwo
, which essentially means all records after "type":""
.
Your help is greatly appreciated.
Desired output
caseOne = [
{"name":"Hulk", "gender":"M", ... ... ,"type":"User"},
{"name":"Loky", "gender":"M", ... ... ,"type":"User"},
{"name":"Thore", "gender":"M", ... ... ,"type":"Admin"}
];
caseTwo = [];