utils

Core Utilities for Sockbot

License: MIT

utils.uuid() ⇒ string

Generate a "good enough" Type 4 UUID.

Not cryptographically secure, not pretty, not fast, but since we only need a couple of these it's good enough

Kind: static method of utils
Returns: string - a "type 4 UUID"

utils.log(message)

Log a message to the console

Kind: static method of utils

Param Type Description
message * Message to log

utils.warn(message)

Log a warning to the console

Kind: static method of utils

Param Type Description
message * Warning to log

utils.error(message)

Log an error to the console

Kind: static method of utils

Param Type Description
message * Error to log

utils.cloneData(original) ⇒ *

Clone object

Kind: static method of utils
Returns: * - Cloned original data

Param Type Description
original * Data to clone

utils.mergeObjects([mergeArrays], ...mixin) ⇒ object

Merge multiple objects into one object

Later objects override earlier objects

Kind: static method of utils
Returns: object - object constructed by merging mixins from left to right

Param Type Description
[mergeArrays] boolean Merge arrays instead of concatenating them
...mixin object Objects to merge

utils.filterIgnored(post, topic, callback)

Filter post/topic for ignore conditions

Kind: static method of utils

Param Type Description
post externals.posts.CleanedPost Post to filter
topic externals.topics.Topic Topic to filter
callback completionCallback Completion Callback

utils~addTimestamp(message) ⇒ string

Add timestamp to message.

Kind: inner method of utils
Returns: string - timestamped input message

Param Type Description
message * Message to timestamp

utils~mergeInner(base, mixin, [mergeArrays])

Recursively merge objects

Kind: inner method of utils

Param Type Description
base object Base object to merge mixin into
mixin object Mixin object to merge into base
[mergeArrays] boolean Merge arrays instead of concatenating them

utils~filterIgnoredOnPost(post, topic, callback) ⇒ null

Proccess post for ignore contitions

Kind: inner method of utils
Returns: null - No return value

Param Type Description
post externals.posts.CleanedPost Post to filter
topic externals.topics.Topic Topic post belongs to
callback filterCallback Completion Callback

utils~filterIgnoredOnTopic(post, topic, callback) ⇒ null

Proccess topic for ignore contitions

Kind: inner method of utils
Returns: null - No return value

Param Type Description
post externals.posts.CleanedPost Triggering post
topic externals.topics.Topic Topic to filter
callback filterCallback Completion Callback