Skip to content

Commit

Permalink
Merge pull request bleenco#382 from jkuri/style-handlefiles
Browse files Browse the repository at this point in the history
style(): update code style for handling allowed extensions
  • Loading branch information
retailify authored Nov 12, 2017
2 parents 3ed40e6 + 7261a26 commit 8156bbb
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 8156bbb

Please sign in to comment.