| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,15 +6,16 @@ require('../common'); | |||
| 6 | 6 | const assert = require('assert'); | |
| 7 | 7 | const async_hooks = require('async_hooks'); | |
| 8 | 8 | ||
| 9 | - [0, 1, false, true, null, 'hello'].forEach((badArg) => { | ||
| 9 | + const falsyValues = [0, 1, false, true, null, 'hello']; | ||
| 10 | + for (const badArg of falsyValues) { | ||
| 10 | 11 | const hookNames = ['init', 'before', 'after', 'destroy', 'promiseResolve']; | |
| 11 | - hookNames.forEach((field) => { | ||
| 12 | + for (const hookName of hookNames) { | ||
| 12 | 13 | assert.throws(() => { | |
| 13 | - async_hooks.createHook({ [field]: badArg }); | ||
| 14 | + async_hooks.createHook({ [hookName]: badArg }); | ||
| 14 | 15 | }, { | |
| 15 | 16 | code: 'ERR_ASYNC_CALLBACK', | |
| 16 | 17 | name: 'TypeError', | |
| 17 | - message: `hook.${field} must be a function` | ||
| 18 | + message: `hook.${hookName} must be a function` | ||
| 18 | 19 | }); | |
| 19 | - }); | ||
| 20 | - }); | ||
| 20 | + } | ||
| 21 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments