@ddd-framework/uuid
is a package within the comprehensive@ddd-framework
framework. It provides a class for working with Universally Unique Identifiers (UUIDs) following the RFC4122 standard.
The @ddd-framework/uuid
package is an essential component of the @ddd-framework
. It offers a class, Uuid, that allows developers to work with Universally Unique Identifiers (UUIDs) in a DDD context within Node.js applications. This package provides convenient methods for generating, manipulating, and comparing UUIDs, adhering to the RFC4122 standard.
For more detailed information on @ddd-framework/uuid
, including usage examples and API reference, please refer to the official documentation.
To install @ddd-framework/uuid
, ensure you have the following prerequisites:
Once the prerequisites are installed, run the following command:
$ pnpm i @ddd-framework/uuid
...
This will install the @ddd-framework/uuid
package and its dependencies.
The @ddd-framework/uuid
package provides the following features:
By utilizing the features of the @ddd-framework/uuid
package, developers can easily generate, manipulate, and compare Universally Unique Identifiers (UUIDs) within their Node.js applications, following the RFC4122 standard.
To use @ddd-framework/uuid
, import the Uuid
class from the package. For example:
import { Uuid } from '@ddd-framework/uuid';
// Generate a new UUID
console.log(Uuid.generate()); // Output: e6fd1f80-7236-4ce2-8a25-18445a60af84
// Create a UUID instance from a string value
const uuid = new Uuid(Uuid.generate());
// Unpack the UUID instance to a string value
const primitiveValue = uuid.unpack();
console.log(primitiveValue); // Output: e6fd1f80-7236-4ce2-8a25-18445a60af84
// Check if two UUID instances are equal
const anotherUuid = new Uuid('e6fd1f80-7236-4ce2-8a25-18445a60af84');
console.log(uuid.equals(anotherUuid)); // Output: true
@ddd-framework/uuid
is released under the MIT License. Feel free to customize it further to fit your needs.