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

@react-native-async-storage/async-storage

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native-async-storage/async-storage - npm Package Compare versions

Comparing version 1.15.5 to 1.15.6

28

jest/async-storage-mock.js

@@ -5,2 +5,9 @@ /**

import mergeOptions from 'merge-options';
const merge = mergeOptions.bind({
concatArrays: true,
ignoreUndefined: true,
});
const asMock = {

@@ -99,3 +106,3 @@ __INTERNAL_MOCK_STORAGE__: {},

asMock.__INTERNAL_MOCK_STORAGE__[key] = JSON.stringify(
_deepMergeInto(oldValue, value),
merge(oldValue, value),
);

@@ -108,21 +115,2 @@ });

const _isObject = (obj) => typeof obj === 'object' && !Array.isArray(obj);
const _deepMergeInto = (oldObject, newObject) => {
const newKeys = Object.keys(newObject);
const mergedObject = oldObject;
newKeys.forEach((key) => {
const oldValue = mergedObject[key];
const newValue = newObject[key];
if (_isObject(oldValue) && _isObject(newValue)) {
mergedObject[key] = _deepMergeInto(oldValue, newValue);
} else {
mergedObject[key] = newValue;
}
});
return mergedObject;
};
module.exports = asMock;

@@ -8,3 +8,3 @@ "use strict";

var _deepAssign = _interopRequireDefault(require("deep-assign"));
var _mergeOptions = _interopRequireDefault(require("merge-options"));

@@ -22,2 +22,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

*/
const merge = _mergeOptions.default.bind({
concatArrays: true,
ignoreUndefined: true
});
const mergeLocalStorageItem = (key, value) => {

@@ -27,3 +32,3 @@ const oldValue = window.localStorage.getItem(key);

const newObject = JSON.parse(value);
const nextValue = JSON.stringify((0, _deepAssign.default)({}, oldObject, newObject));
const nextValue = JSON.stringify(merge(oldObject, newObject));
window.localStorage.setItem(key, nextValue);

@@ -30,0 +35,0 @@ };

@@ -23,3 +23,18 @@ /**

if (!_RCTAsyncStorage.default) {
throw new Error("[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.\n\nTo fix this issue try these steps:\n\n \u2022 Run `react-native link @react-native-async-storage/async-storage` in the project root.\n\n \u2022 Rebuild and restart the app.\n\n \u2022 Run the packager with `--reset-cache` flag.\n\n \u2022 If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app.\n\n \u2022 If this happens while testing with Jest, check out docs how to integrate AsyncStorage with it: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest\n\nIf none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-async-storage/react-native-async-storage/issues\n");
throw new Error(`[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
To fix this issue try these steps:
• Run \`react-native link @react-native-async-storage/async-storage\` in the project root.
• Rebuild and restart the app.
• Run the packager with \`--reset-cache\` flag.
• If you are using CocoaPods on iOS, run \`pod install\` in the \`ios\` directory and then rebuild and re-run the app.
• If this happens while testing with Jest, check out docs how to integrate AsyncStorage with it: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-async-storage/react-native-async-storage/issues
`);
}

@@ -31,3 +46,3 @@

if (typeof usedKey !== 'string') {
console.warn("[AsyncStorage] Using ".concat(typeof usedKey, " type for key is not supported. This can lead to unexpected behavior/errors. Use string instead.\nKey passed: ").concat(usedKey, "\n"));
console.warn(`[AsyncStorage] Using ${typeof usedKey} type for key is not supported. This can lead to unexpected behavior/errors. Use string instead.\nKey passed: ${usedKey}\n`);
}

@@ -37,5 +52,5 @@

if (value == null) {
throw new Error("[AsyncStorage] Passing null/undefined as value is not supported. If you want to remove value, Use .remove method instead.\nPassed value: ".concat(value, "\nPassed key: ").concat(usedKey, "\n"));
throw new Error(`[AsyncStorage] Passing null/undefined as value is not supported. If you want to remove value, Use .remove method instead.\nPassed value: ${value}\nPassed key: ${usedKey}\n`);
} else {
console.warn("[AsyncStorage] The value for key \"".concat(usedKey, "\" is not a string. This can lead to unexpected behavior/errors. Consider stringifying it.\nPassed value: ").concat(value, "\nPassed key: ").concat(usedKey, "\n"));
console.warn(`[AsyncStorage] The value for key "${usedKey}" is not a string. This can lead to unexpected behavior/errors. Consider stringifying it.\nPassed value: ${value}\nPassed key: ${usedKey}\n`);
}

@@ -42,0 +57,0 @@ }

@@ -10,3 +10,7 @@ /**

*/
import merge from 'deep-assign';
import mergeOptions from 'merge-options';
const merge = mergeOptions.bind({
concatArrays: true,
ignoreUndefined: true
});

@@ -17,3 +21,3 @@ const mergeLocalStorageItem = (key, value) => {

const newObject = JSON.parse(value);
const nextValue = JSON.stringify(merge({}, oldObject, newObject));
const nextValue = JSON.stringify(merge(oldObject, newObject));
window.localStorage.setItem(key, nextValue);

@@ -20,0 +24,0 @@ };

