diff --git a/package.json b/package.json index d9bab067b3..237c582897 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "clean": "rimraf dist/**/*", "build": "npm run clean && tsc", "build:watch": "npm run clean && tsc -watch", - "lint": "tslint src/**/*.ts spec/**/*.ts", - "lint:fix": "tslint src/**/*.ts spec/**/*.ts --fix", + "lint": "tslint 'src/**/*.ts' 'spec/**/*.ts'", + "lint:fix": "tslint 'src/**/*.ts' 'spec/**/*.ts' --fix", "test": "karma start ./spec/support/karma.conf.js --single-run", "test:watch": "karma start ./spec/support/karma.conf.js", "test:node": "npm run build && jasmine", diff --git a/spec/common/importers/lastpassCsvImporter.spec.ts b/spec/common/importers/lastpassCsvImporter.spec.ts index df1dea0fb8..fc8d152620 100644 --- a/spec/common/importers/lastpassCsvImporter.spec.ts +++ b/spec/common/importers/lastpassCsvImporter.spec.ts @@ -160,7 +160,7 @@ Notes:",nomonth,,0`, ]; describe('Lastpass CSV Importer', () => { - CipherData.forEach((data) => { + CipherData.forEach(data => { it(data.title, async () => { const importer = new Importer(); const result = await importer.parse(data.csv); diff --git a/spec/common/misc/sequentialize.spec.ts b/spec/common/misc/sequentialize.spec.ts index f3ec1d0ec3..fa184ef444 100644 --- a/spec/common/misc/sequentialize.spec.ts +++ b/spec/common/misc/sequentialize.spec.ts @@ -84,12 +84,12 @@ describe('sequentialize decorator', () => { const allRes: number[] = []; await Promise.all([ - foo.bar(1).then((res) => allRes.push(res)), - foo.bar(1).then((res) => allRes.push(res)), - foo.bar(2).then((res) => allRes.push(res)), - foo.bar(2).then((res) => allRes.push(res)), - foo.bar(3).then((res) => allRes.push(res)), - foo.bar(3).then((res) => allRes.push(res)), + foo.bar(1).then(res => allRes.push(res)), + foo.bar(1).then(res => allRes.push(res)), + foo.bar(2).then(res => allRes.push(res)), + foo.bar(2).then(res => allRes.push(res)), + foo.bar(3).then(res => allRes.push(res)), + foo.bar(3).then(res => allRes.push(res)), ]); expect(foo.calls).toBe(3); expect(allRes.length).toBe(6); @@ -102,12 +102,12 @@ describe('sequentialize decorator', () => { const allRes: number[] = []; await Promise.all([ - foo.baz(1).then((res) => allRes.push(res)), - foo.baz(1).then((res) => allRes.push(res)), - foo.baz(2).then((res) => allRes.push(res)), - foo.baz(2).then((res) => allRes.push(res)), - foo.baz(3).then((res) => allRes.push(res)), - foo.baz(3).then((res) => allRes.push(res)), + foo.baz(1).then(res => allRes.push(res)), + foo.baz(1).then(res => allRes.push(res)), + foo.baz(2).then(res => allRes.push(res)), + foo.baz(2).then(res => allRes.push(res)), + foo.baz(3).then(res => allRes.push(res)), + foo.baz(3).then(res => allRes.push(res)), ]); expect(foo.calls).toBe(3); expect(allRes.length).toBe(6); @@ -119,20 +119,20 @@ describe('sequentialize decorator', () => { class Foo { calls = 0; - @sequentialize((args) => 'bar' + args[0]) + @sequentialize(args => 'bar' + args[0]) bar(a: number): Promise { this.calls++; - return new Promise((res) => { + return new Promise(res => { setTimeout(() => { res(a * 2); }, Math.random() * 100); }); } - @sequentialize((args) => 'baz' + args[0]) + @sequentialize(args => 'baz' + args[0]) baz(a: number): Promise { this.calls++; - return new Promise((res) => { + return new Promise(res => { setTimeout(() => { res(a * 3); }, Math.random() * 100); diff --git a/spec/common/misc/throttle.spec.ts b/spec/common/misc/throttle.spec.ts index f7a273a6f9..6f9237573f 100644 --- a/spec/common/misc/throttle.spec.ts +++ b/spec/common/misc/throttle.spec.ts @@ -72,7 +72,7 @@ class Foo { bar(a: number) { this.calls++; this.inflight++; - return new Promise((res) => { + return new Promise(res => { setTimeout(() => { expect(this.inflight).toBe(1); this.inflight--; @@ -85,7 +85,7 @@ class Foo { baz(a: number) { this.calls++; this.inflight++; - return new Promise((res) => { + return new Promise(res => { setTimeout(() => { expect(this.inflight).toBeLessThanOrEqual(5); this.inflight--; @@ -94,12 +94,12 @@ class Foo { }); } - @sequentialize((args) => 'qux' + args[0]) + @sequentialize(args => 'qux' + args[0]) @throttle(1, () => 'qux') qux(a: number) { this.calls++; this.inflight++; - return new Promise((res) => { + return new Promise(res => { setTimeout(() => { expect(this.inflight).toBe(1); this.inflight--; diff --git a/spec/common/services/consoleLog.service.spec.ts b/spec/common/services/consoleLog.service.spec.ts index b4f7d9d612..2aa062418b 100644 --- a/spec/common/services/consoleLog.service.spec.ts +++ b/spec/common/services/consoleLog.service.spec.ts @@ -40,7 +40,7 @@ describe('ConsoleLogService', () => { }); it('filters messages below the set threshold', () => { - logService = new ConsoleLogService(true, (level) => true); + logService = new ConsoleLogService(true, level => true); logService.debug('debug'); logService.info('info'); logService.warning('warning'); @@ -86,7 +86,7 @@ describe('ConsoleLogService', () => { }); it('filters time output', async () => { - logService = new ConsoleLogService(true, (level) => true); + logService = new ConsoleLogService(true, level => true); logService.time(); logService.timeEnd(); diff --git a/spec/utils.ts b/spec/utils.ts index 94535d9b82..4df925ed5a 100644 --- a/spec/utils.ts +++ b/spec/utils.ts @@ -1,5 +1,5 @@ function newGuid() { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => { // tslint:disable:no-bitwise const r = Math.random() * 16 | 0; const v = c === 'x' ? r : (r & 0x3 | 0x8); diff --git a/spec/web/services/webCryptoFunction.service.spec.ts b/spec/web/services/webCryptoFunction.service.spec.ts index ee81c14cdc..35204d29c5 100644 --- a/spec/web/services/webCryptoFunction.service.spec.ts +++ b/spec/web/services/webCryptoFunction.service.spec.ts @@ -468,8 +468,8 @@ function testRsaGenerateKeyPair(length: 1024 | 2048 | 4096) { function getWebCryptoFunctionService() { const platformUtilsMock = TypeMoq.Mock.ofType(PlatformUtilsServiceMock); - platformUtilsMock.setup((x) => x.isEdge()).returns(() => navigator.userAgent.indexOf(' Edg/') !== -1); - platformUtilsMock.setup((x) => x.isIE()).returns(() => navigator.userAgent.indexOf(' Edg/') === -1 && + platformUtilsMock.setup(x => x.isEdge()).returns(() => navigator.userAgent.indexOf(' Edg/') !== -1); + platformUtilsMock.setup(x => x.isIE()).returns(() => navigator.userAgent.indexOf(' Edg/') === -1 && navigator.userAgent.indexOf(' Trident/') !== -1); return new WebCryptoFunctionService(window, platformUtilsMock.object); } diff --git a/src/angular/components/add-edit.component.ts b/src/angular/components/add-edit.component.ts index ede0b2f107..a348878089 100644 --- a/src/angular/components/add-edit.component.ts +++ b/src/angular/components/add-edit.component.ts @@ -159,7 +159,7 @@ export class AddEditComponent implements OnInit { const myEmail = await this.userService.getEmail(); this.ownershipOptions.push({ name: myEmail, value: null }); const orgs = await this.userService.getAllOrganizations(); - orgs.sort(Utils.getSortFunction(this.i18nService, 'name')).forEach((o) => { + orgs.sort(Utils.getSortFunction(this.i18nService, 'name')).forEach(o => { if (o.enabled && o.status === OrganizationUserStatusType.Confirmed) { this.ownershipOptions.push({ name: o.name, value: o.id }); if (policies != null && o.usePolicies && !o.canManagePolicies && this.allowPersonal) { @@ -231,7 +231,7 @@ export class AddEditComponent implements OnInit { if (this.cipher != null && (!this.editMode || addEditCipherInfo != null || this.cloneMode)) { await this.organizationChanged(); if (this.collectionIds != null && this.collectionIds.length > 0 && this.collections.length > 0) { - this.collections.forEach((c) => { + this.collections.forEach(c => { if (this.collectionIds.indexOf(c.id) > -1) { (c as any).checked = true; } @@ -273,7 +273,7 @@ export class AddEditComponent implements OnInit { // Allows saving of selected collections during "Add" and "Clone" flows if ((!this.editMode || this.cloneMode) && this.cipher.organizationId != null) { this.cipher.collectionIds = this.collections == null ? [] : - this.collections.filter((c) => (c as any).checked).map((c) => c.id); + this.collections.filter(c => (c as any).checked).map(c => c.id); } // Clear current Cipher Id to trigger "Add" cipher flow @@ -459,10 +459,10 @@ export class AddEditComponent implements OnInit { async organizationChanged() { if (this.writeableCollections != null) { - this.writeableCollections.forEach((c) => (c as any).checked = false); + this.writeableCollections.forEach(c => (c as any).checked = false); } if (this.cipher.organizationId != null) { - this.collections = this.writeableCollections.filter((c) => c.organizationId === this.cipher.organizationId); + this.collections = this.writeableCollections.filter(c => c.organizationId === this.cipher.organizationId); const org = await this.userService.getOrganization(this.cipher.organizationId); if (org != null) { this.cipher.organizationUseTotp = org.useTotp; @@ -496,7 +496,7 @@ export class AddEditComponent implements OnInit { protected async loadCollections() { const allCollections = await this.collectionService.getAllDecrypted(); - return allCollections.filter((c) => !c.readOnly); + return allCollections.filter(c => !c.readOnly); } protected loadCipher() { diff --git a/src/angular/components/attachments.component.ts b/src/angular/components/attachments.component.ts index 5c8e00c137..8de40cf1fe 100644 --- a/src/angular/components/attachments.component.ts +++ b/src/angular/components/attachments.component.ts @@ -192,7 +192,7 @@ export class AttachmentsComponent implements OnInit { // 3. Delete old this.deletePromises[attachment.id] = this.deleteCipherAttachment(attachment.id); await this.deletePromises[attachment.id]; - const foundAttachment = this.cipher.attachments.filter((a2) => a2.id === attachment.id); + const foundAttachment = this.cipher.attachments.filter(a2 => a2.id === attachment.id); if (foundAttachment.length > 0) { const i = this.cipher.attachments.indexOf(foundAttachment[0]); if (i > -1) { diff --git a/src/angular/components/ciphers.component.ts b/src/angular/components/ciphers.component.ts index 0cca07d3d6..94330da652 100644 --- a/src/angular/components/ciphers.component.ts +++ b/src/angular/components/ciphers.component.ts @@ -82,7 +82,7 @@ export class CiphersComponent { if (this.searchTimeout != null) { clearTimeout(this.searchTimeout); } - const deletedFilter: (cipher: CipherView) => boolean = (c) => c.isDeleted === this.deleted; + const deletedFilter: (cipher: CipherView) => boolean = c => c.isDeleted === this.deleted; if (timeout == null) { this.ciphers = await this.searchService.searchCiphers(this.searchText, [this.filter, deletedFilter], null); await this.resetPaging(); diff --git a/src/angular/components/collections.component.ts b/src/angular/components/collections.component.ts index c6be2fc985..336334e9c4 100644 --- a/src/angular/components/collections.component.ts +++ b/src/angular/components/collections.component.ts @@ -42,9 +42,9 @@ export class CollectionsComponent implements OnInit { this.cipher = await this.cipherDomain.decrypt(); this.collections = await this.loadCollections(); - this.collections.forEach((c) => (c as any).checked = false); + this.collections.forEach(c => (c as any).checked = false); if (this.collectionIds != null) { - this.collections.forEach((c) => { + this.collections.forEach(c => { (c as any).checked = this.collectionIds != null && this.collectionIds.indexOf(c.id) > -1; }); } @@ -52,8 +52,8 @@ export class CollectionsComponent implements OnInit { async submit() { const selectedCollectionIds = this.collections - .filter((c) => !!(c as any).checked) - .map((c) => c.id); + .filter(c => !!(c as any).checked) + .map(c => c.id); if (!this.allowSelectNone && selectedCollectionIds.length === 0) { this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), this.i18nService.t('selectOneCollection')); @@ -79,7 +79,7 @@ export class CollectionsComponent implements OnInit { protected async loadCollections() { const allCollections = await this.collectionService.getAllDecrypted(); - return allCollections.filter((c) => !c.readOnly && c.organizationId === this.cipher.organizationId); + return allCollections.filter(c => !c.readOnly && c.organizationId === this.cipher.organizationId); } protected saveCollections() { diff --git a/src/angular/components/groupings.component.ts b/src/angular/components/groupings.component.ts index f8f1c8cf2d..9141106944 100644 --- a/src/angular/components/groupings.component.ts +++ b/src/angular/components/groupings.component.ts @@ -79,7 +79,7 @@ export class GroupingsComponent { } const collections = await this.collectionService.getAllDecrypted(); if (organizationId != null) { - this.collections = collections.filter((c) => c.organizationId === organizationId); + this.collections = collections.filter(c => c.organizationId === organizationId); } else { this.collections = collections; } diff --git a/src/angular/components/modal.component.ts b/src/angular/components/modal.component.ts index b58c739a7f..3057aeb3ab 100644 --- a/src/angular/components/modal.component.ts +++ b/src/angular/components/modal.component.ts @@ -56,7 +56,7 @@ export class ModalComponent implements OnDestroy { const modals = Array.from(document.querySelectorAll('.modal, .modal *[data-dismiss="modal"]')); for (const closeElement of modals) { - closeElement.addEventListener('click', (event) => { + closeElement.addEventListener('click', event => { this.close(); }); } diff --git a/src/angular/components/send/send.component.ts b/src/angular/components/send/send.component.ts index 85843fecca..674e9622f6 100644 --- a/src/angular/components/send/send.component.ts +++ b/src/angular/components/send/send.component.ts @@ -100,13 +100,13 @@ export class SendComponent implements OnInit { clearTimeout(this.searchTimeout); } if (timeout == null) { - this.filteredSends = this.sends.filter((s) => this.filter == null || this.filter(s)); + this.filteredSends = this.sends.filter(s => this.filter == null || this.filter(s)); this.applyTextSearch(); return; } this.searchPending = true; this.searchTimeout = setTimeout(async () => { - this.filteredSends = this.sends.filter((s) => this.filter == null || this.filter(s)); + this.filteredSends = this.sends.filter(s => this.filter == null || this.filter(s)); this.applyTextSearch(); this.searchPending = false; }, timeout); @@ -189,7 +189,7 @@ export class SendComponent implements OnInit { selectType(type: SendType) { this.clearSelections(); this.selectedType = type; - this.applyFilter((s) => s.type === type); + this.applyFilter(s => s.type === type); } clearSelections() { diff --git a/src/angular/components/set-password.component.ts b/src/angular/components/set-password.component.ts index 6c29be00b7..5eeabd02f0 100644 --- a/src/angular/components/set-password.component.ts +++ b/src/angular/components/set-password.component.ts @@ -44,7 +44,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent { await this.syncService.fullSync(true); this.syncLoading = false; - const queryParamsSub = this.route.queryParams.subscribe(async (qParams) => { + const queryParamsSub = this.route.queryParams.subscribe(async qParams => { if (qParams.identifier != null) { this.identifier = qParams.identifier; } diff --git a/src/angular/components/share.component.ts b/src/angular/components/share.component.ts index 3cfc5d8eb5..7c9b428296 100644 --- a/src/angular/components/share.component.ts +++ b/src/angular/components/share.component.ts @@ -43,10 +43,10 @@ export class ShareComponent implements OnInit { async load() { const allCollections = await this.collectionService.getAllDecrypted(); - this.writeableCollections = allCollections.map((c) => c).filter((c) => !c.readOnly); + this.writeableCollections = allCollections.map(c => c).filter(c => !c.readOnly); const orgs = await this.userService.getAllOrganizations(); this.organizations = orgs.sort(Utils.getSortFunction(this.i18nService, 'name')) - .filter((o) => o.enabled && o.status === OrganizationUserStatusType.Confirmed); + .filter(o => o.enabled && o.status === OrganizationUserStatusType.Confirmed); const cipherDomain = await this.cipherService.get(this.cipherId); this.cipher = await cipherDomain.decrypt(); @@ -57,18 +57,18 @@ export class ShareComponent implements OnInit { } filterCollections() { - this.writeableCollections.forEach((c) => (c as any).checked = false); + this.writeableCollections.forEach(c => (c as any).checked = false); if (this.organizationId == null || this.writeableCollections.length === 0) { this.collections = []; } else { - this.collections = this.writeableCollections.filter((c) => c.organizationId === this.organizationId); + this.collections = this.writeableCollections.filter(c => c.organizationId === this.organizationId); } } async submit(): Promise { const selectedCollectionIds = this.collections - .filter((c) => !!(c as any).checked) - .map((c) => c.id); + .filter(c => !!(c as any).checked) + .map(c => c.id); if (selectedCollectionIds.length === 0) { this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), this.i18nService.t('selectOneCollection')); diff --git a/src/angular/components/sso.component.ts b/src/angular/components/sso.component.ts index 655be7db7f..7fbdb37211 100644 --- a/src/angular/components/sso.component.ts +++ b/src/angular/components/sso.component.ts @@ -45,7 +45,7 @@ export class SsoComponent { protected passwordGenerationService: PasswordGenerationService) { } async ngOnInit() { - const queryParamsSub = this.route.queryParams.subscribe(async (qParams) => { + const queryParamsSub = this.route.queryParams.subscribe(async qParams => { if (qParams.code != null && qParams.state != null) { const codeVerifier = await this.storageService.get(ConstantsService.ssoCodeVerifierKey); const state = await this.storageService.get(ConstantsService.ssoStateKey); diff --git a/src/angular/components/two-factor.component.ts b/src/angular/components/two-factor.component.ts index 3459b96934..440f5efb6e 100644 --- a/src/angular/components/two-factor.component.ts +++ b/src/angular/components/two-factor.component.ts @@ -63,7 +63,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy { return; } - const queryParamsSub = this.route.queryParams.subscribe(async (qParams) => { + const queryParamsSub = this.route.queryParams.subscribe(async qParams => { if (qParams.identifier != null) { this.identifier = qParams.identifier; } diff --git a/src/angular/directives/box-row.directive.ts b/src/angular/directives/box-row.directive.ts index 9f2cb60368..a7dd0bee50 100644 --- a/src/angular/directives/box-row.directive.ts +++ b/src/angular/directives/box-row.directive.ts @@ -18,7 +18,7 @@ export class BoxRowDirective implements OnInit { ngOnInit(): void { this.formEls = Array.from(this.el.querySelectorAll('input:not([type="hidden"]), select, textarea')); - this.formEls.forEach((formEl) => { + this.formEls.forEach(formEl => { formEl.addEventListener('focus', (event: Event) => { this.el.classList.add('active'); }, false); diff --git a/src/angular/pipes/search-ciphers.pipe.ts b/src/angular/pipes/search-ciphers.pipe.ts index 407011e911..480a272231 100644 --- a/src/angular/pipes/search-ciphers.pipe.ts +++ b/src/angular/pipes/search-ciphers.pipe.ts @@ -15,13 +15,13 @@ export class SearchCiphersPipe implements PipeTransform { } if (searchText == null || searchText.length < 2) { - return ciphers.filter((c) => { + return ciphers.filter(c => { return deleted !== c.isDeleted; }); } searchText = searchText.trim().toLowerCase(); - return ciphers.filter((c) => { + return ciphers.filter(c => { if (deleted !== c.isDeleted) { return false; } diff --git a/src/angular/pipes/search.pipe.ts b/src/angular/pipes/search.pipe.ts index adc6da0daa..6c9e140b5a 100644 --- a/src/angular/pipes/search.pipe.ts +++ b/src/angular/pipes/search.pipe.ts @@ -17,7 +17,7 @@ export class SearchPipe implements PipeTransform { } searchText = searchText.trim().toLowerCase(); - return items.filter((i) => { + return items.filter(i => { if (prop1 != null && i[prop1] != null && i[prop1].toString().toLowerCase().indexOf(searchText) > -1) { return true; } diff --git a/src/cli/commands/login.command.ts b/src/cli/commands/login.command.ts index 46ac1fb2cc..107a523029 100644 --- a/src/cli/commands/login.command.ts +++ b/src/cli/commands/login.command.ts @@ -175,7 +175,7 @@ export class LoginCommand { if (twoFactorMethod != null) { try { - selectedProvider = twoFactorProviders.filter((p) => p.type === twoFactorMethod)[0]; + selectedProvider = twoFactorProviders.filter(p => p.type === twoFactorMethod)[0]; } catch (e) { return Response.error('Invalid two-step login method.'); } @@ -185,7 +185,7 @@ export class LoginCommand { if (twoFactorProviders.length === 1) { selectedProvider = twoFactorProviders[0]; } else if (this.canInteract) { - const twoFactorOptions = twoFactorProviders.map((p) => p.name); + const twoFactorOptions = twoFactorProviders.map(p => p.name); twoFactorOptions.push(new inquirer.Separator()); twoFactorOptions.push('Cancel'); const answer: inquirer.Answers = diff --git a/src/cli/models/response.ts b/src/cli/models/response.ts index 24ca7d3c36..8e3dc5819f 100644 --- a/src/cli/models/response.ts +++ b/src/cli/models/response.ts @@ -24,7 +24,7 @@ export class Response { static multipleResults(ids: string[]): Response { let msg = 'More than one result was found. Try getting a specific object by `id` instead. ' + 'The following objects were found:'; - ids.forEach((id) => { + ids.forEach(id => { msg += '\n' + id; }); return Response.error(msg, ids); diff --git a/src/electron/services/electronPlatformUtils.service.ts b/src/electron/services/electronPlatformUtils.service.ts index 0ea3f2188a..0a43100b9c 100644 --- a/src/electron/services/electronPlatformUtils.service.ts +++ b/src/electron/services/electronPlatformUtils.service.ts @@ -118,9 +118,9 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService { remote.dialog.showSaveDialog(remote.getCurrentWindow(), { defaultPath: fileName, showsTagField: false, - }).then((ret) => { + }).then(ret => { if (ret.filePath != null) { - fs.writeFile(ret.filePath, Buffer.from(blobData), (err) => { + fs.writeFile(ret.filePath, Buffer.from(blobData), err => { // error check? }); } @@ -213,7 +213,7 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService { } authenticateBiometric(): Promise { - return new Promise((resolve) => { + return new Promise(resolve => { const val = ipcRenderer.sendSync('biometric', { action: 'authenticate', }); diff --git a/src/electron/updater.main.ts b/src/electron/updater.main.ts index f09ca46847..bdf8cd9dab 100644 --- a/src/electron/updater.main.ts +++ b/src/electron/updater.main.ts @@ -89,7 +89,7 @@ export class UpdaterMain { this.reset(); }); - autoUpdater.on('update-downloaded', async (info) => { + autoUpdater.on('update-downloaded', async info => { if (this.onUpdateDownloaded != null) { this.onUpdateDownloaded(); } @@ -114,7 +114,7 @@ export class UpdaterMain { } }); - autoUpdater.on('error', (error) => { + autoUpdater.on('error', error => { if (this.doingUpdateCheckWithFeedback) { dialog.showErrorBox(this.i18nService.t('updateError'), error == null ? this.i18nService.t('unknown') : (error.stack || error).toString()); diff --git a/src/importers/ascendoCsvImporter.ts b/src/importers/ascendoCsvImporter.ts index f729c0f6d9..c8179dc62a 100644 --- a/src/importers/ascendoCsvImporter.ts +++ b/src/importers/ascendoCsvImporter.ts @@ -12,7 +12,7 @@ export class AscendoCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (value.length < 2) { return; } diff --git a/src/importers/avastCsvImporter.ts b/src/importers/avastCsvImporter.ts index 8e12a05f9c..5519b67aca 100644 --- a/src/importers/avastCsvImporter.ts +++ b/src/importers/avastCsvImporter.ts @@ -12,7 +12,7 @@ export class AvastCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const cipher = this.initLoginCipher(); cipher.name = this.getValueOrDefault(value.name); cipher.login.uris = this.makeUriArray(value.web); diff --git a/src/importers/aviraCsvImporter.ts b/src/importers/aviraCsvImporter.ts index 2586aa63be..1547d7f279 100644 --- a/src/importers/aviraCsvImporter.ts +++ b/src/importers/aviraCsvImporter.ts @@ -12,7 +12,7 @@ export class AviraCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const cipher = this.initLoginCipher(); cipher.name = this.getValueOrDefault(value.name, this.getValueOrDefault(this.nameFromUrl(value.website), '--')); diff --git a/src/importers/baseImporter.ts b/src/importers/baseImporter.ts index 5fb43f3fef..366f97a651 100644 --- a/src/importers/baseImporter.ts +++ b/src/importers/baseImporter.ts @@ -91,7 +91,7 @@ export abstract class BaseImporter { data = this.splitNewLine(data).join('\n').trim(); const result = papa.parse(data, parseOptions); if (result.errors != null && result.errors.length > 0) { - result.errors.forEach((e) => { + result.errors.forEach(e => { if (e.row != null) { // tslint:disable-next-line this.logService.warning('Error parsing row ' + e.row + ': ' + e.message); @@ -129,7 +129,7 @@ export abstract class BaseImporter { if (uri.length > 0) { const returnArr: LoginUriView[] = []; - uri.forEach((u) => { + uri.forEach(u => { const loginUri = new LoginUriView(); loginUri.uri = this.fixUri(u); if (this.isNullOrWhitespace(loginUri.uri)) { @@ -265,8 +265,8 @@ export abstract class BaseImporter { } protected moveFoldersToCollections(result: ImportResult) { - result.folderRelationships.forEach((r) => result.collectionRelationships.push(r)); - result.collections = result.folders.map((f) => { + result.folderRelationships.forEach(r => result.collectionRelationships.push(r)); + result.collections = result.folders.map(f => { const collection = new CollectionView(); collection.name = f.name; return collection; @@ -281,7 +281,7 @@ export abstract class BaseImporter { } protected querySelectorAllDirectChild(parentEl: Element, query: string) { - return Array.from(parentEl.querySelectorAll(query)).filter((el) => el.parentNode === parentEl); + return Array.from(parentEl.querySelectorAll(query)).filter(el => el.parentNode === parentEl); } protected initLoginCipher() { diff --git a/src/importers/bitwardenCsvImporter.ts b/src/importers/bitwardenCsvImporter.ts index ab2bc0d83d..65a123d37b 100644 --- a/src/importers/bitwardenCsvImporter.ts +++ b/src/importers/bitwardenCsvImporter.ts @@ -23,10 +23,10 @@ export class BitwardenCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (this.organization && !this.isNullOrWhitespace(value.collections)) { const collections = (value.collections as string).split(','); - collections.forEach((col) => { + collections.forEach(col => { let addCollection = true; let collectionIndex = result.collections.length; diff --git a/src/importers/bitwardenJsonImporter.ts b/src/importers/bitwardenJsonImporter.ts index 25f72abe3b..3c37d2867d 100644 --- a/src/importers/bitwardenJsonImporter.ts +++ b/src/importers/bitwardenJsonImporter.ts @@ -71,7 +71,7 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer { if (!this.organization && c.folderId != null && groupingsMap.has(c.folderId)) { this.result.folderRelationships.push([this.result.ciphers.length, groupingsMap.get(c.folderId)]); } else if (this.organization && c.collectionIds != null) { - c.collectionIds.forEach((cId) => { + c.collectionIds.forEach(cId => { if (groupingsMap.has(cId)) { this.result.collectionRelationships.push([this.result.ciphers.length, groupingsMap.get(cId)]); } @@ -123,7 +123,7 @@ export class BitwardenJsonImporter extends BaseImporter implements Importer { if (!this.organization && c.folderId != null && groupingsMap.has(c.folderId)) { this.result.folderRelationships.push([this.result.ciphers.length, groupingsMap.get(c.folderId)]); } else if (this.organization && c.collectionIds != null) { - c.collectionIds.forEach((cId) => { + c.collectionIds.forEach(cId => { if (groupingsMap.has(cId)) { this.result.collectionRelationships.push([this.result.ciphers.length, groupingsMap.get(cId)]); } diff --git a/src/importers/blackBerryCsvImporter.ts b/src/importers/blackBerryCsvImporter.ts index 5d26bcc9a6..1e1113487d 100644 --- a/src/importers/blackBerryCsvImporter.ts +++ b/src/importers/blackBerryCsvImporter.ts @@ -12,7 +12,7 @@ export class BlackBerryCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (value.grouping === 'list') { return; } diff --git a/src/importers/blurCsvImporter.ts b/src/importers/blurCsvImporter.ts index 6a6001b4f7..3f36e166e0 100644 --- a/src/importers/blurCsvImporter.ts +++ b/src/importers/blurCsvImporter.ts @@ -12,7 +12,7 @@ export class BlurCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (value.label === 'null') { value.label = null; } diff --git a/src/importers/buttercupCsvImporter.ts b/src/importers/buttercupCsvImporter.ts index 344f7c0895..bd9e5553ab 100644 --- a/src/importers/buttercupCsvImporter.ts +++ b/src/importers/buttercupCsvImporter.ts @@ -16,7 +16,7 @@ export class ButtercupCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { this.processFolder(result, this.getValueOrDefault(value['!group_name'])); const cipher = this.initLoginCipher(); diff --git a/src/importers/chromeCsvImporter.ts b/src/importers/chromeCsvImporter.ts index 8f4a77822b..3580ec5c29 100644 --- a/src/importers/chromeCsvImporter.ts +++ b/src/importers/chromeCsvImporter.ts @@ -12,7 +12,7 @@ export class ChromeCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const cipher = this.initLoginCipher(); cipher.name = this.getValueOrDefault(value.name, '--'); cipher.login.username = this.getValueOrDefault(value.username); diff --git a/src/importers/codebookCsvImporter.ts b/src/importers/codebookCsvImporter.ts index 96e56ef481..fdc563d262 100644 --- a/src/importers/codebookCsvImporter.ts +++ b/src/importers/codebookCsvImporter.ts @@ -12,7 +12,7 @@ export class CodebookCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { this.processFolder(result, this.getValueOrDefault(value.Category)); const cipher = this.initLoginCipher(); diff --git a/src/importers/encryptrCsvImporter.ts b/src/importers/encryptrCsvImporter.ts index 3deb155541..adad9aa768 100644 --- a/src/importers/encryptrCsvImporter.ts +++ b/src/importers/encryptrCsvImporter.ts @@ -16,7 +16,7 @@ export class EncryptrCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const cipher = this.initLoginCipher(); cipher.name = this.getValueOrDefault(value.Label, '--'); cipher.notes = this.getValueOrDefault(value.Notes); diff --git a/src/importers/enpassCsvImporter.ts b/src/importers/enpassCsvImporter.ts index 8543ae2f6e..0b421d9687 100644 --- a/src/importers/enpassCsvImporter.ts +++ b/src/importers/enpassCsvImporter.ts @@ -19,7 +19,7 @@ export class EnpassCsvImporter extends BaseImporter implements Importer { } let firstRow = true; - results.forEach((value) => { + results.forEach(value => { if (value.length < 2 || (firstRow && (value[0] === 'Title' || value[0] === 'title'))) { firstRow = false; return; @@ -106,7 +106,7 @@ export class EnpassCsvImporter extends BaseImporter implements Importer { if (fields == null || name == null) { return false; } - return fields.filter((f) => !this.isNullOrWhitespace(f) && + return fields.filter(f => !this.isNullOrWhitespace(f) && f.toLowerCase() === name.toLowerCase()).length > 0; } } diff --git a/src/importers/firefoxCsvImporter.ts b/src/importers/firefoxCsvImporter.ts index 87dd13c35a..fb41cc29a8 100644 --- a/src/importers/firefoxCsvImporter.ts +++ b/src/importers/firefoxCsvImporter.ts @@ -12,7 +12,7 @@ export class FirefoxCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const cipher = this.initLoginCipher(); const url = this.getValueOrDefault(value.url, this.getValueOrDefault(value.hostname)); cipher.name = this.getValueOrDefault(this.nameFromUrl(url), '--'); diff --git a/src/importers/kasperskyTxtImporter.ts b/src/importers/kasperskyTxtImporter.ts index d01f4ba296..efaf92286d 100644 --- a/src/importers/kasperskyTxtImporter.ts +++ b/src/importers/kasperskyTxtImporter.ts @@ -43,7 +43,7 @@ export class KasperskyTxtImporter extends BaseImporter implements Importer { const applications = this.parseDataCategory(applicationsData); const websites = this.parseDataCategory(websitesData); - notes.forEach((n) => { + notes.forEach(n => { const cipher = this.initLoginCipher(); cipher.name = this.getValueOrDefault(n.get('Name')); cipher.notes = this.getValueOrDefault(n.get('Text')); @@ -51,7 +51,7 @@ export class KasperskyTxtImporter extends BaseImporter implements Importer { result.ciphers.push(cipher); }); - websites.concat(applications).forEach((w) => { + websites.concat(applications).forEach(w => { const cipher = this.initLoginCipher(); const nameKey = w.has('Website name') ? 'Website name' : 'Application'; cipher.name = this.getValueOrDefault(w.get(nameKey), ''); @@ -80,14 +80,14 @@ export class KasperskyTxtImporter extends BaseImporter implements Importer { return []; } const items: Map[] = []; - data.split(Delimiter).forEach((p) => { + data.split(Delimiter).forEach(p => { if (p.indexOf('\n') === -1) { return; } const item = new Map(); let itemComment: string; let itemCommentKey: string; - p.split('\n').forEach((l) => { + p.split('\n').forEach(l => { if (itemComment != null) { itemComment += ('\n' + l); return; diff --git a/src/importers/keepass2XmlImporter.ts b/src/importers/keepass2XmlImporter.ts index 604a6f7d26..c91a925f50 100644 --- a/src/importers/keepass2XmlImporter.ts +++ b/src/importers/keepass2XmlImporter.ts @@ -49,11 +49,11 @@ export class KeePass2XmlImporter extends BaseImporter implements Importer { this.result.folders.push(folder); } - this.querySelectorAllDirectChild(node, 'Entry').forEach((entry) => { + this.querySelectorAllDirectChild(node, 'Entry').forEach(entry => { const cipherIndex = this.result.ciphers.length; const cipher = this.initLoginCipher(); - this.querySelectorAllDirectChild(entry, 'String').forEach((entryString) => { + this.querySelectorAllDirectChild(entry, 'String').forEach(entryString => { const valueEl = this.querySelectorDirectChild(entryString, 'Value'); const value = valueEl != null ? valueEl.textContent : null; if (this.isNullOrWhitespace(value)) { @@ -93,7 +93,7 @@ export class KeePass2XmlImporter extends BaseImporter implements Importer { } }); - this.querySelectorAllDirectChild(node, 'Group').forEach((group) => { + this.querySelectorAllDirectChild(node, 'Group').forEach(group => { this.traverse(group, false, groupName); }); } diff --git a/src/importers/keepassxCsvImporter.ts b/src/importers/keepassxCsvImporter.ts index 69a3d2144e..6845c8e8cf 100644 --- a/src/importers/keepassxCsvImporter.ts +++ b/src/importers/keepassxCsvImporter.ts @@ -12,7 +12,7 @@ export class KeePassXCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (this.isNullOrWhitespace(value.Title)) { return; } diff --git a/src/importers/keeperCsvImporter.ts b/src/importers/keeperCsvImporter.ts index 68bfd79dbc..e10b8f3343 100644 --- a/src/importers/keeperCsvImporter.ts +++ b/src/importers/keeperCsvImporter.ts @@ -14,7 +14,7 @@ export class KeeperCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (value.length < 6) { return; } diff --git a/src/importers/lastpassCsvImporter.ts b/src/importers/lastpassCsvImporter.ts index 63c76bffce..5abee25fe2 100644 --- a/src/importers/lastpassCsvImporter.ts +++ b/src/importers/lastpassCsvImporter.ts @@ -233,7 +233,7 @@ export class LastPassCsvImporter extends BaseImporter implements Importer { const dataObj: any = {}; let processingNotes = false; - extraParts.forEach((extraPart) => { + extraParts.forEach(extraPart => { let key: string = null; let val: string = null; if (!processingNotes) { diff --git a/src/importers/logMeOnceCsvImporter.ts b/src/importers/logMeOnceCsvImporter.ts index 8e3542bae5..f6e3c5dbe8 100644 --- a/src/importers/logMeOnceCsvImporter.ts +++ b/src/importers/logMeOnceCsvImporter.ts @@ -12,7 +12,7 @@ export class LogMeOnceCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (value.length < 4) { return; } diff --git a/src/importers/meldiumCsvImporter.ts b/src/importers/meldiumCsvImporter.ts index 98117758b9..0b7ed11d1a 100644 --- a/src/importers/meldiumCsvImporter.ts +++ b/src/importers/meldiumCsvImporter.ts @@ -12,7 +12,7 @@ export class MeldiumCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const cipher = this.initLoginCipher(); cipher.name = this.getValueOrDefault(value.DisplayName, '--'); cipher.notes = this.getValueOrDefault(value.Notes); diff --git a/src/importers/msecureCsvImporter.ts b/src/importers/msecureCsvImporter.ts index e37a76c53e..248b53801a 100644 --- a/src/importers/msecureCsvImporter.ts +++ b/src/importers/msecureCsvImporter.ts @@ -17,7 +17,7 @@ export class MSecureCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (value.length < 3) { return; } diff --git a/src/importers/mykiCsvImporter.ts b/src/importers/mykiCsvImporter.ts index 365cb2cfef..e206ae1a03 100644 --- a/src/importers/mykiCsvImporter.ts +++ b/src/importers/mykiCsvImporter.ts @@ -19,7 +19,7 @@ export class MykiCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const cipher = this.initLoginCipher(); cipher.name = this.getValueOrDefault(value.nickname, '--'); cipher.notes = this.getValueOrDefault(value.additionalInfo); diff --git a/src/importers/onepasswordImporters/onepassword1PifImporter.ts b/src/importers/onepasswordImporters/onepassword1PifImporter.ts index 66f5e77d9b..e82f31852e 100644 --- a/src/importers/onepasswordImporters/onepassword1PifImporter.ts +++ b/src/importers/onepasswordImporters/onepassword1PifImporter.ts @@ -17,7 +17,7 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer { result = new ImportResult(); parse(data: string): Promise { - data.split(this.newLineRegex).forEach((line) => { + data.split(this.newLineRegex).forEach(line => { if (this.isNullOrWhitespace(line) || line[0] !== '{') { return; } @@ -237,7 +237,7 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer { const fieldName = this.isNullOrWhitespace(field[nameKey]) ? 'no_name' : field[nameKey]; if (fieldName === 'password' && cipher.passwordHistory != null && - cipher.passwordHistory.some((h) => h.password === fieldValue)) { + cipher.passwordHistory.some(h => h.password === fieldValue)) { return; } diff --git a/src/importers/onepasswordImporters/onepasswordCsvImporter.ts b/src/importers/onepasswordImporters/onepasswordCsvImporter.ts index 87ee36e54b..b16bebe074 100644 --- a/src/importers/onepasswordImporters/onepasswordCsvImporter.ts +++ b/src/importers/onepasswordImporters/onepasswordCsvImporter.ts @@ -27,7 +27,7 @@ export abstract class OnePasswordCsvImporter extends BaseImporter implements Imp return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (this.isNullOrWhitespace(this.getProp(value, 'title'))) { return; } diff --git a/src/importers/padlockCsvImporter.ts b/src/importers/padlockCsvImporter.ts index 8ec5e8228d..e106af3e49 100644 --- a/src/importers/padlockCsvImporter.ts +++ b/src/importers/padlockCsvImporter.ts @@ -16,7 +16,7 @@ export class PadlockCsvImporter extends BaseImporter implements Importer { } let headers: string[] = null; - results.forEach((value) => { + results.forEach(value => { if (headers == null) { headers = value.map((v: string) => v); return; @@ -29,7 +29,7 @@ export class PadlockCsvImporter extends BaseImporter implements Importer { if (!this.isNullOrWhitespace(value[1])) { if (this.organization) { const tags = (value[1] as string).split(','); - tags.forEach((tag) => { + tags.forEach(tag => { tag = tag.trim(); let addCollection = true; let collectionIndex = result.collections.length; diff --git a/src/importers/passkeepCsvImporter.ts b/src/importers/passkeepCsvImporter.ts index e1c2873c02..a010550c32 100644 --- a/src/importers/passkeepCsvImporter.ts +++ b/src/importers/passkeepCsvImporter.ts @@ -12,7 +12,7 @@ export class PassKeepCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { this.processFolder(result, this.getValue('category', value)); const cipher = this.initLoginCipher(); cipher.notes = this.getValue('description', value); diff --git a/src/importers/passpackCsvImporter.ts b/src/importers/passpackCsvImporter.ts index 3fcdf4120e..d2450b9058 100644 --- a/src/importers/passpackCsvImporter.ts +++ b/src/importers/passpackCsvImporter.ts @@ -14,7 +14,7 @@ export class PasspackCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const tagsJson = !this.isNullOrWhitespace(value.Tags) ? JSON.parse(value.Tags) : null; const tags: string[] = tagsJson != null && tagsJson.tags != null && tagsJson.tags.length > 0 ? tagsJson.tags.map((tagJson: string) => { @@ -26,7 +26,7 @@ export class PasspackCsvImporter extends BaseImporter implements Importer { }).filter((t: string) => !this.isNullOrWhitespace(t)) : null; if (this.organization && tags != null && tags.length > 0) { - tags.forEach((tag) => { + tags.forEach(tag => { let addCollection = true; let collectionIndex = result.collections.length; diff --git a/src/importers/passwordAgentCsvImporter.ts b/src/importers/passwordAgentCsvImporter.ts index d14e8036cc..b505c633b0 100644 --- a/src/importers/passwordAgentCsvImporter.ts +++ b/src/importers/passwordAgentCsvImporter.ts @@ -13,7 +13,7 @@ export class PasswordAgentCsvImporter extends BaseImporter implements Importer { } let newVersion = true; - results.forEach((value) => { + results.forEach(value => { if (value.length !== 5 && value.length < 9) { return; } diff --git a/src/importers/passwordDragonXmlImporter.ts b/src/importers/passwordDragonXmlImporter.ts index 9195fca5ba..15110b8243 100644 --- a/src/importers/passwordDragonXmlImporter.ts +++ b/src/importers/passwordDragonXmlImporter.ts @@ -13,7 +13,7 @@ export class PasswordDragonXmlImporter extends BaseImporter implements Importer } const records = doc.querySelectorAll('PasswordManager > record'); - Array.from(records).forEach((record) => { + Array.from(records).forEach(record => { const category = this.querySelectorDirectChild(record, 'Category'); const categoryText = category != null && !this.isNullOrWhitespace(category.textContent) && category.textContent !== 'Unfiled' ? category.textContent : null; @@ -36,7 +36,7 @@ export class PasswordDragonXmlImporter extends BaseImporter implements Importer attributes.push('Attribute-' + i); } - this.querySelectorAllDirectChild(record, attributes.join(',')).forEach((attr) => { + this.querySelectorAllDirectChild(record, attributes.join(',')).forEach(attr => { if (this.isNullOrWhitespace(attr.textContent) || attr.textContent === 'null') { return; } diff --git a/src/importers/passwordSafeXmlImporter.ts b/src/importers/passwordSafeXmlImporter.ts index e105e186e8..e8e607311c 100644 --- a/src/importers/passwordSafeXmlImporter.ts +++ b/src/importers/passwordSafeXmlImporter.ts @@ -21,7 +21,7 @@ export class PasswordSafeXmlImporter extends BaseImporter implements Importer { const notesDelimiter = passwordSafe.getAttribute('delimiter'); const entries = doc.querySelectorAll('passwordsafe > entry'); - Array.from(entries).forEach((entry) => { + Array.from(entries).forEach(entry => { const group = this.querySelectorDirectChild(entry, 'group'); const groupText = group != null && !this.isNullOrWhitespace(group.textContent) ? group.textContent.split('.').join('/') : null; diff --git a/src/importers/passwordWalletTxtImporter.ts b/src/importers/passwordWalletTxtImporter.ts index 561085aa04..8a27956260 100644 --- a/src/importers/passwordWalletTxtImporter.ts +++ b/src/importers/passwordWalletTxtImporter.ts @@ -12,7 +12,7 @@ export class PasswordWalletTxtImporter extends BaseImporter implements Importer return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (value.length < 1) { return; } diff --git a/src/importers/rememBearCsvImporter.ts b/src/importers/rememBearCsvImporter.ts index bc9aaeb945..c12788b7c2 100644 --- a/src/importers/rememBearCsvImporter.ts +++ b/src/importers/rememBearCsvImporter.ts @@ -16,7 +16,7 @@ export class RememBearCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (value.trash === 'true') { return; } diff --git a/src/importers/roboformCsvImporter.ts b/src/importers/roboformCsvImporter.ts index 99c763665c..cb0c0de8b1 100644 --- a/src/importers/roboformCsvImporter.ts +++ b/src/importers/roboformCsvImporter.ts @@ -13,7 +13,7 @@ export class RoboFormCsvImporter extends BaseImporter implements Importer { } let i = 1; - results.forEach((value) => { + results.forEach(value => { const folder = !this.isNullOrWhitespace(value.Folder) && value.Folder.startsWith('/') ? value.Folder.replace('/', '') : value.Folder; const folderName = !this.isNullOrWhitespace(folder) ? folder : null; diff --git a/src/importers/safeInCloudXmlImporter.ts b/src/importers/safeInCloudXmlImporter.ts index ea22fe2aa4..f1a9569250 100644 --- a/src/importers/safeInCloudXmlImporter.ts +++ b/src/importers/safeInCloudXmlImporter.ts @@ -27,7 +27,7 @@ export class SafeInCloudXmlImporter extends BaseImporter implements Importer { const foldersMap = new Map(); - Array.from(doc.querySelectorAll('database > label')).forEach((labelEl) => { + Array.from(doc.querySelectorAll('database > label')).forEach(labelEl => { const name = labelEl.getAttribute('name'); const id = labelEl.getAttribute('id'); if (!this.isNullOrWhitespace(name) && !this.isNullOrWhitespace(id)) { @@ -38,7 +38,7 @@ export class SafeInCloudXmlImporter extends BaseImporter implements Importer { } }); - Array.from(doc.querySelectorAll('database > card')).forEach((cardEl) => { + Array.from(doc.querySelectorAll('database > card')).forEach(cardEl => { if (cardEl.getAttribute('template') === 'true') { return; } @@ -60,7 +60,7 @@ export class SafeInCloudXmlImporter extends BaseImporter implements Importer { cipher.secureNote = new SecureNoteView(); cipher.secureNote.type = SecureNoteType.Generic; } else { - Array.from(this.querySelectorAllDirectChild(cardEl, 'field')).forEach((fieldEl) => { + Array.from(this.querySelectorAllDirectChild(cardEl, 'field')).forEach(fieldEl => { const text = fieldEl.textContent; if (this.isNullOrWhitespace(text)) { return; @@ -83,7 +83,7 @@ export class SafeInCloudXmlImporter extends BaseImporter implements Importer { }); } - Array.from(this.querySelectorAllDirectChild(cardEl, 'notes')).forEach((notesEl) => { + Array.from(this.querySelectorAllDirectChild(cardEl, 'notes')).forEach(notesEl => { cipher.notes += (notesEl.textContent + '\n'); }); diff --git a/src/importers/saferpassCsvImport.ts b/src/importers/saferpassCsvImport.ts index 3fdad40b8a..1273e74120 100644 --- a/src/importers/saferpassCsvImport.ts +++ b/src/importers/saferpassCsvImport.ts @@ -12,7 +12,7 @@ export class SaferPassCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const cipher = this.initLoginCipher(); cipher.name = this.getValueOrDefault(this.nameFromUrl(value.url), '--'); cipher.notes = this.getValueOrDefault(value.notes); diff --git a/src/importers/secureSafeCsvImporter.ts b/src/importers/secureSafeCsvImporter.ts index 068c70098e..fc15efec96 100644 --- a/src/importers/secureSafeCsvImporter.ts +++ b/src/importers/secureSafeCsvImporter.ts @@ -12,7 +12,7 @@ export class SecureSafeCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const cipher = this.initLoginCipher(); cipher.name = this.getValueOrDefault(value.Title); cipher.notes = this.getValueOrDefault(value.Comment); diff --git a/src/importers/splashIdCsvImporter.ts b/src/importers/splashIdCsvImporter.ts index 9210824c0a..4e895d55c3 100644 --- a/src/importers/splashIdCsvImporter.ts +++ b/src/importers/splashIdCsvImporter.ts @@ -13,7 +13,7 @@ export class SplashIdCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (value.length < 3) { return; } diff --git a/src/importers/stickyPasswordXmlImporter.ts b/src/importers/stickyPasswordXmlImporter.ts index 3955099255..313ab1fcd1 100644 --- a/src/importers/stickyPasswordXmlImporter.ts +++ b/src/importers/stickyPasswordXmlImporter.ts @@ -13,7 +13,7 @@ export class StickyPasswordXmlImporter extends BaseImporter implements Importer } const loginNodes = doc.querySelectorAll('root > Database > Logins > Login'); - Array.from(loginNodes).forEach((loginNode) => { + Array.from(loginNodes).forEach(loginNode => { const accountId = loginNode.getAttribute('ID'); if (this.isNullOrWhitespace(accountId)) { return; diff --git a/src/importers/truekeyCsvImporter.ts b/src/importers/truekeyCsvImporter.ts index a7d8f8f9c9..52f43da81f 100644 --- a/src/importers/truekeyCsvImporter.ts +++ b/src/importers/truekeyCsvImporter.ts @@ -22,7 +22,7 @@ export class TrueKeyCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const cipher = this.initLoginCipher(); cipher.favorite = this.getValueOrDefault(value.favorite, '').toLowerCase() === 'true'; cipher.name = this.getValueOrDefault(value.name, '--'); diff --git a/src/importers/upmCsvImporter.ts b/src/importers/upmCsvImporter.ts index 40cb814b79..23e4ece3e7 100644 --- a/src/importers/upmCsvImporter.ts +++ b/src/importers/upmCsvImporter.ts @@ -12,7 +12,7 @@ export class UpmCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (value.length !== 5) { return; } diff --git a/src/importers/yotiCsvImporter.ts b/src/importers/yotiCsvImporter.ts index abfe0d6c63..56a80d5df7 100644 --- a/src/importers/yotiCsvImporter.ts +++ b/src/importers/yotiCsvImporter.ts @@ -12,7 +12,7 @@ export class YotiCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { const cipher = this.initLoginCipher(); cipher.name = this.getValueOrDefault(value.Name, '--'); cipher.login.username = this.getValueOrDefault(value['User name']); diff --git a/src/importers/zohoVaultCsvImporter.ts b/src/importers/zohoVaultCsvImporter.ts index 4b91e4f5a7..4ff99f2804 100644 --- a/src/importers/zohoVaultCsvImporter.ts +++ b/src/importers/zohoVaultCsvImporter.ts @@ -13,7 +13,7 @@ export class ZohoVaultCsvImporter extends BaseImporter implements Importer { return Promise.resolve(result); } - results.forEach((value) => { + results.forEach(value => { if (this.isNullOrWhitespace(value['Password Name']) && this.isNullOrWhitespace(value['Secret Name'])) { return; } @@ -45,7 +45,7 @@ export class ZohoVaultCsvImporter extends BaseImporter implements Importer { return; } const dataLines = this.splitNewLine(data); - dataLines.forEach((line) => { + dataLines.forEach(line => { const delimPosition = line.indexOf(':'); if (delimPosition < 0) { return; diff --git a/src/misc/analytics.ts b/src/misc/analytics.ts index b6d0808cb9..970e4dee73 100644 --- a/src/misc/analytics.ts +++ b/src/misc/analytics.ts @@ -109,7 +109,7 @@ export class Analytics { } const pathParts = pagePath.split('/'); const newPathParts: string[] = []; - pathParts.forEach((p) => { + pathParts.forEach(p => { if (p.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i)) { newPathParts.push('__guid__'); } else { diff --git a/src/misc/nodeUtils.ts b/src/misc/nodeUtils.ts index e1567e26ba..d3864fe56d 100644 --- a/src/misc/nodeUtils.ts +++ b/src/misc/nodeUtils.ts @@ -19,11 +19,11 @@ export class NodeUtils { const readStream = fs.createReadStream(fileName, {encoding: 'utf8'}); const readInterface = readline.createInterface(readStream); readInterface - .on('line', (line) => { + .on('line', line => { readStream.close(); resolve(line); }) - .on('error', (err) => reject(err)); + .on('error', err => reject(err)); }); } diff --git a/src/misc/serviceUtils.ts b/src/misc/serviceUtils.ts index 50ee43eb7d..f8cb5257fe 100644 --- a/src/misc/serviceUtils.ts +++ b/src/misc/serviceUtils.ts @@ -27,7 +27,7 @@ export class ServiceUtils { return; } - if (nodeTree.filter((n) => n.node.name === partName).length === 0) { + if (nodeTree.filter(n => n.node.name === partName).length === 0) { if (end) { nodeTree.push(new TreeNode(obj, partName, parent)); return; diff --git a/src/misc/utils.ts b/src/misc/utils.ts index b512cb925d..91daaa8938 100644 --- a/src/misc/utils.ts +++ b/src/misc/utils.ts @@ -159,7 +159,7 @@ export class Utils { // ref: http://stackoverflow.com/a/2117523/1090359 static newGuid(): string { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => { // tslint:disable-next-line const r = Math.random() * 16 | 0; // tslint:disable-next-line @@ -242,7 +242,7 @@ export class Utils { } const map = new Map(); const pairs = (url.search[0] === '?' ? url.search.substr(1) : url.search).split('&'); - pairs.forEach((pair) => { + pairs.forEach(pair => { const parts = pair.split('='); if (parts.length < 1) { return; @@ -289,7 +289,7 @@ export class Utils { private static isMobile(win: Window) { let mobile = false; - ((a) => { + (a => { // tslint:disable-next-line if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) { mobile = true; diff --git a/src/models/data/cipherData.ts b/src/models/data/cipherData.ts index fc87ae60d6..487fc5ba6c 100644 --- a/src/models/data/cipherData.ts +++ b/src/models/data/cipherData.ts @@ -72,13 +72,13 @@ export class CipherData { } if (response.fields != null) { - this.fields = response.fields.map((f) => new FieldData(f)); + this.fields = response.fields.map(f => new FieldData(f)); } if (response.attachments != null) { - this.attachments = response.attachments.map((a) => new AttachmentData(a)); + this.attachments = response.attachments.map(a => new AttachmentData(a)); } if (response.passwordHistory != null) { - this.passwordHistory = response.passwordHistory.map((ph) => new PasswordHistoryData(ph)); + this.passwordHistory = response.passwordHistory.map(ph => new PasswordHistoryData(ph)); } } } diff --git a/src/models/data/loginData.ts b/src/models/data/loginData.ts index c173c2f162..90673e5695 100644 --- a/src/models/data/loginData.ts +++ b/src/models/data/loginData.ts @@ -20,7 +20,7 @@ export class LoginData { this.totp = data.totp; if (data.uris) { - this.uris = data.uris.map((u) => new LoginUriData(u)); + this.uris = data.uris.map(u => new LoginUriData(u)); } } } diff --git a/src/models/domain/cipher.ts b/src/models/domain/cipher.ts index ddf78557e1..1a7aaa9032 100644 --- a/src/models/domain/cipher.ts +++ b/src/models/domain/cipher.ts @@ -85,19 +85,19 @@ export class Cipher extends Domain { } if (obj.attachments != null) { - this.attachments = obj.attachments.map((a) => new Attachment(a, alreadyEncrypted)); + this.attachments = obj.attachments.map(a => new Attachment(a, alreadyEncrypted)); } else { this.attachments = null; } if (obj.fields != null) { - this.fields = obj.fields.map((f) => new Field(f, alreadyEncrypted)); + this.fields = obj.fields.map(f => new Field(f, alreadyEncrypted)); } else { this.fields = null; } if (obj.passwordHistory != null) { - this.passwordHistory = obj.passwordHistory.map((ph) => new Password(ph, alreadyEncrypted)); + this.passwordHistory = obj.passwordHistory.map(ph => new Password(ph, alreadyEncrypted)); } else { this.passwordHistory = null; } @@ -135,7 +135,7 @@ export class Cipher extends Domain { await this.attachments.reduce((promise, attachment) => { return promise.then(() => { return attachment.decrypt(orgId, encKey); - }).then((decAttachment) => { + }).then(decAttachment => { attachments.push(decAttachment); }); }, Promise.resolve()); @@ -147,7 +147,7 @@ export class Cipher extends Domain { await this.fields.reduce((promise, field) => { return promise.then(() => { return field.decrypt(orgId, encKey); - }).then((decField) => { + }).then(decField => { fields.push(decField); }); }, Promise.resolve()); @@ -159,7 +159,7 @@ export class Cipher extends Domain { await this.passwordHistory.reduce((promise, ph) => { return promise.then(() => { return ph.decrypt(orgId, encKey); - }).then((decPh) => { + }).then(decPh => { passwordHistory.push(decPh); }); }, Promise.resolve()); @@ -207,13 +207,13 @@ export class Cipher extends Domain { } if (this.fields != null) { - c.fields = this.fields.map((f) => f.toFieldData()); + c.fields = this.fields.map(f => f.toFieldData()); } if (this.attachments != null) { - c.attachments = this.attachments.map((a) => a.toAttachmentData()); + c.attachments = this.attachments.map(a => a.toAttachmentData()); } if (this.passwordHistory != null) { - c.passwordHistory = this.passwordHistory.map((ph) => ph.toPasswordHistoryData()); + c.passwordHistory = this.passwordHistory.map(ph => ph.toPasswordHistoryData()); } return c; } diff --git a/src/models/domain/login.ts b/src/models/domain/login.ts index c8be800447..2dcbeac561 100644 --- a/src/models/domain/login.ts +++ b/src/models/domain/login.ts @@ -30,7 +30,7 @@ export class Login extends Domain { if (obj.uris) { this.uris = []; - obj.uris.forEach((u) => { + obj.uris.forEach(u => { this.uris.push(new LoginUri(u, alreadyEncrypted)); }); } @@ -65,7 +65,7 @@ export class Login extends Domain { if (this.uris != null && this.uris.length > 0) { l.uris = []; - this.uris.forEach((u) => { + this.uris.forEach(u => { l.uris.push(u.toLoginUriData()); }); } diff --git a/src/models/export/cipher.ts b/src/models/export/cipher.ts index d88db8f7a4..abb4438b04 100644 --- a/src/models/export/cipher.ts +++ b/src/models/export/cipher.ts @@ -39,7 +39,7 @@ export class Cipher { view.favorite = req.favorite; if (req.fields != null) { - view.fields = req.fields.map((f) => Field.toView(f)); + view.fields = req.fields.map(f => Field.toView(f)); } switch (req.type) { @@ -71,7 +71,7 @@ export class Cipher { domain.favorite = req.favorite; if (req.fields != null) { - domain.fields = req.fields.map((f) => Field.toDomain(f)); + domain.fields = req.fields.map(f => Field.toDomain(f)); } switch (req.type) { @@ -122,9 +122,9 @@ export class Cipher { if (o.fields != null) { if (o instanceof CipherView) { - this.fields = o.fields.map((f) => new Field(f)); + this.fields = o.fields.map(f => new Field(f)); } else { - this.fields = o.fields.map((f) => new Field(f)); + this.fields = o.fields.map(f => new Field(f)); } } diff --git a/src/models/export/login.ts b/src/models/export/login.ts index 4bf487b6f1..8c275746cd 100644 --- a/src/models/export/login.ts +++ b/src/models/export/login.ts @@ -17,7 +17,7 @@ export class Login { static toView(req: Login, view = new LoginView()) { if (req.uris != null) { - view.uris = req.uris.map((u) => LoginUri.toView(u)); + view.uris = req.uris.map(u => LoginUri.toView(u)); } view.username = req.username; view.password = req.password; @@ -27,7 +27,7 @@ export class Login { static toDomain(req: Login, domain = new LoginDomain()) { if (req.uris != null) { - domain.uris = req.uris.map((u) => LoginUri.toDomain(u)); + domain.uris = req.uris.map(u => LoginUri.toDomain(u)); } domain.username = req.username != null ? new CipherString(req.username) : null; domain.password = req.password != null ? new CipherString(req.password) : null; @@ -47,9 +47,9 @@ export class Login { if (o.uris != null) { if (o instanceof LoginView) { - this.uris = o.uris.map((u) => new LoginUri(u)); + this.uris = o.uris.map(u => new LoginUri(u)); } else { - this.uris = o.uris.map((u) => new LoginUri(u)); + this.uris = o.uris.map(u => new LoginUri(u)); } } diff --git a/src/models/request/cipherBulkShareRequest.ts b/src/models/request/cipherBulkShareRequest.ts index 413212e1ae..5d1e6781ef 100644 --- a/src/models/request/cipherBulkShareRequest.ts +++ b/src/models/request/cipherBulkShareRequest.ts @@ -9,7 +9,7 @@ export class CipherBulkShareRequest { constructor(ciphers: Cipher[], collectionIds: string[]) { if (ciphers != null) { this.ciphers = []; - ciphers.forEach((c) => { + ciphers.forEach(c => { this.ciphers.push(new CipherWithIdRequest(c)); }); } diff --git a/src/models/request/cipherRequest.ts b/src/models/request/cipherRequest.ts index 5c1e950311..cdd0087d9d 100644 --- a/src/models/request/cipherRequest.ts +++ b/src/models/request/cipherRequest.ts @@ -50,7 +50,7 @@ export class CipherRequest { this.login.totp = cipher.login.totp ? cipher.login.totp.encryptedString : null; if (cipher.login.uris != null) { - this.login.uris = cipher.login.uris.map((u) => { + this.login.uris = cipher.login.uris.map(u => { const uri = new LoginUriApi(); uri.uri = u.uri != null ? u.uri.encryptedString : null; uri.match = u.match != null ? u.match : null; @@ -110,7 +110,7 @@ export class CipherRequest { } if (cipher.fields != null) { - this.fields = cipher.fields.map((f) => { + this.fields = cipher.fields.map(f => { const field = new FieldApi(); field.type = f.type; field.name = f.name ? f.name.encryptedString : null; @@ -121,7 +121,7 @@ export class CipherRequest { if (cipher.passwordHistory != null) { this.passwordHistory = []; - cipher.passwordHistory.forEach((ph) => { + cipher.passwordHistory.forEach(ph => { this.passwordHistory.push({ lastUsedDate: ph.lastUsedDate, password: ph.password ? ph.password.encryptedString : null, @@ -132,7 +132,7 @@ export class CipherRequest { if (cipher.attachments != null) { this.attachments = {}; this.attachments2 = {}; - cipher.attachments.forEach((attachment) => { + cipher.attachments.forEach(attachment => { const fileName = attachment.fileName ? attachment.fileName.encryptedString : null; this.attachments[attachment.id] = fileName; const attachmentRequest = new AttachmentRequest(); diff --git a/src/models/view/loginView.ts b/src/models/view/loginView.ts index a891f9d231..24c8f0aca4 100644 --- a/src/models/view/loginView.ts +++ b/src/models/view/loginView.ts @@ -32,7 +32,7 @@ export class LoginView implements View { } get canLaunch(): boolean { - return this.hasUris && this.uris.some((u) => u.canLaunch); + return this.hasUris && this.uris.some(u => u.canLaunch); } get hasTotp(): boolean { @@ -41,7 +41,7 @@ export class LoginView implements View { get launchUri(): string { if (this.hasUris) { - const uri = this.uris.find((u) => u.canLaunch); + const uri = this.uris.find(u => u.canLaunch); if (uri != null) { return uri.launchUri; } diff --git a/src/services/api.service.ts b/src/services/api.service.ts index 41908283f3..793762889d 100644 --- a/src/services/api.service.ts +++ b/src/services/api.service.ts @@ -1312,7 +1312,7 @@ export class ApiService implements ApiServiceAbstraction { } private qsStringify(params: any): string { - return Object.keys(params).map((key) => { + return Object.keys(params).map(key => { return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]); }).join('&'); } diff --git a/src/services/audit.service.ts b/src/services/audit.service.ts index 1282ce2bd3..db9a045730 100644 --- a/src/services/audit.service.ts +++ b/src/services/audit.service.ts @@ -22,7 +22,7 @@ export class AuditService implements AuditServiceAbstraction { const response = await this.apiService.nativeFetch(new Request(PwnedPasswordsApi + hashStart)); const leakedHashes = await response.text(); - const match = leakedHashes.split(/\r?\n/).find((v) => { + const match = leakedHashes.split(/\r?\n/).find(v => { return v.split(':')[0] === hashEnding; }); diff --git a/src/services/broadcaster.service.ts b/src/services/broadcaster.service.ts index beda9c1c55..6dfbfa6454 100644 --- a/src/services/broadcaster.service.ts +++ b/src/services/broadcaster.service.ts @@ -11,7 +11,7 @@ export class BroadcasterService implements BroadcasterServiceAbstraction { return; } - this.subscribers.forEach((value) => { + this.subscribers.forEach(value => { value(message); }); } diff --git a/src/services/cipher.service.ts b/src/services/cipher.service.ts index 539321f5db..c004f6dca7 100644 --- a/src/services/cipher.service.ts +++ b/src/services/cipher.service.ts @@ -113,12 +113,12 @@ export class CipherService implements CipherServiceAbstraction { } } if (existingCipher.hasFields) { - const existingHiddenFields = existingCipher.fields.filter((f) => f.type === FieldType.Hidden && + const existingHiddenFields = existingCipher.fields.filter(f => f.type === FieldType.Hidden && f.name != null && f.name !== '' && f.value != null && f.value !== ''); const hiddenFields = model.fields == null ? [] : - model.fields.filter((f) => f.type === FieldType.Hidden && f.name != null && f.name !== ''); - existingHiddenFields.forEach((ef) => { - const matchedField = hiddenFields.find((f) => f.name === ef.name); + model.fields.filter(f => f.type === FieldType.Hidden && f.name != null && f.name !== ''); + existingHiddenFields.forEach(ef => { + const matchedField = hiddenFields.find(f => f.name === ef.name); if (matchedField == null || matchedField.value !== ef.value) { const ph = new PasswordHistoryView(); ph.password = ef.name + ': ' + ef.value; @@ -157,13 +157,13 @@ export class CipherService implements CipherServiceAbstraction { notes: null, }, key), this.encryptCipherData(cipher, model, key), - this.encryptFields(model.fields, key).then((fields) => { + this.encryptFields(model.fields, key).then(fields => { cipher.fields = fields; }), - this.encryptPasswordHistories(model.passwordHistory, key).then((ph) => { + this.encryptPasswordHistories(model.passwordHistory, key).then(ph => { cipher.passwordHistory = ph; }), - this.encryptAttachments(model.attachments, key).then((attachments) => { + this.encryptAttachments(model.attachments, key).then(attachments => { cipher.attachments = attachments; }), ]); @@ -178,7 +178,7 @@ export class CipherService implements CipherServiceAbstraction { const promises: Promise[] = []; const encAttachments: Attachment[] = []; - attachmentsModel.forEach(async (model) => { + attachmentsModel.forEach(async model => { const attachment = new Attachment(); attachment.id = model.id; attachment.size = model.size; @@ -302,8 +302,8 @@ export class CipherService implements CipherServiceAbstraction { const promises: any[] = []; const ciphers = await this.getAll(); - ciphers.forEach((cipher) => { - promises.push(cipher.decrypt().then((c) => decCiphers.push(c))); + ciphers.forEach(cipher => { + promises.push(cipher.decrypt().then(c => decCiphers.push(c))); }); await Promise.all(promises); @@ -315,7 +315,7 @@ export class CipherService implements CipherServiceAbstraction { async getAllDecryptedForGrouping(groupingId: string, folder: boolean = true): Promise { const ciphers = await this.getAllDecrypted(); - return ciphers.filter((cipher) => { + return ciphers.filter(cipher => { if (cipher.isDeleted) { return false; } @@ -339,7 +339,7 @@ export class CipherService implements CipherServiceAbstraction { const eqDomainsPromise = domain == null ? Promise.resolve([]) : this.settingsService.getEquivalentDomains().then((eqDomains: any[][]) => { let matches: any[] = []; - eqDomains.forEach((eqDomain) => { + eqDomains.forEach(eqDomain => { if (eqDomain.length && eqDomain.indexOf(domain) >= 0) { matches = matches.concat(eqDomain); } @@ -363,7 +363,7 @@ export class CipherService implements CipherServiceAbstraction { } } - return ciphers.filter((cipher) => { + return ciphers.filter(cipher => { if (cipher.deletedDate != null) { return false; } @@ -432,10 +432,10 @@ export class CipherService implements CipherServiceAbstraction { if (ciphers != null && ciphers.data != null && ciphers.data.length) { const decCiphers: CipherView[] = []; const promises: any[] = []; - ciphers.data.forEach((r) => { + ciphers.data.forEach(r => { const data = new CipherData(r); const cipher = new Cipher(data); - promises.push(cipher.decrypt().then((c) => decCiphers.push(c))); + promises.push(cipher.decrypt().then(c => decCiphers.push(c))); }); await Promise.all(promises); decCiphers.sort(this.getLocaleSortingFunction()); @@ -556,7 +556,7 @@ export class CipherService implements CipherServiceAbstraction { async shareWithServer(cipher: CipherView, organizationId: string, collectionIds: string[]): Promise { const attachmentPromises: Promise[] = []; if (cipher.attachments != null) { - cipher.attachments.forEach((attachment) => { + cipher.attachments.forEach(attachment => { if (attachment.key == null) { attachmentPromises.push(this.shareAttachmentWithServer(attachment, cipher.id, organizationId)); } @@ -580,7 +580,7 @@ export class CipherService implements CipherServiceAbstraction { for (const cipher of ciphers) { cipher.organizationId = organizationId; cipher.collectionIds = collectionIds; - promises.push(this.encrypt(cipher).then((c) => { + promises.push(this.encrypt(cipher).then(c => { encCiphers.push(c); })); } @@ -588,7 +588,7 @@ export class CipherService implements CipherServiceAbstraction { const request = new CipherBulkShareRequest(encCiphers, collectionIds); await this.apiService.putShareCiphers(request); const userId = await this.userService.getUserId(); - await this.upsert(encCiphers.map((c) => c.toCipherData(userId))); + await this.upsert(encCiphers.map(c => c.toCipherData(userId))); } saveAttachmentWithServer(cipher: Cipher, unencryptedFile: any, admin = false): Promise { @@ -604,7 +604,7 @@ export class CipherService implements CipherServiceAbstraction { reject(e); } }; - reader.onerror = (evt) => { + reader.onerror = evt => { reject('Error reading file.'); }; }); @@ -674,7 +674,7 @@ export class CipherService implements CipherServiceAbstraction { const c = cipher as CipherData; ciphers[c.id] = c; } else { - (cipher as CipherData[]).forEach((c) => { + (cipher as CipherData[]).forEach(c => { ciphers[c.id] = c; }); } @@ -704,7 +704,7 @@ export class CipherService implements CipherServiceAbstraction { ciphers = {}; } - ids.forEach((id) => { + ids.forEach(id => { if (ciphers.hasOwnProperty(id)) { ciphers[id].folderId = folderId; } @@ -728,7 +728,7 @@ export class CipherService implements CipherServiceAbstraction { } delete ciphers[id]; } else { - (id as string[]).forEach((i) => { + (id as string[]).forEach(i => { delete ciphers[i]; }); } diff --git a/src/services/collection.service.ts b/src/services/collection.service.ts index 61e233ff65..3c594080f8 100644 --- a/src/services/collection.service.ts +++ b/src/services/collection.service.ts @@ -52,8 +52,8 @@ export class CollectionService implements CollectionServiceAbstraction { } const decCollections: CollectionView[] = []; const promises: Promise[] = []; - collections.forEach((collection) => { - promises.push(collection.decrypt().then((c) => decCollections.push(c))); + collections.forEach(collection => { + promises.push(collection.decrypt().then(c => decCollections.push(c))); }); await Promise.all(promises); return decCollections.sort(Utils.getSortFunction(this.i18nService, 'name')); @@ -103,7 +103,7 @@ export class CollectionService implements CollectionServiceAbstraction { collections = await this.getAllDecrypted(); } const nodes: TreeNode[] = []; - collections.forEach((c) => { + collections.forEach(c => { const collectionCopy = new CollectionView(); collectionCopy.id = c.id; collectionCopy.organizationId = c.organizationId; @@ -130,7 +130,7 @@ export class CollectionService implements CollectionServiceAbstraction { const c = collection as CollectionData; collections[c.id] = c; } else { - (collection as CollectionData[]).forEach((c) => { + (collection as CollectionData[]).forEach(c => { collections[c.id] = c; }); } @@ -162,7 +162,7 @@ export class CollectionService implements CollectionServiceAbstraction { const i = id as string; delete collections[id]; } else { - (id as string[]).forEach((i) => { + (id as string[]).forEach(i => { delete collections[i]; }); } diff --git a/src/services/crypto.service.ts b/src/services/crypto.service.ts index f2040caf81..6eadd432a7 100644 --- a/src/services/crypto.service.ts +++ b/src/services/crypto.service.ts @@ -80,7 +80,7 @@ export class CryptoService implements CryptoServiceAbstraction { setOrgKeys(orgs: ProfileOrganizationResponse[]): Promise<{}> { const orgKeys: any = {}; - orgs.forEach((org) => { + orgs.forEach(org => { orgKeys[org.id] = org.key; }); diff --git a/src/services/event.service.ts b/src/services/event.service.ts index 316073d3e5..b34cd4b69a 100644 --- a/src/services/event.service.ts +++ b/src/services/event.service.ts @@ -39,7 +39,7 @@ export class EventService implements EventServiceAbstraction { if (organizations == null) { return; } - const orgIds = new Set(organizations.filter((o) => o.useEvents).map((o) => o.id)); + const orgIds = new Set(organizations.filter(o => o.useEvents).map(o => o.id)); if (orgIds.size === 0) { return; } @@ -73,7 +73,7 @@ export class EventService implements EventServiceAbstraction { if (eventCollection == null || eventCollection.length === 0) { return; } - const request = eventCollection.map((e) => { + const request = eventCollection.map(e => { const req = new EventRequest(); req.type = e.type; req.cipherId = e.cipherId; diff --git a/src/services/export.service.ts b/src/services/export.service.ts index 77a020d864..a53ce3d104 100644 --- a/src/services/export.service.ts +++ b/src/services/export.service.ts @@ -59,11 +59,11 @@ export class ExportService implements ExportServiceAbstraction { let decCiphers: CipherView[] = []; const promises = []; - promises.push(this.folderService.getAllDecrypted().then((folders) => { + promises.push(this.folderService.getAllDecrypted().then(folders => { decFolders = folders; })); - promises.push(this.cipherService.getAllDecrypted().then((ciphers) => { + promises.push(this.cipherService.getAllDecrypted().then(ciphers => { decCiphers = ciphers.filter(f => f.deletedDate == null); })); @@ -71,14 +71,14 @@ export class ExportService implements ExportServiceAbstraction { if (format === 'csv') { const foldersMap = new Map(); - decFolders.forEach((f) => { + decFolders.forEach(f => { if (f.id != null) { foldersMap.set(f.id, f); } }); const exportCiphers: any[] = []; - decCiphers.forEach((c) => { + decCiphers.forEach(c => { // only export logins and secure notes if (c.type !== CipherType.Login && c.type !== CipherType.SecureNote) { return; @@ -103,7 +103,7 @@ export class ExportService implements ExportServiceAbstraction { items: [], }; - decFolders.forEach((f) => { + decFolders.forEach(f => { if (f.id == null) { return; } @@ -112,7 +112,7 @@ export class ExportService implements ExportServiceAbstraction { jsonDoc.folders.push(folder); }); - decCiphers.forEach((c) => { + decCiphers.forEach(c => { if (c.organizationId != null) { return; } @@ -131,12 +131,12 @@ export class ExportService implements ExportServiceAbstraction { let ciphers: Cipher[] = []; const promises = []; - promises.push(this.folderService.getAll().then((f) => { + promises.push(this.folderService.getAll().then(f => { folders = f; })); - promises.push(this.cipherService.getAll().then((c) => { - ciphers = c.filter((f) => f.deletedDate == null); + promises.push(this.cipherService.getAll().then(c => { + ciphers = c.filter(f => f.deletedDate == null); })); await Promise.all(promises); @@ -147,7 +147,7 @@ export class ExportService implements ExportServiceAbstraction { items: [], }; - folders.forEach((f) => { + folders.forEach(f => { if (f.id == null) { return; } @@ -156,7 +156,7 @@ export class ExportService implements ExportServiceAbstraction { jsonDoc.folders.push(folder); }); - ciphers.forEach((c) => { + ciphers.forEach(c => { if (c.organizationId != null) { return; } @@ -174,12 +174,12 @@ export class ExportService implements ExportServiceAbstraction { const decCiphers: CipherView[] = []; const promises = []; - promises.push(this.apiService.getCollections(organizationId).then((collections) => { + promises.push(this.apiService.getCollections(organizationId).then(collections => { const collectionPromises: any = []; if (collections != null && collections.data != null && collections.data.length > 0) { - collections.data.forEach((c) => { + collections.data.forEach(c => { const collection = new Collection(new CollectionData(c as CollectionDetailsResponse)); - collectionPromises.push(collection.decrypt().then((decCol) => { + collectionPromises.push(collection.decrypt().then(decCol => { decCollections.push(decCol); })); }); @@ -187,12 +187,12 @@ export class ExportService implements ExportServiceAbstraction { return Promise.all(collectionPromises); })); - promises.push(this.apiService.getCiphersOrganization(organizationId).then((ciphers) => { + promises.push(this.apiService.getCiphersOrganization(organizationId).then(ciphers => { const cipherPromises: any = []; if (ciphers != null && ciphers.data != null && ciphers.data.length > 0) { - ciphers.data.filter((c) => c.deletedDate === null).forEach((c) => { + ciphers.data.filter(c => c.deletedDate === null).forEach(c => { const cipher = new Cipher(new CipherData(c)); - cipherPromises.push(cipher.decrypt().then((decCipher) => { + cipherPromises.push(cipher.decrypt().then(decCipher => { decCiphers.push(decCipher); })); }); @@ -204,12 +204,12 @@ export class ExportService implements ExportServiceAbstraction { if (format === 'csv') { const collectionsMap = new Map(); - decCollections.forEach((c) => { + decCollections.forEach(c => { collectionsMap.set(c.id, c); }); const exportCiphers: any[] = []; - decCiphers.forEach((c) => { + decCiphers.forEach(c => { // only export logins and secure notes if (c.type !== CipherType.Login && c.type !== CipherType.SecureNote) { return; @@ -218,8 +218,8 @@ export class ExportService implements ExportServiceAbstraction { const cipher: any = {}; cipher.collections = []; if (c.collectionIds != null) { - cipher.collections = c.collectionIds.filter((id) => collectionsMap.has(id)) - .map((id) => collectionsMap.get(id).name); + cipher.collections = c.collectionIds.filter(id => collectionsMap.has(id)) + .map(id => collectionsMap.get(id).name); } this.buildCommonCipher(cipher, c); exportCiphers.push(cipher); @@ -233,13 +233,13 @@ export class ExportService implements ExportServiceAbstraction { items: [], }; - decCollections.forEach((c) => { + decCollections.forEach(c => { const collection = new CollectionExport(); collection.build(c); jsonDoc.collections.push(collection); }); - decCiphers.forEach((c) => { + decCiphers.forEach(c => { const cipher = new CipherExport(); cipher.build(c); jsonDoc.items.push(cipher); @@ -253,10 +253,10 @@ export class ExportService implements ExportServiceAbstraction { const ciphers: Cipher[] = []; const promises = []; - promises.push(this.apiService.getCollections(organizationId).then((c) => { + promises.push(this.apiService.getCollections(organizationId).then(c => { const collectionPromises: any = []; if (c != null && c.data != null && c.data.length > 0) { - c.data.forEach((r) => { + c.data.forEach(r => { const collection = new Collection(new CollectionData(r as CollectionDetailsResponse)); collections.push(collection); }); @@ -264,10 +264,10 @@ export class ExportService implements ExportServiceAbstraction { return Promise.all(collectionPromises); })); - promises.push(this.apiService.getCiphersOrganization(organizationId).then((c) => { + promises.push(this.apiService.getCiphersOrganization(organizationId).then(c => { const cipherPromises: any = []; if (c != null && c.data != null && c.data.length > 0) { - c.data.filter((item) => item.deletedDate === null).forEach((item) => { + c.data.filter(item => item.deletedDate === null).forEach(item => { const cipher = new Cipher(new CipherData(item)); ciphers.push(cipher); }); @@ -283,13 +283,13 @@ export class ExportService implements ExportServiceAbstraction { items: [], }; - collections.forEach((c) => { + collections.forEach(c => { const collection = new CollectionExport(); collection.build(c); jsonDoc.collections.push(collection); }); - ciphers.forEach((c) => { + ciphers.forEach(c => { const cipher = new CipherExport(); cipher.build(c); jsonDoc.items.push(cipher); @@ -335,7 +335,7 @@ export class ExportService implements ExportServiceAbstraction { if (c.login.uris) { cipher.login_uri = []; - c.login.uris.forEach((u) => { + c.login.uris.forEach(u => { cipher.login_uri.push(u.uri); }); } diff --git a/src/services/folder.service.ts b/src/services/folder.service.ts index dad533973a..0f3ae50e23 100644 --- a/src/services/folder.service.ts +++ b/src/services/folder.service.ts @@ -83,8 +83,8 @@ export class FolderService implements FolderServiceAbstraction { const decFolders: FolderView[] = []; const promises: Promise[] = []; const folders = await this.getAll(); - folders.forEach((folder) => { - promises.push(folder.decrypt().then((f) => decFolders.push(f))); + folders.forEach(folder => { + promises.push(folder.decrypt().then(f => decFolders.push(f))); }); await Promise.all(promises); @@ -101,7 +101,7 @@ export class FolderService implements FolderServiceAbstraction { async getAllNested(): Promise[]> { const folders = await this.getAllDecrypted(); const nodes: TreeNode[] = []; - folders.forEach((f) => { + folders.forEach(f => { const folderCopy = new FolderView(); folderCopy.id = f.id; folderCopy.revisionDate = f.revisionDate; @@ -144,7 +144,7 @@ export class FolderService implements FolderServiceAbstraction { const f = folder as FolderData; folders[f.id] = f; } else { - (folder as FolderData[]).forEach((f) => { + (folder as FolderData[]).forEach(f => { folders[f.id] = f; }); } @@ -178,7 +178,7 @@ export class FolderService implements FolderServiceAbstraction { } delete folders[id]; } else { - (id as string[]).forEach((i) => { + (id as string[]).forEach(i => { delete folders[i]; }); } diff --git a/src/services/import.service.ts b/src/services/import.service.ts index d41cee06bd..26cb1412d6 100644 --- a/src/services/import.service.ts +++ b/src/services/import.service.ts @@ -306,7 +306,7 @@ export class ImportService implements ImportServiceAbstraction { } } if (importResult.folderRelationships != null) { - importResult.folderRelationships.forEach((r) => + importResult.folderRelationships.forEach(r => request.folderRelationships.push(new KvpRequest(r[0], r[1]))); } return await this.apiService.postImportCiphers(request); @@ -325,7 +325,7 @@ export class ImportService implements ImportServiceAbstraction { } } if (importResult.collectionRelationships != null) { - importResult.collectionRelationships.forEach((r) => + importResult.collectionRelationships.forEach(r => request.collectionRelationships.push(new KvpRequest(r[0], r[1]))); } return await this.apiService.postImportOrganizationCiphers(organizationId, request); diff --git a/src/services/passwordGeneration.service.ts b/src/services/passwordGeneration.service.ts index fc83dcb0d5..6bce0a1732 100644 --- a/src/services/passwordGeneration.service.ts +++ b/src/services/passwordGeneration.service.ts @@ -269,7 +269,7 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr return enforcedOptions; } - policies.forEach((currentPolicy) => { + policies.forEach(currentPolicy => { if (!currentPolicy.enabled || currentPolicy.data == null) { return; } @@ -471,7 +471,7 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr return Promise.resolve([]); } - const promises = history.map(async (item) => { + const promises = history.map(async item => { const encrypted = await this.cryptoService.encrypt(item.password); return new GeneratedPasswordHistory(encrypted.encryptedString, item.date); }); @@ -484,7 +484,7 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr return Promise.resolve([]); } - const promises = history.map(async (item) => { + const promises = history.map(async item => { const decrypted = await this.cryptoService.decryptToUtf8(new CipherString(item.password)); return new GeneratedPasswordHistory(decrypted, item.date); }); diff --git a/src/services/policy.service.ts b/src/services/policy.service.ts index 6d3dcb7518..a929aec9d4 100644 --- a/src/services/policy.service.ts +++ b/src/services/policy.service.ts @@ -37,7 +37,7 @@ export class PolicyService implements PolicyServiceAbstraction { this.policyCache = response; } if (type != null) { - return this.policyCache.filter((p) => p.type === type); + return this.policyCache.filter(p => p.type === type); } else { return this.policyCache; } @@ -60,14 +60,14 @@ export class PolicyService implements PolicyServiceAbstraction { if (policies == null) { policies = await this.getAll(PolicyType.MasterPassword); } else { - policies = policies.filter((p) => p.type === PolicyType.MasterPassword); + policies = policies.filter(p => p.type === PolicyType.MasterPassword); } if (policies == null || policies.length === 0) { return enforcedOptions; } - policies.forEach((currentPolicy) => { + policies.forEach(currentPolicy => { if (!currentPolicy.enabled || currentPolicy.data == null) { return; } diff --git a/src/services/search.service.ts b/src/services/search.service.ts index 0fc96ac5b0..fee647dc5c 100644 --- a/src/services/search.service.ts +++ b/src/services/search.service.ts @@ -61,7 +61,7 @@ export class SearchService implements SearchServiceAbstraction { { extractor: (c: CipherView) => this.attachmentExtractor(c, true) }); builder.field('organizationid', { extractor: (c: CipherView) => c.organizationId }); const ciphers = await this.cipherService.getAllDecrypted(); - ciphers.forEach((c) => builder.add(c)); + ciphers.forEach(c => builder.add(c)); this.index = builder.build(); this.indexing = false; @@ -85,7 +85,7 @@ export class SearchService implements SearchServiceAbstraction { } if (filter != null && Array.isArray(filter) && filter.length > 0) { - ciphers = ciphers.filter((c) => filter.every((f) => f == null || f(c))); + ciphers = ciphers.filter(c => filter.every(f => f == null || f(c))); } else if (filter != null) { ciphers = ciphers.filter(filter as (cipher: CipherView) => boolean); } @@ -95,9 +95,9 @@ export class SearchService implements SearchServiceAbstraction { } if (this.indexing) { - await new Promise((r) => setTimeout(r, 250)); + await new Promise(r => setTimeout(r, 250)); if (this.indexing) { - await new Promise((r) => setTimeout(r, 500)); + await new Promise(r => setTimeout(r, 500)); } } @@ -108,7 +108,7 @@ export class SearchService implements SearchServiceAbstraction { } const ciphersMap = new Map(); - ciphers.forEach((c) => ciphersMap.set(c.id, c)); + ciphers.forEach(c => ciphersMap.set(c.id, c)); let searchResults: lunr.Index.Result[] = null; const isQueryString = query != null && query.length > 1 && query.indexOf('>') === 0; @@ -119,8 +119,8 @@ export class SearchService implements SearchServiceAbstraction { } else { // tslint:disable-next-line const soWild = lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING; - searchResults = index.query((q) => { - lunr.tokenizer(query).forEach((token) => { + searchResults = index.query(q => { + lunr.tokenizer(query).forEach(token => { const t = token.toString(); q.term(t, { fields: ['name'], wildcard: soWild }); q.term(t, { fields: ['subtitle'], wildcard: soWild }); @@ -131,7 +131,7 @@ export class SearchService implements SearchServiceAbstraction { } if (searchResults != null) { - searchResults.forEach((r) => { + searchResults.forEach(r => { if (ciphersMap.has(r.ref)) { results.push(ciphersMap.get(r.ref)); } @@ -142,7 +142,7 @@ export class SearchService implements SearchServiceAbstraction { searchCiphersBasic(ciphers: CipherView[], query: string, deleted: boolean = false) { query = query.trim().toLowerCase(); - return ciphers.filter((c) => { + return ciphers.filter(c => { if (deleted !== c.isDeleted) { return false; } @@ -193,7 +193,7 @@ export class SearchService implements SearchServiceAbstraction { return null; } let fields: string[] = []; - c.fields.forEach((f) => { + c.fields.forEach(f => { if (f.name != null) { fields.push(f.name); } @@ -201,7 +201,7 @@ export class SearchService implements SearchServiceAbstraction { fields.push(f.value); } }); - fields = fields.filter((f) => f.trim() !== ''); + fields = fields.filter(f => f.trim() !== ''); if (fields.length === 0) { return null; } @@ -213,7 +213,7 @@ export class SearchService implements SearchServiceAbstraction { return null; } let attachments: string[] = []; - c.attachments.forEach((a) => { + c.attachments.forEach(a => { if (a != null && a.fileName != null) { if (joined && a.fileName.indexOf('.') > -1) { attachments.push(a.fileName.substr(0, a.fileName.lastIndexOf('.'))); @@ -222,7 +222,7 @@ export class SearchService implements SearchServiceAbstraction { } } }); - attachments = attachments.filter((f) => f.trim() !== ''); + attachments = attachments.filter(f => f.trim() !== ''); if (attachments.length === 0) { return null; } @@ -234,7 +234,7 @@ export class SearchService implements SearchServiceAbstraction { return null; } const uris: string[] = []; - c.login.uris.forEach((u) => { + c.login.uris.forEach(u => { if (u.uri == null || u.uri === '') { return; } diff --git a/src/services/send.service.ts b/src/services/send.service.ts index 284f60cce3..5a37c242d1 100644 --- a/src/services/send.service.ts +++ b/src/services/send.service.ts @@ -115,8 +115,8 @@ export class SendService implements SendServiceAbstraction { const decSends: SendView[] = []; const promises: Promise[] = []; const sends = await this.getAll(); - sends.forEach((send) => { - promises.push(send.decrypt().then((f) => decSends.push(f))); + sends.forEach(send => { + promises.push(send.decrypt().then(f => decSends.push(f))); }); await Promise.all(promises); @@ -173,7 +173,7 @@ export class SendService implements SendServiceAbstraction { const s = send as SendData; sends[s.id] = s; } else { - (send as SendData[]).forEach((s) => { + (send as SendData[]).forEach(s => { sends[s.id] = s; }); } @@ -207,7 +207,7 @@ export class SendService implements SendServiceAbstraction { } delete sends[id]; } else { - (id as string[]).forEach((i) => { + (id as string[]).forEach(i => { delete sends[i]; }); } @@ -232,7 +232,7 @@ export class SendService implements SendServiceAbstraction { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.readAsArrayBuffer(file); - reader.onload = async (evt) => { + reader.onload = async evt => { try { const [name, data] = await this.encryptFileData(file.name, evt.target.result as ArrayBuffer, key); send.file.fileName = name; @@ -241,7 +241,7 @@ export class SendService implements SendServiceAbstraction { reject(e); } }; - reader.onerror = (evt) => { + reader.onerror = evt => { reject('Error reading file.'); }; }); diff --git a/src/services/sync.service.ts b/src/services/sync.service.ts index a609748b58..55cc58fa16 100644 --- a/src/services/sync.service.ts +++ b/src/services/sync.service.ts @@ -290,7 +290,7 @@ export class SyncService implements SyncServiceAbstraction { await this.userService.setSecurityStamp(response.securityStamp); const organizations: { [id: string]: OrganizationData; } = {}; - response.organizations.forEach((o) => { + response.organizations.forEach(o => { organizations[o.id] = new OrganizationData(o); }); return await this.userService.replaceOrganizations(organizations); @@ -298,7 +298,7 @@ export class SyncService implements SyncServiceAbstraction { private async syncFolders(userId: string, response: FolderResponse[]) { const folders: { [id: string]: FolderData; } = {}; - response.forEach((f) => { + response.forEach(f => { folders[f.id] = new FolderData(f, userId); }); return await this.folderService.replace(folders); @@ -306,7 +306,7 @@ export class SyncService implements SyncServiceAbstraction { private async syncCollections(response: CollectionDetailsResponse[]) { const collections: { [id: string]: CollectionData; } = {}; - response.forEach((c) => { + response.forEach(c => { collections[c.id] = new CollectionData(c); }); return await this.collectionService.replace(collections); @@ -314,7 +314,7 @@ export class SyncService implements SyncServiceAbstraction { private async syncCiphers(userId: string, response: CipherResponse[]) { const ciphers: { [id: string]: CipherData; } = {}; - response.forEach((c) => { + response.forEach(c => { ciphers[c.id] = new CipherData(c, userId); }); return await this.cipherService.replace(ciphers); @@ -322,7 +322,7 @@ export class SyncService implements SyncServiceAbstraction { private async syncSends(userId: string, response: SendResponse[]) { const sends: { [id: string]: SendData; } = {}; - response.forEach((s) => { + response.forEach(s => { sends[s.id] = new SendData(s, userId); }); return await this.sendService.replace(sends); @@ -335,7 +335,7 @@ export class SyncService implements SyncServiceAbstraction { } if (response != null && response.globalEquivalentDomains != null) { - response.globalEquivalentDomains.forEach((global) => { + response.globalEquivalentDomains.forEach(global => { if (global.domains.length > 0) { eqDomains.push(global.domains); } @@ -348,7 +348,7 @@ export class SyncService implements SyncServiceAbstraction { private async syncPolicies(response: PolicyResponse[]) { const policies: { [id: string]: PolicyData; } = {}; if (response != null) { - response.forEach((p) => { + response.forEach(p => { policies[p.id] = new PolicyData(p); }); } diff --git a/src/services/system.service.ts b/src/services/system.service.ts index d5d0d6ea01..053dd50de4 100644 --- a/src/services/system.service.ts +++ b/src/services/system.service.ts @@ -59,7 +59,7 @@ export class SystemService implements SystemServiceAbstraction { if (Utils.isNullOrWhitespace(clipboardValue)) { return; } - this.storageService.get(ConstantsService.clearClipboardKey).then((clearSeconds) => { + this.storageService.get(ConstantsService.clearClipboardKey).then(clearSeconds => { if (clearSeconds == null) { return; } diff --git a/tslint.json b/tslint.json index 3fe8b5b5ba..76f1843ee8 100644 --- a/tslint.json +++ b/tslint.json @@ -52,6 +52,10 @@ "check-type" ], "max-classes-per-file": false, + "arrow-parens": [ + true, + "ban-single-arg-parens" + ], "semicolon": [ true, "always"