Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Simplize deserialize condition #818

Closed
wants to merge 1 commit into from

2 participants

@tricknotes

Return undefined directly the same as serialize

@tricknotes tricknotes Simplize deserialize condition
Return `undefined` directly the same as `serialize`.
198db57
@igorT
Owner

Thanks for the PR but I think the way it was before is better as it explicitly states that we expect serialized to be null or undefined and that otherwise we don't know what to do with it(should probably raise an error).

@igorT igorT closed this
@tricknotes tricknotes deleted the tricknotes:simplize-condition branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 18, 2013
  1. @tricknotes

    Simplize deserialize condition

    tricknotes authored
    Return `undefined` directly the same as `serialize`.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 5 deletions.
  1. +2 −5 packages/ember-data/lib/transforms/json_transforms.js
View
7 packages/ember-data/lib/transforms/json_transforms.js
@@ -65,10 +65,8 @@ DS.JSONTransforms = {
}
return date;
- } else if (serialized === null || serialized === undefined) {
- // if the value is not present in the data,
- // return undefined, not null.
- return serialized;
+ } else if (serialized === undefined) {
+ return undefined;
} else {
return null;
}
@@ -91,7 +89,6 @@ DS.JSONTransforms = {
utcMinutes = date.getUTCMinutes(),
utcSeconds = date.getUTCSeconds();
-
var dayOfWeek = days[utcDay];
var dayOfMonth = pad(utcDayOfMonth);
var month = months[utcMonth];
Something went wrong with that request. Please try again.