Namespace: helpers

Playbasis. helpers

Playbasis Helpers

Methods


<static> appendAndJoinIfNotNullAsUrlParam(param)

Join variable url param together as query string, then prefix it with "&" if there's at least one non-null key-value pair.

Parameters:
Name Type Argument Description
param param <repeatable>

url param as part of url

Returns:

query string

Type
string

<static> appendAndJoinIfNotNullAsUrlParam2(keys, defaultValues, inputObj)

Join variable url param together as query string, then prefix it with "&" if there's at least one non-null key-value pair.

Parameters:
Name Type Description
keys Array

Array containing all keys string

defaultValues Array

Array containing all default values string

inputObj Object

Input optional object parameter, inside there're key-value pairs according to key and values of final query string

Returns:

query string

Type
String

<static> combinedObjects(objA, objB)

Combine two objects together but skip key-value pair whose either key or value is null. If both of objects are null, then return empty object. If object B has same keys as in object A, object A's values will be replaced by values of object B.

Parameters:
Name Type Description
objA Object

object A to combine

objB Object

object B to combine

Returns:

Combined object A and B but skipped key-value pair whose either key or value is null

Type
Object

<static> createApiUrl(method, param)

Create api url for used with Playbasis's API modules. If you use this, make sure you know what you're doing.

Parameters:
Name Type Argument Description
method string

method url for target API

param param <repeatable>

url param as part of url

Returns:

url ready to be used to make a qurey for Playbasis's API modules

Type
string

<static> createObjectFromTarget(obj, keysLimit)

Create object with keys and values from specified object. If 'keysLimit' is specified then it will only copy for those matching keys only, and ignore the less. It will ignore and skip key-value pair whose either key or value is null. It specified object is null, then it will create an empty object.

Parameters:
Name Type Description
obj Object

target object to get keys and values from in order to create a new object

keysLimit Array

(optional) keys as array to limit the copying process from target object

Returns:

new object created with non-null keys and values from specified object

Type
Object

<static> joinIfNotNullAsUrlParam(param)

Join variable url param together as query string.

Parameters:
Name Type Argument Description
param param <repeatable>

url param as part of url

Returns:

query string

Type
string

<static> joinParams(paramKvp)

Join each key of object into querystring and return it. It will iterate for all keys of its object, and process each pair of KVP making into final querystring.

Parameters:
Name Type Description
paramKvp object

options object

Returns:

query string

Type
string