@ancon/wildcat-utils 1.5.0 → 1.6.0

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.
package/dist/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from './shared';
2
2
  export * from './outlet';
3
3
  export * from './versioning';
4
4
  export * from './api';
5
+ export * from './string';
package/dist/index.js CHANGED
@@ -14,3 +14,4 @@ __exportStar(require("./shared"), exports);
14
14
  __exportStar(require("./outlet"), exports);
15
15
  __exportStar(require("./versioning"), exports);
16
16
  __exportStar(require("./api"), exports);
17
+ __exportStar(require("./string"), exports);
@@ -0,0 +1,2 @@
1
+ import slugify from './slugify';
2
+ export { slugify };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.slugify = void 0;
7
+ const slugify_1 = __importDefault(require("./slugify"));
8
+ exports.slugify = slugify_1.default;
@@ -0,0 +1 @@
1
+ export default function slugify(str: string, locales?: string | string[]): string;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function slugify(str, locales) {
4
+ return str
5
+ .toLocaleLowerCase(locales)
6
+ .replace(/[åäæ]/g, 'a') // Replace å, ä and æ with a
7
+ .replace(/[öø]/g, 'o') // Replace ö and ø with o
8
+ .replace(/[é]/g, 'e') // Replace é with e
9
+ .replace(/\s+/g, '-') // Replace spaces with -
10
+ .replace(/[^\w-]+/g, '') // Remove all non-word chars
11
+ .replace(/--+/g, '-') // Replace multiple - with single -
12
+ .replace(/^-+/, '') // Trim - from start of text
13
+ .replace(/-+$/, ''); // Trim - from end of text
14
+ }
15
+ exports.default = slugify;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "",
5
5
  "repository": "git@bitbucket.org:anconab/wildcat.client.utils.git",
6
6
  "main": "dist/index.js",