@react-native-async-storage/async-storage
Advanced tools
Comparing version 1.14.1 to 1.15.0
@@ -41,2 +41,16 @@ /** | ||
} | ||
function checkValidArgs(keyValuePairs, callback) { | ||
if (!Array.isArray(keyValuePairs) || keyValuePairs.length === 0 || !Array.isArray(keyValuePairs[0])) { | ||
throw new Error('[AsyncStorage] Expected array of key-value pairs as first argument to multiSet'); | ||
} | ||
if (callback && typeof callback !== 'function') { | ||
if (Array.isArray(callback)) { | ||
throw new Error('[AsyncStorage] Expected function as second argument to multiSet. Did you forget to wrap key-value pairs in an array for the first argument?'); | ||
} | ||
throw new Error('[AsyncStorage] Expected function as second argument to multiSet'); | ||
} | ||
} | ||
/** | ||
@@ -282,2 +296,3 @@ * `AsyncStorage` is a simple, unencrypted, asynchronous, persistent, key-value | ||
multiSet: function (keyValuePairs, callback) { | ||
checkValidArgs(keyValuePairs, callback); | ||
return new Promise((resolve, reject) => { | ||
@@ -284,0 +299,0 @@ keyValuePairs.forEach(([key, value]) => { |
@@ -34,2 +34,16 @@ /** | ||
} | ||
function checkValidArgs(keyValuePairs, callback) { | ||
if (!Array.isArray(keyValuePairs) || keyValuePairs.length === 0 || !Array.isArray(keyValuePairs[0])) { | ||
throw new Error('[AsyncStorage] Expected array of key-value pairs as first argument to multiSet'); | ||
} | ||
if (callback && typeof callback !== 'function') { | ||
if (Array.isArray(callback)) { | ||
throw new Error('[AsyncStorage] Expected function as second argument to multiSet. Did you forget to wrap key-value pairs in an array for the first argument?'); | ||
} | ||
throw new Error('[AsyncStorage] Expected function as second argument to multiSet'); | ||
} | ||
} | ||
/** | ||
@@ -270,2 +284,3 @@ * `AsyncStorage` is a simple, unencrypted, asynchronous, persistent, key-value | ||
multiSet: function (keyValuePairs, callback) { | ||
checkValidArgs(keyValuePairs, callback); | ||
return new Promise((resolve, reject) => { | ||
@@ -272,0 +287,0 @@ keyValuePairs.forEach(([key, value]) => { |
{ | ||
"name": "@react-native-async-storage/async-storage", | ||
"version": "1.14.1", | ||
"version": "1.15.0", | ||
"description": "Asynchronous, persistent, key-value storage system for React Native.", | ||
@@ -131,2 +131,10 @@ "main": "lib/commonjs/index.js", | ||
} | ||
}, | ||
"android.emu.release.next": { | ||
"binaryPath": "example/android/app/build/outputs/apk/next/app-next.apk", | ||
"testBinaryPath": "example/android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk", | ||
"type": "android.emulator", | ||
"device": { | ||
"avdName": "Emu_E2E" | ||
} | ||
} | ||
@@ -133,0 +141,0 @@ } |
@@ -72,2 +72,26 @@ /** | ||
function checkValidArgs(keyValuePairs, callback) { | ||
if ( | ||
!Array.isArray(keyValuePairs) || | ||
keyValuePairs.length === 0 || | ||
!Array.isArray(keyValuePairs[0]) | ||
) { | ||
throw new Error( | ||
'[AsyncStorage] Expected array of key-value pairs as first argument to multiSet', | ||
); | ||
} | ||
if (callback && typeof callback !== 'function') { | ||
if (Array.isArray(callback)) { | ||
throw new Error( | ||
'[AsyncStorage] Expected function as second argument to multiSet. Did you forget to wrap key-value pairs in an array for the first argument?', | ||
); | ||
} | ||
throw new Error( | ||
'[AsyncStorage] Expected function as second argument to multiSet', | ||
); | ||
} | ||
} | ||
/** | ||
@@ -325,2 +349,3 @@ * `AsyncStorage` is a simple, unencrypted, asynchronous, persistent, key-value | ||
): Promise<null> { | ||
checkValidArgs(keyValuePairs, callback); | ||
return new Promise((resolve, reject) => { | ||
@@ -327,0 +352,0 @@ keyValuePairs.forEach(([key, value]) => { |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
397654
86
1899