npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-ts-uuid

v2.0.5

Published

A simple uuid generator

Downloads

35,255

Readme

Node UUID

License Current Version npm

A simple uuid generator. The generator uses the MAC address / IPv6 address + the process id + the current time to ensure a unique id is generated. The length of the uuid can be specified, this will either increase or decrease the number of characters in the uuid. If the uuid needs to be padded to create a longer uuid, a bitwise operation is used to generate the unique characters. A prefix may also specified.

Installation

yarn add node-ts-uuid

Usage

import { Uuid, UuidOptions } from 'node-ts-uuid';

const options: UuidOptions = {
  length: 50,
  prefix: 'test-',
};

export function getUuid() {
  const uuid: string = Uuid.generate(options);
  console.log(uuid);
  return uuid;
}

Will generate a uuid similar to: test-6xke0ccwg0k00emrjrz81gu8a63657918908addf9942c

Methods

generate(options?: UuidOptions)

Generates a UUID using the IPv6 / Mac Address, the process id, and the current time. Optionally add a prefix, and limit / pad the uuid to be a specific length.

getPid()

Returns the running process id or a randomly generated 5 digit number.

getAddress()

Returns the MAC Address or IPv6 Address, if neither are available a randomly generated 8 digit number is returned.

getNow()

Returns the current epoch time or the previously returned epoch time incremented by 1.

postProcessUuid(uuid: string, length?: number)

Pads / limits the length of the provided uuid if the length is shorter than desired a bitwise operation provides the randomly generated characters.

Options

UuidOptions {
  length?: number;
  prefix?: string;
}
  • length: Pad / Limit the length of the uuid.
  • prefix: Add a prefix to the uuid.

License

MIT License

Contributing

Contributions are encouraged, please see further details below:

Pull Requests

Here are some basic rules to follow to ensure timely addition of your request:

  1. Match coding style (braces, spacing, etc.).
  2. If it is a feature, bugfix, or anything please only change the minimum amount of code required to satisfy the change.
  3. Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge.
  4. Pull requests must be made against the main branch. Any other branch (unless specified by the maintainers) will get rejected.
  5. Check for existing issues first, before filing a new issue.