@rokkit/core 1.0.0-next.114 → 1.0.0-next.116

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/utils.d.ts CHANGED
@@ -15,7 +15,7 @@ export function noop(): void;
15
15
  *
16
16
  * @returns {string} A random id
17
17
  */
18
- export function id(): string;
18
+ export function id(prefix?: string): string;
19
19
  /**
20
20
  * Check if a value is a json object
21
21
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/core",
3
- "version": "1.0.0-next.114",
3
+ "version": "1.0.0-next.116",
4
4
  "description": "Contains core utility functions and classes that can be used in various components.",
5
5
  "author": "Jerry Thomas <me@jerrythomas.name>",
6
6
  "license": "MIT",
package/src/utils.js CHANGED
@@ -25,8 +25,10 @@ export function noop() {
25
25
  *
26
26
  * @returns {string} A random id
27
27
  */
28
- export function id() {
29
- return [Math.random().toString(36).substring(2, 9), ++idCounter].join('-')
28
+ export function id(prefix = '') {
29
+ return [prefix, Math.random().toString(36).substring(2, 9), ++idCounter]
30
+ .filter((x) => !isNil(x) && x !== '')
31
+ .join('-')
30
32
  }
31
33
 
32
34
  /**