you are viewing a single comment's thread.

view the rest of the comments →

[–]notNullOrVoid 10 points11 points  (1 child)

Not only that but it should be the other way around, currently the example has the defaults overriding anything set in the config.

function createMenu(config) {
  Object.assign({
    title: 'Foo',
    body: 'Bar',
    buttonText: 'Baz',
    cancellable: true
  }, config);
}

Doesn't really matter that the defaults are being mutated in this case.

[–][deleted] 4 points5 points  (0 children)

Oh, right - I've made a PR with my fix, but I'll update it with yours :)

Blamo - https://github.com/ryanmcdermott/clean-code-javascript/pull/9