This module exposes a constant object DATA_TYPES
that is a collection of enumerated values representing the data types and values supported by JS.
Enum | data type | Enum | data type | Enum | data type |
---|---|---|---|---|---|
ARRAY | array | FUNCTION | function | REGEXP | regexp |
BIGINT | bigint | MAP | map | SET | set |
BOOLEAN | boolean | NULL | null | STRING | string |
DATE | date | NUMBER | number | SYMBOL | symbol |
ERROR | error | OBJECT | object | UNDEFINED | undefined |
Creates a renew object with the same structure of the input, containing copies of the primitive values.
- obj - source object to be duplicated
A new object with the same structure as the input object and copies of the primitive values.
Creates a comparator function for use with an array of objects containing the given property.
- propertyName - string - name of the property to be used to compare objects in a sort method.
- ascending - boolean - optional (defaulted to true) indication or the required sort order.
A comparator function used to sort objects containing the given property.
Identifies which of the above Standard data Type being used by the supplied argument.
- subject variable of any type.
Lowercase string representation of the type of data held in the variable. This includes the following:
Standard Values | ||
---|---|---|
undefined | null | |
Standard Types | ||
boolean | number | string |
object | array | regexp |
date | error | set |
map | symbol | bigint |
Creates a renew object with the same structure of the input, containing copies of the primitive values and objects such as RegExp, Date and Function.
- obj - source object to be duplicated
A new object with the same structure as the input object and copies of the primitive values and more complicated objects.
Reduces the complexity of the given object by renaming sub-object properties and array elements.
- srcObj - The source Object to be flattened. It has a default value of an empty Object.
- propKey - An optional string fro the name of a property in the source Object or lower.
An Object with all the properties elevated to the top level. Nested properties are flattened and given a name that is a composite.
- ? - A variable that might or might not be null or undefined.
A Boolean indicationg if the supplied parameter is null/undefined.
Evaluates an object and reports if it is a valid but empty Object.
- obj - An object that could be empty, populated, null or undefined.
Boolean flag indication if the value is an object, null or undefined.
- ? - A variable that might or might not be an Object.
Boolean flag indication if the value is an object or not.
Compares two objects and reports in they are equivalent (contain the same primitives.)
- obj1 - first object in comparison
- obj2 - second object in comparison
Boolean flag indication if the values held withint obj1 are the same as those in obj2.
Creates an ultra-shallow copy of a given object with references to not only compound properties, such as nested objects and arrays, but also primitive properties. Optional parameters enable the generated to object to include or exclude specific top-level properties.
The primary use case for this function is to generate a cut-down object that is as close to the original as possible/required.
- src - Object to be cloned
- propList - optional list of property names (strings). Default value is an empty array
- isInclude - optional flag to indicate how the values in the propList are to be used. Default value is false
New object with references to all top-level properties of the source object.