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

react-native-data-storage

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-data-storage

A data storage tool for React Native written on top of AsyncStorage

  • 0.0.1
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

#DataStorage

react-native-data-storage is a data storage tool for React Native written on top of AsyncStorage.

With react-native-data-storage you can set, get, remove and check for data. You can save integers, booleans, strings, primitive objects and arrays (anything that can be represented as in the JSON format). The methods always return a promise.

##Installation

npm install react-native-data-storage --save

##Reference

set(key, value): sets a new value to the storage. get(key): gets a value in the storage. Promise is rejected if key is not found. An array of keys can be passed and an object with the values will be returned. has(key): checks whether a value has been set to the storage. Promise resolves with true of false. remove(key): removes a value from the storage. getAll(): gets all the values in the storage as an object.

##Usage

import DataStorage from 'react-native-data-storage';

Storage.set('name','John Doe')
.then((data)=>{
    return Storage.has('name');
})
.then((data)=>{
    if(data) return Storage.get('name');
    else return '';
})
.then((name)=>{
    console.log(name); //outputs 'John Doe';
    return Storage.remove('name');
})
.then((name)=>{
    console.log('Completed!');
});

FAQs

Package last updated on 09 Nov 2017

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

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