From 6d14ab2206b42b772c6f6f9406b65f5035352d3a Mon Sep 17 00:00:00 2001 From: Makarov Artem Date: Fri, 20 Mar 2020 14:11:00 +0300 Subject: [PATCH] Update README.md --- README.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 68 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index eb0f206..ccc190f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,75 @@ -# Welcome to simple-data-storage +# SData.js ![Version](https://img.shields.io/badge/version-0.1.0-blue.svg?cacheSeconds=2592000) [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/artmakarov/simple-data-storage/graphs/commit-activity) [![License: MIT](https://img.shields.io/github/license/artmakarov/simple-data-storage)](https://github.com/artmakarov/simple-data-storage/blob/master/LICENSE) -> Simple key-value storage +> Simple key-value storage in the browser or node + + +## Install + +```shell script +npm i simple-data-storage +``` + +in browser: + +``` + +``` + + +## Usage example + +```js +const sdata = require('simple-data-storage'); + +sdata('one_key', 'one_value'); +console.log(sdata('one_key')); //=> one_value + +sdata(321, 963); +sdata('other key', { abc: 'boom!' }); +console.log(sdata(321)); //=> 963 +console.log(sdata('321')); //=> 963 +console.log(sdata('other key')); //=> { abc: 'boom!' } +console.log(sdata('other key').abc); //=> boom! + +// clear one item +sdata.clear('other key'); +console.log(sdata('other key')); //=> undefined +console.log(sdata('one_key')); //=> one_value + +// clear all items +sdata(123, ['test', 4]); +sdata.clear(); +console.log(sdata(123)); //=> undefined +console.log(sdata('one_key')); //=> undefined +``` + +In the browser, use the global function **SData()** + +```html + +``` + +## Development + +```shell script +git clone git@github.com:artmakarov/simple-data-storage.git +cd simple-data-storage +npm install +npm run build +``` + +#### Tests + +```shell script +npm run test +``` + ## Contributing @@ -11,9 +77,6 @@ Contributions, issues and feature requests are welcome! Feel free to check [issues page](https://github.com/artmakarov/simple-data-storage/issues). -## Show your support - -Give a ⭐️ if this project helped you! ## License