@positional_advantage_coder/id-generator
v1.0.8
Published
Simple package for id generation
Maintainers
Keywords
Readme
@positional-advantage-libs/id-generator
Library for id generation
The primary goal of this library is to remove direct dependency of your project on id generation process
Core Concepts
The architecture is built on 1 primary abstraction:
IdGenerator: A base interface that describes how to generate id.
Dependencies
- uuid
- typescript
Installation
npm install data-provider-core uuidAPI Reference
This library exports 1 primary abstraction and suggested implementation
IdGenerator
abstract class IdGenerator {
abstract generateId(): string;
}
##Example
import {IdGenerator} from "./id-generator";
import { v6 as uuidv6 } from 'uuid';
export class IdGeneratorImplementation implements IdGenerator {
public generateId(): string {
return uuidv6();
}
}
!important -
Can be imported as IdGeneratorImplementation from the library or implemented by the contract
