Skip to content

Commit

Permalink
feat: split on semicolons (;) instead of commas (,) to avoid srcset p…
Browse files Browse the repository at this point in the history
…arser confusion
  • Loading branch information
JonasKruckenberg committed Mar 8, 2021
1 parent 763cc3b commit e02d7e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const cartesian = (...a: any[]) => a.reduce((a, b) => a.flatMap(d => b.ma

export function buildDirectiveOptions(src: URL): DirectiveOptions[] {
return Array.from(src.searchParams.entries())
.map<[string, string[]]>(([key, value]) => [key, value.split(',')])
.map<[string, string[]]>(([key, value]) => [key, value.split(';')])
.map(([key, values]) => values.map(v => ({ [key]: v })))
.reduce((prev, cur) => prev.length ? cartesian(prev, cur) : cur, [])
.map((options: Record<string, any>[]) => Array.isArray(options) ? Object.assign({}, ...options) : options)
Expand Down

0 comments on commit e02d7e3

Please sign in to comment.