Comparing version 2.2.6 to 2.2.7
@@ -58,2 +58,7 @@ var util = require(__dirname+'/../util.js'); | ||
/** | ||
* Whether this string must be a uuid or not. | ||
* @type {number} | ||
*/ | ||
this._uuid = undefined; | ||
/** | ||
* Options for this type "enforce_missing", "enforce_type", "enforce_extra" | ||
@@ -255,3 +260,19 @@ * @type {Object=} | ||
/** | ||
* Set the string to be a uuid. | ||
* @param {number} version | ||
* @return {TypeString} | ||
*/ | ||
TypeString.prototype.uuid = function(version) { | ||
if (isNaN(version)) { | ||
throw new Errors.ValidationError("The value for `version` must be a number."); | ||
} | ||
if (version < 3 || version > 5) { | ||
throw new Errors.ValidationError("The value for `version` must be either 3, 4 or 5"); | ||
} | ||
this._uuid = version; | ||
return this; | ||
} | ||
/** | ||
@@ -348,2 +369,5 @@ * Set a custom validator that will be called with the string. The validator | ||
} | ||
if ((this._uuid !== undefined) && (validator.isUUID(str, this._uuid) === false)) { | ||
throw new Errors.ValidationError("Value for "+prefix+" must be a uuid string.") | ||
} | ||
if ((this._enum !== undefined) && (this._enum[str] !== true)) { | ||
@@ -350,0 +374,0 @@ var validValues = Object.keys(this._enum); |
{ | ||
"name": "thinky", | ||
"version": "2.2.6", | ||
"version": "2.2.7", | ||
"description": "RethinkDB ORM for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/thinky.js", |
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
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
222017
5983