Skip to content

Commit

Permalink
improvement (set)!: return a list of what was inserted
Browse files Browse the repository at this point in the history
  • Loading branch information
JadsonLucena committed Mar 23, 2023
1 parent 267813b commit ac34355
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/MediaTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,21 @@ class MediaTypes {
let content = {};
content[extension] = mediaType;

if (this.#updateList(content)) {
const list = this.#updateList(content);

fs.writeFileSync(__dirname +'/DB.json', JSON.stringify({
mediaTypes: this.#mediaTypes,
versions: this.#versions
}));
if (!(extension in list)) {

return [];

}

fs.writeFileSync(__dirname +'/DB.json', JSON.stringify({
mediaTypes: this.#mediaTypes,
versions: this.#versions
}));

return list[extension];

}

delete = (extension, mediaType) => {
Expand Down

0 comments on commit ac34355

Please sign in to comment.