A collection of reusable utilities for creating Node modules or web experiences.
To install:
npm install spook-utils
To use in your project:
var spookUtils = require('spook-utils');
Alternatively, include ./dist/spook-utils.min.js and ./dist/spook-utils.min.js.map in your project.
Kind: global namespace
- spookUtils :
object
- .cloneObject(inputObject, targetObj) ⇒
object
- .combineObjects(objArray) ⇒
object
- .isValidObject(inputObject) ⇒
boolean
- .validBoolean(inputObject, returnValue) ⇒
boolean
- .validNumber(inputObject, returnValue) ⇒
number
- .validObject(inputObject, returnValue) ⇒
object
- .validString(inputObject, returnValue) ⇒
string
- .cloneObject(inputObject, targetObj) ⇒
Creates a new object that shares the same property values as an original object
Kind: static method of spookUtils
Returns: object
- The object result of the cloning operation
Param | Type | Description |
---|---|---|
inputObject | object |
The object to clone |
targetObj | object |
An optional target object to clone to |
Combines a collection of objects and returns the resulting object
Kind: static method of spookUtils
Returns: object
- The result of combining the objects
Param | Type | Description |
---|---|---|
objArray | array |
An array of objects to combine |
Determines if an object is a valid, non-null object
Kind: static method of spookUtils
Returns: boolean
- The boolean result of evaluating inputObject
Param | Type | Description |
---|---|---|
inputObject | object |
The object to validate |
Attempts to parse an object as a valid boolean
Kind: static method of spookUtils
Returns: boolean
- The boolean result of evaluating inputObject
Param | Type | Description |
---|---|---|
inputObject | object |
The object to validate as a boolean |
returnValue | boolean |
The default value to return, defaults to false |
Attempts to parse an object as a valid base-10 number
Kind: static method of spookUtils
Returns: number
- The numerical result of evaluating inputObject
Param | Type | Description |
---|---|---|
inputObject | object |
The object to validate as a number |
returnValue | number |
The default value to return, defaults to 0 |
Attempts to parse an object as a valid object
Kind: static method of spookUtils
Returns: object
- The object result of evaluating inputObject
Param | Type | Description |
---|---|---|
inputObject | object |
The object to validate as an object |
returnValue | object |
The default value to return, defaults to null |
Attempts to parse an object as a valid string
Kind: static method of spookUtils
Returns: string
- The string result of evaluating inputObject
Param | Type | Description |
---|---|---|
inputObject | object |
The object to validate as an object |
returnValue | string |
The default value to return, defaults to '' |