Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/waterline/utils/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ module.exports = {
}

if (context.attributes[pk].type == 'integer') {
coercePK = function(pk) {return +pk;};
coercePK = function(pk) {
var val = +pk;
if (isNaN(val) || !isFinite(val)) val = 0;
return val;
};
} else if (context.attributes[pk].type == 'string') {
coercePK = function(pk) {return String(pk).toString();};

Expand Down