
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
svelte-qparam
Advanced tools
š Type-Safe Query Parameter for SvelteKit
npm i svelte-qparam
Use the define
function to set multiple parameter definitions at once.
<script>
import { page } from '$app/state'
import { define } from 'svelte-qparam'
import { string, number, boolean } from 'svelte-qparam/serde'
const extract = define({
str: string,
num: number,
bool: boolean
})
// https://example.com/?str=value&num=123&bool=false
let { values, qparams: q } = $derived(extract(page.url))
// {
// str: 'value',
// num: 123,
// bool: false
// }
console.log(values)
// output 'value'
console.log(q.str)
q.num = 456
q.bool = true
</script>
Values defined with the define
function can be used in +page.js
and +page.server.js
.
This allows you to handle parameters type-safely across applications across servers and clients.
// +page.js
import { define } from 'svelte-qparam'
import { string, number, boolean } from 'svelte-qparam/serde'
export const _extract = define({
str: string,
num: number,
bool: boolean
})
export const load = ({ url, data }) => {
const { values, qparams } = _extract(url)
// ...
return {
qparams
}
}
// +page.server.js
import { _extract } from './+page.js'
export const load = ({ url }) => {
const { values } = _extract(url)
// ...
return {
// Note: Cannot return `qparams` from server
// ...
}
}
<!-- +page.svelte -->
<script>
let { data } = $props()
let { qparams: q } = $derived(data)
// ...
</script>
FAQs
š Type-Safe Query Parameter for SvelteKit
We found that svelte-qparam demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Ā It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.