@sprucelabs/spruce-heartwood-utils 7.9.0 → 7.10.1

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.
@@ -11,6 +11,7 @@ import { AbstractViewController, vcAssert, } from '@sprucelabs/heartwood-view-co
11
11
  import { assertOptions } from '@sprucelabs/schema';
12
12
  import { eventFaker, } from '@sprucelabs/spruce-test-fixtures';
13
13
  import { assert } from '@sprucelabs/test';
14
+ import slug from '../utilities/slug.js';
14
15
  const remoteVcAssert = {
15
16
  assertSkillViewRendersRemoteCards(options) {
16
17
  var _a;
@@ -125,7 +126,7 @@ function generateVcSource(options) {
125
126
  ].join('\n\n');
126
127
  }
127
128
  export function generateId() {
128
- return `${Math.round(new Date().getTime() * (Math.random() * 100))}`;
129
+ return slug(`${Math.round(new Date().getTime() * (Math.random() * 100))}`);
129
130
  }
130
131
  class ThrowingErrorCardVc extends AbstractViewController {
131
132
  constructor(options) {
@@ -0,0 +1 @@
1
+ export default function slug(slug: string): string;
@@ -0,0 +1,6 @@
1
+ export default function slug(slug) {
2
+ return `${slug
3
+ .toLowerCase()
4
+ .replace(/[^a-z0-9]/gi, '')
5
+ .trim()}`;
6
+ }
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.generateId = void 0;
4
7
  const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
5
8
  const schema_1 = require("@sprucelabs/schema");
6
9
  const spruce_test_fixtures_1 = require("@sprucelabs/spruce-test-fixtures");
7
10
  const test_1 = require("@sprucelabs/test");
11
+ const slug_1 = __importDefault(require("../utilities/slug"));
8
12
  const remoteVcAssert = {
9
13
  async assertSkillViewRendersRemoteCards(options) {
10
14
  var _a;
@@ -117,7 +121,7 @@ function generateVcSource(options) {
117
121
  ].join('\n\n');
118
122
  }
119
123
  function generateId() {
120
- return `${Math.round(new Date().getTime() * (Math.random() * 100))}`;
124
+ return (0, slug_1.default)(`${Math.round(new Date().getTime() * (Math.random() * 100))}`);
121
125
  }
122
126
  exports.generateId = generateId;
123
127
  class ThrowingErrorCardVc extends heartwood_view_controllers_1.AbstractViewController {
@@ -0,0 +1 @@
1
+ export default function slug(slug: string): string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function slug(slug) {
4
+ return `${slug
5
+ .toLowerCase()
6
+ .replace(/[^a-z0-9]/gi, '')
7
+ .trim()}`;
8
+ }
9
+ exports.default = slug;
10
+ //# sourceMappingURL=slug.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-heartwood-utils",
3
3
  "description": "Heartwood Utilities",
4
- "version": "7.9.0",
4
+ "version": "7.10.1",
5
5
  "skill": {
6
6
  "namespace": "heartwood"
7
7
  },
@@ -34,6 +34,10 @@
34
34
  "build/tests/remoteVcAssert.d.ts",
35
35
  "build/esm/tests/remoteVcAssert.js",
36
36
  "build/esm/tests/remoteVcAssert.d.ts",
37
+ "build/utilities/slug.js",
38
+ "build/utilities/slug.d.ts",
39
+ "build/esm/utilities/slug.js",
40
+ "build/esm/utilities/slug.d.ts",
37
41
  "build/types/heartwood-module.types.js",
38
42
  "build/types/heartwood-module.types.d.ts",
39
43
  "build/esm/types/heartwood-module.types.js",