(data)
| 240 | } |
| 241 | |
| 242 | fromJSON(data) { |
| 243 | // The data argument must be a string, or an array of strings that |
| 244 | // is JSON parseable. |
| 245 | if (ArrayIsArray(data)) { |
| 246 | for (const n of data) { |
| 247 | if (typeof n !== 'string') { |
| 248 | throw new ERR_INVALID_ARG_TYPE('data', ['string', 'string[]'], data); |
| 249 | } |
| 250 | } |
| 251 | } else if (typeof data !== 'string') { |
| 252 | throw new ERR_INVALID_ARG_TYPE('data', ['string', 'string[]'], data); |
| 253 | } else { |
| 254 | data = JSONParse(data); |
| 255 | if (!ArrayIsArray(data)) { |
| 256 | throw new ERR_INVALID_ARG_TYPE('data', ['string', 'string[]'], data); |
| 257 | } |
| 258 | for (const n of data) { |
| 259 | if (typeof n !== 'string') { |
| 260 | throw new ERR_INVALID_ARG_TYPE('data', ['string', 'string[]'], data); |
| 261 | } |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | this.#parseIPInfo(data); |
| 266 | } |
| 267 | |
| 268 | |
| 269 | get rules() { |
no test coverage detected