Home Reference Source
import {SharedHelperUtil} from 'cables-shared-api'
public class | source

SharedHelperUtil

Extends:

cables_dev/shared/api/shared_util.js~SharedUtil → SharedHelperUtil

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

MAX_NAME_LENGTH: number

public get
Private Members
private

Method Summary

Public Methods
public

capitalizeFirstLetter(string: *): *

public

cleanJson(obj: *): *

public

copy(aObject: *): *

public

endl(str: *): *

public

formatDate(date: *, format: undefined): *

public
public

generateShortId(longId: *, creationTimestamp: *): *

public
public

getFileNamesRecursive(baseDir: *, fileName: undefined, dir: undefined): *

public

getFilesRecursive(baseDir: *, fileName: undefined, dir: undefined): *

public

getLogEntry(key: *, text: *, date: undefined): {"created": *, "key": *, "text": *}

public

getPaginationInfo(items: *[], limit: number, offset: number, fullCount: undefined): {"count": *, "offset": *, "limit": *, "pages": *, "currentPage": *, "itemsOnPage": *, "nextPage": *, "prevPage": *}

public

isNumeric(n: *): *

public

leven(first: *, second: *): *

public

removeTrailingSpaces(input: *): *

public

sanitizeUsername(name: *): *

public

shuffle(array: Array): *

Shuffles an array, returns the same array with shuffles elements

public

sortAndReduce(arr: *): *

public

uniqueArray(arr: *): *

Private Methods
private

_shortIdBase(num: *, base: *): *

Public Constructors

public constructor() source

Public Members

public MAX_NAME_LENGTH: number source

public get utilName: * source

Private Members

private _validShortIdChars: * source

Public Methods

public capitalizeFirstLetter(string: *): * source

Params:

NameTypeAttributeDescription
string *

Return:

*

public cleanJson(obj: *): * source

Params:

NameTypeAttributeDescription
obj *

Return:

*

public copy(aObject: *): * source

Params:

NameTypeAttributeDescription
aObject *

Return:

*

public endl(str: *): * source

Params:

NameTypeAttributeDescription
str *

Return:

*

public formatDate(date: *, format: undefined): * source

Params:

NameTypeAttributeDescription
date *
format undefined
  • optional
  • default: undefined

Return:

*

public generateRandomId(): * source

Return:

*

public generateShortId(longId: *, creationTimestamp: *): * source

Params:

NameTypeAttributeDescription
longId *
creationTimestamp *

Return:

*

public generateUUID(): * source

Return:

*

public getFileNamesRecursive(baseDir: *, fileName: undefined, dir: undefined): * source

Params:

NameTypeAttributeDescription
baseDir *
fileName undefined
  • optional
  • default: undefined
dir undefined
  • optional
  • default: undefined

Return:

*

public getFilesRecursive(baseDir: *, fileName: undefined, dir: undefined): * source

Params:

NameTypeAttributeDescription
baseDir *
fileName undefined
  • optional
  • default: undefined
dir undefined
  • optional
  • default: undefined

Return:

*

public getLogEntry(key: *, text: *, date: undefined): {"created": *, "key": *, "text": *} source

Params:

NameTypeAttributeDescription
key *
text *
date undefined
  • optional
  • default: undefined

Return:

{"created": *, "key": *, "text": *}

public getPaginationInfo(items: *[], limit: number, offset: number, fullCount: undefined): {"count": *, "offset": *, "limit": *, "pages": *, "currentPage": *, "itemsOnPage": *, "nextPage": *, "prevPage": *} source

Params:

NameTypeAttributeDescription
items *[]
  • optional
  • default: []
limit number
  • optional
  • default: 0
offset number
  • optional
  • default: 0
fullCount undefined
  • optional
  • default: undefined

Return:

{"count": *, "offset": *, "limit": *, "pages": *, "currentPage": *, "itemsOnPage": *, "nextPage": *, "prevPage": *}

public isNumeric(n: *): * source

Params:

NameTypeAttributeDescription
n *

Return:

*

public leven(first: *, second: *): * source

Params:

NameTypeAttributeDescription
first *
second *

Return:

*

public removeTrailingSpaces(input: *): * source

Params:

NameTypeAttributeDescription
input *

Return:

*

public sanitizeUsername(name: *): * source

Params:

NameTypeAttributeDescription
name *

Return:

*

public shuffle(array: Array): * source

Shuffles an array, returns the same array with shuffles elements

Params:

NameTypeAttributeDescription
array Array

Return:

*

public sortAndReduce(arr: *): * source

Params:

NameTypeAttributeDescription
arr *

Return:

*

public uniqueArray(arr: *): * source

Params:

NameTypeAttributeDescription
arr *

Return:

*

Private Methods

private _shortIdBase(num: *, base: *): * source

Params:

NameTypeAttributeDescription
num *
base *

Return:

*