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

react-native-preference

Package Overview
Dependencies
Maintainers
4
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-preference - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

42

index.js

@@ -9,3 +9,13 @@ import {NativeModules, NativeEventEmitter} from 'react-native';

for (const key in info) {
set(key, info[key]);
const value = info[key];
if (isNil(value)) {
delete PREFERENCES[key];
} else {
try {
const safeValue = JSON.parse(JSON.stringify(value));
PREFERENCES[key] = safeValue;
} catch (error) {
console.warn('wrong format:', value);
}
}
}

@@ -19,9 +29,9 @@

eventEmitter.addListener('SHMPreferenceClear', info => {
if (info != null) {
if (!isNil(info)) {
//clear key
const key = info[key];
if (PREFERENCES[key] !== null) {
clear(key);
const key = info['key'];
if (!isNil(PREFERENCES[key])) {
delete PREFERENCES[key];
for (let listener of listeners) {
listener();
listener({[key]: null});
}

@@ -32,5 +42,5 @@ }

if (Object.keys(PREFERENCES).length !== 0) {
clear();
PREFERENCES = {};
for (let listener of listeners) {
listener();
listener({});
}

@@ -59,13 +69,7 @@ }

function get(key) {
if (key != null) {
return PREFERENCES[key];
} else {
return {
...PREFERENCES,
};
}
return isNil(key) ? PREFERENCES : PREFERENCES[key];
}
function set(key, value) {
if (value === null || typeof value === 'undefined') {
if (isNil(value)) {
return clear(key);

@@ -86,3 +90,3 @@ } else {

function clear(key) {
if (key === null || typeof key === 'undefined') {
if (isNil(key)) {
PREFERENCES = {};

@@ -103,2 +107,6 @@ return RNPreferenceManager.clear();

function isNil(value) {
return value === null || value === undefined
}
export default {

@@ -105,0 +113,0 @@ addPreferenceChangedListener,

{
"name": "react-native-preference",
"version": "2.2.2",
"version": "2.2.3",
"description": "Manage react-native app's preference data synchronously",

@@ -5,0 +5,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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