You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use dot notation for property access instead of bracket notation
TypeScript correctly handles type safety with dot notation for known properties.
Bracket notation was unnecessarily verbose and reduced code readability.
/* c8 ignore next - Type encoder uses default PurlComponentEncoder, never returns null/undefined. */letpurlStr=`pkg:${(PurlComponent['type']?.['encode']asComponentEncoder)?.(type)??''}/`
225
+
/* c8 ignore next - Type encoder uses default PurlComponentEncoder, never returns null/undefined. */letpurlStr=`pkg:${(PurlComponent.type?.encodeasComponentEncoder)?.(type)??''}/`
226
226
if(namespace){
227
-
/* c8 ignore next - Namespace encoder always returns string, never null/undefined. */purlStr=`${purlStr}${(PurlComponent['namespace']?.['encode']asComponentEncoder)?.(namespace)??''}/`
227
+
/* c8 ignore next - Namespace encoder always returns string, never null/undefined. */purlStr=`${purlStr}${(PurlComponent.namespace?.encodeasComponentEncoder)?.(namespace)??''}/`
228
228
}
229
-
/* c8 ignore next - Name encoder always returns string, never null/undefined. */purlStr=`${purlStr}${(PurlComponent['name']?.['encode']asComponentEncoder)?.(name)??''}`
229
+
/* c8 ignore next - Name encoder always returns string, never null/undefined. */purlStr=`${purlStr}${(PurlComponent.name?.encodeasComponentEncoder)?.(name)??''}`
230
230
if(version){
231
-
/* c8 ignore next - Version encoder always returns string, never null/undefined. */purlStr=`${purlStr}@${(PurlComponent['version']?.['encode']asComponentEncoder)?.(version)??''}`
231
+
/* c8 ignore next - Version encoder always returns string, never null/undefined. */purlStr=`${purlStr}@${(PurlComponent.version?.encodeasComponentEncoder)?.(version)??''}`
232
232
}
233
233
if(qualifiers){
234
-
/* c8 ignore next - Qualifiers encoder always returns string, never null/undefined. */purlStr=`${purlStr}?${(PurlComponent['qualifiers']?.['encode']asComponentEncoder)?.(qualifiers)??''}`
234
+
/* c8 ignore next - Qualifiers encoder always returns string, never null/undefined. */purlStr=`${purlStr}?${(PurlComponent.qualifiers?.encodeasComponentEncoder)?.(qualifiers)??''}`
235
235
}
236
236
if(subpath){
237
-
/* c8 ignore next - Subpath encoder always returns string, never null/undefined. */purlStr=`${purlStr}#${(PurlComponent['subpath']?.['encode']asComponentEncoder)?.(subpath)??''}`
237
+
/* c8 ignore next - Subpath encoder always returns string, never null/undefined. */purlStr=`${purlStr}#${(PurlComponent.subpath?.encodeasComponentEncoder)?.(subpath)??''}`
238
238
}
239
239
returnpurlStr
240
240
}
@@ -278,12 +278,12 @@ class PackageURL {
278
278
// Create a safe object without prototype chain to prevent prototype pollution
0 commit comments