How can i filter items from an array of objects with conditional check on a property of type string
My JSON is like this
{"startIndex":2,"selections":[{"type":"SKU","colIndex":0,"values":[{"value":1231319,"bgcolour":"","textcolour":"","type":1,"colIndex":0,"rowIndex":2,"selected":false},{"value":1231320,"bgcolour":"","textcolour":"","type":1,"colIndex":0,"rowIndex":3,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":4,"selected":false},{"value":1231322,"bgcolour":"","textcolour":"","type":1,"colIndex":0,"rowIndex":5,"selected":false},{"value":1231323,"bgcolour":"","textcolour":"","type":1,"colIndex":0,"rowIndex":6,"selected":false},{"value":1231324,"bgcolour":"","textcolour":"","type":1,"colIndex":0,"rowIndex":7,"selected":false},{"value":1231325,"bgcolour":"","textcolour":"","type":1,"colIndex":0,"rowIndex":8,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":9,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":10,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":11,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":12,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":13,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":14,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":15,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":16,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":17,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":18,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":0,"rowIndex":19,"selected":false}]},{"type":"QTY","colIndex":1,"values":[{"value":2,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":2,"selected":false},{"value":1,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":3,"selected":false},{"value":-1,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":4,"selected":false},{"value":0,"bgcolour":"","textcolour":"","type":0,"colIndex":1,"rowIndex":5,"selected":false},{"value":1,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":6,"selected":false},{"value":2,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":7,"selected":false},{"value":3,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":8,"selected":false},{"value":1,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":9,"selected":false},{"value":"Some more products under a merged cell just to be annoying","bgcolour":"","textcolour":"","type":0,"colIndex":1,"rowIndex":10,"selected":false},{"value":"product ID","bgcolour":"","textcolour":"","type":0,"colIndex":1,"rowIndex":11,"selected":false},{"value":333444,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":12,"selected":false},{"value":333445,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":13,"selected":false},{"value":333446,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":14,"selected":false},{"value":333447,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":15,"selected":false},{"value":333448,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":16,"selected":false},{"value":333449,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":17,"selected":false},{"bgcolour":"","textcolour":"","type":0,"colIndex":1,"rowIndex":18,"selected":false},{"value":333451,"bgcolour":"","textcolour":"","type":1,"colIndex":1,"rowIndex":19,"selected":false}]},{"type":"Name","colIndex":2,"values":[{"value":"BRONZE HAT","bgcolour":"","textcolour":"","type":0,"colIndex":2,"rowIndex":2,"selected":true},{"value":"GOLD HAT","bgcolour":"","textcolour":"","type":0,"colIndex":2,"rowIndex":3,"selected":true},{"value":"unknown?","bgcolour":"","textcolour":"","type":0,"colIndex":2,"rowIndex":4,"selected":true},{"value":8,"bgcolour":"","textcolour":"","type":1,"colIndex":2,"rowIndex":5,"selected":true},{"value":"this data is a bit messy%","bgcolour":"","textcolour":"","type":0,"colIndex":2,"rowIndex":6,"selected":true},{"value":"Trouser A","bgcolour":"","textcolour":"","type":0,"colIndex":2,"rowIndex":7,"selected":true},{"value":"Trouser B","bgcolour":"","textcolour":"","type":0,"colIndex":2,"rowIndex":8,"selected":true},{"bgcolour":"","textcolour":"","type":0,"colIndex":2,"rowIndex":9,"selected":true},{"bgcolour":"","textcolour":"","type":0,"colIndex":2,"rowIndex":10,"selected":true},{"value":"quantity required","bgcolour":"","textcolour":"","type":0,"colIndex":2,"rowIndex":11,"selected":true},{"value":2,"bgcolour":"","textcolour":"","type":1,"colIndex":2,"rowIndex":12,"selected":true},{"value":1,"bgcolour":"","textcolour":"","type":1,"colIndex":2,"rowIndex":13,"selected":true},{"value":-1,"bgcolour":"","textcolour":"","type":1,"colIndex":2,"rowIndex":14,"selected":true},{"bgcolour":"","textcolour":"","type":0,"colIndex":2,"rowIndex":15,"selected":true},{"value":1,"bgcolour":"","textcolour":"","type":1,"colIndex":2,"rowIndex":16,"selected":true},{"value":2,"bgcolour":"","textcolour":"","type":1,"colIndex":2,"rowIndex":17,"selected":true},{"value":3,"bgcolour":"","textcolour":"","type":1,"colIndex":2,"rowIndex":18,"selected":true},{"value":1,"bgcolour":"","textcolour":"","type":1,"colIndex":2,"rowIndex":19,"selected":true}]}]}
I am using the following typescript but still all items are returned
var selected_skus = this.selectionSettings.selections.filter(e => e.type === 'SKU' && e.values.filter(x=>x.value?.length >0 ))
.map(obj => obj.values);
console.log(selected_skus);
How can i ensure that items with a not null x.value is returning back