Comparing version 0.5.2 to 0.5.3
@@ -0,1 +1,5 @@ | ||
0.5.3 2016-07-11 | ||
----------------- | ||
- Throw error if ObjectId is not a string or a buffer. | ||
0.5.2 2016-07-11 | ||
@@ -2,0 +6,0 @@ ----------------- |
@@ -46,2 +46,4 @@ /** | ||
return id; | ||
} else { | ||
throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); | ||
} | ||
@@ -71,2 +73,5 @@ | ||
var hexString = ''; | ||
if(!this.id || !this.id.length) { | ||
throw new Error('invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is [' + JSON.stringify(this.id) + ']'); | ||
} | ||
@@ -73,0 +78,0 @@ if(this.id instanceof _Buffer) { |
@@ -251,4 +251,6 @@ "use strict" | ||
buffer.write(value.id, index, 'binary') | ||
} else if(value.id && value.id.copy){ | ||
value.id.copy(buffer, index, 0, 12); | ||
} else { | ||
value.id.copy(buffer, index, 0, 12); | ||
throw new Error('object [' + JSON.stringify(value) + "] is not a valid ObjectId"); | ||
} | ||
@@ -255,0 +257,0 @@ |
@@ -17,3 +17,3 @@ { | ||
], | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"author": "Christian Amor Kvalheim <christkv@gmail.com>", | ||
@@ -20,0 +20,0 @@ "contributors": [], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11653
445520
29
1
0