svelte-qparam

npm-version npm-license npm-download-month npm-min-size ci.yml website

🔎 Type-Safe Query Parameter for SvelteKit

â–· Installation

https://svelte-qparam.jill64.dev/?

str = num = 0 bool_array = []
<!-- +page.svelte -->
<script>
  import { array, qparam } from 'svelte-qparam'
  import { boolean, number } from 'typed-qparam/serde'

  $: str = $qparam('str')
  $: num = $qparam('num', number)
  $: bool_array = $qparam('bool_array', array(boolean))
</script>

<output>
  <code>str = {$str}</code>
  <code>num = {$num}</code>
  <code>bool_array = {JSON.stringify($bool_array)}</code>
</output>