Skip to content

Commit

Permalink
add trailing commas
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Jan 11, 2024
1 parent 655ab25 commit 1652148
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions webgpu/lessons/resources/wgsl-offset-computer.html
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,9 @@ <h1>WGSL Offset Computer</h1>

function bindGroupLayoutDescriptorsToString(bindGroupLayoutDescriptors) {
return JSON.stringify(bindGroupLayoutDescriptors, stringifyBindGroupLayoutDescriptor, 2)
.replace(/"(\w+)":/g, '$1:')
.replace(/"(GPUS.*?)"/g, '$1');
.replace(/"(\w+)":/g, '$1:') // "key": value -> key: value
.replace(/(}|\]|"|\d|\w)\n/g, '$1,\n') // add trailing commas
.replace(/"(GPUS.*?)"/g, '$1'); // remove quotes from GPUShaderStage
}

const epLines = [];
Expand Down

0 comments on commit 1652148

Please sign in to comment.