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

@azure/core-util

Package Overview
Dependencies
Maintainers
1
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/core-util - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

7

dist-esm/src/uuidUtils.js

@@ -5,6 +5,11 @@ // Copyright (c) Microsoft Corporation.

import { randomUUID as v4RandomUUID } from "crypto";
import { generateUUID } from "./uuidUtils.native";
// NOTE: This is a workaround until we can use `globalThis.crypto.randomUUID` in Node.js 19+.
const uuidFunction = typeof ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === "function"
let uuidFunction = typeof ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === "function"
? globalThis.crypto.randomUUID.bind(globalThis.crypto)
: v4RandomUUID;
// Not defined in earlier versions of Node.js 14
if (!uuidFunction) {
uuidFunction = generateUUID;
}
/**

@@ -11,0 +16,0 @@ * Generated Universally Unique Identifier

@@ -207,7 +207,43 @@ 'use strict';

// Licensed under the MIT license.
/**
* Generated Universally Unique Identifier
*
* @returns RFC4122 v4 UUID.
*/
function generateUUID() {
let uuid = "";
for (let i = 0; i < 32; i++) {
// Generate a random number between 0 and 15
const randomNumber = Math.floor(Math.random() * 16);
// Set the UUID version to 4 in the 13th position
if (i === 12) {
uuid += "4";
}
else if (i === 16) {
// Set the UUID variant to "10" in the 17th position
uuid += (randomNumber & 0x3) | 0x8;
}
else {
// Add a random hexadecimal digit to the UUID string
uuid += randomNumber.toString(16);
}
// Add hyphens to the UUID string at the appropriate positions
if (i === 7 || i === 11 || i === 15 || i === 19) {
uuid += "-";
}
}
return uuid;
}
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
var _a;
// NOTE: This is a workaround until we can use `globalThis.crypto.randomUUID` in Node.js 19+.
const uuidFunction = typeof ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === "function"
let uuidFunction = typeof ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID) === "function"
? globalThis.crypto.randomUUID.bind(globalThis.crypto)
: crypto.randomUUID;
// Not defined in earlier versions of Node.js 14
if (!uuidFunction) {
uuidFunction = generateUUID;
}
/**

@@ -214,0 +250,0 @@ * Generated Universally Unique Identifier

2

package.json
{
"name": "@azure/core-util",
"version": "1.3.0",
"version": "1.3.1",
"description": "Core library for shared utility methods",

@@ -5,0 +5,0 @@ "sdk-type": "client",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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