Socket
Socket
Sign inDemoInstall

joi-objectid

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

5

History.md
1.1.0 / 2014-12-10
==================
* Check based on a regexp matching only hexadecimal #1 [https://github.com/Marsup](Marsup)
1.0.0 / 2014-09-19

@@ -3,0 +8,0 @@ ==================

4

index.js

@@ -5,3 +5,3 @@

module.exports = function objectId() {
return Joi.string().alphanum().length(24);
}
return Joi.string().regex(/^[0-9a-fA-F]{24}$/);
};
{
"name": "joi-objectid",
"version": "1.0.0",
"version": "1.1.0",
"description": "A MongoDB ObjectId validator for Joi",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,8 +7,8 @@

describe('joi-objectid', function() {
it('requires an alphnum string of 24 chars', function(done) {
it('requires an hexadecimal string of 24 chars', function(done) {
var tests = [
{ val: '$sdf56789012345678901234', pass: false }
, { val: ' sdf56789012345678901234', pass: false }
, { val: 'asdf5678901234567890123', pass: false }
, { val: 'asdf56789012345678901234', pass: true }
{ val: '$bcd56789012345678901234', pass: false }
, { val: ' bcd56789012345678901234', pass: false }
, { val: 'abcd5678901234567890123', pass: false }
, { val: 'abcd56789012345678901234', pass: true }
, { val: 123456789012345678901234, pass: false }

@@ -23,3 +23,3 @@ , { val: { length: 24 } , pass: false }

assert(test.pass === ! res.error, res.error);
})
});

@@ -26,0 +26,0 @@ done();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc