# craydent-object

> Node module to extend all native class functionality and simplify code for maintainability and readability

Latest version **1.0.2** (published 2024-09-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install craydent-object
pnpm add craydent-object
yarn add craydent-object
bun add craydent-object
```

## 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 | 1.0.2 |
| Published | 2024-09-20 |
| First published | 2018-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 42 |
| Unpacked size | 81.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Clark Inada |
| Maintainers | craydent |
| Keywords | array, class, co, control flow, craydent, date, es6, function, jquery, json, library, moment, mongo, mongodb, number, object, object, regexp, string, sugar, template, typeof, utilities |

## Links

- npm: https://www.npmjs.com/package/craydent-object
- Repository: https://github.com/craydent/Node-Library
- Homepage: https://github.com/craydent/Node-Library/tree/master/modules/typeof
- Issues: https://github.com/craydent/Node-Library/issues
- npm.io page: https://npm.io/package/craydent-object

## Dependencies (42)

- [craydent.has](https://npm.io/package/craydent.has.md) 1.0.2
- [craydent.map](https://npm.io/package/craydent.map.md) 1.0.2
- [craydent.count](https://npm.io/package/craydent.count.md) 1.0.2
- [craydent.every](https://npm.io/package/craydent.every.md) 1.0.2
- [craydent.isint](https://npm.io/package/craydent.isint.md) 1.0.2
- [craydent.keyof](https://npm.io/package/craydent.keyof.md) 1.0.2
- [craydent.merge](https://npm.io/package/craydent.merge.md) 1.0.2
- [craydent.equals](https://npm.io/package/craydent.equals.md) 1.0.2
- [craydent.isdate](https://npm.io/package/craydent.isdate.md) 1.0.2
- [craydent.changes](https://npm.io/package/craydent.changes.md) 1.0.2
- [craydent.cobject](https://npm.io/package/craydent.cobject.md) 1.0.2
- [craydent.getkeys](https://npm.io/package/craydent.getkeys.md) 1.0.2
- [craydent.include](https://npm.io/package/craydent.include.md) 1.0.2
- [craydent.isarray](https://npm.io/package/craydent.isarray.md) 1.0.2
- [craydent.isasync](https://npm.io/package/craydent.isasync.md) 1.0.2
- [craydent.isempty](https://npm.io/package/craydent.isempty.md) 1.0.2
- [craydent.iserror](https://npm.io/package/craydent.iserror.md) 1.0.2
- [craydent.isfloat](https://npm.io/package/craydent.isfloat.md) 1.0.2
- [craydent.contains](https://npm.io/package/craydent.contains.md) 1.0.2
- [craydent.getclass](https://npm.io/package/craydent.getclass.md) 1.0.2
- [craydent.getvalue](https://npm.io/package/craydent.getvalue.md) 1.0.2
- [craydent.isnumber](https://npm.io/package/craydent.isnumber.md) 1.0.2
- [craydent.isobject](https://npm.io/package/craydent.isobject.md) 1.0.2
- [craydent.isregexp](https://npm.io/package/craydent.isregexp.md) 1.0.2
- [craydent.isstring](https://npm.io/package/craydent.isstring.md) 1.0.2
- [craydent.issubset](https://npm.io/package/craydent.issubset.md) 1.0.2
- [craydent.duplicate](https://npm.io/package/craydent.duplicate.md) 1.0.2
- [craydent.globalize](https://npm.io/package/craydent.globalize.md) 1.0.2
- [craydent.isbetween](https://npm.io/package/craydent.isbetween.md) 1.0.2
- [craydent.isboolean](https://npm.io/package/craydent.isboolean.md) 1.0.2
- [craydent.ispromise](https://npm.io/package/craydent.ispromise.md) 1.0.2
- [craydent.itemcount](https://npm.io/package/craydent.itemcount.md) 1.0.2
- [craydent.copyobject](https://npm.io/package/craydent.copyobject.md) 1.0.2
- [craydent.isfunction](https://npm.io/package/craydent.isfunction.md) 1.0.2
- [craydent.getproperty](https://npm.io/package/craydent.getproperty.md) 1.0.2
- [craydent.isgenerator](https://npm.io/package/craydent.isgenerator.md) 1.0.2
- [craydent.setproperty](https://npm.io/package/craydent.setproperty.md) 1.0.2
- [craydent.tostringalt](https://npm.io/package/craydent.tostringalt.md) 1.0.2
- [craydent.eachproperty](https://npm.io/package/craydent.eachproperty.md) 1.0.2
- [craydent.isdomelement](https://npm.io/package/craydent.isdomelement.md) 1.0.2
- [craydent.isgeolocation](https://npm.io/package/craydent.isgeolocation.md) 1.0.2
- [craydent.addobjectprototype](https://npm.io/package/craydent.addobjectprototype.md) 1.0.2

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.2 (latest) — 2024-09-20
- 1.0.1 — 2024-08-30
- 1.0.0 — 2024-08-23
- 0.15.2 — 2022-08-19
- 0.15.1 — 2022-08-17
- 0.15.0 — 2022-08-16
- 0.14.0 — 2022-08-15
- 0.13.5 — 2021-09-16
- 0.13.4 — 2021-08-09
- 0.13.3 — 2021-08-08
- 0.13.2 — 2021-08-07
- 0.13.1 — 2021-08-04
- 0.13.0 — 2021-07-15
- 0.12.3 — 2021-07-15
- 0.12.2 — 2021-07-15
- … 22 more at https://npm.io/package/craydent-object/versions

## README

<img src="http://craydent.com/JsonObjectEditor/img/svgs/craydent-logo.svg" width=75 height=75/>

# Craydent 1.0.2
**by Clark Inada**

Craydent is all inclusive utility library.  There are several ways to use the library in NodeJS.
More detailed documentation on constants can be found at [Craydent Properties](http://www.craydent.com/JsonObjectEditor/docs.html#/property/CraydentNode).
More detailed documentation on methods can be found at [Craydent Methods](http://www.craydent.com/JsonObjectEditor/docs.html#/method/CraydentNode)

```js
// require with prototypes - this require will add prototypes to extend classes and add two constants ($c, $g) to the global space.
// $g is an alias to global and $c is the constant containing all the utility methods and properties.
require('craydent-object');
$c.logit($c.VERSION);
arr.prototypedMethod(args);
```

```js
// require no conflict - this require is the fully modular version with no global constants, prototypes, or methods.
var $c = require('craydent-object/noConflict');
$c.logit($c.VERSION);
$c.prototypedMethod(arr, args);
```

```js
// require global - this require constants and methods in the global space and add prototypes to extend classes.
// $g is an alias to global and $c is the constant containing all the utility methods and properties.
require('craydent-object/global');
logit($c.VERSION);
arr.prototypedMethod(args);
```

## Categories

* [Constants](#markdown-header-constants)
* [Featured](#markdown-header-featured)
* [Object](#markdown-header-object)

<a name='markdown-header-constants'></a>
## Constants

| | | |
| ----- | ----- | ----- |
| CONSOLE_COLORS (Object) |LOCAL_IP (String) |TEMPLATE_TAG_CONFIG (Object) |
DEBUG_MODE (Boolean) |MODULES_LOADED (Object) |TEMPLATE_VARS (Array) |
ERROR_TYPES (Array) |PUBLIC_IP (String) |VERSION (String) |
HTTP_STATUS_TEMPLATE (Object) |RESPONSES (Object) |

<a name='markdown-header-featured'></a>
## Featured

### Object

*** 
#### _get_ 
***

**Info:** Alias to getProperty; however, it can not be used as a protoype property.

**Return:** (any)

**Parameters:**

>* object: (Object) object to get the property of
>* path: (String) Path to nested property
>* delimiter?: (Char) Separator used to parse path

**Overloads:**

>Parameters
>* object: (Object) object to get the property of
>* path: (RegExp) Regex match for the property

>Parameters
>* object: (Object) object to get the property of
>* path: (String) Path to nested property
>* options: (GetPropertyOptions) Options for ignoring inheritance, validPath, etc

>Parameters
>* object: (Object) object to get the property of
>* path: (String) Path to nested property
>* delimiter: (Char) Separator used to parse path
>* options: (GetPropertyOptions) Options for ignoring inheritance, validPath, etc

*** 
#### _getProperty_ 
***

**Info:** Object class extension to retrieve nested properties without error when property path does not exist

**Return:** (any)

**Parameters:**

>* path: (String) Path to nested property

**Overloads:**

>Parameters
>* path: (String) Path to nested property
>* delimiter: (Char) Separator used to parse path

>Parameters
>* path: (RegExp) Regex match for the property

>Parameters
>* path: (String) Path to nested property
>* options: (GetPropertyOptions) Options for ignoring inheritance, validPath, etc

>Parameters
>* path: (String) Path to nested property
>* delimiter: (Char) Separator used to parse path
>* options: (GetPropertyOptions) Options for ignoring inheritance, validPath, etc



## Methods

<a name='markdown-header-object'></a>
## Object

*** 
#### _addObjectPrototype_ 
***

**Info:** Method to extend the Object Class

**Return:** (void)

**Parameters:**

>* name: (String) name of the method to add
>* fn: (Function) method implementation
>* override?: (Bool) if true, override the previously defined prototype

**Overloads:**

>None

*** 
#### _changes_ 
***

**Info:** Object class extension to compare properties that have changed

**Return:** (Object)

**Parameters:**

>* compare: (any) Object to compare against

**Overloads:**

>None

*** 
#### _contains_ 
***

**Info:** Object class extension to check if value exists

**Return:** (Bool)

**Parameters:**

>* val: (ContainsValue|ContainsObjectIterator<T, TValue>) Value to check or custom function to determine validity

**Overloads:**

>Parameters
>* val: (ContainsValue) Value to check
>* func: (ContainsIterator<T>) Callback function used to do the comparison

>Parameters
>* val: (ContainsValue) Value to check
>* func: (ComparisonOperator) String indicating logical operator ("$lt"|"$lte"|"$gt"|"$gte"|"$mod"|"$type")

>Parameters
>* arr: (Array<TValue>) Array of values to return first matching value

*** 
#### _copyObject_ 
***

**Info:** Object class extension to copy an object excluding constructor

**Return:** (Object)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _count_ 
***

**Info:** Object class extension to count the properties in the object/elements in arrays/characters in strings.

**Return:** (Int)

**Parameters:**

>None

**Overloads:**

>Parameters
>* option: (WhereCondition) Query used in Array.where when counting elements in an Array

>Parameters
>* option: (String) Word or phrase to count in the String

>Parameters
>* option: (RegExp) Word or phrase pattern to count in the String

*** 
#### _duplicate_ 
***

**Info:** Object class extension to copy an object including constructor

**Return:** (Object)

**Parameters:**

>* recursive?: (Boolean) Flag to copy all child objects recursively

**Overloads:**

>None

*** 
#### _eachProperty_ 
***

**Info:** Object class extension to loop through all properties where hasOwnValue is true.

**Return:** (Object)

**Parameters:**

>* callback: (EachIterator<T>) Function to call for each property.  Callback will have two arguments (the value of the object and the property name) passed

**Overloads:**

>None

*** 
#### _every_ 
***

**Info:** Object class extension to check property values against a function

**Return:** (Bool)

**Parameters:**

>* callback: (ObjectIterator<T, TValue>) Callback to apply to each value

**Overloads:**

>Parameters
>* callback: (ObjectIterator<T, TValue>) Callback to apply to each value
>* craydent_ctxObject: (any) Context for the callback function

*** 
#### _equals_ 
***

**Info:** Object class extension to check if object values are equal

**Return:** (Bool)

**Parameters:**

>* compare: (any) Object to compare against
>* props?: (String[]) Array of property values to compare against

**Overloads:**

>None

*** 
#### _getClass_ 
***

**Info:** Object class extension to get the constructor name

**Return:** (String)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _getKeys_ 
***

**Info:** Object class extension to get the keys of the object

**Return:** (Array<string>)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _has_ 
***

**Info:** Alias to Object.prototype.hasOwnProperty

**Return:** (Boolean)

**Parameters:**

>* property: (String) Property name to check

**Overloads:**

>None

*** 
#### _isArray_ 
***

**Info:** Object class extension to check if object is an array

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isAsync_ 
***

**Info:** Object class extension to check if object is a async function

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isBetween_ 
***

**Info:** Object class extension to check if object is between lower and upper bounds

**Return:** (Bool)

**Parameters:**

>* lowerBound: (any) Lower bound comparison
>* upperBound: (any) Upper bound comparison
>* inclusive?: (Bool) Flag to include give bounds

**Overloads:**

>None

*** 
#### _isBoolean_ 
***

**Info:** Object class extension to check if object is a boolean

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isDate_ 
***

**Info:** Object class extension to check if object is a date

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isDomElement_ 
***

**Info:** Object class extension to check if object is a DOM element

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isEmpty_ 
***

**Info:** Object class extension to check if it is empty

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isError_ 
***

**Info:** Object class extension to check if object is an error object

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isFloat_ 
***

**Info:** Object class extension to check if object is a float

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isFunction_ 
***

**Info:** Object class extension to check if object is a function

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isGenerator_ 
***

**Info:** Object class extension to check if object is a generator function

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isGeolocation_ 
***

**Info:** Object class extension to check if object is a geolocation

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isInt_ 
***

**Info:** Object class extension to check if object is an integer

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isNullOrEmpty_ 
***

**Info:** Object class extension to check if object is a null or empty (object with no props, empty string, etc)

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isNumber_ 
***

**Info:** Object class extension to check if object is a number

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isObject_ 
***

**Info:** Object class extension to check if object is an object

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isPromise_ 
***

**Info:** Object class extension to check if object is a promise object

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isRegExp_ 
***

**Info:** Object class extension to check if object is a RegExp

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isString_ 
***

**Info:** Object class extension to check if object is a string

**Return:** (Bool)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _isSubset_ 
***

**Info:** Object class extension to check if item is a subset

**Return:** (Bool)

**Parameters:**

>* compare: (any) Superset to compare against
>* sharesAny: (Boolean) Flag to check if any property is shared

**Overloads:**

>None

*** 
#### _itemCount_ 
***

**Info:** Object class extension to count the properties in item

**Return:** (Int)

**Parameters:**

>None

**Overloads:**

>None

*** 
#### _keyOf_ 
***

**Info:** Object class extension to get the key of the give value

**Return:** (String)

**Parameters:**

>* value: (any) Value to compare against

**Overloads:**

>None

*** 
#### _map_ 
***

**Info:** Object class extension to apply method to every value

**Return:** (void)

**Parameters:**

>* callback: (ObjectIterator<T, TValue>) Callback to apply to each value
>* craydent_ctxObject?: (any) Context for the callback function

**Overloads:**

>None

*** 
#### _merge_ 
***

**Info:** Object class extension to merge objects

**Return:** (Object)

**Parameters:**

>* secondary: (Object) Object to merge with
>* condition?: (MergeEnums|MergeOptions|MergeIterator<T>) Flags to recurse, merge only shared value, clone, intersect etc

**Overloads:**

>None

*** 
#### _set_ 
***

**Info:** Alias to setProperty; however, it can not be used as a protoype property.

**Return:** (Bool)

**Parameters:**

>* object: (Object) object to add the property to
>* path: (String) Path to nested property
>* value: (any) Value to set
>* delimiter?: (Char) Separator used to parse path

**Overloads:**

>None

*** 
#### _setProperty_ 
***

**Info:** Object class extension to set nested properties creating necessary property paths

**Return:** (Bool)

**Parameters:**

>* path: (String) Path to nested property
>* value: (any) Value to set
>* delimiter?: (Char) Separator used to parse path

**Overloads:**

>None

*** 
#### _toStringAlt_ 
***

**Info:** Object class extension for an alternate way to stringify object to formatted string

**Return:** (String)

**Parameters:**

>* delimiter?: (Char) Character to separate the property from the value
>* prefix?: (Char) Character to prefix the property name
>* urlEncode?: (Bool) Flag to url encode the property and value

**Overloads:**

>None




## Download

 * [GitHub](https://github.com/craydent/node-library/modules/object)
 * [BitBucket](https://bitbucket.org/craydent/node-library/modules/object)
 * [GitLab](https://gitlab.com/craydent/node-library/modules/object)
Craydent is released under the [Dual licensed under the MIT or GPL Version 2 licenses](http://craydent.com/license).<br>

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