aboutsummaryrefslogtreecommitdiff
path: root/htmx/path-params.js
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2025-04-26 20:07:06 -0400
committerXe Iaso <me@xeiaso.net>2025-04-26 20:07:06 -0400
commit62665656ffc8c20b7913b64dd14f4739bdcf29e7 (patch)
tree52893728becf4b7cb7b6b21f36d3a030b33ab376 /htmx/path-params.js
parent0a566abb1557f1a06723564b080061c06afd5de9 (diff)
downloadx-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.js25
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);
+ },
+ );
}
- }
-})
+ },
+});