ga-wdi-boston / mongoose

An introduction to mongoose
Other
5 stars 136 forks source link

I'm assuming h stands for hash #40

Open payne-chris-r opened 7 years ago

payne-chris-r commented 7 years ago

Hashes don't exist in javascript.

const mapPerson = function (h) {
  let newPerson = {
    name: {}
  };
  Object.keys(h).forEach(function() {
    newPerson.name.given = h.given_name;
    newPerson.name.surname = h.surname;
    newPerson.dob = h.dob;
    newPerson.gender = h.gender;
    newPerson.height = h.height;
    newPerson.weight = h.weight;
  });
  return newPerson;
};
raq929 commented 7 years ago

I support doing away with one letter variable names in almost every case.

On Mon, Dec 12, 2016, 1:51 PM Chris R. Payne notifications@github.com wrote:

Hashes don't exist in javascript.

const mapPerson = function (h) { let newPerson = { name: {} }; Object.keys(h).forEach(function() { newPerson.name.given = h.given_name; newPerson.name.surname = h.surname; newPerson.dob = h.dob; newPerson.gender = h.gender; newPerson.height = h.height; newPerson.weight = h.weight; }); return newPerson; };

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ga-wdi-boston/mongoose-crud/issues/40, or mute the thread https://github.com/notifications/unsubscribe-auth/ANRw2OTqtc6PIACYpgLllA6lt558lzyeks5rHZergaJpZM4LK5BJ .

gaand commented 7 years ago

Naming things is hard. Is hash a better name than h?

gaand commented 7 years ago

Hashes do exist in JavaScript. Every object is a hash.

gaand commented 7 years ago

Also, see #34

payne-chris-r commented 7 years ago

They do?! Objects are considered hashes too? I no likey! hash just feels very rubyy. That's probably my lack of experience showing... I just think there are better names (if we decide this code is worth keeping). dict? person? It is called mapPerson...

raq929 commented 7 years ago

I think hash is better than h.

On Tue, Dec 13, 2016, 8:37 PM Chris R. Payne notifications@github.com wrote:

Reopened #40 https://github.com/ga-wdi-boston/mongoose-crud/issues/40.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ga-wdi-boston/mongoose-crud/issues/40#event-892975287, or mute the thread https://github.com/notifications/unsubscribe-auth/ANRw2PivXOLDvp9EVxd1dnj2XNcex_0Sks5rH0hMgaJpZM4LK5BJ .

gaand commented 7 years ago

But what about #34?

The name of the variable is the least of the issues.