import { extensionBrowser } from './chrome' ; import { getBaseSupportedLedgers } from './types/ledgers' ; export function isFromExtension ( origin ) { const s = origin . split ( '://' ) ; return s [ 0 ] === 'chrome-extension' && s [ 1 ] === extensionBrowser . runtime . id ; } param obj returns { * } export function removeEmptyFields ( obj ) { Object . keys ( obj ) . forEach ( ( key ) => { if ( obj . hasOwnProperty ( key ) ) { if ( obj [ key ] === null || obj [ key ] === undefined || obj [ key ] . length === 0 ) delete obj [ key ] ; } } ) ; return obj ; } param ledger returns export function isLedgerBaseSupported ( ledger ) { return getBaseSupportedLedgers ( ) . map ( ( l ) => l . name . toLowerCase ( ) ) . includes ( ledger . toLowerCase ( ) ) ; }