From 08b2d509886dd9d0956fec4131c9dcbe02bf1ba5 Mon Sep 17 00:00:00 2001 From: Carmine DiMascio Date: Sat, 16 May 2020 15:23:16 -0400 Subject: [PATCH] Update README.md --- README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 657b994..81a86a2 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,26 @@ const mUUID2 = MUUID.from('393967e0-8de1-11e8-9eb6-529269fb1459') const mUUID3 = MUUID.from(/** MongoDb Binary of SUBTYPE_UUID */) ``` +## Formatting + +UUIDs may be formatted using the following options: + +Format | Description | Example +-- | -- | -- +N | 32 digits | `00000000000000000000000000000000` +D | 32 digits separated by hyphens | `00000000-0000-0000-0000-000000000000` +B | 32 digits separated by hyphens, enclosed in braces | `{00000000-0000-0000-0000-000000000000}` +P | 32 digits separated by hyphens, enclosed in parentheses | `(00000000-0000-0000-0000-000000000000)` + +**example:** +```javascript +const mUUID4 = MUUID.v4(); +mUUID1.toString(); // equivalent to `D` separated by hyphens +mUUID1.toString('P'); // enclosed in parens, separated by hypens +mUUID1.toString('B'); // enclosed in braces, separated by hyphens +mUUID1.toString('N'); // 32 digits +``` + ## Modes uuid-mongodb offers two modes, **canonical** (default) and **relaxed**. @@ -60,26 +80,6 @@ e.g. `JSON.stringy(mUUID.v1())` outputs the following: "1ac34980-97a7-11ea-8bab-b5327b548666" // relaxed mode ``` -## Formatting - -UUIDs may be formatted using the following options: - -Format | Description | Example --- | -- | -- -N | 32 digits | `00000000000000000000000000000000` -D | 32 digits separated by hyphens | `00000000-0000-0000-0000-000000000000` -B | 32 digits separated by hyphens, enclosed in braces | `{00000000-0000-0000-0000-000000000000}` -P | 32 digits separated by hyphens, enclosed in parentheses | `(00000000-0000-0000-0000-000000000000)` - -**example:** -```javascript -const mUUID4 = MUUID.v4(); -mUUID1.toString(); // equivalent to `D` separated by hyphens -mUUID1.toString('P'); // enclosed in parens, separated by hypens -mUUID1.toString('B'); // enclosed in braces, separated by hyphens -mUUID1.toString('N'); // 32 digits -``` - ## Examples **Query using binary UUIDs**