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 🙏

© 2025 – Pkg Stats / Ryan Hefner

mech-guid

v0.2.2

Published

Guid mechanisms

Downloads

34

Readme

mech-guid

A library of mechanisms for Guid (Globally unique IDs) data types and the generation of Guids.

Jsperf execution speeds.

See Mechanism Home for more information and other libraries.

Supported Mechanisms

empty Mechanism

Represents an empty mechanism.

empty.go - Returns an empty guid ("00000000-0000-0000-0000-000000000000")
empty.goStr - Returns an empty guid ("00000000-0000-0000-0000-000000000000")
empty.isEmpty - always true

mguid.empty.go; // returns an empty guid
mguid.empty.goStr; // returns an empty guid
mguid.empty.isEmpty; // always returns true

guid Mechanism

A guid primitive.

Create a new guid:

var newGuid = mguid.guid(); // the guid is generated right here

newGuid.go; // returns the new guid
newGuid.goStr; // returns the new guid
newGuid.isEmpty; // returns false

Create a guid from a string primitive:

var newGuid = mguid.guid("60bce630-5a0c-41c1-abd3-f21df4d0290f");

newGuid.go; // returns the guid
newGuid.goStr; // returns the guid
newGuid.isEmpty; // returns false

Create an empty guid using the empty mechanism:

var newGuid = mguid.guid(mguid.empty);

newGuid.go; // returns an empty guid
newGuid.goStr; // returns an empty guid
newGuid.isEmpty; // returns true

Create a guid using make. This is the same as making a guid without passing any parameter

var newGuid = mguid.guid(mguid.make.go); // the guid is generated right here

newGuid.go; // returns the new guid
newGuid.goStr; // returns the new guid
newGuid.isEmpty; // returns false

In the above example, we pass make.go to guid() meaning newGuid will store the value generated by make.go. In the next example, we pass make to guid(). This means, every time we invoke newGuid, newGuid will invoke make causing a new Guid to be generated every time.

var newGuid = mguid.guid(mguid.make); // the guid is NOT generated right here

newGuid.go; // returns a new guid
newGuid.goStr; // returns a new guid
newGuid.isEmpty; // returns false

The m.hold mechanism can be used to retain the value of mguid.make.

var newGuid = mguid.guid(m.hold(mguid.make)); // the guid is NOT generated right here

newGuid.go; // the guid is generated here, on the first access
newGuid.goStr; // the guid is NOT generated here, on the second access
newGuid.isEmpty; // returns false

Create an invalid guid while validate is true returns an empty guid.

var newGuid = mguid.guid("INVALID", true);

newGuid.go; // returns an empty guid
newGuid.goStr; // returns an empty guid
newGuid.isEmpty; // returns true

Create an invalid guid while validate is false returns the invalid guid.

var newGuid = mguid.guid("SOME VALUE", false);

newGuid.go; // returns "SOME VALUE"
newGuid.goStr; // returns "SOME VALUE"
newGuid.isEmpty; // returns false

// BUT

mguid.isValid(newGuid).go; // returns false

isValid Mechanism

Validates a guid.

mguid.isValid("").go; // returns false
mguid.isValid("").goBool; // returns false
mguid.isValid("an invalid guid").goBool; // returns false
mguid.isValid(mguid.make).go; // returns true
mguid.isValid(mguid.make).goBool; // returns true

make Mechanism

Creates a new guid. This is not stored internally so you will need to do something with it.

mguid.make.go; // creates a new guid
mguid.make.goStr; // creates a new guid

Setup

Using In Your Projects

Change directory to your node project.

$ npm install --save mech-guid

Development

Get Involved!

There are a lot of core mechanisms just waiting to be created. Many of them can be created in a few hours including in-depth tests. Clone mech-library to get started!

Setup

Install:

$ npm install

Continuous test:

$ gulp

Test:

$ gulp webtests

Test Server

Read documentation in gulpfile.js to see how to setup automated web testing.

$ gulp webserver