@@ -16,3 +16,18 @@ /**

if (!RCTAsyncStorage) {
throw new Error("[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.\n\nTo fix this issue try these steps:\n\n \u2022 Run `react-native link @react-native-async-storage/async-storage` in the project root.\n\n \u2022 Rebuild and restart the app.\n\n \u2022 Run the packager with `--reset-cache` flag.\n\n \u2022 If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app.\n\n \u2022 If this happens while testing with Jest, check out docs how to integrate AsyncStorage with it: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest\n\nIf none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-async-storage/react-native-async-storage/issues\n");
throw new Error(`[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
To fix this issue try these steps:
• Run \`react-native link @react-native-async-storage/async-storage\` in the project root.
• Rebuild and restart the app.
• Run the packager with \`--reset-cache\` flag.
• If you are using CocoaPods on iOS, run \`pod install\` in the \`ios\` directory and then rebuild and re-run the app.
• If this happens while testing with Jest, check out docs how to integrate AsyncStorage with it: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-async-storage/react-native-async-storage/issues
`);
}

@@ -24,3 +39,3 @@

if (typeof usedKey !== 'string') {
console.warn("[AsyncStorage] Using ".concat(typeof usedKey, " type for key is not supported. This can lead to unexpected behavior/errors. Use string instead.\nKey passed: ").concat(usedKey, "\n"));
console.warn(`[AsyncStorage] Using ${typeof usedKey} type for key is not supported. This can lead to unexpected behavior/errors. Use string instead.\nKey passed: ${usedKey}\n`);
}

@@ -30,5 +45,5 @@

if (value == null) {
throw new Error("[AsyncStorage] Passing null/undefined as value is not supported. If you want to remove value, Use .remove method instead.\nPassed value: ".concat(value, "\nPassed key: ").concat(usedKey, "\n"));
throw new Error(`[AsyncStorage] Passing null/undefined as value is not supported. If you want to remove value, Use .remove method instead.\nPassed value: ${value}\nPassed key: ${usedKey}\n`);
} else {
console.warn("[AsyncStorage] The value for key \"".concat(usedKey, "\" is not a string. This can lead to unexpected behavior/errors. Consider stringifying it.\nPassed value: ").concat(value, "\nPassed key: ").concat(usedKey, "\n"));
console.warn(`[AsyncStorage] The value for key "${usedKey}" is not a string. This can lead to unexpected behavior/errors. Consider stringifying it.\nPassed value: ${value}\nPassed key: ${usedKey}\n`);
}

@@ -35,0 +50,0 @@ }

{
"name": "@react-native-async-storage/async-storage",
"version": "1.15.5",
"version": "1.15.6",
"description": "Asynchronous, persistent, key-value storage system for React Native.",

@@ -64,3 +64,3 @@ "main": "lib/commonjs/index.js",

"dependencies": {
"deep-assign": "^3.0.0"
"merge-options": "^3.0.4"
},

@@ -74,11 +74,8 @@ "peerDependencies": {

"@expo/webpack-config": "^0.12.0",
"@react-native-community/bob": "^0.17.0",
"@react-native-community/cli": "^4.10.0",
"@react-native-community/cli-platform-android": "^4.10.0",
"@react-native-community/cli-platform-ios": "^4.10.0",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.5.2",
"babel-plugin-module-resolver": "3.1.3",
"@react-native-community/eslint-config": "^3.0.0",
"detox": "17.10.6",
"eslint": "^6.0.0",
"eslint": "^7.0.0",
"expo": "^38.0.10",

@@ -94,6 +91,7 @@ "flow-bin": "^0.122.0",

"react-native": "0.63.4",
"react-native-macos": "0.63.4",
"react-native-test-app": "^0.3.0",
"react-native-builder-bob": "^0.18.0",
"react-native-macos": "^0.63.4",
"react-native-test-app": "^0.7.1",
"react-native-web": "~0.12.0",
"react-native-windows": "0.63.18",
"react-native-windows": "^0.63.18",
"react-test-renderer": "16.13.1",

@@ -145,3 +143,3 @@ "semantic-release": "^17.2.1"

},
"@react-native-community/bob": {
"react-native-builder-bob": {
"source": "src",

@@ -148,0 +146,0 @@ "output": "lib",

@@ -11,4 +11,9 @@ /**

import merge from 'deep-assign';
import mergeOptions from 'merge-options';
const merge = mergeOptions.bind({
concatArrays: true,
ignoreUndefined: true,
});
const mergeLocalStorageItem = (key, value) => {

@@ -18,3 +23,3 @@ const oldValue = window.localStorage.getItem(key);

const newObject = JSON.parse(value);
const nextValue = JSON.stringify(merge({}, oldObject, newObject));
const nextValue = JSON.stringify(merge(oldObject, newObject));
window.localStorage.setItem(key, nextValue);

@@ -21,0 +26,0 @@ };

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

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