@bestplace/just

Common utils for JavaScript projects

Usage no npm install needed!

<script type="module">
  import bestplaceJust from 'https://cdn.skypack.dev/@bestplace/just';
</script>

README

Functions

parseLayerConfigShortcut(layer, extend)Object

Parses layer config shortcut into an object. The shortcut can either be string or object. '^' and '+' in the beginning of the string shortcut set flags 'active' and 'toggle' respectively. The resulting object can optionally be extended with 'name' and 'apiVersion'. By default 'name' is set to the same value as under 'url' and 'apiVersion' is set to 4.

addQueryParams(url, queryParams, excludeId)String

Returns source url merged with query params, optionally excluding 'id' param.

parseLayerConfigShortcut(layer, extend) ⇒ Object

Parses layer config shortcut into an object. The shortcut can either be string or object. '^' and '+' in the beginning of the string shortcut set flags 'active' and 'toggle' respectively. The resulting object can optionally be extended with 'name' and 'apiVersion'. By default 'name' is set to the same value as under 'url' and 'apiVersion' is set to 4.

Kind: global function

Param Type Default Description
layer String | Object layer config shortcut
extend Boolean true whether to extend the result with 'name' and 'apiVersion'

addQueryParams(url, queryParams, excludeId) ⇒ String

Returns source url merged with query params, optionally excluding 'id' param.

Kind: global function

Param Type Default Description
url String source url
queryParams Object query params object
excludeId Boolean false exclude 'id' query param from total url