diff options
| author | Xe Iaso <me@xeiaso.net> | 2025-04-26 20:07:06 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2025-04-26 20:07:06 -0400 |
| commit | 62665656ffc8c20b7913b64dd14f4739bdcf29e7 (patch) | |
| tree | 52893728becf4b7cb7b6b21f36d3a030b33ab376 /htmx/path-params.js | |
| parent | 0a566abb1557f1a06723564b080061c06afd5de9 (diff) | |
| download | x-62665656ffc8c20b7913b64dd14f4739bdcf29e7.tar.xz x-62665656ffc8c20b7913b64dd14f4739bdcf29e7.zip | |
chore: reformat the world, set up autoformat on commit
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'htmx/path-params.js')
| -rw-r--r-- | htmx/path-params.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/htmx/path-params.js b/htmx/path-params.js index 0c65d84..7c3792a 100644 --- a/htmx/path-params.js +++ b/htmx/path-params.js @@ -1,11 +1,16 @@ -htmx.defineExtension('path-params', { - onEvent: function(name, evt) { - if (name === 'htmx:configRequest') { - evt.detail.path = evt.detail.path.replace(/{([^}]+)}/g, function(_, param) { - var val = evt.detail.parameters[param] - delete evt.detail.parameters[param] - return val === undefined ? '{' + param + '}' : encodeURIComponent(val) - }) +htmx.defineExtension("path-params", { + onEvent: function (name, evt) { + if (name === "htmx:configRequest") { + evt.detail.path = evt.detail.path.replace( + /{([^}]+)}/g, + function (_, param) { + var val = evt.detail.parameters[param]; + delete evt.detail.parameters[param]; + return val === undefined + ? "{" + param + "}" + : encodeURIComponent(val); + }, + ); } - } -}) + }, +}); |
