New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@actually_connor/uuid

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@actually_connor/uuid - npm Package Compare versions

Comparing version 0.2.8 to 0.3.0

72

dist/esm-browser/Uuid.js

@@ -9,29 +9,71 @@ "use strict";

const uuid_1 = require("uuid");
/**
* Uuid provides constants and static methods for working with and generating UUIDs
*/
class Uuid {
/**
* Creates a universally unique identifier (UUID) from an array of fields
*
* Unless you're making advanced use of this library to generate identifiers that deviate RFC 4122, you
* probably do not want to instantiate a UUID directly. Use the static methods, instead:
*
* import { Uuid } from '@actually_connor/uuid';
* Uuid.uuid4();
*
* @param uuid The Array-like collection of 16 values (starting from offset) between 0-255
*/
constructor(uuid) {
this.uuid = uuid;
}
/**
* @inheritDoc
*/
getUuid() {
return this.uuid;
}
/**
*
* @param uuid
*
* @return UuidInterface
*/
static fromString(uuid) {
return new Uuid((0, uuid_1.parse)(uuid));
}
/**
* @inheritDoc
*/
toString() {
return (0, uuid_1.stringify)(this.uuid);
}
/**
* @inheritDoc
*/
toHex() {
getHex() {
return (0, uuid_1.stringify)(this.uuid).replace(/-/g, '').toUpperCase();
}
/**
* Creates a UUID from a byte string
*
* @param bytes A binary string
*
* @return UuidInterface A UuidInterface instance created from a binary string representation
*/
static fromBytes(uuid) {
static fromBytes(bytes) {
let result = '';
for (let i = 0; i < uuid.length; i++) {
result += uuid.charCodeAt(i).toString(16);
for (let i = 0; i < bytes.length; i++) {
result += bytes.charCodeAt(i).toString(16);

@@ -50,3 +92,7 @@ switch (i) {

}
/**
* @inheritDoc
*/
getBytes() {

@@ -61,9 +107,27 @@ let bytes = '';

}
/**
* Returns a version 4 (random) UUID
*
* @return UuidInterface A UuidInterface instance that represents a version 4 UUID
*/
static uuid4() {
return new Uuid((0, uuid_1.parse)((0, uuid_1.v4)()));
}
/**
* Returns true if the provided string is a valid UUID
*
* @param uuid A string to validate as a UUID
*
* @return boolean
*/
static isValid(uuid) {
return (0, uuid_1.validate)(uuid);
}
}
exports.Uuid = Uuid;

@@ -9,29 +9,71 @@ "use strict";

const uuid_1 = require("uuid");
/**
* Uuid provides constants and static methods for working with and generating UUIDs
*/
class Uuid {
/**
* Creates a universally unique identifier (UUID) from an array of fields
*
* Unless you're making advanced use of this library to generate identifiers that deviate RFC 4122, you
* probably do not want to instantiate a UUID directly. Use the static methods, instead:
*
* import { Uuid } from '@actually_connor/uuid';
* Uuid.uuid4();
*
* @param uuid The Array-like collection of 16 values (starting from offset) between 0-255
*/
constructor(uuid) {
this.uuid = uuid;
}
/**
* @inheritDoc
*/
getUuid() {
return this.uuid;
}
/**
*
* @param uuid
*
* @return UuidInterface
*/
static fromString(uuid) {
return new Uuid((0, uuid_1.parse)(uuid));
}
/**
* @inheritDoc
*/
toString() {
return (0, uuid_1.stringify)(this.uuid);
}
/**
* @inheritDoc
*/
toHex() {
getHex() {
return (0, uuid_1.stringify)(this.uuid).replace(/-/g, '').toUpperCase();
}
/**
* Creates a UUID from a byte string
*
* @param bytes A binary string
*
* @return UuidInterface A UuidInterface instance created from a binary string representation
*/
static fromBytes(uuid) {
static fromBytes(bytes) {
let result = '';
for (let i = 0; i < uuid.length; i++) {
result += uuid.charCodeAt(i).toString(16);
for (let i = 0; i < bytes.length; i++) {
result += bytes.charCodeAt(i).toString(16);

@@ -50,3 +92,7 @@ switch (i) {

}
/**
* @inheritDoc
*/
getBytes() {

@@ -61,9 +107,27 @@ let bytes = '';

}
/**
* Returns a version 4 (random) UUID
*
* @return UuidInterface A UuidInterface instance that represents a version 4 UUID
*/
static uuid4() {
return new Uuid((0, uuid_1.parse)((0, uuid_1.v4)()));
}
/**
* Returns true if the provided string is a valid UUID
*
* @param uuid A string to validate as a UUID
*
* @return boolean
*/
static isValid(uuid) {
return (0, uuid_1.validate)(uuid);
}
}
exports.Uuid = Uuid;

@@ -9,29 +9,71 @@ "use strict";

const uuid_1 = require("uuid");
/**
* Uuid provides constants and static methods for working with and generating UUIDs
*/
class Uuid {
/**
* Creates a universally unique identifier (UUID) from an array of fields
*
* Unless you're making advanced use of this library to generate identifiers that deviate RFC 4122, you
* probably do not want to instantiate a UUID directly. Use the static methods, instead:
*
* import { Uuid } from '@actually_connor/uuid';
* Uuid.uuid4();
*
* @param uuid The Array-like collection of 16 values (starting from offset) between 0-255
*/
constructor(uuid) {
this.uuid = uuid;
}
/**
* @inheritDoc
*/
getUuid() {
return this.uuid;
}
/**
*
* @param uuid
*
* @return UuidInterface
*/
static fromString(uuid) {
return new Uuid((0, uuid_1.parse)(uuid));
}
/**
* @inheritDoc
*/
toString() {
return (0, uuid_1.stringify)(this.uuid);
}
/**
* @inheritDoc
*/
toHex() {
getHex() {
return (0, uuid_1.stringify)(this.uuid).replace(/-/g, '').toUpperCase();
}
/**
* Creates a UUID from a byte string
*
* @param bytes A binary string
*
* @return UuidInterface A UuidInterface instance created from a binary string representation
*/
static fromBytes(uuid) {
static fromBytes(bytes) {
let result = '';
for (let i = 0; i < uuid.length; i++) {
result += uuid.charCodeAt(i).toString(16);
for (let i = 0; i < bytes.length; i++) {
result += bytes.charCodeAt(i).toString(16);

@@ -50,3 +92,7 @@ switch (i) {

}
/**
* @inheritDoc
*/
getBytes() {

@@ -61,9 +107,27 @@ let bytes = '';

}
/**
* Returns a version 4 (random) UUID
*
* @return UuidInterface A UuidInterface instance that represents a version 4 UUID
*/
static uuid4() {
return new Uuid((0, uuid_1.parse)((0, uuid_1.v4)()));
}
/**
* Returns true if the provided string is a valid UUID
*
* @param uuid A string to validate as a UUID
*
* @return boolean
*/
static isValid(uuid) {
return (0, uuid_1.validate)(uuid);
}
}
exports.Uuid = Uuid;

2

package.json
{
"name": "@actually_connor/uuid",
"version": "0.2.8",
"version": "0.3.0",
"description": "A JavaScript library that provides a 'ramsey/uuid'-like interface for the uuid package",

@@ -5,0 +5,0 @@ "keywords": [

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