@leaddreamer/GenericUtilities
Useful cross-project utilities to be shared between Back and Front End - not browser services.
Modules
UtilitiesTypedefs, constants, support functions and database operations for general Utilities
PromiseQueueTypedefs, constants, support functions and database operations related to Promise getQueueSize Thes era euseful for scheduling large serial asynchronous operations
GenericUtilitiesuseful cross-project utilities, to be shared between Back and Front End - not browser services.
Utilities
Typedefs, constants, support functions and database operations for general Utilities
- Utilities
- static
- .simpleObjectCompare(object1, object2) ⇒
boolean - .formatItem(thisItem, thisFormat) ⇒
string - .compare(thisItem, anotherItem, sort) ⇒
string - .anyInAny(findFrom, findIn) ⇒
boolean - .PromisePoolRunner(entryArray, actionFunction, promiseOptions) ⇒
Promise - .lesserOf(args) ⇒
number - .largerOf(args) ⇒
number - .bound(value, lowerBound, upperBound) ⇒
number - .blindPush(targetArray, newObject)
- .addToArrayObject(arrayObject, key, object)
- .makeHexAsNeeded(color) ⇒
string
- .simpleObjectCompare(object1, object2) ⇒
- inner
- ~PromisePool
- ~promiseOptionsDefault :
PromiseOptions - ~generateIterator(entryArray, actionFunction)
- ~PromiseOptions :
object
- static
Utilities.simpleObjectCompare(object1, object2) ⇒ boolean
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 Utilities
| Param | Type |
|---|---|
| object1 | object |
| object2 | object |
Utilities.formatItem(thisItem, thisFormat) ⇒ string
Allows string substitution from an object field names support Dot notation field names allow ":" extension for alternate formatting
Kind: static method of Utilities
| Param | Type | Description |
|---|---|---|
| thisItem | object |
object to create formated string from |
| thisFormat | string |
string describing formatted output - fieldname wrapped in {} will be substituted. DOT notation allowed for fields. |
Utilities.compare(thisItem, anotherItem, sort) ⇒ string
Kind: static method of Utilities
| Param | Type | Description |
|---|---|---|
| thisItem | object |
one of two objects being compared |
| anotherItem | object |
the other of two objects being compared |
| sort | string |
string describing sort - format "fieldName:sortType" - sort Type is "string, "date" or "number" (default) |
Utilities.anyInAny(findFrom, findIn) ⇒ boolean
An array based compare function - is any entry of findFrom present in findIn
Kind: static method of Utilities
| Param | Type |
|---|---|
| findFrom | Array.any |
| findIn | Array.any |
Utilities.PromisePoolRunner(entryArray, actionFunction, promiseOptions) ⇒ Promise
Kind: static method of Utilities
| Param | Type |
|---|---|
| entryArray | Array.object |
| actionFunction | callback |
| promiseOptions | PromiseOptions |
Utilities.lesserOf(args) ⇒ number
A convenience function for legibility
Kind: static method of Utilities
Returns: number - the least of any of the arguments
b
| Param | Type | Description |
|---|---|---|
| args | any |
unbounded list of arguments |
Utilities.largerOf(args) ⇒ number
Kind: static method of Utilities
Returns: number - the largest of any of the arguments
| Param | Type | Description |
|---|---|---|
| args | any |
unbounded list of arguments |
Utilities.bound(value, lowerBound, upperBound) ⇒ number
clips value to given bounds
Kind: static method of Utilities
| Param | Type |
|---|---|
| value | number |
| lowerBound | number |
| upperBound | number |
Utilities.blindPush(targetArray, newObject)
function to push an element to an array which may not be initialized
Kind: static method of Utilities
| Param | Type |
|---|---|
| targetArray | Array.object |
| newObject | object |
Utilities.addToArrayObject(arrayObject, key, object)
Kind: static method of Utilities
| Param | Type | Description |
|---|---|---|
| arrayObject | Array.Array.object |
|
| key | string |
key or index to choose which Array.object to add this object to |
| object | object |
Utilities.makeHexAsNeeded(color) ⇒ string
Kind: static method of Utilities
Returns: string - hex value of named color
| Param | Type | Description |
|---|---|---|
| color | string |
name of color |
Utilities~PromisePool
Kind: inner constant of Utilities
Utilities~promiseOptionsDefault : PromiseOptions
Kind: inner constant of Utilities
Default: {"concurrency":3,"rate":10}
Read only: true
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 Utilities
| Param | Type |
|---|---|
| entryArray | Array.any |
| actionFunction | callback |
Utilities~PromiseOptions : object
Kind: inner typedef of Utilities
Properties
| Name | Type |
|---|---|
| concurrency | number |
| rate | number |
PromiseQueue
Typedefs, constants, support functions and database operations related to Promise getQueueSize Thes era euseful for scheduling large serial asynchronous operations
GenericUtilities
useful cross-project utilities, to be shared between Back and Front End - not browser services.
2020-2024 Tracy Hall / Dreams and Logic Inc / SaltSweetSpirits