Skip to content

Commit

Permalink
style(): update code style for handling allowed extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuri committed Nov 12, 2017
1 parent 3ed40e6 commit 7261a26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/ngx-uploader/classes/ngx-uploader.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@ export class NgUploaderService {
}

handleFiles(incomingFiles: FileList): void {
let allowedIncomingFiles: File[] = [];

for (let i = 0; i < incomingFiles.length; i++) {
let checkFile = incomingFiles[i];
const allowedIncomingFiles: File[] = [].reduce.call(incomingFiles, (acc: File[], checkFile: File, i: number) => {
if (this.isContentTypeAllowed(checkFile.type)) {
allowedIncomingFiles.push(checkFile);
acc = acc.concat(checkFile);
} else {
const rejectedFile: UploadFile = this.makeUploadFile(checkFile, i);
this.serviceEvents.emit({ type: 'rejected', file: rejectedFile });
}
}

return acc;
}, []);

this.queue.push(...[].map.call(allowedIncomingFiles, (file: File, i: number) => {
const uploadFile: UploadFile = this.makeUploadFile(file, i);
Expand Down
1 change: 0 additions & 1 deletion src/ngx-uploader/module/ngx-uploader.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ import { NgFileSelectDirective } from '../directives/ng-file-select.directive';
]
})
export class NgUploaderModule {}

0 comments on commit 7261a26

Please sign in to comment.