amp-utils
Advanced tools
Comparing version 1.0.4 to 1.1.0
{ | ||
"name": "amp-utils", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "A collection of handy utilities.", | ||
@@ -5,0 +5,0 @@ "main": "src/amp.js", |
@@ -228,2 +228,11 @@ # amp | ||
## String Utilities | ||
### `amp.string.guid()` | ||
Generate a globally unique identifier (GUID) string. Returns `String`. | ||
#### Examples | ||
```js | ||
amp.string.guid(); // '5aac52a7-d431-aecc-8d35-ef18bf1cbb85' | ||
amp.string.guid(); // 'f2295534-89e3-50cd-18d7-120c62311ac7' | ||
``` | ||
### `amp.string.slug(str)` | ||
@@ -230,0 +239,0 @@ Slugify the given string. Returns `String`. |
@@ -183,2 +183,11 @@ /** | ||
/** | ||
* Generate random GUID string | ||
* @return {String} | ||
*/ | ||
guid() { | ||
const s4 = () => Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); | ||
return `${s4()}${s4()}-${s4()}-${s4()}-${s4()}-${s4()}${s4()}${s4()}`; | ||
}, | ||
/** | ||
* Slugify the given string | ||
@@ -185,0 +194,0 @@ * @param {String} str |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
14318
208
269
1