# next-core-utilities

> Augmented Next Core - Utilities and Functions.

Latest version **3.4.1** (published 2021-01-09) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install next-core-utilities
pnpm add next-core-utilities
yarn add next-core-utilities
bun add next-core-utilities
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.4.1 |
| Published | 2021-01-09 |
| First published | 2018-08-20 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 183.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bob Warren |
| Maintainers | thedocbwarren |
| Keywords | augmentedjs, presentation |

## Links

- npm: https://www.npmjs.com/package/next-core-utilities
- Repository: https://github.com/Augmentedjs/next-core-utilities
- Homepage: https://www.augmentedjs.com
- Issues: https://github.com/Augmentedjs/next-core-utilities/issues
- npm.io page: https://npm.io/package/next-core-utilities

## Recent versions

- 3.4.1 (latest) — 2021-01-09
- 3.4.0 — 2021-01-09
- 3.3.0 — 2020-09-02
- 3.2.0 — 2020-09-02
- 3.1.0 — 2020-09-02
- 3.0.0 — 2020-08-16
- 2.9.0 — 2020-03-21
- 2.8.0 — 2019-12-12
- 2.7.1 — 2019-09-17
- 2.7.0 — 2019-09-17
- 2.6.1 — 2018-09-23
- 2.6.0 — 2018-09-15
- 2.5.5 — 2018-08-20
- 2.5.4 — 2018-08-20
- 2.5.3 — 2018-08-20

## README

# next-core-utilities

Augmented Next Core - Utilities and Functions

