emberjs/data — pull request #308 by sandstrom (2012-06-26 17:31:13+00:00)
Title: Return undefined when transforming dates with value null

The comment says date transformations should return `undefined` when the value is `null` or `undefined`, but the code one line below said comment returns the value (which can be either).

This commit aligns the code with the comment accompanying it.

*If the comment is wrong, the code should be kept as is and the comment updated instead.*

from: function(serialized) {
var type = typeof serialized;

if (type === "string" || type === "number") {
return new Date(serialized);
} else if (serialized === null || serialized === undefined) {
// if the value is not present in the data,
// return undefined, not null.
return serialized;
} else {
return null;
}
},