Skip to content

Commit b851db0

Browse files
committed
Revert "refactor: use Object.create(null) for null-prototype objects"
This reverts commit cecb825.
1 parent cecb825 commit b851db0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/purl-component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export type ComponentValidator = (_value: unknown, _throws: boolean) => boolean
4040
export type QualifiersValue = string | number | boolean | null | undefined
4141
export type QualifiersObject = Record<string, QualifiersValue>
4242

43-
const componentSortOrderLookup = Object.assign(Object.create(null), {
43+
const componentSortOrderLookup = {
44+
__proto__: null,
4445
type: 0,
4546
namespace: 1,
4647
name: 2,
@@ -49,7 +50,7 @@ const componentSortOrderLookup = Object.assign(Object.create(null), {
4950
qualifierKey: 5,
5051
qualifierValue: 6,
5152
subpath: 7,
52-
})
53+
}
5354

5455
/**
5556
* Compare two component names for sorting.

src/purl-qualifier-names.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55

66
// Known qualifiers:
77
// https://github.com/package-url/purl-spec/blob/master/PURL-SPECIFICATION.rst#known-qualifiers-keyvalue-pairs
8-
const PurlQualifierNames = Object.assign(Object.create(null), {
8+
const PurlQualifierNames = {
9+
__proto__: null,
910
RepositoryUrl: 'repository_url',
1011
DownloadUrl: 'download_url',
1112
VcsUrl: 'vcs_url',
1213
FileName: 'file_name',
1314
Checksum: 'checksum',
14-
})
15+
}
1516

1617
export { PurlQualifierNames }

0 commit comments

Comments
 (0)