New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@plq/use-persisted-state

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plq/use-persisted-state - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [0.0.10](https://github.com/Akurganow/use-persisted-state/compare/v0.0.9...v0.0.10) (2019-09-10)
### Bug Fixes
* **check value:** check key in ([9b3ab38](https://github.com/Akurganow/use-persisted-state/commit/9b3ab38))
## [0.0.9](https://github.com/Akurganow/use-persisted-state/compare/v0.0.8...v0.0.9) (2019-09-10)

@@ -2,0 +9,0 @@

4

lib/index.js

@@ -19,3 +19,3 @@ import * as React from 'react';

let initialOrPersistedValue = initialValue;
if (initialPersist && initialPersist[key]) {
if (initialPersist && key in initialPersist) {
initialOrPersistedValue = initialPersist[key] || initialValue;

@@ -46,3 +46,3 @@ }

const newState = JSON.parse(event.newValue);
const newValue = newState && newState[key] ? newState[key] : initialValue;
const newValue = newState && key in newState ? newState[key] : initialValue;
setState(newValue);

@@ -49,0 +49,0 @@ }

{
"name": "@plq/use-persisted-state",
"version": "0.0.9",
"version": "0.0.10",
"description": "Like useState hook but with persistance in storage",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -29,3 +29,3 @@ import * as React from 'react'

if (initialPersist && initialPersist[key]) {
if (initialPersist && key in initialPersist) {
initialOrPersistedValue = (initialPersist[key] as T) || initialValue

@@ -65,3 +65,3 @@ }

const newState = JSON.parse(event.newValue as string)
const newValue = newState && newState[key] ? newState[key] : initialValue
const newValue = newState && key in newState ? newState[key] : initialValue

@@ -68,0 +68,0 @@ setState(newValue)

Sorry, the diff of this file is not supported yet

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