npm package: @leaddreamer/genericutilities
Description: useful cross-project utilities
Author: Tracy R. Hall, Dreams and Logic
Latest version: 0.1.6

[![view on
npm](http://img.shields.io/npm/v/@leaddreamer/genericutilities.svg)](https://www.npmjs.org/package/@leaddreamer/genericutilities)
# @leaddreamer/GenericUtilities

Useful cross-project utilities to be shared between Back and Front End - not browser services.

## Modules

<dl>
<dt><a href="#module_Utilities">Utilities</a></dt>
<dd><p>Typedefs, constants, support functions and database operations for
general Utilities</p>
</dd>
<dt><a href="#module_PromiseQueue">PromiseQueue</a></dt>
<dd><p>Typedefs, constants, support functions and database operations related to Promise getQueueSize
Thes era euseful for scheduling large serial asynchronous operations</p>
</dd>
<dt><a href="#module_GenericUtilities">GenericUtilities</a></dt>
<dd><p>useful cross-project utilities, to be shared between Back and Front End  - not browser
services.</p>
</dd>
</dl>

<a name="module_Utilities"></a>

## Utilities
Typedefs, constants, support functions and database operations for
general Utilities


* [Utilities](#module_Utilities)
    * _static_
        * [.simpleObjectCompare(object1, object2)](#module_Utilities.simpleObjectCompare) ⇒ <code>boolean</code>
        * [.formatItem(thisItem, thisFormat)](#module_Utilities.formatItem) ⇒ <code>string</code>
        * [.compare(thisItem, anotherItem, sort)](#module_Utilities.compare) ⇒ <code>string</code>
        * [.anyInAny(findFrom, findIn)](#module_Utilities.anyInAny) ⇒ <code>boolean</code>
        * [.PromisePoolRunner(entryArray, actionFunction, promiseOptions)](#module_Utilities.PromisePoolRunner) ⇒ <code>Promise</code>
        * [.lesserOf(args)](#module_Utilities.lesserOf) ⇒ <code>number</code>
        * [.largerOf(args)](#module_Utilities.largerOf) ⇒ <code>number</code>
        * [.bound(value, lowerBound, upperBound)](#module_Utilities.bound) ⇒ <code>number</code>
        * [.blindPush(targetArray, newObject)](#module_Utilities.blindPush)
        * [.addToArrayObject(arrayObject, key, object)](#module_Utilities.addToArrayObject)
        * [.makeHexAsNeeded(color)](#module_Utilities.makeHexAsNeeded) ⇒ <code>string</code>
    * _inner_
        * [~PromisePool](#module_Utilities..PromisePool)
        * [~promiseOptionsDefault](#module_Utilities..promiseOptionsDefault) : <code>PromiseOptions</code>
        * [~generateIterator(entryArray, actionFunction)](#module_Utilities..generateIterator)
        * [~PromiseOptions](#module_Utilities..PromiseOptions) : <code>object</code>

<a name="module_Utilities.simpleObjectCompare"></a>

### Utilities.simpleObjectCompare(object1, object2) ⇒ <code>boolean</code>
Simple top-level object compare - assumes objects have similar structure - or
AT LEAST all the fields of object1 are present in object2

**Kind**: static method of [<code>Utilities</code>](#module_Utilities)  

| Param | Type |
| --- | --- |
| object1 | <code>object</code> | 
| object2 | <code>object</code> | 

<a name="module_Utilities.formatItem"></a>

### Utilities.formatItem(thisItem, thisFormat) ⇒ <code>string</code>
Allows string substitution from an object
field names support Dot notation
field names allow ":" extension for alternate formatting

**Kind**: static method of [<code>Utilities</code>](#module_Utilities)  

| Param | Type | Description |
| --- | --- | --- |
| thisItem | <code>object</code> | object to create formated string from |
| thisFormat | <code>string</code> | string describing formatted output - fieldname wrapped in {} will be substituted.  DOT notation allowed for fields. |

<a name="module_Utilities.compare"></a>

### Utilities.compare(thisItem, anotherItem, sort) ⇒ <code>string</code>
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)  

| Param | Type | Description |
| --- | --- | --- |
| thisItem | <code>object</code> | one of two objects being compared |
| anotherItem | <code>object</code> | the other of two objects being compared |
| sort | <code>string</code> | string describing sort - format "fieldName:sortType" - sort Type is "string, "date" or "number" (default) |

<a name="module_Utilities.anyInAny"></a>

### Utilities.anyInAny(findFrom, findIn) ⇒ <code>boolean</code>
An array based compare function - is any entry of findFrom present in findIn

**Kind**: static method of [<code>Utilities</code>](#module_Utilities)  

| Param | Type |
| --- | --- |
| findFrom | <code>Array.any</code> | 
| findIn | <code>Array.any</code> | 

<a name="module_Utilities.PromisePoolRunner"></a>

### Utilities.PromisePoolRunner(entryArray, actionFunction, promiseOptions) ⇒ <code>Promise</code>
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)  

| Param | Type |
| --- | --- |
| entryArray | <code>Array.object</code> | 
| actionFunction | <code>callback</code> | 
| promiseOptions | <code>PromiseOptions</code> | 

<a name="module_Utilities.lesserOf"></a>

### Utilities.lesserOf(args) ⇒ <code>number</code>
A convenience function for legibility

**Kind**: static method of [<code>Utilities</code>](#module_Utilities)  
**Returns**: <code>number</code> - the least of any of the arguments
b  

| Param | Type | Description |
| --- | --- | --- |
| args | <code>any</code> | unbounded list of arguments |

<a name="module_Utilities.largerOf"></a>

### Utilities.largerOf(args) ⇒ <code>number</code>
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)  
**Returns**: <code>number</code> - the largest of any of the arguments  

| Param | Type | Description |
| --- | --- | --- |
| args | <code>any</code> | unbounded list of arguments |

<a name="module_Utilities.bound"></a>

### Utilities.bound(value, lowerBound, upperBound) ⇒ <code>number</code>
clips value to given bounds

**Kind**: static method of [<code>Utilities</code>](#module_Utilities)  

| Param | Type |
| --- | --- |
| value | <code>number</code> | 
| lowerBound | <code>number</code> | 
| upperBound | <code>number</code> | 

<a name="module_Utilities.blindPush"></a>

### Utilities.blindPush(targetArray, newObject)
function to push an element to an array which may not be initialized

**Kind**: static method of [<code>Utilities</code>](#module_Utilities)  

| Param | Type |
| --- | --- |
| targetArray | <code>Array.object</code> | 
| newObject | <code>object</code> | 

<a name="module_Utilities.addToArrayObject"></a>

### Utilities.addToArrayObject(arrayObject, key, object)
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)  

| Param | Type | Description |
| --- | --- | --- |
| arrayObject | <code>Array.Array.object</code> |  |
| key | <code>string</code> | key or index to choose which Array.object to add *this* object to |
| object | <code>object</code> |  |

<a name="module_Utilities.makeHexAsNeeded"></a>

### Utilities.makeHexAsNeeded(color) ⇒ <code>string</code>
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)  
**Returns**: <code>string</code> - hex value of named color  

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

<a name="module_Utilities..PromisePool"></a>

### Utilities~PromisePool
**Kind**: inner constant of [<code>Utilities</code>](#module_Utilities)  
<a name="module_Utilities..promiseOptionsDefault"></a>

### Utilities~promiseOptionsDefault : <code>PromiseOptions</code>
**Kind**: inner constant of [<code>Utilities</code>](#module_Utilities)  
**Default**: <code>{&quot;concurrency&quot;:3,&quot;rate&quot;:10}</code>  
**Read only**: true  
<a name="module_Utilities..generateIterator"></a>

### Utilities~generateIterator(entryArray, actionFunction)
An Action Iterator Generator.  Cycles through the entries in the passed array,
yielding the result of a function for each entry.
Only cares that inputs are an array, and a function that returns a
promise

**Kind**: inner method of [<code>Utilities</code>](#module_Utilities)  

| Param | Type |
| --- | --- |
| entryArray | <code>Array.any</code> | 
| actionFunction | <code>callback</code> | 

<a name="module_Utilities..PromiseOptions"></a>

### Utilities~PromiseOptions : <code>object</code>
**Kind**: inner typedef of [<code>Utilities</code>](#module_Utilities)  
**Properties**

| Name | Type |
| --- | --- |
| concurrency | <code>number</code> | 
| rate | <code>number</code> | 

<a name="module_PromiseQueue"></a>

## PromiseQueue
Typedefs, constants, support functions and database operations related to Promise getQueueSize
Thes era euseful for scheduling large serial asynchronous operations

<a name="module_GenericUtilities"></a>

## GenericUtilities
useful cross-project utilities, to be shared between Back and Front End  - not browser
services.


* * *

&copy; 2020-2024 Tracy Hall / Dreams and Logic Inc / SaltSweetSpirits