Socket
Socket
Sign inDemoInstall

serialize-query-params

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serialize-query-params

A library for simplifying encoding and decoding URL query parameters.


Version published
Weekly downloads
436K
increased by3.6%
Maintainers
1
Weekly downloads
 
Created

What is serialize-query-params?

The serialize-query-params npm package is a utility for serializing and deserializing URL query parameters in JavaScript. It provides a simple and consistent way to handle query parameters, making it easier to work with URLs in web applications.

What are serialize-query-params's main functionalities?

Serialize Query Parameters

This feature allows you to convert an object of query parameters into a query string. The `stringify` function takes an object and returns a URL-encoded string.

const { stringify } = require('serialize-query-params');
const queryParams = { name: 'John', age: 30 };
const queryString = stringify(queryParams);
console.log(queryString); // Output: 'name=John&age=30'

Deserialize Query Parameters

This feature allows you to convert a query string back into an object. The `parse` function takes a URL-encoded string and returns an object representing the query parameters.

const { parse } = require('serialize-query-params');
const queryString = 'name=John&age=30';
const queryParams = parse(queryString);
console.log(queryParams); // Output: { name: 'John', age: 30 }

Custom Parameter Serialization

This feature allows you to customize the serialization of query parameters. For example, you can specify how arrays should be formatted in the query string.

const { stringify } = require('serialize-query-params');
const queryParams = { name: 'John', age: 30, tags: ['developer', 'blogger'] };
const queryString = stringify(queryParams, { arrayFormat: 'comma' });
console.log(queryString); // Output: 'name=John&age=30&tags=developer,blogger'

Other packages similar to serialize-query-params

Keywords

FAQs

Package last updated on 20 Oct 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc