index.js
function(providerObject) {
  const fixedProviderObject = Object.assign({}, providerObject);
  const oldGetAccountsMethod = providerObject.getAccounts;

  // fix get accounts
  if (typeof fixedProviderObject.getAccounts !== 'undefined') {
    fixedProviderObject.getAccounts = function(getAccountsCallback) {
      const oldCallback = getAccountsCallback;

      // build fixed callback with lowercased accounts
      const fixedCallback = function(accountsError, accountsResult) {
        const fixedAccountsResult = accountsResult.slice(0);

        // if no error, fixed result
        if (!accountsError) {
          fixedAccountsResult.map(function(item) {
            return String(item.toLowerCase());
          });
        }

        // fire oldd callback with new fix
        oldCallback(accountsError, fixedAccountsResult);
      }

      // fire get accounts method
      oldGetAccountsMethod(fixedCallback);
    };
  }

  // return fixed provider object
  return fixedProviderObject;
}
function(providerObject) {
  const fixedProviderObject = Object.assign({}, providerObject);
  const oldGetAccountsMethod = providerObject.getAccounts;

  // fix get accounts
  if (typeof fixedProviderObject.getAccounts !== 'undefined') {
    fixedProviderObject.getAccounts = function(getAccountsCallback) {
      const oldCallback = getAccountsCallback;

      // build fixed callback with lowercased accounts
      const fixedCallback = function(accountsError, accountsResult) {
        const fixedAccountsResult = accountsResult.slice(0);

        // if no error, fixed result
        if (!accountsError) {
          fixedAccountsResult.map(function(item) {
            return String(item.toLowerCase());
          });
        }

        // fire oldd callback with new fix
        oldCallback(accountsError, fixedAccountsResult);
      }

      // fire get accounts method
      oldGetAccountsMethod(fixedCallback);
    };
  }

  // return fixed provider object
  return fixedProviderObject;
}
function ( providerObject ) { const fixedProviderObject = Object . assign ( { } , providerObject ) ; const oldGetAccountsMethod = providerObject . getAccounts ; // fix get accounts if ( typeof fixedProviderObject . getAccounts !== 'undefined' ) { fixedProviderObject . getAccounts = function ( getAccountsCallback ) { const oldCallback = getAccountsCallback ; // build fixed callback with lowercased accounts const fixedCallback = function ( accountsError , accountsResult ) { const fixedAccountsResult = accountsResult . slice ( 0 ) ; // if no error, fixed result if ( ! accountsError ) { fixedAccountsResult . map ( function ( item ) { return String ( item . toLowerCase ( ) ) ; } ) ; } // fire oldd callback with new fix oldCallback ( accountsError , fixedAccountsResult ) ; } // fire get accounts method oldGetAccountsMethod ( fixedCallback ) ; } ; } // return fixed provider object return fixedProviderObject ; }
fix getAccounts method
fix getAccounts method