2.0.18 • Published 6 years ago

@appstractdk/as-utils v2.0.18

Weekly downloads
24
License
ISC
Repository
-
Last release
6 years ago

#as-utils Utils module containing the following methods:

  • getCookie(name) - returns cookie by specified name; returns null if it doesn't exist.
  • setCookie(name, days, value) - sets cookie.
  • clearCookie(name) - clears cookie by specified name.

  • format(integer, decimalNumber, decimalSeparator, thousandsSeparator) - number formatting helper. If decimalSeparator is not provided, comma (EUROPEAN) is used as default decimal separator. If thousandsSeparator is not provided, dot (EUROPEAN) is used as default thousands separator; if thousands separator is not desired, an empty string should be passed in.

  • matches(element, selector) - Element.matches() polyfill.

  • query(base, selector) - returns an array of all elements descended from the selector within the 'base' element object or within document if 'base' is not provided.

  • updateQueryString(key, value, url) - modifies query string with provided key and value(if provided value is set to null, query parameter will be removed).

  • getParameterByName(key, url) - returns value of the specified key(returns an empty string if parameter is not found).
  • queryStringToMap(query) - parses query string to a map
  • buildUrl(base, search) - builds URL from provided base and map parameters.

  • template(tag, { templateName: 'nameValue' }) - formats a template string.

  • uuid() - generates an UUID v4 style.