wycats / javascript-decorators

2.4k stars 127 forks source link

typo, wrong return value or parameter name #47

Open fi0rini opened 9 years ago

fi0rini commented 9 years ago

in README.md the first decorator takes description as a parameter, changes descriptor in the function body and then returns descriptor. I think it should change description in function body and then return description.

silkentrance commented 8 years ago

Close, outdated?

silkentrance commented 8 years ago

descriptors seem to be immutable, so if one needs to alter a given descriptor, one has to clone it and then return the clone, possibly modified.

yleviel commented 8 years ago

It is my understanding that @nf071590 is referencing the following from the examples in the doc:

function nonenumerable(target, name, description) {
  descriptor.enumerable = false;
  return descriptor;
}

Note that the parameter description does not match the variable used within the function body named descriptor (r vs. n). The fix would simply change the parameter name to descriptor.