craydent-number

Node module to extend number functionality and simplify code for maintainability and readability

Usage no npm install needed!

<script type="module">
  import craydentNumber from 'https://cdn.skypack.dev/craydent-number';
</script>

README

Craydent 0.13.4

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. More detailed documentation on methods can be found at Craydent Methods

// 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-number');
$c.logit($c.VERSION);
arr.prototypedMethod(args);
// require no conflict - this require is the fully modular version with no global constants, prototypes, or methods.
var $c = require('craydent-number/noConflict');
$c.logit($c.VERSION);
$c.prototypedMethod(arr, args);
// 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-number/global');
logit($c.VERSION);
arr.prototypedMethod(args);

Categories

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)

Methods

Number


aboutEqualTo


Info: Number class extension to check if values are approximately equal

Return: (Bool)

Parameters:

  • compare: (Number) Number to compare
  • giveOrTake: (Number) Plus/minus value

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) 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) Array of values to return first matching value

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


isEven


Info: Number class extension to check if number is even

Return: (Bool)

Parameters:

None

Overloads:

None


isOdd


Info: Number class extension to check if number is odd

Return: (Bool)

Parameters:

None

Overloads:

None

Download