Skip to content

Instantly share code, notes, and snippets.

@jlebrech
Created August 20, 2014 11:32
Show Gist options
  • Select an option

  • Save jlebrech/09b0c830c13f11098511 to your computer and use it in GitHub Desktop.

Select an option

Save jlebrech/09b0c830c13f11098511 to your computer and use it in GitHub Desktop.

Revisions

  1. jlebrech created this gist Aug 20, 2014.
    20 changes: 20 additions & 0 deletions add-getters-to-results.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    results = []

    for (i in res.guests){

    model = {
    name: res.guests[i].name
    };

    Object.defineProperties(model, {
    'reversename': {
    get: function(){
    return this.name.split('').reverse().join('');
    }
    }
    });

    results.push(model)
    }

    return results;