<commit_before># Local DB

Local DB is a wrapper around IndexedDB that drastically simplifies the API to `getItem`, `setItem`, and `removeItem`, making it similar to the `localStorage` API.

Its only dependency is [q.js](https://github.com/kriskowal/q).

## API

#### `initialize()`
Initialize the object and return a `q.promise`. All subsequent calls should be in a resolve handler: `localDB.initialize().done(function () { ... });`

#### `setItem(key, value)`
Store the given value and associate it with the given key. Returns a `q.promise` which can be used for success/error handling.

#### `getItem(key)`
Retrieve the value associated with the given key. The return value is not the retrieved value, but rather a `q.promise`. The success handler of the `q.promise` will contain the retrieved value: `localDB.getItem("foo").done(function (result) { ... });

#### `removeItem(key)`
Remove the value associated with the given key from the object store. Returns a `q.promise` which can be used for success/error handling.

### Example
```javascript
localDB.initialize().then(function () {
	return localDB.setItem("foo", "bar");
}).then(function () {
	console.log("set item");
	return localDB.getItem("foo");
}).then(function (value) {
	console.log("got item", value);
	return localDB.removeItem("foo");
}).then(function () {
	console.log("removed item");
});
```

Check out the `example` directory for more examples.<commit_msg>Fix readme<commit_after># Local DB

Local DB is a wrapper around IndexedDB that drastically simplifies the API to `getItem`, `setItem`, and `removeItem`, making it similar to the `localStorage` API.

Its only dependency is [q.js](https://github.com/kriskowal/q).

## API

#### `initialize()`
Initialize the object and return a `q.promise`. All subsequent calls should be in a resolve handler: `localDB.initialize().done(function () { ... });`

#### `setItem(key, value)`
Store the given value and associate it with the given key. Returns a `q.promise` which can be used for success/error handling.

#### `getItem(key)`
Retrieve the value associated with the given key. The return value is not the retrieved value, but rather a `q.promise`. The success handler of the `q.promise` will contain the retrieved value: `localDB.getItem("foo").done(function (result) { ... });`

#### `removeItem(key)`
Remove the value associated with the given key from the object store. Returns a `q.promise` which can be used for success/error handling.

### Example
```javascript
localDB.initialize().then(function () {
	return localDB.setItem("foo", "bar");
}).then(function () {
	console.log("set item");
	return localDB.getItem("foo");
}).then(function (value) {
	console.log("got item", value);
	return localDB.removeItem("foo");
}).then(function () {
	console.log("removed item");
});
```

Check out the `example` directory for more examples.
{'fraction_non_alphanumeric': 0.14530812324929973, 'fraction_numerical': 0.0, 'mean_word_length': 4.927385892116183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6086616', 'n_tokens_mistral': 821, 'n_tokens_neox': 818, 'n_words': 320}