title: Delete all status from a json Twitter result if the key do not exist in a nested json in Javascript
body: <p>From this Twitter result, i want to delete all entry/item/status who do not contain video in JavaScript.</p>
  <p>It's mean that the <code>extended_entities.media</code> key will not exist.
  Obviously, it's also mean that the <code>extended_entities.media.video_info.variants[0].url</code> will not exist too.</p>
  <p>Since i also want to use .map (or not) to rename all the key names.</p>
  <p>I do not know how to delete the entire status if there's no video in this item.</p>
  <p>Should i do this in two step?
  like deleting the item if there's no video then rename the result after with .map.
  Can it be done with filter, reduce, map, or foreach with some if and else in one shot or do .map after with the result?</p>
  <p>The main key from Twitter is &quot;statuses&quot;.The key for the video url will be renamed as &quot;sources&quot; later.</p>
  <pre><code>  var new_Data = data.statuses.map(function(item) {
  
      return {
        id: item.id,
        subtitle: item.text,
        //sources: keyExists(item.extended_entities, &quot;url&quot;),
        //sources: getMedia(keyExists(item.extended_entities, &quot;variants&quot;), item),
        sources: item.extended_entities.media.video_info.variants[0].url,
        //poster: item.entities?.media.id,
        tweetURL: &quot;https://twitter.com/&quot; + item.user.screen_name + &quot;/status/&quot; + item.id_str,
        name: item.user.name,
        username: item.user.screen_name,
        //retweet_count: item.retweeted_status.retweet_count,
        //favorite_count: item.retweeted_status.favorite_count,
        thumb: item.user.profile_image_url,
        userUrl: &quot;https://twitter.com/&quot; + item.user.screen_name
      };
   });
  </code></pre>
  <p>This .map example is the example i use to test for now but maybe 95% of these results do not contain video at all.</p>
  <p>Here is a example of a Twitter API results: <a href="https://run.mocky.io/v3/30ca83f2-46f3-4c4a-9067-fcdabdcab75e" rel="nofollow noreferrer">https://run.mocky.io/v3/30ca83f2-46f3-4c4a-9067-fcdabdcab75e</a>
  You can search for .mp4 or extended_entities to help you find where they are.
  all item do not contains these key or value</p>