Skip to content

Commit 259dbae

Browse files
committed
readme fixes
1 parent 20d1e27 commit 259dbae

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# DataStore
22

3-
DataStore is a JavaScript module that makes it easy to save key value pairs to [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) with an API similar to [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).
3+
DataStore is a JavaScript module that makes it easy to save key value/pairs to [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) with an API similar to [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).
44

5-
IndexedDB is allowed more storage space than localStorage. It also can store more data types than strings. That means you can save structured data without having to convert it to JSON first. IndexedDB, unlike localStorage, isn’t blocking—all operations are asynchronous.
5+
IndexedDB is allowed more storage space than localStorage. It can also store more data types than strings. That means you can save structured data without having to convert it to JSON first. IndexedDB, unlike localStorage, isn’t blocking—all operations are asynchronous.
66

7-
IndexedDB can do a _lot_ more, but the above reasons above are enough to use it even in relatively simple cases. This DataStore class is woefully underusing IndexedDB features. It merely replicates localStorage but by using IndexedDB behind the scenes for its advantages.
7+
IndexedDB can do a _lot_ more, but the reasons above are enough to use it even in relatively simple cases. This DataStore class is woefully underusing IndexedDB features. It merely replicates localStorage but by using IndexedDB behind the scenes for its advantages.
88

99
## Usage
1010

11-
While DataStore aims to be as simple as localStorage, it does have one extra setup step: an instance needs to be instantiated.
11+
While DataStore aims to be as simple as localStorage, it does have one extra setup step: you must create an instance.
1212

1313
```js
1414
import DataStore from './path/to/DataStore.js';
@@ -97,7 +97,7 @@ While localStorage gives you a `length` property that you can read from, DataSto
9797
async function main() {
9898
let num = await store.count();
9999
// Ex: 3
100-
100+
101101
// if you prefer the word "length," this method is identical
102102
num = await store.length();
103103
// still 3
@@ -123,7 +123,7 @@ DataStore.setupDb({
123123
onUpgradeNeeded: async (db, stores) => {
124124
// Perform any database operations you want to do.
125125
// `stores` represents a DataStore instance for each store you created.
126-
}
126+
},
127127
});
128128
```
129129

@@ -140,15 +140,15 @@ async function main() {
140140
const store = new DataStore('My Database');
141141
// number keys get turned into strings under the hood
142142
const post = await store.getItem(1);
143-
144-
// pecify database name and object store name if not using default.
143+
144+
// specify database name and object store name if not using default.
145145
const metaStore = new DataStore('My Database', 'metadata');
146146
const likes = await metaStore.getItem('likes-1');
147-
147+
148148
return { post, likes };
149149
}
150150
```
151151

152152
## Keys are strings
153153

154-
Datastore only supports strings as keys. That said, you *can* use numbers in `getItem`, `setItem`, and `removeItems`. Just be aware that they get converted to strings under the hood. The `keys()` method always returns an array of strings.
154+
DataStore only supports strings as keys. That said, you _can_ use numbers in `getItem`, `setItem`, and `removeItem`. Just be aware that they get converted to strings under the hood. The `keys()` method always returns an array of strings.

0 commit comments

Comments
 (0)