Comparing version 0.3.0 to 0.3.1
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
var Connection, EventEmitter, Model, association, type, value, _bindDomain, _ref, | ||
var Connection, EventEmitter, Model, association, _bindDomain, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -96,11 +96,4 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
_ref = require('./types'); | ||
for (type in _ref) { | ||
value = _ref[type]; | ||
Connection[type] = value; | ||
Connection.prototype[type] = value; | ||
} | ||
module.exports = Connection; | ||
}).call(this); |
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
var type, types; | ||
exports.Connection = exports.DBConnection = require('./connection'); | ||
exports.Connection = require('./connection'); | ||
exports.Model = require('./model'); | ||
types = require('./types'); | ||
exports.types = require('./types'); | ||
for (type in types) { | ||
exports[type] = types[type]; | ||
} | ||
}).call(this); |
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
var Model, async, inflector, type, value, _, _bindDomain, _getRef, _getValue, _ref, _setValue, _use, | ||
var Model, async, inflector, types, _, _bindDomain, _getRef, _getValue, _setValue, _use, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -13,2 +13,4 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
types = require('./types'); | ||
_bindDomain = function(fn) { | ||
@@ -128,15 +130,15 @@ var d; | ||
case String: | ||
type = Model.String; | ||
type = types.String; | ||
break; | ||
case Number: | ||
type = Model.Number; | ||
type = types.Number; | ||
break; | ||
case Boolean: | ||
type = Model.Boolean; | ||
type = types.Boolean; | ||
break; | ||
case Date: | ||
type = Model.Date; | ||
type = types.Date; | ||
break; | ||
case Object: | ||
type = Model.Object; | ||
type = types.Object; | ||
} | ||
@@ -147,6 +149,6 @@ if (typeof type !== 'string') { | ||
type = type.toLowerCase(); | ||
if (type === Model.GeoPoint && !this._adapter.support_geopoint) { | ||
if (type === types.GeoPoint && !this._adapter.support_geopoint) { | ||
throw new Error('this adapter does not support GeoPoint'); | ||
} | ||
if (type === Model.RecordID) { | ||
if (type === types.RecordID) { | ||
target_connection = property.connection || this._connection; | ||
@@ -190,3 +192,3 @@ if (this._connection === target_connection && target_connection._adapter.key_type_internal) { | ||
if (value != null) { | ||
if (property.type === Model.Object && !adapter.support_object) { | ||
if (property.type === types.Object && !adapter.support_object) { | ||
value = JSON.parse(value); | ||
@@ -276,3 +278,3 @@ } else { | ||
switch (property.type) { | ||
case Model.Number: | ||
case types.Number: | ||
value = Number(value); | ||
@@ -285,3 +287,3 @@ if (isNaN(value)) { | ||
break; | ||
case Model.Boolean: | ||
case types.Boolean: | ||
if (typeof value !== 'boolean') { | ||
@@ -291,3 +293,3 @@ return "'" + column + "' is not a boolean"; | ||
break; | ||
case Model.Integer: | ||
case types.Integer: | ||
value = Number(value); | ||
@@ -300,3 +302,3 @@ if (isNaN(value) || (value >> 0) !== value) { | ||
break; | ||
case Model.GeoPoint: | ||
case types.GeoPoint: | ||
if (!(Array.isArray(value) && value.length === 2)) { | ||
@@ -309,3 +311,3 @@ return "'" + column + "' is not a geo point"; | ||
break; | ||
case Model.Date: | ||
case types.Date: | ||
value = new Date(value); | ||
@@ -371,3 +373,3 @@ if (isNaN(value.getTime())) { | ||
value = _getValue(model, parts); | ||
if (property.type === Model.Object && !adapter.support_object) { | ||
if (property.type === types.Object && !adapter.support_object) { | ||
value = JSON.stringify(value); | ||
@@ -607,11 +609,4 @@ } else { | ||
_ref = require('./types'); | ||
for (type in _ref) { | ||
value = _ref[type]; | ||
Model[type] = value; | ||
Model.prototype[type] = value; | ||
} | ||
module.exports = Model; | ||
}).call(this); |
{ | ||
"name": "cormo", | ||
"description": "ORM framework for Node.js", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "orm", |
@@ -54,4 +54,4 @@ # About | ||
You can use any of cormo.String, Connection.String, connection.String, or 'string' | ||
(also native JavaScript Function - String - if exists) to specify a type. | ||
You can use any of cormo.types.String, 'string', or String | ||
(native JavaScript Function, if exists) to specify a type. | ||
@@ -345,3 +345,3 @@ Currently supported types: | ||
name: String | ||
location: Connection.GeoPoint | ||
location: cormo.types.GeoPoint | ||
@@ -348,0 +348,0 @@ connection.applySchemas() |
113436
2974