| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d0302e7 commit ed7eab1
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -170,6 +170,15 @@ added: | |||
| 170 | 170 | ||
| 171 | 171 | The list of rules added to the blocklist. | |
| 172 | 172 | ||
| 173 | + ### `BlockList.isBlockList(value)` | ||
| 174 | + | ||
| 175 | + <!-- YAML | ||
| 176 | + added: REPLACEME | ||
| 177 | + --> | ||
| 178 | + | ||
| 179 | + * `value` {any} Any JS value | ||
| 180 | + * Returns `true` if the `value` is a `net.BlockList`. | ||
| 181 | + | ||
| 173 | 182 | ## Class: `net.SocketAddress` | |
| 174 | 183 | ||
| 175 | 184 | <!-- YAML | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,6 +43,15 @@ class BlockList { | |||
| 43 | 43 | this[kHandle][owner_symbol] = this; | |
| 44 | 44 | } | |
| 45 | 45 | ||
| 46 | + /** | ||
| 47 | + * Returns true if the value is a BlockList | ||
| 48 | + * @param {any} value | ||
| 49 | + * @returns {boolean} | ||
| 50 | + */ | ||
| 51 | + static isBlockList(value) { | ||
| 52 | + return value?.[kHandle] !== undefined; | ||
| 53 | + } | ||
| 54 | + | ||
| 46 | 55 | [kInspect](depth, options) { | |
| 47 | 56 | if (depth < 0) | |
| 48 | 57 | return this; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -282,3 +282,8 @@ const util = require('util'); | |||
| 282 | 282 | assert(!blocklist.check('1.1.1.2')); | |
| 283 | 283 | assert(!blocklist.check('2.3.4.5')); | |
| 284 | 284 | } | |
| 285 | + | ||
| 286 | + { | ||
| 287 | + assert(BlockList.isBlockList(new BlockList())); | ||
| 288 | + assert(!BlockList.isBlockList({})); | ||
| 289 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments