Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uuidv4

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uuidv4 - npm Package Compare versions

Comparing version 6.0.9 to 6.1.0

12

build/lib/uuidv4.d.ts

@@ -6,5 +6,15 @@ declare const uuidv4: () => string;

};
declare const jsonSchema: {
v4: {
type: string;
pattern: string;
};
v5: {
type: string;
pattern: string;
};
};
declare const isUuid: (value: string) => boolean;
declare const empty: () => string;
declare const fromString: (text: string) => string;
export { uuidv4 as uuid, regex, isUuid, empty, fromString };
export { uuidv4 as uuid, regex, isUuid, empty, fromString, jsonSchema };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromString = exports.empty = exports.isUuid = exports.regex = exports.uuid = void 0;
exports.jsonSchema = exports.fromString = exports.empty = exports.isUuid = exports.regex = exports.uuid = void 0;
const uuid_1 = require("uuid");

@@ -14,2 +14,9 @@ const uuidv4 = function () {

exports.regex = regex;
const jsonSchema = {
/* eslint-disable @typescript-eslint/no-base-to-string */
v4: { type: 'string', pattern: regex.v4.toString().slice(1, -1) },
v5: { type: 'string', pattern: regex.v5.toString().slice(1, -1) }
/* eslint-enable @typescript-eslint/no-base-to-string */
};
exports.jsonSchema = jsonSchema;
const isUuid = function (value) {

@@ -16,0 +23,0 @@ return regex.v4.test(value) || regex.v5.test(value);

@@ -0,1 +1,8 @@

# [6.1.0](https://github.com/thenativeweb/uuidv4/compare/6.0.9...6.1.0) (2020-05-27)
### Features
* Allow UUID verification using JSON schemas. ([#167](https://github.com/thenativeweb/uuidv4/issues/167)) ([8af8a27](https://github.com/thenativeweb/uuidv4/commit/8af8a27a01a9a301484bcddf402d87840a19cbbb))
## [6.0.9](https://github.com/thenativeweb/uuidv4/compare/6.0.8...6.0.9) (2020-05-21)

@@ -2,0 +9,0 @@

@@ -12,2 +12,9 @@ import { v4, v5 } from 'uuid';

const jsonSchema = {
/* eslint-disable @typescript-eslint/no-base-to-string */
v4: { type: 'string', pattern: regex.v4.toString().slice(1, -1) },
v5: { type: 'string', pattern: regex.v5.toString().slice(1, -1) }
/* eslint-enable @typescript-eslint/no-base-to-string */
};
const isUuid = function (value: string): boolean {

@@ -34,3 +41,4 @@ return regex.v4.test(value) || regex.v5.test(value);

empty,
fromString
fromString,
jsonSchema
};

8

package.json
{
"name": "uuidv4",
"version": "6.0.9",
"version": "6.1.0",
"description": "uuidv4 creates v4 UUIDs.",

@@ -33,6 +33,6 @@ "contributors": [

"devDependencies": {
"@types/uuid": "7.0.3",
"@types/uuid": "8.0.0",
"assertthat": "5.1.1",
"roboter": "11.1.24",
"semantic-release-configuration": "1.0.19"
"roboter": "11.1.26",
"semantic-release-configuration": "1.0.20"
},

@@ -39,0 +39,0 @@ "repository": {

@@ -55,4 +55,6 @@ # uuidv4

If you want to perform the verification on your own, use the `regex` property, and access its `v4` or `v5` property, depending on what you need:
#### Using a regular expression
If you want to perform the verification on your own using a regular expression, use the `regex` property, and access its `v4` or `v5` property, depending on what you need:
```javascript

@@ -67,2 +69,15 @@ import { regex } from 'uuidv4';

#### Using a JSON schema
If you want to perform the verification on your own using a JSON schema, use the `jsonSchema` property, and access its `v4` or `v5` property, depending on what you need:
```javascript
import { jsonSchema } from 'uuidv4';
console.log(jsonSchema.v4);
console.log(jsonSchema.v5);
```
_Please note that the JSON schemas also consider `empty()` to be a valid UUID._
### Getting a UUID from a string

@@ -69,0 +84,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc