New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

get-query-strings

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-query-strings

Gets url query string parameters

latest
Source
npmnpm
Version
1.4.0
Version published
Maintainers
1
Created
Source

Get URL query string parameters

Returns all the query string params in a object or gets a single param by name

Usage

e.g http://my-awsome.website/welcome?name=luke&job=dev

import { allQueryStrings, queryString } from 'get-query-strings'
const params = allQueryStrings()

const params2 = allQueryStrings('?a=1&b=2')

const name = queryString('name'),

const name2 = queryString('name', '?name=luke'),

Output : 

console.log(params)

{
  name: luke, 
  job: dev
}

console.log(params2)

{
  a: 1,
  b: 2
}

console.log(name)

luke

console.log(name2)

luke

Please note : decodeURIComponent is used on both the KEY and the VALUE Also will add a ? to the string if missing and passed in manually

Authors

  • Luke Robertson - DesignAlchemy

License

Public

Keywords

query

FAQs

Package last updated on 25 Jun 2018

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