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

simple-query-mutator

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-query-mutator

for mutating a search query,delete,change prop.

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

simple-query-mutator

NPM version

Install

$ npm install simple-query-mutator --save

formatQuery

formatQuery direct formats the query.

formatQuery(rawQuery,propToBeRemoved,propToBeChange,ChangeValue);
import { formatQuery } from 'simple-query-mutator';
// ...
const searchStr = '?language=eng&sort=price&type=product';
const result = formatQuery(searchStr, 'language');
// "?sort=price&type=product"

const result = formatQuery(searchStr, null, 'sort', 'date');
// "?language=eng&sort=date&type=product"

const result = formatQuery(searchStr, 'type', 'language', 'alien');
// "?language=alien&sort=date"

checkAndFormatQuery

checkAndFormatQuery checks whether or not the prop exist then continue formatting.

checkAndFormatQuery(rawQuery,method,prop,ChangeValue);
import { checkAndFormatQuery } from 'simple-query-mutator';
// ...
const searchStr = '?language=eng&sort=price&type=product';
const result = checkAndFormatQuery(searchStr, 'get', 'type');
// "product"

const result = checkAndFormatQuery(searchStr, 'has', 'type');
// true

const result = checkAndFormatQuery(searchStr, 'change', 'language', 'alien');
// "?language=alien&sort=date"

const result = checkAndFormatQuery(searchStr, 'delete', 'language');
// "?sort=date"

Keywords

FAQs

Package last updated on 11 Jul 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

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