guid-string
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

guid-string

Utilities that allow us to do simple management of Guids or uuids as strings

Installation

Install with npm:

npm install guid-string

Or with yarn:

yarn add guid-string

Usage

Typescript

Creating a new Guid.

import { Guid } from 'guid-string';

let id = Guid.newGuid();

Check if a string is a valid Guid.

import { Guid } from 'guid-string';

let valid = Guid.isGuid('...');

Check if a string is an empty guid ("00000000-0000-0000-0000-000000000000", "", undefined, and null are all considered empty).

import { Guid } from 'guid-string';

let isEmpty = Guid.isEmpty('...');

Get the constant for an empty guid ("00000000-0000-0000-0000-000000000000").

import { Guid } from 'guid-string';

let myEmptyGuid = Guid.empty;

Javascript

Creating a new Guid.

import { Guid } from 'guid-string';

var id = Guid.newGuid();

Check if a string is a valid Guid.

import { Guid } from 'guid-string';

var valid = Guid.isGuid('...');

Check if a string is an empty guid ("00000000-0000-0000-0000-000000000000", "", undefined, and null are all considered empty).

import { Guid } from 'guid-string';

var isEmpty = Guid.isEmpty('...');

Get the constant for an empty guid ("00000000-0000-0000-0000-000000000000").

import { Guid } from 'guid-string';

var myEmptyGuid = Guid.empty;

Typescript

This project is written in typescript and comes with its own bindings.

License

Licensed under the MIT license.

Package Sidebar

Install

npm i guid-string

Weekly Downloads

79

Version

1.0.2

License

MIT

Unpacked Size

13.2 kB

Total Files

18

Last publish

Collaborators

  • scottbamford