Skip to content

Commit

Permalink
drop delete logic
Browse files Browse the repository at this point in the history
  • Loading branch information
musdotdigital committed Nov 30, 2023
1 parent f4723d1 commit a441092
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
11 changes: 7 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ class Package {
constructor(name, version, extraFields) {
this.name = name;
this.version = version;
// omit name and version from extra fields to avoid overriding
extraFields === null || extraFields === void 0 ? true : delete extraFields.name;
extraFields === null || extraFields === void 0 ? true : delete extraFields.version;
Object.assign(this, extraFields);
if (extraFields) {
for (const [key, value] of Object.entries(extraFields)) {
if (key !== 'name' && key !== 'version') {
Object.assign(this, { [key]: value });
}
}
}
}
}
exports.Package = Package;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions src/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ export class Package {
) {
this.name = name
this.version = version
// omit name and version from extra fields to avoid overriding
delete extraFields?.name
delete extraFields?.version
Object.assign(this, extraFields)
if (extraFields) {
for (const [key, value] of Object.entries(extraFields)) {
if (key !== 'name' && key !== 'version') {
Object.assign(this, {[key]: value})
}
}
}
}
}

Expand Down

0 comments on commit a441092

Please sign in to comment.