General-purpose utility functions.
General-purpose utility functions.
(build-url path query-params)Build a URL string from a path and query params map. Omits query params with nil values. Returns path if no query params remain.
Build a URL string from a path and query params map. Omits query params with nil values. Returns path if no query params remain.
(escape-js-string s)Escape a string for safe embedding in a single-quoted JavaScript string literal inside a <script> block. Handles backslashes, quotes, newlines, line/paragraph separators, and </script> injection.
Escape a string for safe embedding in a single-quoted JavaScript string literal inside a <script> block. Handles backslashes, quotes, newlines, line/paragraph separators, and </script> injection.
(parse-query-string query-string)Parse a query string into a keyword-keyed map with URL-decoded values. Returns nil if query-string is nil.
Parse a query string into a keyword-keyed map with URL-decoded values. Returns nil if query-string is nil.
(warn-on-access-map m)Wrap a map so that accessing any key not present in the map returns nil and logs a warning. Used for SSE re-render requests where HTTP context is unavailable — the warning alerts developers to use middleware + cursors for data that must survive re-renders.
Wrap a map so that accessing any key not present in the map returns nil and logs a warning. Used for SSE re-render requests where HTTP context is unavailable — the warning alerts developers to use middleware + cursors for data that must survive re-renders.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |