This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = (paramName) => { | |
| throw new Error(`Missing ${paramName}`) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const claimMissing = require('./utils/claimMissing') | |
| const fn = (importantParam = claimMissing('importantParam')) => { | |
| console.log(importantParam) | |
| } | |
| fn() // Error: Missing importantParam | |
| fn('hello world') // hello world |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fn = (fnParam) => { | |
| if (!fnParam) throw new Error('Missing fnParam') | |
| ... | |
| } |
NewerOlder