loading...

Discussion on: Javascript in a Ninja Way

Collapse
samholmes profile image
Sam Holmes

Cool trick for #5. You could even include parameters for require like so:

required = (f, p) => {
  throw new Error(`Parameter ${p} for ${f} required.`);
}

foo = (bar = required('foo', 'bar')) => {
  return bar;
}