@osovitny/anatoly 2.1.8 → 2.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1616,7 +1616,7 @@
1616
1616
  if (this.subscription != null) {
1617
1617
  return;
1618
1618
  }
1619
- this.subscription = this.get('GetCurrentContext', null).subscribe(function (data) {
1619
+ this.subscription = this.get('getCurrentContext', null).subscribe(function (data) {
1620
1620
  _this.dataReceived(data);
1621
1621
  }, function (e) { });
1622
1622
  };
@@ -2021,6 +2021,33 @@
2021
2021
  Utils.downloadFile(fileName, downloadURL);
2022
2022
  }
2023
2023
  };
2024
+ /*
2025
+ Author:
2026
+ https://medium.com/@mhagemann/the-ultimate-way-to-slugify-a-url-string-in-javascript-b8e4a0d849e1
2027
+ */
2028
+ Utils.slugify = function (text, prefix, postfix) {
2029
+ if (prefix === void 0) { prefix = ''; }
2030
+ if (postfix === void 0) { postfix = ''; }
2031
+ var a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;';
2032
+ var b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------';
2033
+ var p = new RegExp(a.split('').join('|'), 'g');
2034
+ /*
2035
+ https://css-tricks.com/snippets/javascript/strip-html-tags-in-javascript/
2036
+ https://stackoverflow.com/questions/822452/strip-html-from-text-javascript
2037
+ */
2038
+ text = text.replace(/(<([^>]+)>)/gi, '');
2039
+ var result = text
2040
+ .toString()
2041
+ .toLowerCase()
2042
+ .replace(/\s+/g, '-') // Replace spaces with -
2043
+ .replace(p, function (c) { return b.charAt(a.indexOf(c)); }) // Replace special characters
2044
+ .replace(/&/g, '-and-') // Replace & with 'and'
2045
+ .replace(/[^\w\-]+/g, '') // Remove all non-word characters
2046
+ .replace(/\-\-+/g, '-') // Replace multiple - with single -
2047
+ .replace(/^-+/, '') // Trim - from start of text
2048
+ .replace(/-+$/, ''); // Trim - from end of text
2049
+ return prefix + result + postfix;
2050
+ };
2024
2051
  return Utils;
2025
2052
  }());
2026
2053