<commit_before># consul-kv-object
[![Build Status](https://travis-ci.org/lekoder/consul-kv-object.svg?branch=master)](https://travis-ci.org/lekoder/consul-kv-object)
[![Coverage Status](https://coveralls.io/repos/github/lekoder/consul-kv-object/badge.svg?branch=master)](https://coveralls.io/github/lekoder/consul-kv-object?branch=master)

Store and retrive POJsO from consul keystore.

[![NPM](https://nodei.co/npm/consul-kv-object.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/consul-kv-object/)

## Usage

```
npm install --save consul-kv-object
```

```
var consul = require('consul')();
var kv = require('consul-kv-object')(consul.kv);

kv.set("test/key",{ pojo: true, nested: { yep: "asd" } });
kv.get("test/key", function( err, res ) { } );
kv.del("test/key");
```

## Options

Options are passed as optional second parameter.

| Option       | Default   | Meaning |
|--------------|-----------|---------|
| mapTypes     | true      | Perform type mapping when setting and getting
| guessTypes   | false     | Try to guess types when reading value with flags==0
| defaultType  | see below | Default type to use when flag is not recognized 
| typeMapFlags | see below | Type mapping array

## Type mapping 

Types are preserved using flags and flag mapping array. Each type has other flag value.
When flag is not recognized or type mapping is disabled, `consul-kv-object` returns 
strings.

## Type guessing
<commit_msg>Add concurrency description to readme<commit_after># consul-kv-object
[![Build Status](https://travis-ci.org/lekoder/consul-kv-object.svg?branch=master)](https://travis-ci.org/lekoder/consul-kv-object)
[![Coverage Status](https://coveralls.io/repos/github/lekoder/consul-kv-object/badge.svg?branch=master)](https://coveralls.io/github/lekoder/consul-kv-object?branch=master)

Store and retrive POJsO from consul keystore.

[![NPM](https://nodei.co/npm/consul-kv-object.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/consul-kv-object/)

## Usage

```
npm install --save consul-kv-object
```

```
var consul = require('consul')();
var kv = require('consul-kv-object')(consul.kv);

kv.set("test/key",{ pojo: true, nested: { yep: "asd" } });
kv.get("test/key", function( err, res ) { } );
kv.del("test/key");
```

## Options

Options are passed as optional second parameter.

| Option       | Default   | Meaning |
|--------------|-----------|---------|
| mapTypes     | true      | Perform type mapping when setting and getting
| guessTypes   | false     | Try to guess types when reading value with flags==0
| defaultType  | see below | Default type to use when flag is not recognized 
| typeMapFlags | see below | Type mapping array
| concurrency  | 10        | Number of concurrent consul connections when setting values

## Type mapping 

Types are preserved using flags and flag mapping array. Each type has other flag value.
When flag is not recognized or type mapping is disabled, `consul-kv-object` returns 
strings.

## Type guessing

{'fraction_non_alphanumeric': 0.16683250414593698, 'fraction_numerical': 0.0013266998341625207, 'mean_word_length': 3.8488745980707395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1906179', 'n_tokens_mistral': 994, 'n_tokens_neox': 954, 'n_words': 248}