# API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [isString](#isstring)
    -   [Parameters](#parameters)
-   [isFunction](#isfunction)
    -   [Parameters](#parameters-1)
-   [has](#has)
    -   [Parameters](#parameters-2)
-   [isObject](#isobject)
    -   [Parameters](#parameters-3)
-   [allKeys](#allkeys)
    -   [Parameters](#parameters-4)
-   [create](#create)
    -   [Parameters](#parameters-5)
-   [result](#result)
-   [arrayhas](#arrayhas)
    -   [Parameters](#parameters-6)
-   [exec](#exec)
    -   [Parameters](#parameters-7)
-   [isDefined](#isdefined)
    -   [Parameters](#parameters-8)
-   [prettyPrint](#prettyprint)
    -   [Parameters](#parameters-9)
-   [prettyPrintHTML](#prettyprinthtml)
    -   [Parameters](#parameters-10)
-   [shuffle](#shuffle)
    -   [Parameters](#parameters-11)
-   [binarySearch](#binarysearch)
    -   [Parameters](#parameters-12)
-   [TransformerType](#transformertype)
    -   [Properties](#properties)
-   [Transformer](#transformer)
    -   [transform](#transform)
        -   [Parameters](#parameters-13)
    -   [transform](#transform-1)
        -   [Parameters](#parameters-14)
    -   [isType](#istype)
        -   [Parameters](#parameters-15)
-   [wrap](#wrap)
    -   [Parameters](#parameters-16)
-   [filterObject](#filterobject)
    -   [Parameters](#parameters-17)
-   [findByMatchingProperties](#findbymatchingproperties)
    -   [Parameters](#parameters-18)
-   [sortObjects](#sortobjects)
    -   [Parameters](#parameters-19)
-   [mergeSort](#mergesort)
    -   [Parameters](#parameters-20)
-   [mergeSort](#mergesort-1)
    -   [Parameters](#parameters-21)
-   [mergeSort](#mergesort-2)
    -   [Parameters](#parameters-22)
-   [QuickSort](#quicksort)
    -   [Parameters](#parameters-23)
-   [formatBinary](#formatbinary)
    -   [Parameters](#parameters-24)
-   [binaryToHex](#binarytohex)
    -   [Parameters](#parameters-25)
-   [formatDate](#formatdate)
    -   [Parameters](#parameters-26)
-   [filter](#filter)
    -   [Parameters](#parameters-27)
-   [sizeOf](#sizeof)
-   [formatByteSize](#formatbytesize)
-   [memorySizeOf](#memorysizeof)
-   [hammingDistance](#hammingdistance)
    -   [Parameters](#parameters-28)
-   [isEqual](#isequal)
    -   [Parameters](#parameters-29)

## isString

isString -
checks if a value is a String

### Parameters

-   `val`  
-   `variable` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to check

Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if value is a string

## isFunction

isFunction -
returns true if called name is a function
simular to jQuery .isFunction method

### Parameters

-   `name` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The name of the function to test

Returns **any** true if called name is a function

## has

has

### Parameters

-   `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The input object
-   `key` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The test key

Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns true of the key exists

## isObject

isObject

### Parameters

-   `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The input object

Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns true of the param is an object

## allKeys

Augmented.allKeys

### Parameters

-   `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The input object

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Returns the array of ALL keys including prototyped

## create

Augmented.create

### Parameters

-   `prototype` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The input prototype
-   `props` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The properties (optional)

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Returns the created object

## result

Augmented.result - returns named property in an object
simular to underscore .result method

Returns **any** named property in an object

## arrayhas

Array.has - returns is a property is in the array (very fast return)

### Parameters

-   `arr` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Source array
-   `key` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Key to test for

Returns **any** true if property is included in an array

## exec

exec method - Execute a function by name

### Parameters

-   `functionName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the function
-   `context` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The context to call from
-   `args` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Arguments

## isDefined

isDefined - Checks and returns if a passed variable is defined

### Parameters

-   `val`  
-   `variable` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to check

Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if value is defined

## prettyPrint

Prints an object nicely

### Parameters

-   `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The object to print
-   `spaces` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Use spaces instead of tabs (optional, default `false`)
-   `number` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number spaces to use (if spaces is true) (optional, default `2`)

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** formatted JSON string

## prettyPrintHTML

Prints an object nicely in HTML

### Parameters

-   `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The object to print
-   `indent`   (optional, default `0`)
-   `array`   (optional, default `false`)
-   `last`   (optional, default `true`)

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** formatted JSON string in HTML

## shuffle

Shuffles an Array with Fisher-Yates Shuffle algorithm

### Parameters

-   `array` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The array to shuffle

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** A new shuffled array

## binarySearch

Performs a binary search on the host array. vs indexOf<br/>
Binary Search is a complexity of <em>O(n log n)</em> vs <em>O(n)</em> with indexOf

### Parameters

-   `arr` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The array.
-   `find` **Any** The item to search for within the array.
-   `comparator` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The comparator to use

Returns **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** The index of the element which defaults to -1 when not found.

## TransformerType

Augmented.Utility.TransformerType <br/>
Transformer type for use in the transformer

Type: [Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol)

### Properties

-   `String` **[Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol)** Standard String
-   `Integer` **[Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol)** Integer
-   `Number` **[Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol)** Any number
-   `Boolean` **[Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol)** True/False
-   `Array` **[Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol)** Stanrdard Array
-   `Object` **[Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol)** Any Object
-   `Null` **[Symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol)** Null

## Transformer

Augmented.Utility.Transformer <br/>
Transform an object, type, or array to another type, object, or array

### transform

The transformer type enum

Type: Augmented.Utility.TransformerType

#### Parameters

-   `source`  
-   `type`  

### transform

Transform an object, primitive, or array to another object, primitive, or array

#### Parameters

-   `source` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Source primitive to transform
-   `type` **Augmented.Utility.TransformerType** Type to transform to

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** returns a transformed object or primitive

### isType

Returns a Augmented.Utility.TransformerType of a passed object

#### Parameters

-   `source` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The source primitive

Returns **Augmented.Utility.TransformerType** type of source as Augmented.Utility.TransformerType

## wrap

Wrap method to handle wrapping functions (simular to \_.wrap)

### Parameters

-   `fn`  
-   `wrap`  

## filterObject

filter an object from array of values

### Parameters

-   `object` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object to filter
-   `keys` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** keys to filter from the object

Returns **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** returns a new object with only these keys

## findByMatchingProperties

find an oject from matching properties

### Parameters

-   `set` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** array/set of objects
-   `properties` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** properties to find by

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** returns a the objects that matched

## sortObjects

Sorts an array of objects by propery in object

### Parameters

-   `array` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The object array to sort
-   `key` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The property to sort by

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The sorted array

## mergeSort

Split the array into halves and merge them recursively

### Parameters

-   `array` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The array to sort

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The sorted array

## mergeSort

Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time.
It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.

### Parameters

-   `array` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The array to sort

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The sorted array

## mergeSort

Simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order.

### Parameters

-   `array` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The array to sort

Returns **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The sorted array

## QuickSort

Quick Sort implimentation for Arrays -

### Parameters

-   `arr` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Array to Sort

Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** Returns a sorted array

## formatBinary

Format a number into binary string at a set precision

### Parameters

-   `num` **num** The number to format
-   `pres` **pres** The bit precision

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The formatted binary string

## binaryToHex

Format a binary string into a hex value (two characters)

### Parameters

-   `binary` **binary** The 8-bit binary string to return as hex characters
-   `pad` **pad** Add a zero if under '10'

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The hex value

## formatDate

Format a date to US format (MM/DD/YYYY HH:mm AM/PM) or (MM/DD/YYYY) only

### Parameters

-   `date` **[date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)** The date to format
-   `noTime` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Exclude the time

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The formatted date

## filter

Filter a string by removing a char

### Parameters

-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The string
-   `char` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The char

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The filtered string

## sizeOf

Returns the size in bytes of an object

Returns **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** size in bytes

## formatByteSize

Returns the number (in bytes) as a human readable string

Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** size in formated human readable string

## memorySizeOf

Returns the object size as a human readable string

Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** size in formated human readable string

## hammingDistance

The Hamming Distance is the number of different symbols between two
strings/numbers (equal length). It can be also considered as the number of
changes required to convert from one input to another.

### Parameters

-   `num1` **([number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) \| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** First number
-   `num2` **([number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) \| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** Second number

Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** the distance

## isEqual

Performs a deep comparison between two values to determine if they are
equivalent.  This is a simular function to lodash isEquals. <br/>

<strong>Note:</strong> This method supports comparing arrays, array buffers,
booleans, dates, error objects, maps, numbers, objects, regexes, sets,
strings, symbols, and typed arrays.
Objects are compared by their own, not inherited, enumerable properties.</br>
<em>Functions are compared by strict equality, i.e. ===.</em><br/>
<em>DOM nodes are considered objects and treaked as such as this library does
not assume browsers.</em>

### Parameters

-   `first` **any** The first item
-   `second` **any** The second item

Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns true if equal

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