import { omitBy } from 'lodash' ; import { KBN_SCREENSHOT_HEADER_BLOCK_LIST , KBN_SCREENSHOT_HEADER_BLOCK_LIST_STARTS_WITH_PATTERN , } from '../../../common/constants' ; export const omitBlockedHeaders = ( decryptedHeaders ) => { const filteredHeaders = omitBy ( decryptedHeaders , ( _value , header ) => header && ( KBN_SCREENSHOT_HEADER_BLOCK_LIST . includes ( header ) || KBN_SCREENSHOT_HEADER_BLOCK_LIST_STARTS_WITH_PATTERN . some ( ( pattern ) => header ?. startsWith ( pattern ) ) ) ) ; return filteredHeaders ; } ;