1.0.14 • Published 5 years ago
ts-guid v1.0.14
ts-guid
ts-guid provides functionality for simple Guids.
Index
Installation
This section shows how to install ts-guid.
npm
npm install --save ts-guid
yarn
yarn add ts-guid
Usage
This section shows how to use the features of ts-guid.
emptyGuid
This is an empty guid constant.
import { emptyGuid } from 'ts-guid';
const user: User = {
id: emptyGuid
};
isGuid
Checks if a string is a guid.
import { isGuid } from 'ts-guid';
export function validateUser(user: User): boolean {
return isGuid(user.id);
}
newGuid
Generates a new guid.
import { newGuid } from 'ts-guid';
const user: User = {
id: newGuid()
};