bytepushers-js-obj-extensions
v0.0.13
Published
A collection of core object extensions and general utilities that can be used as base foundational classes.
Downloads
8
Readme
bytepushers-js-obj-extensions
Byte Pushers Object Extensions JavaScript library that supports core object extensions and general utilities that can be used as base fundamental classes.
Installation
npm install bytepushers-js-obj-extensions
Synopsis
Byte Pushers Object Extensions JavaScript library that supports common object extensions and general utilities that can be used as base fundamental classes. This module will be able to decipher and validate code from arrays to be able to tell whether a function is a constructor. This will show you how to use all code
Code Example
In the following code example, we call Object.isArray() method to determine if the array literal passed to this method is an array or not:
var result = Object.isArray([1, 3, 45, "d"]); // result ==> true
In the following code example, we call Object.isArray() method to determine if the object literal passed to this method is an array or not:
var obj = {};
var result = Object.isArray(obj); // result ==> false
In the following code example, we call Object.isString() method to determine if the string literal passed to this method is a string or not:
//string
var result = Object.isString("some string"); // result ==> true
In the following code example, we call Object.isString() method to determine if the numeric literal passed to this method is a string or not:
//string
var result = Object.isString(100); // result ==> false
The same injection method is used in all of the functions to test. Be in mind that these are all either static convenience functions or static functions. The trend of injecting your code as a parameter is followed throughout all of the function.
Motivation
The motivation behind the creation of the software.bytepushers.object.extensions.js is to create pre-made test for your code. This can be a time saver by keeping you away from "console.log()". The test ran will give you true or false for all code so you will quickly be able to tell whether the specified code is defined as expected.
| Testable Objects | | |:--------------------------|:---------------------------| |Arrays | Gets Properties | |Dates | Sets Properties | |Strings | Has Properties | |Numerics | Has Function | |Booleans | Functions | |Defined | Constructors | |Regular Expressions | Defined & not null or null |
API Reference
| Function Named | Function Description | |:----------------------------------|:------------------------------------------------------------------------| | Object.isArray(someArrayObject) |Static function that tells you whether someArrayObject is an array. Returns true if someArrayObject is an array; otherwise returns false.| | Object.isDate(someDateObject) |Static function that tells you whether someDateObject is a date or not. Returns true if someDateObject is an array; otherwise returns false. | | Object.isString(someStringObject) |Static function that tells you whether someStringObject is a string or not. Returns true if someString is an array; otherwise returns false. | | Object.isNumeric(someNumericObject) |Static function that tells you whether someNumericObject is numeric or not. Returns true if someNumericObject is an array; otherwise returns false. | | Object.isBoolean(someBooleanObject) |Static function that tells you whether someBooleanObject is a boolean or not. Returns true if someBooleanObject is an array; otherwise returns false. | | Object.isDefined(someDefinedObject) |Static function that tells you whether someDefinedObject is defined or not. Returns true if someDefinedObject is an array; otherwise returns false. | | Object.isRegEx(someRegExObject) |Static function that tells you whether someRegExObject is defined or not. Returns true if someRegExObject is an array; otherwise returns false. | | Object.getProperty(somePropertyObject) |Static function that tells you whether somePropertyObject is caught or not. Returns true if somePropertyObject is an array; otherwise returns false. | | Object.setProperty(somePropertyObject) |Static function that tells you whether somePropertyObject is set or not. Returns true if somePropertyObject is an array; otherwise returns false. | | Object.hasProperty(somePropertyObject) |Static function that tells you whether somePropertyObject is defined or not. Returns true if somePropertyObject is an array; otherwise returns false. | | Object.hasFunction(someFunctionObject) |Static function that tells you whether someFunctionObject is found or not. Returns true if someFunctionObject is an array; otherwise returns false. | | Object.isFunction(someFunctionObject) |Static function that tells you whether someFunctionObject is defined or not. Returns true if someFunctionObject is an array; otherwise returns false. | | Object.isConstructorFunction(someConstructor) |Static function that tells you whether someConstructor is defined as a constructor. Returns true if someConstructor is an array; otherwise returns false. | | Object.isDefinedAndNotNull(someObject) |Static convenience function that determines whether an object is defined and not null. | | Object.isUndefinedOrNull(someObject) |Static convenience function that determines whether an object is undefined or null. |