API Docs for version 1.3.1803

Utils

Module: Circuit

static

Summary

Static utility functions

Methods

createMentionedUsersArray

Syntax

createMentionedUsersArray

(
  • msg
  • [convUsers]
)
String[]

Summary

Utility function to return an array of mentioned Users in a message.

Parameters:

  • msg String

    Text for the message.

  • [convUsers] String[] optional

    Array of user IDs to filter for.

Returns:

String[]:

Array of mentioned user IDs.

Example:

const mention = '<span class="mention" abbr="0e372ae0-2dff-4439-8f87-1b8a6562f80e">@Roger</span>';
const userId = '0e372ae0-2dff-4439-8f87-1b8a6562f80e';
const mentionUserIds = Circuit.Utils.createMentionedUsersArray(mention, [userId]);

getBrowserInfo

Syntax

getBrowserInfo

() Object

Summary

Provides browser type and version information.

Returns:

Object:

Object with type, version and browser attributes

textToHtmlEscaped

Syntax

textToHtmlEscaped

(
  • str
  • [spaceForNewlines]
)
String

Summary

Utility function to escape text as html, but keep line changes.

Parameters:

  • str String

    Text content to escape

  • [spaceForNewlines] Boolean optional

    If true, newlines (\n) are converted to   instead of

Returns:

String:

Escaped string

Example:

Circuit.Utils.textToHtmlEscaped('<b>bold</b>\ntest');
// returns &lt;b&gt;bold&lt;/b&gt;<br>test

Circuit.Utils.textToHtmlEscaped('<b>bold</b>\ntest', true);
// returns &lt;b&gt;bold&lt;/b&gt;&nbsp;test

Properties

EMAIL_ADDRESS_PATTERN

Syntax

EMAIL_ADDRESS_PATTERN

String final static

Summary

Email address patttern. /^[_a-z0-9-\+]+(?:\.[_a-z0-9-\+]+)*@[a-z0-9-]+(?:\.[a-z0-9-]+)*(?:\.[a-z][a-z]+)$/im