Skip to content

[DEPRECATED] Was a collection of utilities I use a lot, moving to smize: https://github.com/eatyrghost/smize

Notifications You must be signed in to change notification settings

eatyrghost/spook-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spookUtils : object

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.cloneObject(inputObject, targetObj) ⇒ object

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

spookUtils.combineObjects(objArray) ⇒ object

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

spookUtils.isValidObject(inputObject) ⇒ boolean

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

spookUtils.validBoolean(inputObject, returnValue) ⇒ boolean

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

spookUtils.validNumber(inputObject, returnValue) ⇒ number

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

spookUtils.validObject(inputObject, returnValue) ⇒ object

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

spookUtils.validString(inputObject, returnValue) ⇒ string

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 ''

About

[DEPRECATED] Was a collection of utilities I use a lot, moving to smize: https://github.com/eatyrghost/smize

Resources

Stars

Watchers

Forks

Packages

No packages published