Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object-query-string

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-query-string

Stringify objects as URL Query Strings, a lightweight mock of jQuery.param without any dependencies!

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29K
decreased by-6.69%
Maintainers
1
Weekly downloads
 
Created
Source

Object Query String

Stringify objects as URL Query Strings.

A lightweight mock of jQuery.param function without any dependencies!

Example

// TypeScript
import { queryString } from 'object-query-string';

// Node.js
const { queryString } = require("object-query-string");

const query = queryString({
    filter: {
        brands: ["Audi"],
        models: ["A4", "A6", "A8"],
        accidentFree: true
    },
    sort: 'mileage'
});

returns

filter[brands][]=Audi&filter[models][]=A4&filter[models][]=A6&filter[models][]=A8&filter[accidentFree]=true&sort=milage

Options

// queryString(params : string, options : object|undefined)

// default options
queryString(params, {
    separator: '&', // string 
    encode: encodeURIComponent, // function(string) : string
    encodeBrackets: false, // foo[baz]=1 or foo%5Bbaz%5D=1
});


Inspired by jQuery's param!

Keywords

FAQs

Package last updated on 06 Nov 2021

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