@dupkey/uuid
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.5 • Public • Published

    @dupkey/uuid

    Generate an RFC 4122 UUID (currently only v4). Uses the Node.js (v8+) buffer.

    Set a UUID from string or buffer. Get a UUID in string, buffer, or JSON represenation.

    Install

    npm install @dupkey/uuid
    

    Example

    import Uuid from '@dupkey/uuid';
     
    let v4 = Uuid.v4();
    let getBuffer = v4.getBuffer();
    let toString = v4.toString();
    let toJSON = v4.toJSON();
    let fromBuffer = Uuid.fromBuffer(getBuffer);
    let fromString = Uuid.fromString(toString);
    let isValid = Uuid.isValid(toString);

    Command Line

    Compile the TypeScipt and JavaScript versions

    npm run build

    Run the tests

    npm test

    Using Docker

    Build the Docker image

    docker build -t uuid:latest .

    Compile the TypeScipt and JavaScript versions

    docker run -it --rm uuid:latest npm run build

    Run the tests

    docker run -it --rm uuid:latest npm test

    Re-build the Docker container and run tests

    docker run --rm -it $(docker build -q .) npm test

    VS Code Debugging

    Create a launch.json file in your .vscode folder with the following:

    {
      "version": "0.2.0",
      "configurations": [
        {
          "type": "node",
          "request": "launch",
          "name": "Mocha Tests",
          "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
          "args": [
            "--require", "ts-node/register",
            "-u", "tdd",
            "--timeout", "999999",
            "--colors", "--recursive",
            "${workspaceFolder}/test/**/*.ts"
          ],
          "internalConsoleOptions": "openOnSessionStart"
        }
      ]
    }

    In the debug tab (Ctrl+Shift+D) select "Mocha Tests" from the dropdown and then click "Start Debugging". Results will display in the console on the bottom of the VS Code.

    Install

    npm i @dupkey/uuid

    DownloadsWeekly Downloads

    6

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    7.66 kB

    Total Files

    11

    Last publish

    Collaborators

    • nicgene