guid-string
v1.0.2
Published
Utilities that allow us to do simple management of Guids or uuids as strings
Downloads
624
Maintainers
Readme
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.