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

react-search-query-string-helper

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-search-query-string-helper - npm Package Compare versions

Comparing version 0.0.1 to 0.0.3

15

package.json
{
"name": "react-search-query-string-helper",
"version": "0.0.1",
"version": "0.0.3",
"description": "React Search Query String Helper",

@@ -13,11 +13,7 @@ "author": "sandeshshrestha",

},
"scripts": {
},
"scripts": {},
"peerDependencies": {
"react-router-dom": "^4.3.0",
"lodash": "^4.17.0",
"query-string": "^6.4.2"
"react-router-dom": "^4.3.0"
},
"devDependencies": {
},
"devDependencies": {},
"files": [

@@ -27,3 +23,6 @@ "src"

"dependencies": {
"lodash.clonedeep": "^4.5.0",
"lodash.isobject": "^3.0.2",
"query-string": "^6.5.0"
}
}
# React Search Query String Helper
Adds additional methods to handle search query.
[![NPM](https://img.shields.io/npm/v/react-search-query-string-helper.svg)](https://www.npmjs.com/package/react-search-query-string-helper) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
## Install
### npm
```bash
npm install --save react-search-query-string-helper
```
### yarn
```bash
yarn add react-search-query-string-helper
```
## Usage
```jsx
import React, { Component } from 'react';
import withSearchHelper from 'react-search-query-string-helper';
class MyComponent extends Component {
render() {
const search = JSON.stringify(this.parseSearch());
return (
<p>{search}</p>
);
}
}
export default withSearchHelper(MyComponent);
```
## Added Methods
* parseSearch() - Returns parsed search object
* replaceSearch(search [String]) - Call history.replace with supplied search string
* updateSearch(search [Object]) - Convert supplied search object into query string and call *replaceSearch()*
* addSearch(search [Object]) - Add supplied search object with existing search query
* removeSearch(keys [Array]) - Remove all keys from existing search query
* clearSearch() - Clear search query
MIT © [sandeshshrestha](https://github.com/sandeshshrestha)
import { withRouter } from 'react-router-dom';
import queryString from 'query-string';
import { isObject, isArray, cloneDeep } from 'lodash';
import isObject from 'lodash.isobject';
import cloneDeep from 'lodash.clonedeep';

@@ -43,3 +44,3 @@ const cacheSearch = {};

// Stringify the value if it is object or array
if (isObject(val) || isArray(val)) {
if (isObject(val) || Array.isArray(val)) {
val = JSON.stringify(val);

@@ -46,0 +47,0 @@ }

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