@appstractdk/as-utils

2.0.18 • Public • Published

#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.

Readme

Keywords

none

Package Sidebar

Install

npm i @appstractdk/as-utils

Weekly Downloads

9

Version

2.0.18

License

ISC

Unpacked Size

18.6 kB

Total Files

15

Last publish

Collaborators

  • appstract-team
  • raulstefan
  • ioanagrozav
  • mebappstract