Skip to content

Commit

Permalink
Merge pull request #4941 from emberjs/tidy-up-coerce-id
Browse files Browse the repository at this point in the history
only coerce non-string id's
  • Loading branch information
stefanpenner authored Apr 25, 2017
2 parents ef10fe1 + 07d37db commit 347a98f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion addon/-private/system/coerce-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
// ID into the URL, and if we later try to deserialize that URL and find the
// corresponding record, we will not know if it is a string or a number.
export default function coerceId(id) {
return id === null || id === undefined || id === '' ? null : id+'';
if (id === null || id === undefined || id === '') { return null; }
if (typeof id === 'string') { return id; }
return '' + id;
}

0 comments on commit 347a98f

Please sign in to comment.