b2b-platform-utils 1.1.33 → 1.1.35

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/slugger.js +5 -1
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "b2b-platform-utils",
3
- "version": "1.1.33",
3
+ "version": "1.1.35",
4
4
  "description": "Shared utilities for Node.js microservices: errors map, local cache, logger, numbers, dates, filesystem, media optimization, paginator, slugger, crypto wrapper, sanitize HTML, sorting.",
5
5
  "type": "commonjs",
6
6
  "license": "KingSizer",
7
7
  "private": false,
8
8
  "scripts": {
9
9
  "publish-update": "npm version patch --no-git-tag-version && npm publish",
10
- "test": "echo \"Error: no test specified\" && exit 1"
10
+ "test": "node test/slugger.test.js"
11
11
  },
12
12
  "files": [
13
13
  "*.js",
package/slugger.js CHANGED
@@ -10,6 +10,8 @@ module.exports = {
10
10
  setSlug: (inputSlug = null) => {
11
11
  if (!inputSlug) { return ''; }
12
12
  return inputSlug.toString().toLowerCase()
13
+ .replace(/\s+/g, ' ')
14
+ .replace(/\++/g, ' plus ')
13
15
  .replaceAll(' ', '-')
14
16
  .replaceAll('’', '')
15
17
  .replaceAll('‘', '')
@@ -54,6 +56,8 @@ module.exports = {
54
56
  .replaceAll('ï', 'i')
55
57
  .replaceAll('Ç', 'c')
56
58
  // Brands
57
- .replaceAll('™', 'TM');
59
+ .replaceAll('™', 'TM')
60
+ .replace(/-+/g, '-')
61
+ .replace(/^-+|-+$/g, '');
58
62
  }
59
63
  };