# @webantic/util

> A library of utility functions

Latest version **9.0.4** (published 2018-11-14) · SEE LICENSE IN ./LICENSE license · 0 weekly downloads

## Install

```sh
npm install @webantic/util
pnpm add @webantic/util
yarn add @webantic/util
bun add @webantic/util
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 9.0.4 |
| Published | 2018-11-14 |
| First published | 2017-03-06 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN ./LICENSE |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 340.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Webantic |
| Maintainers | andrewshand94, ben-webantic, calvin-evans, carlevans719, georgiawebantic, jnnash, liam-ans, martoidprime, ngaskill, ryandunn, stuart-bennett, yee |

## Links

- npm: https://www.npmjs.com/package/@webantic/util
- Repository: https://github.com/webantic/util
- Homepage: https://github.com/webantic/util#readme
- Issues: https://github.com/webantic/util/issues
- npm.io page: https://npm.io/package/@webantic/util

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) ^3.1.0
- [jquery](https://npm.io/package/jquery.md) ^3.2.1
- [babel-polyfill](https://npm.io/package/babel-polyfill.md) ^6.26.0

## Recent versions

- 9.0.4 (latest) — 2018-11-14
- 9.0.3 — 2018-11-08
- 9.0.2 — 2018-11-08
- 9.0.1 — 2018-08-23
- 9.0.0 — 2018-08-23
- 8.7.2 — 2018-08-21
- 8.7.1 — 2018-08-21
- 8.7.0 — 2018-08-21
- 8.6.0 — 2018-08-21
- 8.5.2 — 2018-08-21
- 8.5.1 — 2018-08-21
- 8.5.0 — 2018-08-21
- 8.4.1 — 2018-06-29
- 8.4.0 — 2018-06-29
- 8.3.1 — 2018-06-13
- … 176 more at https://npm.io/package/@webantic/util/versions

## README

## Modules

<dl>
<dt><a href="#module_util/array">util/array</a></dt>
<dd></dd>
<dt><a href="#module_util/blaze">util/blaze</a></dt>
<dd></dd>
<dt><a href="#module_util/collection">util/collection</a></dt>
<dd></dd>
<dt><a href="#module_util/config">util/config</a></dt>
<dd></dd>
<dt><a href="#module_util/data">util/data</a></dt>
<dd></dd>
<dt><a href="#module_util/date">util/date</a></dt>
<dd></dd>
<dt><a href="#module_util/emitter">util/emitter</a></dt>
<dd></dd>
<dt><a href="#module_util/http">util/http</a></dt>
<dd></dd>
<dt><a href="#module_util/image">util/image</a></dt>
<dd></dd>
<dt><a href="#module_util/location">util/location</a></dt>
<dd></dd>
<dt><a href="#module_util/meteor">util/meteor</a></dt>
<dd></dd>
<dt><a href="#module_util/model">util/model</a></dt>
<dd></dd>
<dt><a href="#module_util/number">util/number</a></dt>
<dd></dd>
<dt><a href="#module_util/object">util/object</a></dt>
<dd></dd>
<dt><a href="#module_util/popover">util/popover</a></dt>
<dd></dd>
<dt><a href="#module_util/reactivity">util/reactivity</a></dt>
<dd></dd>
<dt><a href="#module_util/schema">util/schema</a></dt>
<dd></dd>
<dt><a href="#module_util/config">util/config</a></dt>
<dd></dd>
<dt><a href="#module_util/string">util/string</a></dt>
<dd></dd>
</dl>

<a name="module_util/array"></a>

## util/array

* [util/array](#module_util/array)
    * [~move(array, fromIndex, toIndex)](#module_util/array..move) ⇒ <code>Array.&lt;any&gt;</code>
    * [~addToSet(array, item)](#module_util/array..addToSet) ⇒ <code>Array.&lt;any&gt;</code>
    * [~addToSetInPlace(set, item)](#module_util/array..addToSetInPlace) ⇒ <code>boolean</code>
    * [~first(array)](#module_util/array..first) ⇒ <code>any</code>
    * [~last(array)](#module_util/array..last) ⇒ <code>any</code>
    * [~eachUntil(array, callback)](#module_util/array..eachUntil)
    * [~remove(array, item)](#module_util/array..remove) ⇒ <code>Array.&lt;any&gt;</code>
    * [~removeAll(array, item)](#module_util/array..removeAll) ⇒ <code>Array.&lt;any&gt;</code>
    * [~forceArray(input)](#module_util/array..forceArray) ⇒ <code>Array.&lt;any&gt;</code>
    * [~mapAsync(array, callback, onComplete)](#module_util/array..mapAsync)
    * [~forEachAsync(array, cb, onComplete)](#module_util/array..forEachAsync)

<a name="module_util/array..move"></a>

### util/array~move(array, fromIndex, toIndex) ⇒ <code>Array.&lt;any&gt;</code>
**Kind**: inner method of [<code>util/array</code>](#module_util/array)  
**Summary**: moves an element at a given index to
another index  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| array | <code>Array.&lt;any&gt;</code> | an array containing the element to move |
| fromIndex | <code>number</code> | the location of the element to move |
| toIndex | <code>number</code> | the destination index |

<a name="module_util/array..addToSet"></a>

### util/array~addToSet(array, item) ⇒ <code>Array.&lt;any&gt;</code>
**Kind**: inner method of [<code>util/array</code>](#module_util/array)  
**Summary**: Returns an array containing `item`, adding
it if it is missing.
Note: this only uses indexOf for comparison, so it
will not work for objects  
**Returns**: <code>Array.&lt;any&gt;</code> - the new array  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| array | <code>Array.&lt;any&gt;</code> | an array to potentially add `item` to |
| item | <code>any</code> | an item to ensure is within `array` |

<a name="module_util/array..addToSetInPlace"></a>

### util/array~addToSetInPlace(set, item) ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/array</code>](#module_util/array)  
**Summary**: Adds `item` to `set` if it is
missing, returns true if `set` was modified  
**Returns**: <code>boolean</code> - true if `set` was modified  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| set | <code>Array.&lt;any&gt;</code> | a set to potentially add `item` to |
| item | <code>any</code> | an item to ensure is within `set` |

<a name="module_util/array..first"></a>

### util/array~first(array) ⇒ <code>any</code>
**Kind**: inner method of [<code>util/array</code>](#module_util/array)  
**Summary**: returns the first element in an array  
**Returns**: <code>any</code> - the first element of the array  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| array | <code>Array.&lt;any&gt;</code> | the array to search in |

<a name="module_util/array..last"></a>

### util/array~last(array) ⇒ <code>any</code>
**Kind**: inner method of [<code>util/array</code>](#module_util/array)  
**Summary**: returns the last element in an array  
**Returns**: <code>any</code> - the last element of the array  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| array | <code>Array.&lt;any&gt;</code> | the array to search in |

<a name="module_util/array..eachUntil"></a>

### util/array~eachUntil(array, callback)
**Kind**: inner method of [<code>util/array</code>](#module_util/array)  
**Summary**: calls `callback` for each item in an array,
provided that the previous iteration didn't return `false`  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| array | <code>Array.&lt;any&gt;</code> | of items to iterate |
| callback | <code>ForEachCallback</code> | the function to invoke for each element in the supplied array |

<a name="module_util/array..remove"></a>

### util/array~remove(array, item) ⇒ <code>Array.&lt;any&gt;</code>
**Kind**: inner method of [<code>util/array</code>](#module_util/array)  
**Summary**: Remove an item from an array  
**Returns**: <code>Array.&lt;any&gt;</code> - The new array  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| array | <code>Array.&lt;any&gt;</code> | The array to remove `item` from |
| item | <code>any</code> | The item to remove. Cannot be an object |

**Example**  
```js
var array = ['a', 'b', 'c']
remove(array, 'b') // returns ['a', 'c']
```
<a name="module_util/array..removeAll"></a>

### util/array~removeAll(array, item) ⇒ <code>Array.&lt;any&gt;</code>
**Kind**: inner method of [<code>util/array</code>](#module_util/array)  
**Summary**: Removes all occurrences of `item` from `array`  
**Returns**: <code>Array.&lt;any&gt;</code> - The new array  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| array | <code>Array.&lt;any&gt;</code> | The array to remove all occurrences of `item` from |
| item | <code>any</code> | The item to remove |

**Example**  
```js
var array = ['a', 'b', 'b', 'c']
removeAll(array, 'b') // returns ['a', 'c']
```
<a name="module_util/array..forceArray"></a>

### util/array~forceArray(input) ⇒ <code>Array.&lt;any&gt;</code>
**Kind**: inner method of [<code>util/array</code>](#module_util/array)  
**Summary**: wraps the input in an array if it isn't already one  
**Returns**: <code>Array.&lt;any&gt;</code> - always an array  

| Param | Type |
| --- | --- |
| input | <code>any</code> | 

<a name="module_util/array..mapAsync"></a>

### util/array~mapAsync(array, callback, onComplete)
Map an array's values, iterating asynchronously

**Kind**: inner method of [<code>util/array</code>](#module_util/array)  

| Param | Description |
| --- | --- |
| array | The array to map |
| callback | A callback to receive the current element & index. Should return the new value |
| onComplete | A callback which will be called when all elements have been processed |

<a name="module_util/array..forEachAsync"></a>

### util/array~forEachAsync(array, cb, onComplete)
Iterate the elements in an array, calling the user-supplied callback on each element asynchronously

**Kind**: inner method of [<code>util/array</code>](#module_util/array)  

| Param | Type | Description |
| --- | --- | --- |
| array | <code>Array.&lt;any&gt;</code> | The array to iterate |
| cb | <code>ArrayTypes.MapCallbackFunction</code> | the callback to receive the element(s) |
| onComplete | <code>ArrayTypes.CallbackFunction</code> | A callback to be called when all elements have been iterated |

<a name="module_util/blaze"></a>

## util/blaze

* [util/blaze](#module_util/blaze)
    * [~attachAPI(blaze, API)](#module_util/blaze..attachAPI)
    * [~onCountChanged(callback)](#module_util/blaze..onCountChanged)

<a name="module_util/blaze..attachAPI"></a>

### util/blaze~attachAPI(blaze, API)
Attach a DDP connection to Blaze so that it is available in templates' `this.subscribe`

**Kind**: inner method of [<code>util/blaze</code>](#module_util/blaze)  

| Param | Type | Description |
| --- | --- | --- |
| blaze | <code>Object</code> | a reference to Blaze |
| API | <code>Object</code> | The DDP connection to attachs |

<a name="module_util/blaze..onCountChanged"></a>

### util/blaze~onCountChanged(callback)
Add a function to get called when the count changes

**Kind**: inner method of [<code>util/blaze</code>](#module_util/blaze)  

| Param | Type |
| --- | --- |
| callback | <code>function</code> | 

<a name="module_util/collection"></a>

## util/collection

* [util/collection](#module_util/collection)
    * [~insert(collection, items)](#module_util/collection..insert) ⇒ [<code>ICollectionReturn</code>](#module_util/collection..ICollectionReturn)
    * [~update(collection, items)](#module_util/collection..update) ⇒ [<code>ICollectionReturn</code>](#module_util/collection..ICollectionReturn)
    * [~remove(collection, _ids)](#module_util/collection..remove) ⇒ [<code>ICollectionReturn</code>](#module_util/collection..ICollectionReturn)
    * [~caseInsensitiveSelector(fieldName, str, [wordIsPrefix])](#module_util/collection..caseInsensitiveSelector) ⇒ <code>Object</code>
    * [~selectorFromParams(selectorParams)](#module_util/collection..selectorFromParams) ⇒ <code>Object</code>
    * [~getObserverHandlers(context, collection)](#module_util/collection..getObserverHandlers) ⇒ [<code>IObserveHandlers</code>](#module_util/collection..IObserveHandlers)
    * [~mapHelpersToThis(pureHelpers)](#module_util/collection..mapHelpersToThis) ⇒ <code>any</code>
    * [~IFailedOps](#module_util/collection..IFailedOps) : <code>Object</code>
    * [~ICollectionReturn](#module_util/collection..ICollectionReturn) : <code>Object</code>
    * [~IObserveHandlers](#module_util/collection..IObserveHandlers) : <code>Object</code>
    * [~ISelectorParams](#module_util/collection..ISelectorParams) : <code>Object</code>

<a name="module_util/collection..insert"></a>

### util/collection~insert(collection, items) ⇒ [<code>ICollectionReturn</code>](#module_util/collection..ICollectionReturn)
**Kind**: inner method of [<code>util/collection</code>](#module_util/collection)  
**Summary**: Inserts a number of `items` into the given `collection`  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| collection | <code>Mongo.Collection</code> | A Mongo.Collection |
| items | <code>Array.&lt;object&gt;</code> | the items to insert. |

<a name="module_util/collection..update"></a>

### util/collection~update(collection, items) ⇒ [<code>ICollectionReturn</code>](#module_util/collection..ICollectionReturn)
**Kind**: inner method of [<code>util/collection</code>](#module_util/collection)  
**Summary**: Updates a number of `items` into the given `collection`  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| collection | <code>Mongo.Collection</code> | A Mongo.Collection |
| items | <code>Array.&lt;object&gt;</code> | the items to update. The _id field is used as a selector, the rest of the object as the modifier |

<a name="module_util/collection..remove"></a>

### util/collection~remove(collection, _ids) ⇒ [<code>ICollectionReturn</code>](#module_util/collection..ICollectionReturn)
**Kind**: inner method of [<code>util/collection</code>](#module_util/collection)  
**Summary**: Remvoves a number of items by their _id from the
given `collection`  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| collection | <code>Mongo.Collection</code> | A Mongo.Collection |
| _ids | <code>Array.&lt;string&gt;</code> | the _ids of the items to remove. |

<a name="module_util/collection..caseInsensitiveSelector"></a>

### util/collection~caseInsensitiveSelector(fieldName, str, [wordIsPrefix]) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/collection</code>](#module_util/collection)  
**Summary**: Generates a selector for a field which will perform a case-insensitive
lookup for the given value  
**Returns**: <code>Object</code> - the Mongo selector object  
**Export**:   

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| fieldName | <code>string</code> |  | the name of the field to query |
| str | <code>string</code> |  | the value to query |
| [wordIsPrefix] | <code>boolean</code> | <code>false</code> | whether the supplied value for str is a prefix or the whole query |

<a name="module_util/collection..selectorFromParams"></a>

### util/collection~selectorFromParams(selectorParams) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/collection</code>](#module_util/collection)  
**Summary**: Parses "skip", "limit", "sort", "before" and "since" into a selector and options object  
**Returns**: <code>Object</code> - The constructed selector & options objects  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| selectorParams | [<code>ISelectorParams</code>](#module_util/collection..ISelectorParams) | An object containing any/all of the defined keys. "createdOrUpdated" can be either "createdAt" (default) or "updatedAt". It determines what "before" and "since" act upon |

<a name="module_util/collection..getObserverHandlers"></a>

### util/collection~getObserverHandlers(context, collection) ⇒ [<code>IObserveHandlers</code>](#module_util/collection..IObserveHandlers)
**Kind**: inner method of [<code>util/collection</code>](#module_util/collection)  
**Summary**: Returns a map of default observe callback handlers  
**Returns**: [<code>IObserveHandlers</code>](#module_util/collection..IObserveHandlers) - The map of callback handlers  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| context | <code>any</code> | The `this` context. It should contain `added`, `changed` and `removed` methods |
| collection | <code>string</code> | The name of the collection to add/change/remove documents to/from |

<a name="module_util/collection..mapHelpersToThis"></a>

### util/collection~mapHelpersToThis(pureHelpers) ⇒ <code>any</code>
Takes an object of helpers and wraps them in functions that use
the `this` context and pass it as the first arg. Allows `this`less functions
to be used as collection helpers

**Kind**: inner method of [<code>util/collection</code>](#module_util/collection)  

| Param | Type | Description |
| --- | --- | --- |
| pureHelpers | <code>any</code> | helpers to map |

<a name="module_util/collection..IFailedOps"></a>

### util/collection~IFailedOps : <code>Object</code>
**Kind**: inner typedef of [<code>util/collection</code>](#module_util/collection)  
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| code | <code>number</code> | the error code |
| message | <code>string</code> | the error message |
| additional | <code>any</code> | meta information about the error |

<a name="module_util/collection..ICollectionReturn"></a>

### util/collection~ICollectionReturn : <code>Object</code>
**Kind**: inner typedef of [<code>util/collection</code>](#module_util/collection)  
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| success | <code>boolean</code> | Whether no operations failed |
| failed | [<code>Array.&lt;IFailedOps&gt;</code>](#module_util/collection..IFailedOps) | an array of objects detailling failed operations |
| succeeded | <code>Array.&lt;(any\|boolean)&gt;</code> | an array of objects detailling documents of successful operations |

<a name="module_util/collection..IObserveHandlers"></a>

### util/collection~IObserveHandlers : <code>Object</code>
**Kind**: inner typedef of [<code>util/collection</code>](#module_util/collection)  
**Properties**

| Name | Type |
| --- | --- |
| added | <code>function</code> | 
| changed | <code>function</code> | 
| removed | <code>function</code> | 

<a name="module_util/collection..ISelectorParams"></a>

### util/collection~ISelectorParams : <code>Object</code>
**Kind**: inner typedef of [<code>util/collection</code>](#module_util/collection)  
**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [skip] | <code>number</code> |  | A number indicating how many matching documents to skip |
| [limit] | <code>number</code> |  | A number indicating the maximum number of documents to return |
| [sort] | <code>Object.&lt;number&gt;</code> |  | An object whose keys equate to database column names and whose values are either 1 or -1 to indicate sort order |
| [createdOrUpdated] | <code>string</code> | <code>&quot;\&quot;createdAt\&quot;&quot;</code> |  |
| [before] | <code>Date</code> \| <code>string</code> \| <code>number</code> |  | A parsable representation of a date. Only documents whose createdAt or updatedAt (as defined by createdOrUpdated) are greater than the supplied value will be returned |
| [since] | <code>Date</code> \| <code>string</code> \| <code>number</code> |  | A parsable representation of a date. Only documents whose createdAt or updatedAt (as defined by createdOrUpdated) are less than the supplied value will be returned |
| [fields] | <code>Object.&lt;number&gt;</code> |  | An object whose keys equate to database column names and whose values are either 1 or 0 to indicate inclusion or exclusion |

<a name="module_util/config"></a>

## util/config

* [util/config](#module_util/config)
    * [~Configuration](#module_util/config..Configuration)
        * [new Configuration(collection, Meteor, [Tracker], [connection])](#new_module_util/config..Configuration_new)
    * [~StandaloneConfiguration](#module_util/config..StandaloneConfiguration)
        * [new StandaloneConfiguration()](#new_module_util/config..StandaloneConfiguration_new)

<a name="module_util/config..Configuration"></a>

### util/config~Configuration
**Kind**: inner class of [<code>util/config</code>](#module_util/config)  
<a name="new_module_util/config..Configuration_new"></a>

#### new Configuration(collection, Meteor, [Tracker], [connection])
A configuration class - provides a DB-backed, environment variable / meteor.settings populated set of config values


| Param | Type | Description |
| --- | --- | --- |
| collection | <code>Mongo.Collection</code> | the config collection |
| Meteor | <code>Object</code> | a reference to the Meteor object |
| [Tracker] | <code>Object</code> | an optional reference to Tracker - will be mocked in a non-reactive way if not supplied |
| [connection] | <code>Object</code> | an optional override for the DDP connection to use to subscribe to the config pub |

<a name="module_util/config..StandaloneConfiguration"></a>

### util/config~StandaloneConfiguration
**Kind**: inner class of [<code>util/config</code>](#module_util/config)  
<a name="new_module_util/config..StandaloneConfiguration_new"></a>

#### new StandaloneConfiguration()
A configuration class - provides an environment variable / codebase-populated set of config values

<a name="module_util/data"></a>

## util/data

* [util/data](#module_util/data)
    * [~titles([flatten])](#module_util/data..titles) ⇒ <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code>
    * [~genders([flatten])](#module_util/data..genders) ⇒ <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code>
    * [~maritalStatuses([flatten])](#module_util/data..maritalStatuses) ⇒ <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code>
    * [~nationalities([flatten])](#module_util/data..nationalities) ⇒ <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code>

<a name="module_util/data..titles"></a>

### util/data~titles([flatten]) ⇒ <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code>
**Kind**: inner method of [<code>util/data</code>](#module_util/data)  
**Summary**: provides a list of name titles  
**Returns**: <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code> - If flatten is true, an array of string values otherwise an array of objects with name
and camelized value  
**Export**:   

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [flatten] | <code>boolean</code> | <code>false</code> | whether to return an array of plain text values |

<a name="module_util/data..genders"></a>

### util/data~genders([flatten]) ⇒ <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code>
**Kind**: inner method of [<code>util/data</code>](#module_util/data)  
**Summary**: provides a list of genders  
**Returns**: <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code> - If flatten is true, an array of string values otherwise an array of objects with name
and camelized value  
**Export**:   

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [flatten] | <code>boolean</code> | <code>false</code> | whether to return an array of plain text values |

<a name="module_util/data..maritalStatuses"></a>

### util/data~maritalStatuses([flatten]) ⇒ <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code>
**Kind**: inner method of [<code>util/data</code>](#module_util/data)  
**Summary**: provides a list of maritalStatuses  
**Returns**: <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code> - If flatten is true, an array of string values otherwise an array of objects with name
and camelized value  
**Export**:   

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [flatten] | <code>boolean</code> | <code>false</code> | whether to return an array of plain text values |

<a name="module_util/data..nationalities"></a>

### util/data~nationalities([flatten]) ⇒ <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code>
**Kind**: inner method of [<code>util/data</code>](#module_util/data)  
**Summary**: provides a list of nationalities  
**Returns**: <code>Array.&lt;object&gt;</code> \| <code>Array.&lt;string&gt;</code> - If flatten is true, an array of string values otherwise an array of objects with name
and camelized value  
**Export**:   

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [flatten] | <code>boolean</code> | <code>false</code> | whether to return an array of plain text values |

<a name="module_util/date"></a>

## util/date

* [util/date](#module_util/date)
    * [~randomBetween(from, to)](#module_util/date..randomBetween) ⇒ <code>Date</code>
    * [~getDate([startEnd], [prevNext], [interval])](#module_util/date..getDate) ⇒ <code>Date</code>
    * [~yesterday([startEnd])](#module_util/date..yesterday) ⇒ <code>Date</code>
    * [~tomorrow([startEnd])](#module_util/date..tomorrow) ⇒ <code>Date</code>
    * [~lastWeek([startEnd])](#module_util/date..lastWeek) ⇒ <code>Date</code>
    * [~nextWeek([startEnd])](#module_util/date..nextWeek) ⇒ <code>Date</code>
    * [~lastMonth([startEnd])](#module_util/date..lastMonth) ⇒ <code>Date</code>
    * [~nextMonth([startEnd])](#module_util/date..nextMonth) ⇒ <code>Date</code>
    * [~getPreviousDay(day)](#module_util/date..getPreviousDay) ⇒ <code>string</code>
    * [~getNextDay(day)](#module_util/date..getNextDay) ⇒ <code>string</code>

<a name="module_util/date..randomBetween"></a>

### util/date~randomBetween(from, to) ⇒ <code>Date</code>
**Kind**: inner method of [<code>util/date</code>](#module_util/date)  
**Summary**: gets a random date between two others  
**Returns**: <code>Date</code> - the random date  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| from | <code>Date</code> | random date must be greater than this |
| to | <code>Date</code> | random date must be less than this |

<a name="module_util/date..getDate"></a>

### util/date~getDate([startEnd], [prevNext], [interval]) ⇒ <code>Date</code>
Gets a Date object of a given offset from now

**Kind**: inner method of [<code>util/date</code>](#module_util/date)  
**Returns**: <code>Date</code> - the date object  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [startEnd] | <code>string</code> |  | Either 'start' or 'end' to round the date to the start or end of the day |
| [prevNext] | <code>string</code> | <code>&quot;&#x27;prev&#x27;&quot;</code> |  |
| [interval] | <code>string</code> | <code>&quot;&#x27;day&#x27;&quot;</code> |  |

<a name="module_util/date..yesterday"></a>

### util/date~yesterday([startEnd]) ⇒ <code>Date</code>
Return a Date object from 24 hours ago

**Kind**: inner method of [<code>util/date</code>](#module_util/date)  
**Returns**: <code>Date</code> - the date object  

| Param | Type | Description |
| --- | --- | --- |
| [startEnd] | <code>string</code> | either 'start' or 'end' - determines whether to round the date to the start or end of the day |

<a name="module_util/date..tomorrow"></a>

### util/date~tomorrow([startEnd]) ⇒ <code>Date</code>
Return a Date object for 24 hours in the future

**Kind**: inner method of [<code>util/date</code>](#module_util/date)  
**Returns**: <code>Date</code> - the date object  

| Param | Type | Description |
| --- | --- | --- |
| [startEnd] | <code>string</code> | either 'start' or 'end' - determines whether to round the date to the start or end of the day |

<a name="module_util/date..lastWeek"></a>

### util/date~lastWeek([startEnd]) ⇒ <code>Date</code>
Return a Date object from 7 days ago

**Kind**: inner method of [<code>util/date</code>](#module_util/date)  
**Returns**: <code>Date</code> - the date object  

| Param | Type | Description |
| --- | --- | --- |
| [startEnd] | <code>string</code> | either 'start' or 'end' - determines whether to round the date to the start or end of the day |

<a name="module_util/date..nextWeek"></a>

### util/date~nextWeek([startEnd]) ⇒ <code>Date</code>
Return a Date object for 7 days in the future

**Kind**: inner method of [<code>util/date</code>](#module_util/date)  
**Returns**: <code>Date</code> - the date object  

| Param | Type | Description |
| --- | --- | --- |
| [startEnd] | <code>string</code> | either 'start' or 'end' - determines whether to round the date to the start or end of the day |

<a name="module_util/date..lastMonth"></a>

### util/date~lastMonth([startEnd]) ⇒ <code>Date</code>
Return a Date object from 30 days ago

**Kind**: inner method of [<code>util/date</code>](#module_util/date)  
**Returns**: <code>Date</code> - the date object  

| Param | Type | Description |
| --- | --- | --- |
| [startEnd] | <code>string</code> | either 'start' or 'end' - determines whether to round the date to the start or end of the day |

<a name="module_util/date..nextMonth"></a>

### util/date~nextMonth([startEnd]) ⇒ <code>Date</code>
Return a Date object for 30 days in the future

**Kind**: inner method of [<code>util/date</code>](#module_util/date)  
**Returns**: <code>Date</code> - the date object  

| Param | Type | Description |
| --- | --- | --- |
| [startEnd] | <code>string</code> | either 'start' or 'end' - determines whether to round the date to the start or end of the day |

<a name="module_util/date..getPreviousDay"></a>

### util/date~getPreviousDay(day) ⇒ <code>string</code>
Can be passed either a full or three-letter day name and will return the previous day's name

**Kind**: inner method of [<code>util/date</code>](#module_util/date)  
**Returns**: <code>string</code> - the name of the previous day  

| Param | Type | Description |
| --- | --- | --- |
| day | <code>string</code> | a full or three-letter day name |

<a name="module_util/date..getNextDay"></a>

### util/date~getNextDay(day) ⇒ <code>string</code>
Can be passed either a full or three-letter day name and will return the next day's name

**Kind**: inner method of [<code>util/date</code>](#module_util/date)  
**Returns**: <code>string</code> - the name of the next day  

| Param | Type | Description |
| --- | --- | --- |
| day | <code>string</code> | a full or three-letter day name |

<a name="module_util/emitter"></a>

## util/emitter

* [util/emitter](#module_util/emitter)
    * [.MultiEmitter](#module_util/emitter.MultiEmitter)
        * [new MultiEmitter()](#new_module_util/emitter.MultiEmitter_new)
    * [.Emitter](#module_util/emitter.Emitter)
        * [new Emitter()](#new_module_util/emitter.Emitter_new)
    * [.MultiEmitter#listen(event, callback)](#module_util/emitter.MultiEmitter+listen)
    * [.MultiEmitter#broadcast(event, value)](#module_util/emitter.MultiEmitter+broadcast)
    * [.MultiEmitter#removeListeners(event)](#module_util/emitter.MultiEmitter+removeListeners)
    * [.Emitter#listen()](#module_util/emitter.Emitter+listen)
    * [.Emitter#broadcast(value)](#module_util/emitter.Emitter+broadcast)
    * [.Emitter#removeListeners()](#module_util/emitter.Emitter+removeListeners)

<a name="module_util/emitter.MultiEmitter"></a>

### util/emitter.MultiEmitter
**Kind**: static class of [<code>util/emitter</code>](#module_util/emitter)  
**Export**:   
<a name="new_module_util/emitter.MultiEmitter_new"></a>

#### new MultiEmitter()
Slightly more advanced event emitter style class that allows listening to different events via string arguments

<a name="module_util/emitter.Emitter"></a>

### util/emitter.Emitter
**Kind**: static class of [<code>util/emitter</code>](#module_util/emitter)  
**Export**:   
<a name="new_module_util/emitter.Emitter_new"></a>

#### new Emitter()
Basic class that represents an event that can be listened to and broadcasted

<a name="module_util/emitter.MultiEmitter+listen"></a>

### util/emitter.MultiEmitter#listen(event, callback)
Add a callback to be ran whenver this event is broadcasted

**Kind**: static method of [<code>util/emitter</code>](#module_util/emitter)  

| Param | Description |
| --- | --- |
| event | the event as a string to be listened to |
| callback | the callback to run whenever said event is triggered |

<a name="module_util/emitter.MultiEmitter+broadcast"></a>

### util/emitter.MultiEmitter#broadcast(event, value)
Broadcast an event of the given type

**Kind**: static method of [<code>util/emitter</code>](#module_util/emitter)  

| Param | Description |
| --- | --- |
| event | even type to broadcast |
| value | value to be passed to each callback |

<a name="module_util/emitter.MultiEmitter+removeListeners"></a>

### util/emitter.MultiEmitter#removeListeners(event)
Remove all attached listeners for a specific event type

**Kind**: static method of [<code>util/emitter</code>](#module_util/emitter)  

| Param |
| --- |
| event | 

<a name="module_util/emitter.Emitter+listen"></a>

### util/emitter.Emitter#listen()
Add a callback to be ran whenver this event is broadcasted

**Kind**: static method of [<code>util/emitter</code>](#module_util/emitter)  
<a name="module_util/emitter.Emitter+broadcast"></a>

### util/emitter.Emitter#broadcast(value)
Calls all callbacks that have been registered with the given value

**Kind**: static method of [<code>util/emitter</code>](#module_util/emitter)  

| Param | Description |
| --- | --- |
| value | value to broadcast, if any |

<a name="module_util/emitter.Emitter+removeListeners"></a>

### util/emitter.Emitter#removeListeners()
Remove all attached listeners

**Kind**: static method of [<code>util/emitter</code>](#module_util/emitter)  
<a name="module_util/http"></a>

## util/http

* [util/http](#module_util/http)
    * [~getBaseParameter([{ location, type, required }])](#module_util/http..getBaseParameter) ⇒ <code>Object</code>
    * [~requiredBodyString(extendedDef)](#module_util/http..requiredBodyString) ⇒ <code>Object</code>
    * [~requiredBodyNumber(extendedDef)](#module_util/http..requiredBodyNumber) ⇒ <code>Object</code>
    * [~requiredBodyDate(extendedDef)](#module_util/http..requiredBodyDate) ⇒ <code>Object</code>
    * [~requiredBodyBoolean(extendedDef)](#module_util/http..requiredBodyBoolean) ⇒ <code>Object</code>
    * [~requiredBodyObject(extendedDef)](#module_util/http..requiredBodyObject) ⇒ <code>Object</code>
    * [~optionalBodyString(extendedDef)](#module_util/http..optionalBodyString) ⇒ <code>Object</code>
    * [~optionalBodyNumber(extendedDef)](#module_util/http..optionalBodyNumber) ⇒ <code>Object</code>
    * [~optionalBodyDate(extendedDef)](#module_util/http..optionalBodyDate) ⇒ <code>Object</code>
    * [~optionalBodyBoolean(extendedDef)](#module_util/http..optionalBodyBoolean) ⇒ <code>Object</code>
    * [~optionalBodyObject(extendedDef)](#module_util/http..optionalBodyObject) ⇒ <code>Object</code>

<a name="module_util/http..getBaseParameter"></a>

### util/http~getBaseParameter([{ location, type, required }]) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/http</code>](#module_util/http)  
**Summary**: returns a basic Swagger parameter field  
**Export**:   

| Param | Type | Default |
| --- | --- | --- |
| [{ location, type, required }] | <code>\*</code> | <code>{}</code> | 

<a name="module_util/http..requiredBodyString"></a>

### util/http~requiredBodyString(extendedDef) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/http</code>](#module_util/http)  
**Summary**: scaffolds a required body string parameter  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| extendedDef | <code>Object</code> | the rest of the definition |

<a name="module_util/http..requiredBodyNumber"></a>

### util/http~requiredBodyNumber(extendedDef) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/http</code>](#module_util/http)  
**Summary**: scaffolds a required body number parameter  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| extendedDef | <code>Object</code> | the rest of the definition |

<a name="module_util/http..requiredBodyDate"></a>

### util/http~requiredBodyDate(extendedDef) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/http</code>](#module_util/http)  
**Summary**: scaffolds a required body string parameter  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| extendedDef | <code>Object</code> | the rest of the definition |

<a name="module_util/http..requiredBodyBoolean"></a>

### util/http~requiredBodyBoolean(extendedDef) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/http</code>](#module_util/http)  
**Summary**: scaffolds a required body boolean parameter  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| extendedDef | <code>Object</code> | the rest of the definition |

<a name="module_util/http..requiredBodyObject"></a>

### util/http~requiredBodyObject(extendedDef) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/http</code>](#module_util/http)  
**Summary**: scaffolds a required body object parameter  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| extendedDef | <code>Object</code> | the rest of the definition |

<a name="module_util/http..optionalBodyString"></a>

### util/http~optionalBodyString(extendedDef) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/http</code>](#module_util/http)  
**Summary**: scaffolds a optional body string parameter  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| extendedDef | <code>Object</code> | the rest of the definition |

<a name="module_util/http..optionalBodyNumber"></a>

### util/http~optionalBodyNumber(extendedDef) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/http</code>](#module_util/http)  
**Summary**: scaffolds a optional body number parameter  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| extendedDef | <code>Object</code> | the rest of the definition |

<a name="module_util/http..optionalBodyDate"></a>

### util/http~optionalBodyDate(extendedDef) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/http</code>](#module_util/http)  
**Summary**: scaffolds a optional body string parameter  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| extendedDef | <code>Object</code> | the rest of the definition |

<a name="module_util/http..optionalBodyBoolean"></a>

### util/http~optionalBodyBoolean(extendedDef) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/http</code>](#module_util/http)  
**Summary**: scaffolds a optional body boolean parameter  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| extendedDef | <code>Object</code> | the rest of the definition |

<a name="module_util/http..optionalBodyObject"></a>

### util/http~optionalBodyObject(extendedDef) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/http</code>](#module_util/http)  
**Summary**: scaffolds a optional body object parameter  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| extendedDef | <code>Object</code> | the rest of the definition |

<a name="module_util/image"></a>

## util/image

* [util/image](#module_util/image)
    * [~dataURIToBlob(dataURI)](#module_util/image..dataURIToBlob) ⇒ <code>blob</code>
    * [~toDataURI(file, callback)](#module_util/image..toDataURI)

<a name="module_util/image..dataURIToBlob"></a>

### util/image~dataURIToBlob(dataURI) ⇒ <code>blob</code>
**Kind**: inner method of [<code>util/image</code>](#module_util/image)  
**Summary**: converts a data uri to a blob://  
**Returns**: <code>blob</code> - the uri as a blob  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| dataURI | <code>string</code> | the data uri to convert into a blob |

<a name="module_util/image..toDataURI"></a>

### util/image~toDataURI(file, callback)
**Kind**: inner method of [<code>util/image</code>](#module_util/image)  
**Summary**: converts an image file to a data uri  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| file | <code>File</code> | the image file to convert |
| callback | <code>function</code> | a function to receive the result of the conversion |

<a name="module_util/location"></a>

## util/location
<a name="module_util/location..calculateDistance"></a>

### util/location~calculateDistance(lat1, lon1, lat2, lon2) ⇒ <code>number</code>
**Kind**: inner method of [<code>util/location</code>](#module_util/location)  
**Summary**: Get the distance in KM between two latitude/longitude pairs  
**Returns**: <code>number</code> - The distance between the two points, in KM  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| lat1 | <code>number</code> | The first latitude |
| lon1 | <code>number</code> | The first longitude |
| lat2 | <code>number</code> | The second latitude |
| lon2 | <code>number</code> | The second longitude |

<a name="module_util/meteor"></a>

## util/meteor

* [util/meteor](#module_util/meteor)
    * [~assert(assertion, errorCode, [meta])](#module_util/meteor..assert)
    * [~assertString(value, name)](#module_util/meteor..assertString)
    * [~assertBoolean(value, name)](#module_util/meteor..assertBoolean)
    * [~assertNumber(value, name)](#module_util/meteor..assertNumber)
    * [~assertInt(value, name)](#module_util/meteor..assertInt)
    * [~assertObject(value, name)](#module_util/meteor..assertObject)
    * [~assertArray(value, name, type)](#module_util/meteor..assertArray)
    * [~assertDate(value, options)](#module_util/meteor..assertDate)

<a name="module_util/meteor..assert"></a>

### util/meteor~assert(assertion, errorCode, [meta])
**Kind**: inner method of [<code>util/meteor</code>](#module_util/meteor)  
**Summary**: if the assertion is falsey, throws
an error  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| assertion | <code>any</code> | anything that should be truthy to not throw an error |
| errorCode | <code>number</code> | the error code |
| [meta] | <code>any</code> | additional info to include with the error |

<a name="module_util/meteor..assertString"></a>

### util/meteor~assertString(value, name)
Assert that the typeof ${value} is 'string'

**Kind**: inner method of [<code>util/meteor</code>](#module_util/meteor)  

| Param | Description |
| --- | --- |
| value | any value to check the type of |
| name | the name of the value being checked |

<a name="module_util/meteor..assertBoolean"></a>

### util/meteor~assertBoolean(value, name)
Assert that the typeof ${value} is 'boolean'

**Kind**: inner method of [<code>util/meteor</code>](#module_util/meteor)  

| Param | Description |
| --- | --- |
| value | any value to check the type of |
| name | the name of the value being checked |

<a name="module_util/meteor..assertNumber"></a>

### util/meteor~assertNumber(value, name)
Assert that the typeof ${value} is 'number'

**Kind**: inner method of [<code>util/meteor</code>](#module_util/meteor)  

| Param | Description |
| --- | --- |
| value | any value to check the type of |
| name | the name of the value being checked |

<a name="module_util/meteor..assertInt"></a>

### util/meteor~assertInt(value, name)
Assert that the ${value} is an integer

**Kind**: inner method of [<code>util/meteor</code>](#module_util/meteor)  

| Param | Description |
| --- | --- |
| value | any value to check the type of |
| name | the name of the value being checked |

<a name="module_util/meteor..assertObject"></a>

### util/meteor~assertObject(value, name)
Assert that the typeof ${value} is 'object'

**Kind**: inner method of [<code>util/meteor</code>](#module_util/meteor)  

| Param | Description |
| --- | --- |
| value | any value to check the type of |
| name | the name of the value being checked |

<a name="module_util/meteor..assertArray"></a>

### util/meteor~assertArray(value, name, type)
Assert that the ${value} is an array

**Kind**: inner method of [<code>util/meteor</code>](#module_util/meteor)  

| Param | Description |
| --- | --- |
| value | any value to check the type of |
| name | the name of the value being checked |
| type | the expected datatype of every item within the supposed array |

<a name="module_util/meteor..assertDate"></a>

### util/meteor~assertDate(value, options)
Assert that the typeof ${value} is 'Date'

**Kind**: inner method of [<code>util/meteor</code>](#module_util/meteor)  

| Param | Description |
| --- | --- |
| value | any value to check the type of |
| options | whether to parse the date |

<a name="module_util/model"></a>

## util/model

* [util/model](#module_util/model)
    * [~ModelDefinition](#module_util/model..ModelDefinition)
        * [new ModelDefinition(t)](#new_module_util/model..ModelDefinition_new)
        * [.ModelDefinition#auto(func)](#module_util/model..ModelDefinition.ModelDefinition+auto) ⇒ <code>this</code>
        * [.ModelDefinition#maybe()](#module_util/model..ModelDefinition.ModelDefinition+maybe) ⇒ <code>this</code>
        * [.ModelDefinition#max(val, [exclusive])](#module_util/model..ModelDefinition.ModelDefinition+max) ⇒ <code>this</code>
        * [.ModelDefinition#min(val, [exclusive])](#module_util/model..ModelDefinition.ModelDefinition+min) ⇒ <code>this</code>
        * [.ModelDefinition#maxCount(val)](#module_util/model..ModelDefinition.ModelDefinition+maxCount) ⇒ <code>this</code>
        * [.ModelDefinition#minCount(val)](#module_util/model..ModelDefinition.ModelDefinition+minCount) ⇒ <code>this</code>
        * [.ModelDefinition#subtype(format)](#module_util/model..ModelDefinition.ModelDefinition+subtype) ⇒ <code>this</code>
        * [.ModelDefinition#prop(name, value)](#module_util/model..ModelDefinition.ModelDefinition+prop) ⇒ <code>this</code>
        * [.ModelDefinition#props(properties)](#module_util/model..ModelDefinition.ModelDefinition+props) ⇒ <code>this</code>
        * [.ModelDefinition#elems(definition)](#module_util/model..ModelDefinition.ModelDefinition+elems) ⇒ <code>this</code>
        * [.ModelDefinition#regex(pattern)](#module_util/model..ModelDefinition.ModelDefinition+regex) ⇒ <code>this</code>
        * [.ModelDefinition#in(values)](#module_util/model..ModelDefinition.ModelDefinition+in) ⇒ <code>this</code>
        * [.ModelDefinition#join(model, [field], where)](#module_util/model..ModelDefinition.ModelDefinition+join) ⇒ <code>this</code>
        * [.ModelDefinition#other(key, value)](#module_util/model..ModelDefinition.ModelDefinition+other) ⇒ <code>this</code>
    * [~def](#module_util/model..def) ⇒ <code>this</code>
    * [~ILinkWhere](#module_util/model..ILinkWhere) : <code>Object</code>
    * [~ILink](#module_util/model..ILink) : <code>Object</code>

<a name="module_util/model..ModelDefinition"></a>

### util/model~ModelDefinition
**Kind**: inner class of [<code>util/model</code>](#module_util/model)  
**Export**:   

* [~ModelDefinition](#module_util/model..ModelDefinition)
    * [new ModelDefinition(t)](#new_module_util/model..ModelDefinition_new)
    * [.ModelDefinition#auto(func)](#module_util/model..ModelDefinition.ModelDefinition+auto) ⇒ <code>this</code>
    * [.ModelDefinition#maybe()](#module_util/model..ModelDefinition.ModelDefinition+maybe) ⇒ <code>this</code>
    * [.ModelDefinition#max(val, [exclusive])](#module_util/model..ModelDefinition.ModelDefinition+max) ⇒ <code>this</code>
    * [.ModelDefinition#min(val, [exclusive])](#module_util/model..ModelDefinition.ModelDefinition+min) ⇒ <code>this</code>
    * [.ModelDefinition#maxCount(val)](#module_util/model..ModelDefinition.ModelDefinition+maxCount) ⇒ <code>this</code>
    * [.ModelDefinition#minCount(val)](#module_util/model..ModelDefinition.ModelDefinition+minCount) ⇒ <code>this</code>
    * [.ModelDefinition#subtype(format)](#module_util/model..ModelDefinition.ModelDefinition+subtype) ⇒ <code>this</code>
    * [.ModelDefinition#prop(name, value)](#module_util/model..ModelDefinition.ModelDefinition+prop) ⇒ <code>this</code>
    * [.ModelDefinition#props(properties)](#module_util/model..ModelDefinition.ModelDefinition+props) ⇒ <code>this</code>
    * [.ModelDefinition#elems(definition)](#module_util/model..ModelDefinition.ModelDefinition+elems) ⇒ <code>this</code>
    * [.ModelDefinition#regex(pattern)](#module_util/model..ModelDefinition.ModelDefinition+regex) ⇒ <code>this</code>
    * [.ModelDefinition#in(values)](#module_util/model..ModelDefinition.ModelDefinition+in) ⇒ <code>this</code>
    * [.ModelDefinition#join(model, [field], where)](#module_util/model..ModelDefinition.ModelDefinition+join) ⇒ <code>this</code>
    * [.ModelDefinition#other(key, value)](#module_util/model..ModelDefinition.ModelDefinition+other) ⇒ <code>this</code>

<a name="new_module_util/model..ModelDefinition_new"></a>

#### new ModelDefinition(t)
Class to generate model definitions


| Param | Type | Description |
| --- | --- | --- |
| t | <code>string</code> | The type for this definition |

<a name="module_util/model..ModelDefinition.ModelDefinition+auto"></a>

#### ModelDefinition.ModelDefinition#auto(func) ⇒ <code>this</code>
Define an autoValue

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Description |
| --- | --- | --- |
| func | <code>function</code> | The autovalue function |

<a name="module_util/model..ModelDefinition.ModelDefinition+maybe"></a>

#### ModelDefinition.ModelDefinition#maybe() ⇒ <code>this</code>
Set this field as optional

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  
<a name="module_util/model..ModelDefinition.ModelDefinition+max"></a>

#### ModelDefinition.ModelDefinition#max(val, [exclusive]) ⇒ <code>this</code>
Set this field's maximum allowed value / length

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| val | <code>number</code> |  | The max value / length |
| [exclusive] | <code>boolean</code> | <code>false</code> | Whether this value is an exclusive max |

<a name="module_util/model..ModelDefinition.ModelDefinition+min"></a>

#### ModelDefinition.ModelDefinition#min(val, [exclusive]) ⇒ <code>this</code>
Set this field's minimum allowed value / length

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| val | <code>number</code> |  | The min value / length |
| [exclusive] | <code>boolean</code> | <code>false</code> | Whether this value is an exclusive min |

<a name="module_util/model..ModelDefinition.ModelDefinition+maxCount"></a>

#### ModelDefinition.ModelDefinition#maxCount(val) ⇒ <code>this</code>
Set the maximum number of allowed elements in an array field

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Description |
| --- | --- | --- |
| val | <code>number</code> | The max number of elements |

<a name="module_util/model..ModelDefinition.ModelDefinition+minCount"></a>

#### ModelDefinition.ModelDefinition#minCount(val) ⇒ <code>this</code>
Set the minimum number of allowed elements in an array field

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Description |
| --- | --- | --- |
| val | <code>number</code> | The min number of elements |

<a name="module_util/model..ModelDefinition.ModelDefinition+subtype"></a>

#### ModelDefinition.ModelDefinition#subtype(format) ⇒ <code>this</code>
Set the subtype / format of this field. E.g. "float" for a number type

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Description |
| --- | --- | --- |
| format | <code>string</code> | The format / subtype |

<a name="module_util/model..ModelDefinition.ModelDefinition+prop"></a>

#### ModelDefinition.ModelDefinition#prop(name, value) ⇒ <code>this</code>
Define a single property of an object-type field

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | The property name |
| value | [<code>ModelDefinition</code>](#module_util/model..ModelDefinition) | The property value |

<a name="module_util/model..ModelDefinition.ModelDefinition+props"></a>

#### ModelDefinition.ModelDefinition#props(properties) ⇒ <code>this</code>
Define all properties of an object-type field

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Description |
| --- | --- | --- |
| properties | <code>\*</code> | The property definitions |

<a name="module_util/model..ModelDefinition.ModelDefinition+elems"></a>

#### ModelDefinition.ModelDefinition#elems(definition) ⇒ <code>this</code>
Define the elements of an array-type field

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Description |
| --- | --- | --- |
| definition | [<code>ModelDefinition</code>](#module_util/model..ModelDefinition) | The definition which applies to all elements |

<a name="module_util/model..ModelDefinition.ModelDefinition+regex"></a>

#### ModelDefinition.ModelDefinition#regex(pattern) ⇒ <code>this</code>
Define a RegEx pattern which applies to a string-type field

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Description |
| --- | --- | --- |
| pattern | <code>RegEx</code> | The pattern |

<a name="module_util/model..ModelDefinition.ModelDefinition+in"></a>

#### ModelDefinition.ModelDefinition#in(values) ⇒ <code>this</code>
Define a list of permitted values for this field

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Description |
| --- | --- | --- |
| values | <code>Array</code> \| [<code>ILink</code>](#module_util/model..ILink) | The array of allowed values |

<a name="module_util/model..ModelDefinition.ModelDefinition+join"></a>

#### ModelDefinition.ModelDefinition#join(model, [field], where) ⇒ <code>this</code>
Define a link to another Model

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| model | <code>string</code> |  | The name of the model |
| [field] | <code>string</code> | <code>&quot;&#x27;_id&#x27;&quot;</code> | The field on the other model to join on |
| where | <code>\*</code> |  | An optional selector for items in the foreign model |

<a name="module_util/model..ModelDefinition.ModelDefinition+other"></a>

#### ModelDefinition.ModelDefinition#other(key, value) ⇒ <code>this</code>
Set a custom definition key

**Kind**: static method of [<code>ModelDefinition</code>](#module_util/model..ModelDefinition)  

| Param | Type | Description |
| --- | --- | --- |
| key | <code>string</code> | The key name |
| value | <code>\*</code> | The value |

<a name="module_util/model..def"></a>

### util/model~def ⇒ <code>this</code>
Shorthand to get an instance of ModelDefinition

**Kind**: inner constant of [<code>util/model</code>](#module_util/model)  

| Param | Type | Description |
| --- | --- | --- |
| type | <code>string</code> | The type of the field (e.g. 'string' / 'boolean') |

<a name="module_util/model..ILinkWhere"></a>

### util/model~ILinkWhere : <code>Object</code>
**Kind**: inner typedef of [<code>util/model</code>](#module_util/model)  
**Properties**

| Name | Type |
| --- | --- |
| * | <code>\*</code> | 

<a name="module_util/model..ILink"></a>

### util/model~ILink : <code>Object</code>
**Kind**: inner typedef of [<code>util/model</code>](#module_util/model)  
**Properties**

| Name | Type |
| --- | --- |
| model | <code>string</code> | 
| [field] | <code>string</code> | 
| [where] | <code>ILinkWhere</code> | 

<a name="module_util/number"></a>

## util/number

* [util/number](#module_util/number)
    * [~clamp(val, min, max)](#module_util/number..clamp) ⇒ <code>number</code>
    * [~random([min], [max])](#module_util/number..random)
    * [~pad(num, width, char)](#module_util/number..pad) ⇒ <code>string</code>

<a name="module_util/number..clamp"></a>

### util/number~clamp(val, min, max) ⇒ <code>number</code>
**Kind**: inner method of [<code>util/number</code>](#module_util/number)  
**Summary**: ensures that a number falls between two
others, constraining it if necessary  
**Returns**: <code>number</code> - the clamped number  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| val | <code>number</code> | the number to clamp |
| min | <code>number</code> | the minimum that the number should be |
| max | <code>number</code> | the maximum that the number should be |

<a name="module_util/number..random"></a>

### util/number~random([min], [max])
**Kind**: inner method of [<code>util/number</code>](#module_util/number)  
**Summary**: Returns a random integer, optionally between an min and max  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| [min] | <code>number</code> | The minimum acceptable value |
| [max] | <code>number</code> | The maximum acceptable value |

<a name="module_util/number..pad"></a>

### util/number~pad(num, width, char) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/number</code>](#module_util/number)  
**Summary**: pads out a number to specified width with specified char or 0  
**Returns**: <code>string</code> - the padded number  
**Export**:   

| Param |
| --- |
| num | 
| width | 
| char | 

<a name="module_util/object"></a>

## util/object

* [util/object](#module_util/object)
    * [~map(object, callback)](#module_util/object..map) ⇒ <code>any</code>
    * [~transform(object, callback)](#module_util/object..transform)
    * [~forEach()](#module_util/object..forEach)
    * [~filter(object, callback)](#module_util/object..filter) ⇒ <code>any</code>
    * [~resolve()](#module_util/object..resolve) ⇒ <code>any</code> \| <code>undefined</code>
    * [~didResolve()](#module_util/object..didResolve) ⇒ <code>boolean</code>
    * [~resolveIf()](#module_util/object..resolveIf) ⇒ <code>any</code> \| <code>null</code>
    * [~resolveSet()](#module_util/object..resolveSet) ⇒ <code>boolean</code>
    * [~transformPathsToObjects(obj)](#module_util/object..transformPathsToObjects) ⇒
    * [~flatten(input, _output, _prefix)](#module_util/object..flatten)
    * [~flattenAll(input, _output, _prefix)](#module_util/object..flattenAll)
    * [~resolveSetP(outerObj, outerPath, outerVal)](#module_util/object..resolveSetP) ⇒ <code>boolean</code>
    * [~mapAsync](#module_util/object..mapAsync)
    * [~transformAsync](#module_util/object..transformAsync)

<a name="module_util/object..map"></a>

### util/object~map(object, callback) ⇒ <code>any</code>
**Kind**: inner method of [<code>util/object</code>](#module_util/object)  
**Summary**: passes each key=>value pair to `callback`,
setting the result to a new object under a key of
the same name  
**Returns**: <code>any</code> - a new object with the same key names but mapped values  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| object | <code>any</code> | the object whose values to map |
| callback | <code>function</code> | a function to pass each key=>value pair to |

<a name="module_util/object..transform"></a>

### util/object~transform(object, callback)
**Kind**: inner method of [<code>util/object</code>](#module_util/object)  
**Summary**: Like map, but able to transform the key too. Map the object into a completely
different  

| Param | Description |
| --- | --- |
| object | the object to transform |
| callback | callback to perform the transformation, return an array like [key, value] |

<a name="module_util/object..forEach"></a>

### util/object~forEach()
**Kind**: inner method of [<code>util/object</code>](#module_util/object)  
**Summary**: Like array.forEach, but for an object, gets keys and values  
<a name="module_util/object..filter"></a>

### util/object~filter(object, callback) ⇒ <code>any</code>
**Kind**: inner method of [<code>util/object</code>](#module_util/object)  
**Summary**: passes each key=>value pair of an object
to `callback`, copying them over if the result is
truthy  
**Returns**: <code>any</code> - a filtered copy of the input object  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| object | <code>any</code> | the object whose keys to filter |
| callback | <code>function</code> | the function to pass each key=>value pair to |

<a name="module_util/object..resolve"></a>

### util/object~resolve() ⇒ <code>any</code> \| <code>undefined</code>
**Kind**: inner method of [<code>util/object</code>](#module_util/object)  
**Summary**: get a nested property of an object by string e.g. resolve(myObj, 'nested.property')  
**Returns**: <code>any</code> \| <code>undefined</code> - resolved value or undefined if intermediate values are undefined  
**Export**:   
<a name="module_util/object..didResolve"></a>

### util/object~didResolve() ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/object</code>](#module_util/object)  
**Summary**: report whether an attempt to resolve a nested property of an object
was successful or not.  
**Returns**: <code>boolean</code> - whether the nested property exists  
**Export**:   
<a name="module_util/object..resolveIf"></a>

### util/object~resolveIf() ⇒ <code>any</code> \| <code>null</code>
**Kind**: inner method of [<code>util/object</code>](#module_util/object)  
**Summary**: same as resolve but sets the property to val  
**Returns**: <code>any</code> \| <code>null</code> - The resolved value or null  
**Export**:   
<a name="module_util/object..resolveSet"></a>

### util/object~resolveSet() ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/object</code>](#module_util/object)  
**Summary**: same as resolve but sets the property to val  
**Returns**: <code>boolean</code> - whether setting was successful  
**Export**:   
<a name="module_util/object..transformPathsToObjects"></a>

### util/object~transformPathsToObjects(obj) ⇒
Transform an entire object by converting all of its keys into object paths using resolveSet

**Kind**: inner method of [<code>util/object</code>](#module_util/object)  
**Returns**: obj for convenience, although transformed in place  

| Param | Description |
| --- | --- |
| obj | the object to transform (transformed in place) |

<a name="module_util/object..flatten"></a>

### util/object~flatten(input, _output, _prefix)
Convert a deep object into one which is flat (has a max depth of 1 level). The output object's keys will
use dot notation to symbolise depth.
If a property contains a dot, this will be converted to "[dot]"

**Kind**: inner method of [<code>util/object</code>](#module_util/object)  

| Param | Type | Description |
| --- | --- | --- |
| input | <code>object</code> | An input object. Required |
| _output | <code>object</code> | Private param used in recursion |
| _prefix | <code>string</code> | Private param used in recursion |

**Example**  
```js
var deepObj = {person: {profile: {name: 'Carl', age: 26}, password: 'foobar', '.withDot': true}}
    var res = flatten(deepObj)
    // res === {
    //   'person.profile.name': 'Carl',
    //   'person.profile.age': 26,
    //   'person.password': 'foobar',
    //   'person.[dot]withDot': true
    // }
