Skip to content

mrm8488/isMongoObjectID

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

isMongoObjectID

Greenkeeper badge

Travis_CI_badge

Coverage Status

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:

{ 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' }

About

Super fast function to check if a String is a MongoDB ObjectID based on ES6 Sets.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published