Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mrm8488 committed Nov 6, 2017
1 parent 6398e53 commit 343f1fb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
# isMongoObjectID
Super fast function to check if a String is a MongoDB ObjectID based on ES6 Sets.

## Why?
Because **performance does matter**.

**isMongoObjectID** is almost **6x faster** than **objectid.isValid** (from objectid module)

## Measurements

We check 2 Strings: one with objectID formant and another with invalid format for each case. (We use **performance-node** module for measures).

After several execution we get the following results:

```sh
{ name: 'objectid.isValid(id)-measure',
startTime: 0.8244399875402451,
duration: 6.259790003299713,
entryType: 'measure' }
{ name: 'isValidObjectID(id)-measure',
startTime: 24.24372299015522,
duration: 1.0192510038614273,
entryType: 'measure' }
```

0 comments on commit 343f1fb

Please sign in to comment.