npm package: @r146023/colemen-jsutils
Description: colemen-jsutils test.
Author: r146023
Latest version: 0.0.3

# A simple javascript utility library

<!-- [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Greenkeeper badge](https://badges.greenkeeper.io/alexjoverm/typescript-library-starter.svg)](https://greenkeeper.io/)
[![Travis](https://img.shields.io/travis/alexjoverm/typescript-library-starter.svg)](https://travis-ci.org/alexjoverm/typescript-library-starter)
[![Coveralls](https://img.shields.io/coveralls/alexjoverm/typescript-library-starter.svg)](https://coveralls.io/github/alexjoverm/typescript-library-starter)
[![Dev Dependencies](https://david-dm.org/alexjoverm/typescript-library-starter/dev-status.svg)](https://david-dm.org/alexjoverm/typescript-library-starter?type=dev)
[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg)](https://paypal.me/AJoverMorales) -->

Essentially just a library of methods that I use frequently.

<!-- ![](https://i.imgur.com/opUmHp0.png) -->

### Usage

```bash
npm i @r146023/colemen-jsutils

# import
import utils from 'colemen-jsutils';
```

**Start coding!** `package.json` and entry files are already set up for you, so don't worry about linking to your main file, typings, etc. Just keep those files with the same name.

# arrayUtils
## **<font color="orange">arrayUtils.Flatten</font>**
Flattens an array to a single level of depth
<font color="gray">
* author: Colemen Atwood
* created: 01\11\2022 10:16:00
* memberOf: arrayUtils#
* version: 1.0
</font> 

**arguments**
- `{array}` array - The array to flatten\
- `{boolean}` [allowDuplicates=`true`] - If false, only unique elements are kept

**return** `{array}` \
The formatted array.

===============================================================

## **<font color="orange">arrayUtils.stripDuplicates</font>**
Remove duplicate values from an array
<font color="gray">
* author: Colemen Atwood
* created: 01\11\2022 10:16:00
* memberOf: arrayUtils#
* version: 1.0
</font>

**arguments** \
`{array}` a - The array to format

**return** `{array}`\
The formatted array

===============================================================

## **<font color="orange">arrayUtils.isEmpty</font>**
Checks if an array is empty,null,false or undefined.
<font color="gray">
* author: Colemen Atwood
* created: 01\10\2022 17:09:25
* memberOf: arrayUtils#
* version: 1.0
</font>

**arguments** \
`{array}` a - The array to validate.

**return** `{boolean|null}`\
 True if the array is empty,null,false or undefined. False if it is not empty. Null if the array is not an array.

===============================================================

## **<font color="orange">arrayUtils.longestStringInArray</font>**
Finds the longest string in an array of strings.
<font color="gray">
* author: Colemen Atwood
* created: 01\10\2022 13:52:30
* memberOf: arrayUtils#
* version: 1.0
</font>

**arguments** \
`{string}` aVal - The array to parse.

**return**  `{number}`\
The length of the longest string in the array.

===============================================================



### Features

 - **arrayUtils**
    - flattenArray
    - stripDuplicates
    - isEmpty
    - longestStringInArray
    - divideArray

 - **beaconUtils**
    - newBeacon

 - **browserUtils**
    - generalData
    - localStorage
    - sessionStorage
    - canvasSupported

 - **colorUtils**
    - randomColor
    - hexToRgb
    - randomConsoleColor

 - **componentUtils**
    - genClasses
    - compHasTypeName
    - compHasPropKey
    - getAllChildren
    - getUnknownChildren
    - getChildByProp
    - countChildren

 - **convertUtils**
    - toBoolean
    - toString
    - base64ToUTF8
    - hash
        - MD5
        - SHA1
        - SHA256
        - SHA512
        - RIPEMD160

 - **cookieUtils**
    - set
    - get
    - remove

 - **encryptUtils**
    - encryptAES
    - decryptAES

 - **generateUtils**
    - variations
    - generateTypos
    - randomint
    - randomString
    - randomColor
    - UUID

 - **localStorageUtils**
    - getAllKeys
    - set
    - get
    - remove
    - clear


 - **[RollupJS](https://rollupjs.org/)** for multiple optimized bundles following the [standard convention](http://2ality.com/2017/04/setting-up-multi-platform-packages.html) and [Tree-shaking](https://alexjoverm.github.io/2017/03/06/Tree-shaking-with-Webpack-2-TypeScript-and-Babel/)
 - Tests, coverage and interactive watch mode using **[Jest](http://facebook.github.io/jest/)**
 - **[Prettier](https://github.com/prettier/prettier)** and **[TSLint](https://palantir.github.io/tslint/)** for code formatting and consistency
 - **Docs automatic generation and deployment** to `gh-pages`, using **[TypeDoc](http://typedoc.org/)**
 - Automatic types `(*.d.ts)` file generation
 - **[Travis](https://travis-ci.org)** integration and **[Coveralls](https://coveralls.io/)** report
 - (Optional) **Automatic releases and changelog**, using [Semantic release](https://github.com/semantic-release/semantic-release), [Commitizen](https://github.com/commitizen/cz-cli), [Conventional changelog](https://github.com/conventional-changelog/conventional-changelog) and [Husky](https://github.com/typicode/husky) (for the git hooks)

### Importing library

You can import the generated bundle to use the whole library generated by this starter:

```javascript
import myLib from 'mylib'
```

Additionally, you can import the transpiled modules from `dist/lib` in case you have a modular library:

```javascript
import something from 'mylib/dist/lib/something'
```