<commit_before># kvdb

**kvdb** is a key-value store for iOS backed by SQLite3.

It can serialize and store any objects that implement the `NSCoding` protocol.

Therefore, lots of objects are supported right away:

- `NSDictionary`
- `NSArray`
- `NSNumber`
- `NSString`

etc.

## Usage

```objective-c
#import "kvdb.h"

[[KVDB sharedDB] setValue:@"apple" forKey:@"fruit"];
[[KVDB sharedDB] setValue:@"Chicago" forKey:@"city"];

MyObject *object = [[MyObject alloc] initWithTitle:@"KVDB"];
[[KVDB sharedDB] setValue:object forKey:@"my_object"];
```

## Installation

The recommended way is to install via Cocoapods:

Add into your Podfile:

```ruby
pod 'kvdb', :git => 'https://github.com/colinyoung/kvdb'
```

And run 

```
pod update
```

or you can just clone `kvdb` and add `kvdb/` folder to your project.

## Other stuff

```objective-c
[[KVDB sharedDB] dropDatabase];

[[KVDB sharedDB] createDatabase];

// Instantiate w/ a different file:
[KVDB sharedDBWithFile:@"blah.sqlite3"]; // the file will be created in your documents directory.
```

## Coding nil-values: nil vs NSNull

To provide a compatibility with `NSArray` and `NSDictionary` classes `KVDB` denies the coding of `nil` values. `KVDB` follows the same policy as NSDictionary class does: 

`-[KVDB setValue:forKey:]` - if value is nil then method attempts to remove key using removeValueForKey:.

`[KVDB setObject:forKey:]` raises an NSInvalidArgumentException if aKey is nil.

Like it is done when working with instances of NSArray or NSDictionary use `NSNull` class whereever you want `-[KVDB setValue:forKey]` to provide a given key with a null value:

Use

```objective-c
[[KVDB sharedDB] setValue:[NSNull null] forKey:@"fruit"];

id dbValue = [[KVDB sharedDB] valueForKey:testKey]; 

NSLog(@"%@", dbValue); // will print "<null>" i.e.  NSNull singleton
```
<commit_msg>API listed in README was missing leading dash<commit_after># kvdb

**kvdb** is a key-value store for iOS backed by SQLite3.

It can serialize and store any objects that implement the `NSCoding` protocol.

Therefore, lots of objects are supported right away:

- `NSDictionary`
- `NSArray`
- `NSNumber`
- `NSString`

etc.

## Usage

```objective-c
#import "kvdb.h"

[[KVDB sharedDB] setValue:@"apple" forKey:@"fruit"];
[[KVDB sharedDB] setValue:@"Chicago" forKey:@"city"];

MyObject *object = [[MyObject alloc] initWithTitle:@"KVDB"];
[[KVDB sharedDB] setValue:object forKey:@"my_object"];
```

## Installation

The recommended way is to install via Cocoapods:

Add into your Podfile:

```ruby
pod 'kvdb', :git => 'https://github.com/colinyoung/kvdb'
```

And run 

```
pod update
```

or you can just clone `kvdb` and add `kvdb/` folder to your project.

## Other stuff

```objective-c
[[KVDB sharedDB] dropDatabase];

[[KVDB sharedDB] createDatabase];

// Instantiate w/ a different file:
[KVDB sharedDBWithFile:@"blah.sqlite3"]; // the file will be created in your documents directory.
```

## Coding nil-values: nil vs NSNull

To provide a compatibility with `NSArray` and `NSDictionary` classes `KVDB` denies the coding of `nil` values. `KVDB` follows the same policy as NSDictionary class does: 

`-[KVDB setValue:forKey:]` - if value is nil then method attempts to remove key using removeValueForKey:.

`-[KVDB setObject:forKey:]` - raises an NSInvalidArgumentException if aKey is nil.

Like it is done when working with instances of NSArray or NSDictionary use `NSNull` class whereever you want `-[KVDB setValue:forKey]` to provide a given key with a null value:

Use

```objective-c
[[KVDB sharedDB] setValue:[NSNull null] forKey:@"fruit"];

id dbValue = [[KVDB sharedDB] valueForKey:testKey]; 

NSLog(@"%@", dbValue); // will print "<null>" i.e.  NSNull singleton
```

{'fraction_non_alphanumeric': 0.13128867366155503, 'fraction_numerical': 0.0010761366693570083, 'mean_word_length': 4.873617693522907, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3412672', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1211, 'n_words': 447}