Skip to content

Commit

Permalink
fix: removed dead code and added missing types
Browse files Browse the repository at this point in the history
  • Loading branch information
prisis committed Jan 31, 2022
1 parent 8bb1e6c commit e569e94
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions src/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,6 @@ export class System {
* faker.system.mimeType() // 'video/vnd.vivo'
*/
mimeType(): string {
const typeSet = new Set<string>();
const extensionSet = new Set();
const mimeTypes = this.faker.definitions.system.mimeTypes;

Object.keys(mimeTypes).forEach((m) => {
const type = m.split('/')[0];

typeSet.add(type);

if (mimeTypes[m].extensions instanceof Array) {
mimeTypes[m].extensions.forEach((ext) => {
extensionSet.add(ext);
});
}
});

const types = setToArray(typeSet);
const extensions = setToArray(extensionSet);
const mimeTypeKeys = Object.keys(this.faker.definitions.system.mimeTypes);

return this.faker.random.arrayElement(mimeTypeKeys);
Expand Down Expand Up @@ -145,8 +127,6 @@ export class System {
});

const types = setToArray(typeSet);
const extensions = setToArray(extensionSet);
const mimeTypeKeys = Object.keys(this.faker.definitions.system.mimeTypes);
return this.faker.random.arrayElement(types);
}

Expand All @@ -160,25 +140,8 @@ export class System {
* faker.system.fileExt('application/json') // 'json'
*/
fileExt(mimeType?: string): string {
const typeSet = new Set<string>();
const extensionSet = new Set<string>();
const mimeTypes = this.faker.definitions.system.mimeTypes;

Object.keys(mimeTypes).forEach((m) => {
const type = m.split('/')[0];

typeSet.add(type);

if (mimeTypes[m].extensions instanceof Array) {
mimeTypes[m].extensions.forEach((ext) => {
extensionSet.add(ext);
});
}
});

const types = setToArray(typeSet);
const extensions = setToArray(extensionSet);
const mimeTypeKeys = Object.keys(this.faker.definitions.system.mimeTypes);

if (mimeType) {
const mimes = this.faker.definitions.system.mimeTypes;
Expand Down

0 comments on commit e569e94

Please sign in to comment.