Comparing version 2.1.6 to 2.1.7
### v2.2.0 - (to do, in future) | ||
- Fixes error code spelling: `PARAM_MISSMATCH` -> `PARAM_MISMATCH` | ||
### v2.1.7 - 25 Apr 2014 | ||
- Add explicit 'integer' type to avoid confusion. | ||
`type: 'number', rational: false` will auto convert to `type: 'integer'`. | ||
### v2.1.6 - 23 Apr 2014 | ||
@@ -5,0 +9,0 @@ - Add '.omit' to chain find - opposite of '.only' |
@@ -659,3 +659,3 @@ var ChainFind = require("./ChainFind"); | ||
allProperties[k] = opts.properties[k] || { | ||
type: 'serial', rational: 'false', key: true, klass: 'key' | ||
type: 'serial', key: true, klass: 'key' | ||
}; | ||
@@ -662,0 +662,0 @@ } |
var ORMError = require("./Error"); | ||
var KNOWN_TYPES = [ | ||
"text", "number", "integer", "boolean", "date", "enum", "object", | ||
"binary", "point", "serial" | ||
] | ||
exports.normalize = function (prop, customTypes, Settings) { | ||
@@ -33,6 +38,4 @@ if (typeof prop === "function") { | ||
if ([ "text", "number", "boolean", "date", "enum", "object", "binary", "point" ].indexOf(prop.type) === -1) { | ||
if (!(prop.type in customTypes)) { | ||
throw new ORMError("Unknown property type: " + prop.type, 'NO_SUPPORT'); | ||
} | ||
if (KNOWN_TYPES.indexOf(prop.type) === -1 && !(prop.type in customTypes)) { | ||
throw new ORMError("Unknown property type: " + prop.type, 'NO_SUPPORT'); | ||
} | ||
@@ -44,6 +47,12 @@ | ||
if (prop.type == "number" && !prop.hasOwnProperty("rational")) { | ||
// Defaults to true. Rational means floating point here. | ||
if (prop.type == "number" && prop.rational === undefined) { | ||
prop.rational = true; | ||
} | ||
if (prop.type == "number" && prop.rational === false) { | ||
prop.type = "integer"; | ||
delete prop.rational; | ||
} | ||
return prop; | ||
@@ -50,0 +59,0 @@ }; |
@@ -203,5 +203,4 @@ /** | ||
field_opts = { | ||
type : p.type || "number", | ||
type : p.type || "integer", | ||
size : p.size || 4, | ||
rational : p.rational || false, | ||
unsigned : p.unsigned || true, | ||
@@ -215,5 +214,4 @@ time : p.time || false, | ||
field_opts = { | ||
type : "number", | ||
type : "integer", | ||
unsigned : true, | ||
rational : false, | ||
size : 4, | ||
@@ -220,0 +218,0 @@ required : required |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version" : "2.1.6", | ||
"version" : "2.1.7", | ||
"license" : "MIT", | ||
@@ -42,3 +42,3 @@ "homepage" : "http://dresende.github.io/node-orm2", | ||
"sql-query" : "0.1.16", | ||
"sql-ddl-sync" : "git://github.com/dresende/node-sql-ddl-sync.git#v0.2.4", | ||
"sql-ddl-sync" : "git://github.com/dresende/node-sql-ddl-sync.git#v0.3.0", | ||
"hat" : "0.0.3", | ||
@@ -45,0 +45,0 @@ "lodash" : "2.4.1" |
@@ -174,3 +174,3 @@ ## Object Relational Mapping | ||
name : String, | ||
height : { type: 'number', rational: false } | ||
height : { type: 'integer' } | ||
}); | ||
@@ -177,0 +177,0 @@ Person.tallerThan = function(height, callback) { |
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
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
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
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
224939
63
5722