Skip to content

Commit

Permalink
Merge pull request #12061 from stefanpenner/faster-guid-for-yo
Browse files Browse the repository at this point in the history
[BUGFIX release] improve performance of guidFor when reading an exist…
  • Loading branch information
rwjblue committed Aug 12, 2015
2 parents 5a023f3 + a19e1f9 commit 9bffc1a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/ember-metal/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ export function generateGuid(obj, prefix) {
@return {String} the unique guid for this instance.
*/
export function guidFor(obj) {
if (obj && obj[GUID_KEY]) {
return obj[GUID_KEY];
}

// special cases where we don't want to add a key to object
if (obj === undefined) {
return '(undefined)';
Expand Down Expand Up @@ -237,10 +241,6 @@ export function guidFor(obj) {
return obj ? '(true)' : '(false)';

default:
if (obj[GUID_KEY]) {
return obj[GUID_KEY];
}

if (obj === Object) {
return '(Object)';
}
Expand Down

0 comments on commit 9bffc1a

Please sign in to comment.