Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
query-string-utils
Advanced tools
A small collection of utility functions for working with query strings.
A small collection of utility functions for working with query strings.
$ npm install query-string-utils
import { getQsDate, getQsDates, getQsNumber, getQsNumbers, getQsString, getQsStrings } from 'query-string-utils';
const searchParams = new URLSearchParams(window.location.search);
// ?id=42
const [ id = 0 ] = getQsNumber(searchParams, 'id');
console.log(id);
//=> 42
// ?id=13&id=30&id=7
const ids = getQsNumber(searchParams, 'id');
console.log(ids);
//=> [13, 30, 7]
// ?key=foo
const [ key = '' ] = getQsString(searchParams, 'key');
console.log(key);
//=> 'foo'
// ?key=foo&key=bar&key=baz
const keys = getQsString(searchParams, 'key');
console.log(keys);
//=> ['foo', 'bar', 'baz']
// ?key=1970-01-01T13:30:07
const [ date = new Date() ] = getQsDate(searchParams, 'date');
console.log(date);
//=> Date Thu Jan 01 1970 13:30:07 GMT+0100 (Central European Standard Time)
// ?date=1962-10-16&date=1962-10-28
const dates = getQsDate(searchParams, 'date');
console.log(dates);
//=> [ Date Tue Oct 16 1962 01:00:00 GMT+0100 (Central European Standard Time), Date Sun Oct 28 1962 01:00:00 GMT+0100 (Central European Standard Time) ]
// ?status=true
const [ status = false ] = getQsBoolean(searchParams, 'status');
console.log(active);
//=> true
// ?status=true&status=yes&status=false&status=on
const statuses = getQsBoolean(searchParams, 'status');
console.log(statuses);
//=> true, true, false, true
FAQs
A small collection of utility functions for working with query strings.
The npm package query-string-utils receives a total of 0 weekly downloads. As such, query-string-utils popularity was classified as not popular.
We found that query-string-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.