From 57756606e79da2a4b7c75bee58bc5b833252d12a Mon Sep 17 00:00:00 2001 From: brantje Date: Sat, 8 Oct 2016 14:00:07 +0200 Subject: [PATCH] Format files --- js/app/controllers/export.js | 11 +++++------ js/exporters/exporter-csv.js | 16 ++++++++-------- js/exporters/exporter-main.js | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/js/app/controllers/export.js b/js/app/controllers/export.js index c0da6d8a..56f4d5b3 100644 --- a/js/app/controllers/export.js +++ b/js/app/controllers/export.js @@ -17,7 +17,7 @@ $scope.$watch(function () { return $window.PassmanExporter; }, function (exporters) { - exporters = Object.keys( angular.copy(exporters )); + exporters = Object.keys(angular.copy(exporters)); for (var i = 0; i < exporters.length; i++) { var exporter = exporters[i]; if ($window.PassmanExporter[exporter].hasOwnProperty('info')) { @@ -40,11 +40,11 @@ var _credentials = []; VaultService.getVault(VaultService.getActiveVault()).then(function (vault) { _log('Decrypting credentials'); - if(vault.hasOwnProperty('credentials')){ - if(vault.credentials.length > 0){ - for(var i =0; i < vault.credentials.length; i++){ + if (vault.hasOwnProperty('credentials')) { + if (vault.credentials.length > 0) { + for (var i = 0; i < vault.credentials.length; i++) { var _credential = angular.copy(vault.credentials[i]); - if(_credential.hidden === 0){ + if (_credential.hidden === 0) { _credential = CredentialService.decryptCredential(_credential); _credentials.push(_credential); } @@ -59,7 +59,6 @@ }; - }]); }()); \ No newline at end of file diff --git a/js/exporters/exporter-csv.js b/js/exporters/exporter-csv.js index 4179378c..0e20e8de 100644 --- a/js/exporters/exporter-csv.js +++ b/js/exporters/exporter-csv.js @@ -16,16 +16,16 @@ PassmanExporter.csv.export = function (credentials) { /** global: C_Promise */ return new C_Promise(function () { var _this = this; - var headers = ['label','username','password','email','description','tags']; - var file_data = '"'+headers.join('","')+'"\n'; - for(var i = 0; i < credentials.length; i++){ + var headers = ['label', 'username', 'password', 'email', 'description', 'tags']; + var file_data = '"' + headers.join('","') + '"\n'; + for (var i = 0; i < credentials.length; i++) { var _credential = credentials[i]; var row_data = []; - for(var h=0; h < headers.length; h++ ){ + for (var h = 0; h < headers.length; h++) { var field = headers[h]; - if(field === 'tags'){ + if (field === 'tags') { var _tags = []; - for(var t = 0; t < _credential[field].length; t++){ + for (var t = 0; t < _credential[field].length; t++) { _tags.push(_credential[field][t].text); } var data = '[' + _tags.join(",") + ']'; @@ -35,12 +35,12 @@ PassmanExporter.csv.export = function (credentials) { } } var progress = { - percent: i/credentials.length*100, + percent: i / credentials.length * 100, loaded: i, total: credentials.length }; _this.call_progress(progress); - file_data += row_data.join(',')+"\n"; + file_data += row_data.join(',') + "\n"; } _this.call_then(); download(file_data, 'passman-export.csv'); diff --git a/js/exporters/exporter-main.js b/js/exporters/exporter-main.js index 78b6b72b..0d88f926 100644 --- a/js/exporters/exporter-main.js +++ b/js/exporters/exporter-main.js @@ -1,5 +1,5 @@ // Importers should always start with this -if(!window['PassmanExporter']){ +if (!window['PassmanExporter']) { var PassmanExporter = {} }