Guest User

Untitled

a guest
Apr 25th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. function requiredParam (param) {
  2. const requiredParamError = new Error(
  3. `Required parameter, "${param}" is missing.`
  4. )
  5. // preserve original stack trace
  6. if (typeof Error.captureStackTrace === ‘function’) {
  7. Error.captureStackTrace(
  8. requiredParamError,
  9. requiredParam
  10. )
  11. }
  12. throw requiredParamError
  13. }
  14.  
  15. /*
  16. function findUsersByRole ({
  17. role = requiredParam('role'),
  18. withContactInfo,
  19. includeInactive
  20. } = {}) {...}
  21. */
Add Comment
Please, Sign In to add comment