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

param-store

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

param-store

param store for react

latest
Source
npmnpm
Version
1.2.0
Version published
Weekly downloads
14
-46.15%
Maintainers
1
Weekly downloads
 
Created
Source

param-store

param-store manage the url. What's special about it is it treats url as independent params which can be set and get.

Travis build status npm semantic-release Dependency Status devDependency Status

API

ParamStore

import ParamStore from 'param-store'

// path is a special param in the sense that it is the path in the url
// instead of in the query part.
// Otherwise it is the same as other query params.

// SETTER
// `set` MERGE the new params with the previous params in the url
ParamStore.set({path: 'login'}) // change path
ParamStore.set({userId: 'f38adfn'}) // change userId
ParamStore.set({path: 'user', userId: 'f38adfn'}) // change path and userId
// `setAll` RESETS the whole url and ignore the previous url
Paramstore.setAll({path: 'login'}) // overwrite current params
// Options:
// options apply to set and setAll as the second argument
// replaceState: replace instead of push to history stack
// e.g.
ParamStore.set({ path: 'login' }, {replaceState: true})

// GETTER
ParamStore.get('path') // get 'path' from params
ParamStore.getAll() // get whole params object

// LISTENNER
const listener = ParamStore.listen('path', 'tab', function(report){
  const {changedParams, currentParams, previousParams} = report
})
ParamStore.unlisten(listener)

connect

import {connect} from 'param-store'

connect(Login, 'path', 'tab’) // path and tab will be passed as props
// Link use `setAll` under the hood
import {Link} from 'param-store'

<Link type='button' params={{path: 'about'}}>this is an anchor tag</Link>

DEVELOPMENT

  • test

    npm run browser
    
  • build: NOTE: before buiding, remove node_modules/history

Keywords

react

FAQs

Package last updated on 05 Sep 2016

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