```
<a name="module_util/object..flattenAll"></a>

### util/object~flattenAll(input, _output, _prefix)
Convert a deep object into one which is flat (has a max depth of 1 level). The output object's keys will
use dot notation to symbolise depth. Also processes arrays

**Kind**: inner method of [<code>util/object</code>](#module_util/object)  

| Param | Type | Description |
| --- | --- | --- |
| input | <code>object</code> | An input object. Required |
| _output | <code>object</code> | Private param used in recursion |
| _prefix | <code>string</code> | Private param used in recursion |

**Example**  
```js
var deepObj = {person: {profile: {name: 'Carl', age: 26}, things: ['foo', 'bar'], '.withdot': true}}
    flattenAll(deepObj)
    // returns {
    //   'person.profile.name': 'Carl',
    //   'person.profile.age': 26,
    //   'person.things.0': 'foo',
    //   'person.things.1': 'bar'
    //   'person.[dot]withDot: true
    // }
```
<a name="module_util/object..resolveSetP"></a>

### util/object~resolveSetP(outerObj, outerPath, outerVal) ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/object</code>](#module_util/object)  
**Summary**: same as resolveSet, but will create paths down into
objects where they don't exist  
**Returns**: <code>boolean</code> - whether the op was successful  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| outerObj | <code>object</code> | the object to create the value in |
| outerPath | <code>string</code> | the path (dot notation) into the object |
| outerVal | <code>any</code> | the new value |

<a name="module_util/object..mapAsync"></a>

### util/object~mapAsync
**Kind**: inner typedef of [<code>util/object</code>](#module_util/object)  
**Summary**: passes each key=>value pair to `callback` asynchronously, setting the result to a new object under a key of
the same name. Calls onComplete when all keys have been mapped  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| object | <code>any</code> | the object whose values to map |
| callback | <code>function</code> | a function to pass each key=>value pair to |
| onComplete | <code>function</code> | a callback which will receive two arguments, error and res |

<a name="module_util/object..transformAsync"></a>

### util/object~transformAsync
**Kind**: inner typedef of [<code>util/object</code>](#module_util/object)  
**Summary**: Like map, but able to transform the key too. Map the object into a completely different shape. Iterates
asynchronously  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| object | <code>any</code> | the object to transform |
| cb | <code>function</code> | callback to perform the transformation, return an array like [key, value] |
| onComplete | <code>function</code> | a callback which will received two arguments, error and res |

<a name="module_util/popover"></a>

## util/popover

* [util/popover](#module_util/popover)
    * [~open(source, content, options)](#module_util/popover..open)
    * [~openDropdown(source, dropDownItems, options)](#module_util/popover..openDropdown)
    * [~ifLet(toCheck, ifCallback, elseCallback)](#module_util/popover..ifLet)
    * [~viewportPosition(element)](#module_util/popover..viewportPosition)
    * [~addTriangleToFixedElement(element, positionedWhere, pointingAt, container)](#module_util/popover..addTriangleToFixedElement) ⇒
    * [~positionFixed(element, relativeTo)](#module_util/popover..positionFixed)

<a name="module_util/popover..open"></a>

### util/popover~open(source, content, options)
Opens a popover with the specified content located on the edge of the source object

**Kind**: inner method of [<code>util/popover</code>](#module_util/popover)  

| Param | Description |
| --- | --- |
| source | the target element this popover should be attached to |
| content | the content to show in the popover |
| options |  |

<a name="module_util/popover..openDropdown"></a>

### util/popover~openDropdown(source, dropDownItems, options)
Opens a dropdown, which internally is still a popover with some special additions

**Kind**: inner method of [<code>util/popover</code>](#module_util/popover)  

| Param | Description |
| --- | --- |
| source | which element should the dropdown be attached to? |
| dropDownItems | the items that should be shown in the dropdown @see DropDownItem |
| options |  |

<a name="module_util/popover..ifLet"></a>

### util/popover~ifLet(toCheck, ifCallback, elseCallback)
Internal function used to run a specific callback with a value if it exists

**Kind**: inner method of [<code>util/popover</code>](#module_util/popover)  

| Param | Description |
| --- | --- |
| toCheck | the value, or values to check |
| ifCallback | the callback to run with the value if it exists |
| elseCallback | the callback to run if the value does not exist |

<a name="module_util/popover..viewportPosition"></a>

### util/popover~viewportPosition(element)
Internal function used to get the viewport position of an element

**Kind**: inner method of [<code>util/popover</code>](#module_util/popover)  

| Param |
| --- |
| element | 

<a name="module_util/popover..addTriangleToFixedElement"></a>

### util/popover~addTriangleToFixedElement(element, positionedWhere, pointingAt, container) ⇒
Adds a triangle to point at the edge of one element (element) to a target (pointingAt)

**Kind**: inner method of [<code>util/popover</code>](#module_util/popover)  
**Returns**: the triangle element  

| Param | Description |
| --- | --- |
| element | the element doing the pointing |
| positionedWhere | where is the popup in relation to the target |
| pointingAt | what should it point at |
| container | where do we add the triangle |

<a name="module_util/popover..positionFixed"></a>

### util/popover~positionFixed(element, relativeTo)
Position an element relative to another

**Kind**: inner method of [<code>util/popover</code>](#module_util/popover)  

| Param | Description |
| --- | --- |
| element | the element to position |
| relativeTo | the element to use as an anchor |

<a name="module_util/reactivity"></a>

## util/reactivity
<a name="module_util/reactivity..reactivelyStore"></a>

### util/reactivity~reactivelyStore(getter, autorunnerOrTemplate) ⇒ <code>any</code>
Store some data that depends on reactive data sources in a reactive var so as
not to recalculate it every time

**Kind**: inner method of [<code>util/reactivity</code>](#module_util/reactivity)  
**Returns**: <code>any</code> - a function that when called returns the latest value of the data  

| Param | Description |
| --- | --- |
| getter | callback to get the value |
| autorunnerOrTemplate |  |

<a name="module_util/schema"></a>

## util/schema

* [util/schema](#module_util/schema)
    * [~optional(primitive)](#module_util/schema..optional) ⇒ <code>Object</code>
    * [~blackbox(primitive)](#module_util/schema..blackbox) ⇒ <code>IBlackbox</code>
    * [~optionalBlackbox(primitive)](#module_util/schema..optionalBlackbox) ⇒ <code>IOptionalBlackbox</code>
    * [~createdDate()](#module_util/schema..createdDate) ⇒ <code>Schema.ICreatedDate</code>
    * [~updatedDate()](#module_util/schema..updatedDate) ⇒ <code>Schema.IUpdatedDate</code>
    * [~geoJSON(SimpleSchema)](#module_util/schema..geoJSON) ⇒ <code>Schema.IGeoJSON</code>
    * [~defaultValue(type, value)](#module_util/schema..defaultValue)
    * [~optionalDefaultValue(type, value)](#module_util/schema..optionalDefaultValue)
    * [~minZeroNumber()](#module_util/schema..minZeroNumber) ⇒ <code>Object</code>
    * [~optionalMinZeroNumber()](#module_util/schema..optionalMinZeroNumber) ⇒ <code>Object</code>
    * [~minZeroNumberWithDefault()](#module_util/schema..minZeroNumberWithDefault) ⇒ <code>Object</code>
    * [~integerBetweenValues(min, max)](#module_util/schema..integerBetweenValues)
    * [~optionalIntegerBetweenValues(min, max)](#module_util/schema..optionalIntegerBetweenValues)
    * [~idParams(name)](#module_util/schema..idParams) ⇒ <code>any</code>
    * [~checkParameters(context, params, schema)](#module_util/schema..checkParameters) ⇒ <code>boolean</code>
    * [~positiveNumber()](#module_util/schema..positiveNumber) ⇒ <code>Object</code>
    * [~optionalPositiveNumber()](#module_util/schema..optionalPositiveNumber) ⇒ <code>Object</code>
    * [~positiveInteger()](#module_util/schema..positiveInteger) ⇒ <code>Object</code>
    * [~optionalPositiveInteger()](#module_util/schema..optionalPositiveInteger) ⇒ <code>Object</code>
    * [~immutable()](#module_util/schema..immutable) ⇒ <code>Object</code>
    * [~optionalImmutable()](#module_util/schema..optionalImmutable) ⇒ <code>Object</code>
    * [~alwaysArray()](#module_util/schema..alwaysArray)

<a name="module_util/schema..optional"></a>

### util/schema~optional(primitive) ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns an optional primitive definition  
**Returns**: <code>Object</code> - the schema value definition  
**Export**:   

| Param | Type |
| --- | --- |
| primitive | <code>Schema.PrimitiveConstructor</code> \| <code>string</code> | 

<a name="module_util/schema..blackbox"></a>

### util/schema~blackbox(primitive) ⇒ <code>IBlackbox</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns an blackbox primitive definition  
**Returns**: <code>IBlackbox</code> - the schema value definition  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| primitive | <code>Schema.PrimitiveConstructor</code> \| <code>string</code> | (technically this will always be `Object` but it is configurable for consistency) |

<a name="module_util/schema..optionalBlackbox"></a>

### util/schema~optionalBlackbox(primitive) ⇒ <code>IOptionalBlackbox</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns an optional, blackboxed primitive definition  
**Returns**: <code>IOptionalBlackbox</code> - the schema value definition  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| primitive | <code>Schema.PrimitiveConstructor</code> \| <code>string</code> | (technically this will always be `Object` but it is configurable for consistency) |

<a name="module_util/schema..createdDate"></a>

### util/schema~createdDate() ⇒ <code>Schema.ICreatedDate</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef with a type of Date and an
autoValue function which returns a new date on insert  
**Returns**: <code>Schema.ICreatedDate</code> - the schema value definition  
**Export**:   
<a name="module_util/schema..updatedDate"></a>

### util/schema~updatedDate() ⇒ <code>Schema.IUpdatedDate</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef with a type of Date and an
autoValue function which returns a new date  
**Returns**: <code>Schema.IUpdatedDate</code> - the schema value definition  
**Export**:   
<a name="module_util/schema..geoJSON"></a>

### util/schema~geoJSON(SimpleSchema) ⇒ <code>Schema.IGeoJSON</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for a geoJSON object  
**Returns**: <code>Schema.IGeoJSON</code> - the schema value definition  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| SimpleSchema | <code>\*</code> | A reference to SimpleSchema |

<a name="module_util/schema..defaultValue"></a>

### util/schema~defaultValue(type, value)
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for a field with a defined default  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| type | <code>Schema.PrimitiveConstructor</code> \| <code>string</code> | The type constructor (e.g. Number) |
| value | <code>any</code> | The default value |

<a name="module_util/schema..optionalDefaultValue"></a>

### util/schema~optionalDefaultValue(type, value)
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for an optional field with a defined default  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| type | <code>Schema.PrimitiveConstructor</code> \| <code>string</code> | The type constructor (e.g. Number) |
| value | <code>any</code> | The default value |

<a name="module_util/schema..minZeroNumber"></a>

### util/schema~minZeroNumber() ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for a field for a number with a minimum
permitted value of zero  
**Returns**: <code>Object</code> - typedef for number field with min value of 0  
**Export**:   
<a name="module_util/schema..optionalMinZeroNumber"></a>

### util/schema~optionalMinZeroNumber() ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for an optional field for a number with a minimum
permitted value of zero  
**Returns**: <code>Object</code> - typedef for optional number field with min value of 0  
**Export**:   
<a name="module_util/schema..minZeroNumberWithDefault"></a>

### util/schema~minZeroNumberWithDefault() ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for a field for a number with a minimum
permitted and default value of zero  
**Returns**: <code>Object</code> - typedef for number field with minimum and default value of 0  
**Export**:   
<a name="module_util/schema..integerBetweenValues"></a>

### util/schema~integerBetweenValues(min, max)
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for a field for an integer between two values  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| min | <code>number</code> | the minimum permitted value |
| max | <code>number</code> | the maximum permitted value |

<a name="module_util/schema..optionalIntegerBetweenValues"></a>

### util/schema~optionalIntegerBetweenValues(min, max)
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for an optional field for an integer between two values  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| min | <code>number</code> | the minimum permitted value |
| max | <code>number</code> | the maximum permitted value |

<a name="module_util/schema..idParams"></a>

### util/schema~idParams(name) ⇒ <code>any</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns an array with a single object in which defines an _id path param  
**Returns**: <code>any</code> - the params array  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | the name of the field |

<a name="module_util/schema..checkParameters"></a>

### util/schema~checkParameters(context, params, schema) ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: Check incoming parameters against a schema  
**Returns**: <code>boolean</code> - true  
**Throws**:

- <code>400</code> on validation error

**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| context | <code>any</code> | The `this` context |
| params | <code>any</code> | The incoming parameters |
| schema | <code>any</code> | A SimpleSchema schema |

<a name="module_util/schema..positiveNumber"></a>

### util/schema~positiveNumber() ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for a field for a number with a minimum
permitted value greater than zero  
**Returns**: <code>Object</code> - typedef for number field with positive min value (> 0)  
**Export**:   
<a name="module_util/schema..optionalPositiveNumber"></a>

### util/schema~optionalPositiveNumber() ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for an optional field for a number with a minimum
permitted value of zero  
**Returns**: <code>Object</code> - typedef for optional number field with positive min value (> 0)  
**Export**:   
<a name="module_util/schema..positiveInteger"></a>

### util/schema~positiveInteger() ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for a field for an integer with a minimum
permitted value of zero  
**Returns**: <code>Object</code> - typedef for integer field with positive min value (> 0)  
**Export**:   
<a name="module_util/schema..optionalPositiveInteger"></a>

### util/schema~optionalPositiveInteger() ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for an optional field for an integer with a minimum
permitted value of zero  
**Returns**: <code>Object</code> - typedef for optional integer field with positive min value (> 0)  
**Export**:   
<a name="module_util/schema..immutable"></a>

### util/schema~immutable() ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for a field that should not be updated once set  
**Returns**: <code>Object</code> - typedef for field with immutable value  
**Export**:   
<a name="module_util/schema..optionalImmutable"></a>

### util/schema~optionalImmutable() ⇒ <code>Object</code>
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns a typedef for an optional field that should not be updated once set  
**Returns**: <code>Object</code> - typedef for optional field with immutable value  
**Export**:   
<a name="module_util/schema..alwaysArray"></a>

### util/schema~alwaysArray()
**Kind**: inner method of [<code>util/schema</code>](#module_util/schema)  
**Summary**: returns multiple typedefs for an array of elements of the given type
where the default value is always an empty array  
**Export**:   
<a name="module_util/config"></a>

## util/config

* [util/config](#module_util/config)
    * [~Configuration](#module_util/config..Configuration)
        * [new Configuration(collection, Meteor, [Tracker], [connection])](#new_module_util/config..Configuration_new)
    * [~StandaloneConfiguration](#module_util/config..StandaloneConfiguration)
        * [new StandaloneConfiguration()](#new_module_util/config..StandaloneConfiguration_new)

<a name="module_util/config..Configuration"></a>

### util/config~Configuration
**Kind**: inner class of [<code>util/config</code>](#module_util/config)  
<a name="new_module_util/config..Configuration_new"></a>

#### new Configuration(collection, Meteor, [Tracker], [connection])
A configuration class - provides a DB-backed, environment variable / meteor.settings populated set of config values


| Param | Type | Description |
| --- | --- | --- |
| collection | <code>Mongo.Collection</code> | the config collection |
| Meteor | <code>Object</code> | a reference to the Meteor object |
| [Tracker] | <code>Object</code> | an optional reference to Tracker - will be mocked in a non-reactive way if not supplied |
| [connection] | <code>Object</code> | an optional override for the DDP connection to use to subscribe to the config pub |

<a name="module_util/config..StandaloneConfiguration"></a>

### util/config~StandaloneConfiguration
**Kind**: inner class of [<code>util/config</code>](#module_util/config)  
<a name="new_module_util/config..StandaloneConfiguration_new"></a>

#### new StandaloneConfiguration()
A configuration class - provides an environment variable / codebase-populated set of config values

<a name="module_util/string"></a>

## util/string

* [util/string](#module_util/string)
    * [~capitalize(str)](#module_util/string..capitalize) ⇒ <code>string</code>
    * [~humanize(str)](#module_util/string..humanize) ⇒ <code>string</code>
    * [~titleize(str)](#module_util/string..titleize) ⇒ <code>string</code>
    * [~camelize(str)](#module_util/string..camelize) ⇒ <code>string</code>
    * [~hyphenate(str)](#module_util/string..hyphenate) ⇒ <code>string</code>
    * [~truncate(str, [count])](#module_util/string..truncate) ⇒ <code>string</code>
    * [~addThousandsSeparators(str)](#module_util/string..addThousandsSeparators) ⇒ <code>string</code>
    * [~extname(filename)](#module_util/string..extname) ⇒ <code>string</code>
    * [~underscore(str)](#module_util/string..underscore) ⇒ <code>string</code>
    * [~keyify(str, [replacer])](#module_util/string..keyify) ⇒ <code>string</code>
    * [~getDomain(str)](#module_util/string..getDomain) ⇒ <code>string</code> \| <code>null</code>
    * [~startsWith(haystack, needle)](#module_util/string..startsWith) ⇒ <code>boolean</code>
    * [~endsWith(haystack, needle)](#module_util/string..endsWith) ⇒ <code>boolean</code>
    * [~escapeRegExp(str)](#module_util/string..escapeRegExp) ⇒ <code>string</code>
    * [~isEmail(str)](#module_util/string..isEmail) ⇒ <code>boolean</code>
    * [~isUrl(str)](#module_util/string..isUrl) ⇒ <code>boolean</code>
    * [~isIP(str)](#module_util/string..isIP) ⇒ <code>boolean</code>
    * [~isIPv4(str)](#module_util/string..isIPv4) ⇒ <code>boolean</code>
    * [~isIPv6(str)](#module_util/string..isIPv6) ⇒ <code>boolean</code>
    * [~caseInsensitivePermutations(str)](#module_util/string..caseInsensitivePermutations) ⇒ <code>Array.&lt;string&gt;</code>
    * [~nonEmpty(str)](#module_util/string..nonEmpty) ⇒ <code>boolean</code>
    * [~dedent(strings, values)](#module_util/string..dedent) ⇒ <code>string</code>
    * [~formatPennies(amount, symbol)](#module_util/string..formatPennies)

<a name="module_util/string..capitalize"></a>

### util/string~capitalize(str) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: makes the first letter of a string
uppercase and the rest lowercase  
**Returns**: <code>string</code> - the capitalised string  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the string to capitalise |

<a name="module_util/string..humanize"></a>

### util/string~humanize(str) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: Converts identifiers to more human-friendly
versions. e.g. helloWorld -> Hello world  
**Returns**: <code>string</code> - the human-friendly version of the
string  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the string to humanise |

<a name="module_util/string..titleize"></a>

### util/string~titleize(str) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: converts each words' first letter
to uppercase.  
**Returns**: <code>string</code> - the titleized string  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the string to titleize |

<a name="module_util/string..camelize"></a>

### util/string~camelize(str) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: converts a string of words to a lowerCamelCase word  
**Returns**: <code>string</code> - the camelized string  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the string to camelize |

<a name="module_util/string..hyphenate"></a>

### util/string~hyphenate(str) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: converts spaces to hyphens  
**Returns**: <code>string</code> - the processed string  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the string to perform the replacements on |

<a name="module_util/string..truncate"></a>

### util/string~truncate(str, [count]) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: limits the length of a string to `count` (plus
three for dots)  
**Returns**: <code>string</code> - the possibly truncated string  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the string to truncate |
| [count] | <code>number</code> | the maximum length of the string |

<a name="module_util/string..addThousandsSeparators"></a>

### util/string~addThousandsSeparators(str) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: Inserts a comma every three digits  
**Returns**: <code>string</code> - the formatted number  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> \| <code>number</code> | a number, represented as a string |

<a name="module_util/string..extname"></a>

### util/string~extname(filename) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: gets the file extension from a file name  
**Returns**: <code>string</code> - the file extension  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| filename | <code>string</code> | the full filename. e.g. "movie.avi" |

<a name="module_util/string..underscore"></a>

### util/string~underscore(str) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: converts spaces to underscores in a string  
**Returns**: <code>string</code> - the processed string  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the string to process |

<a name="module_util/string..keyify"></a>

### util/string~keyify(str, [replacer]) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: converts spaces to dashes/underscores &
lowercases the string for db values and filenames etc..  
**Returns**: <code>string</code> - the keyified string  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the string to keyify |
| [replacer] | <code>string</code> | the character to use in place of spaces. Can be '-' or '_' |

<a name="module_util/string..getDomain"></a>

### util/string~getDomain(str) ⇒ <code>string</code> \| <code>null</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: gets the domain from an email address  
**Returns**: <code>string</code> \| <code>null</code> - the domain, or null  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the email address to test |

<a name="module_util/string..startsWith"></a>

### util/string~startsWith(haystack, needle) ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: Reports whether `haystack` starts with `needle`  
**Returns**: <code>boolean</code> - whether haystack starts with needle  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| haystack | <code>string</code> | the string to search |
| needle | <code>string</code> | the substring to search for |

<a name="module_util/string..endsWith"></a>

### util/string~endsWith(haystack, needle) ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: Reports whether `haystack` ends with `needle`  
**Returns**: <code>boolean</code> - whether haystack ends with needle  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| haystack | <code>string</code> | the string to search |
| needle | <code>string</code> | the substring to search for |

<a name="module_util/string..escapeRegExp"></a>

### util/string~escapeRegExp(str) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: Escapes special characters in a string, enabling
the string's use as a regex  
**Returns**: <code>string</code> - the escaped string  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the string to escape |

<a name="module_util/string..isEmail"></a>

### util/string~isEmail(str) ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: determines whether a string looks like
an email address  
**Returns**: <code>boolean</code> - whether the string looks like an email  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the potential email address |

<a name="module_util/string..isUrl"></a>

### util/string~isUrl(str) ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: determines whether a string looks like
a url  
**Returns**: <code>boolean</code> - whether the string looks like a url  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the potential url |

<a name="module_util/string..isIP"></a>

### util/string~isIP(str) ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: determins whether a string looks like
an ip address (either IPv4 or IPv6)  
**Returns**: <code>boolean</code> - whether the string looks like an ip  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the potential ip address |

<a name="module_util/string..isIPv4"></a>

### util/string~isIPv4(str) ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: determines whether a string looks like
an ip address  
**Returns**: <code>boolean</code> - whether the string looks like an ip  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the potential ip address |

<a name="module_util/string..isIPv6"></a>

### util/string~isIPv6(str) ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: determines whether a string looks like
an ip address  
**Returns**: <code>boolean</code> - whether the string looks like an ip  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | the potential ip address |

<a name="module_util/string..caseInsensitivePermutations"></a>

### util/string~caseInsensitivePermutations(str) ⇒ <code>Array.&lt;string&gt;</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: generates permutations of all case variations of a given string.  
**Returns**: <code>Array.&lt;string&gt;</code> - an array of permutations  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>string</code> | The string to get permutations of |

<a name="module_util/string..nonEmpty"></a>

### util/string~nonEmpty(str) ⇒ <code>boolean</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: Check if something is a string and non-empty  
**Returns**: <code>boolean</code> - whether the provided value is a string and has a length  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| str | <code>any</code> | the string to check |

<a name="module_util/string..dedent"></a>

### util/string~dedent(strings, values) ⇒ <code>string</code>
**Kind**: inner method of [<code>util/string</code>](#module_util/string)  
**Summary**: Remove leading indents from a template string without removing all leading whitespace  
**Returns**: <code>string</code> - the processed string  
**Export**:   

| Param | Type | Description |
| --- | --- | --- |
| strings | <code>TemplateStringsArray</code> | the string parts |
| values | <code>Array.&lt;any&gt;</code> | templating variables for interpolation |

<a name="module_util/string..formatPennies"></a>

### util/string~formatPennies(amount, symbol)
Formats an amount in pennies to £x.xx

**Kind**: inner method of [<code>util/string</code>](#module_util/string)  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| amount | <code>number</code> |  |  |
| symbol | <code>string</code> | <code>&quot;£&quot;</code> | override for custom prefixed symbol, defaults to '£' |

---
_Source: https://npm.io/package/@webantic/util · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
