generate-ip 2.4.3 → 2.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,18 +1,29 @@
1
- # <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.generate-ip.org/images/icons/node-graph/white/icon55x49.png?b4eb06e"><img height=32 src="https://media.generate-ip.org/images/icons/node-graph/black/icon55x49.png?b4eb06e"></picture> generate-ip
1
+ <div align="center">
2
2
 
3
- ### Randomly generate, format, and validate IPv4 + IPv6 + MAC addresses.
3
+ <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.generate-ip.org/images/logos/generate-ip/white-logo.png?7768152"><img width=700 src="https://media.generate-ip.org/images/logos/generate-ip/black-logo.png?7768152"></picture>
4
4
 
5
- <a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
6
- <a href="https://github.com/adamlui/js-utils/releases/tag/generate-ip-2.4.3"><img height=31 src="https://img.shields.io/badge/Latest_Build-2.4.3-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
7
- <a href="https://www.npmjs.com/package/generate-ip?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/generate-ip?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
8
- <a href="https://github.com/adamlui/js-utils/blob/generate-ip-2.4.3/generate-ip/dist/generate-ip.min.js"><img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/generate-ip/dist/generate-ip.min.js?branch=generate-ip-2.4.3&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
9
- <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:generate-ip/src/generate-ip.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Agenerate-ip%2Fsrc%2Fgenerate-ip.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
10
- <a href="https://github.com/toolleeo/cli-apps#networking"><img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
11
- <a href="https://www.jsdelivr.com/package/npm/generate-ip?tab=stats"><img height=31 src="https://img.shields.io/jsdelivr/npm/hm/generate-ip?style=for-the-badge&logo=jsdelivr&logoColor=white&label=jsDelivr%20Hits&labelColor=464646&color=49c5d8"></a>
5
+ ### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.generate-ip.org/images/icons/node-graph/white/icon55x49.png?b4eb06e"><img width=23 src="https://media.generate-ip.org/images/icons/node-graph/black/icon55x49.png?b4eb06e"></picture> &nbsp;Randomly generate, format, and validate IPv4 + IPv6 + MAC addresses.
12
6
 
13
7
  <br>
14
8
 
15
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
9
+ <a href="#%EF%B8%8F-mit-license">
10
+ <img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
11
+ <a href="https://github.com/adamlui/js-utils/releases/tag/generate-ip-2.4.5">
12
+ <img height=31 src="https://img.shields.io/badge/Latest_Build-2.4.5-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
13
+ <a href="https://www.npmjs.com/package/generate-ip?activeTab=code">
14
+ <img height=31 src="https://img.shields.io/npm/unpacked-size/generate-ip?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
15
+ <a href="https://github.com/adamlui/js-utils/blob/generate-ip-2.4.5/generate-ip/dist/generate-ip.min.js">
16
+ <img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/generate-ip/dist/generate-ip.min.js?branch=generate-ip-2.4.5&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
17
+ <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:generate-ip/src/generate-ip.js">
18
+ <img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Agenerate-ip%2Fsrc%2Fgenerate-ip.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
19
+ <a href="https://github.com/toolleeo/cli-apps#networking">
20
+ <img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
21
+ <a href="https://www.jsdelivr.com/package/npm/generate-ip?tab=stats">
22
+ <img height=31 src="https://img.shields.io/jsdelivr/npm/hm/generate-ip?style=for-the-badge&logo=jsdelivr&logoColor=white&label=jsDelivr%20Hits&labelColor=464646&color=49c5d8"></a>
23
+
24
+ </div>
25
+
26
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
16
27
 
17
28
  ## 💡 About
18
29
 
@@ -23,7 +34,7 @@
23
34
  - **Multi-environment support —** Use in Node.js or the web browser
24
35
  - **Command line usable —** Just type `generate-ip`, that's it
25
36
 
26
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
37
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
27
38
 
28
39
  ## ⚡ Installation
29
40
 
@@ -47,13 +58,13 @@ $ npm install generate-ip
47
58
 
48
59
  <br>
49
60
 
50
- <a href="https://github.com/sponsors/adamlui"><img src="https://media.js-utils.com/images/banners/sponsor/$10/banner1660x260.png?09f5d64"></a>
61
+ <a href="https://github.com/sponsors/adamlui"><img src="https://assets.js-utils.org/images/banners/sponsor/$10/banner1660x260.png?v=0d36e26"></a>
51
62
 
52
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
63
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
53
64
 
54
65
  ## 🔌 Importing the APIs
55
66
 
56
- ### <img height=18 src="https://media.js-utils.com/images/icons/platforms/node.js/icon25x28.png?3e22bae"> Node.js
67
+ ### <img height=18 src="https://assets.js-utils.org/images/icons/platforms/node.js/icon25x28.png?v=0d36e26"> Node.js
57
68
 
58
69
  #### ECMAScript*:
59
70
 
@@ -69,28 +80,28 @@ const { ipv4, ipv6, mac } = require('generate-ip');
69
80
 
70
81
  ###### _*Node.js version 14 or higher required_
71
82
 
72
- ### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/platforms/web/light/icon25.png?3e22bae"><img width=16 src="https://media.js-utils.com/images/icons/platforms/web/dark/icon25.png?3e22bae"></picture> Web
83
+ ### <picture><source media="(prefers-color-scheme: dark)" srcset="https://assets.js-utils.org/images/icons/platforms/web/light/icon25.png?v=0d36e26"><img width=16 src="https://assets.js-utils.org/images/icons/platforms/web/dark/icon25.png?v=0d36e26"></picture> Web
73
84
 
74
85
  #### <> HTML script tag:
75
86
 
76
87
  ```html
77
- <script src="https://cdn.jsdelivr.net/npm/generate-ip@2.4.3/dist/generate-ip.min.js"></script>
88
+ <script src="https://cdn.jsdelivr.net/npm/generate-ip@2.4.5/dist/generate-ip.min.js"></script>
78
89
  ```
79
90
 
80
91
  #### ES6:
81
92
 
82
93
  ```js
83
94
  (async () => {
84
- await import('https://cdn.jsdelivr.net/npm/generate-ip@2.4.3/dist/generate-ip.min.js');
95
+ await import('https://cdn.jsdelivr.net/npm/generate-ip@2.4.5/dist/generate-ip.min.js');
85
96
  // Your code here...
86
97
  })();
87
98
  ```
88
99
 
89
- ### <img height=17 src="https://media.js-utils.com/images/icons/platforms/tampermonkey/icon28.png?4fd2fa7"><img height=17.5 src="https://media.js-utils.com/images/icons/platforms/violentmonkey/icon25.png?2fe972c"> Greasemonkey
100
+ ### <img height=17 src="https://assets.js-utils.org/images/icons/platforms/tampermonkey/icon28.png?v=0d36e26"><img height=17.5 src="https://assets.js-utils.org/images/icons/platforms/violentmonkey/icon25.png?v=0d36e26"> Greasemonkey
90
101
 
91
102
  ```js
92
103
  ...
93
- // @require https://cdn.jsdelivr.net/npm/generate-ip@2.4.3/dist/generate-ip.min.js
104
+ // @require https://cdn.jsdelivr.net/npm/generate-ip@2.4.5/dist/generate-ip.min.js
94
105
  // ==/UserScript==
95
106
 
96
107
  // Your code here...
@@ -98,11 +109,11 @@ const { ipv4, ipv6, mac } = require('generate-ip');
98
109
 
99
110
  <br>
100
111
 
101
- 📝 **Note:** To always import the latest version (not recommended in production!) remove the `@2.4.3` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/generate-ip/dist/generate-ip.min.js`
112
+ 📝 **Note:** To always import the latest version (not recommended in production!) remove the `@2.4.5` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/generate-ip/dist/generate-ip.min.js`
102
113
 
103
114
  <br>
104
115
 
105
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
116
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
106
117
 
107
118
  ## 📋 API usage
108
119
 
@@ -333,7 +344,7 @@ Name | Type | Description | Default Value
333
344
 
334
345
  <br>
335
346
 
336
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
347
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
337
348
 
338
349
  ## 💻 Command line usage
339
350
 
@@ -345,7 +356,7 @@ $ generate-ip
345
356
 
346
357
  Sample output:
347
358
 
348
- <img src="https://media.generate-ip.org/images/screenshots/cli/generate-ip-cmd-output.png?7b16322">
359
+ <img src="https://media.generate-ip.org/images/screenshots/cli/generate-ip-cmd-output.png?0d36e26">
349
360
 
350
361
  📝 **Note:** To generate other address types, type `generate-ipv6` or `generate-mac`
351
362
 
@@ -369,11 +380,11 @@ Info commands:
369
380
 
370
381
  <br>
371
382
 
372
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
383
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
373
384
 
374
385
  ## 🏛️ MIT License
375
386
 
376
- **Copyright © 2024 [Adam Lui](https://github.com/adamlui) & contributors.**
387
+ **Copyright © 2024–2025 [Adam Lui](https://github.com/adamlui) & contributors.**
377
388
 
378
389
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
379
390
 
@@ -383,32 +394,32 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
383
394
 
384
395
  <br>
385
396
 
386
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
397
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
387
398
 
388
399
  ## 🛠️ Related utilities
389
400
 
390
- ### [🔒 generate-pw](../generate-pw) &nbsp;<a href="https://github.com/toolleeo/cli-apps#password-managers"><img height=18 src="https://media.js-utils.com/images/badges/awesome/badge.svg?7b16322"></a>
401
+ ### [🔒 generate-pw](../generate-pw) &nbsp;<a href="https://github.com/toolleeo/cli-apps#password-managers"><img height=18 src="https://assets.js-utils.org/images/badges/awesome/badge.svg?v=0d36e26"></a>
391
402
 
392
403
  > Randomly generate, strengthen, and validate cryptographically-secure passwords.
393
404
  <br>[Install](https://docs.generatepw.org/#-installation) /
394
405
  [Readme](https://docs.generatepw.org/#readme) /
395
406
  [API usage](https://docs.generatepw.org/#-api-usage) /
396
407
  [CLI usage](https://docs.generatepw.org/#-command-line-usage) /
397
- [Discuss](https://github.js-utils.com/discussions)
408
+ [Discuss](https://github.com/adamlui/js-utils/discussions)
398
409
 
399
- ### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.geolocatejs.org/images/icons/wire-globe/white/icon32.png?e735b99"><img height=22 src="https://media.geolocatejs.org/images/icons/wire-globe/black/icon32.png?e735b99"></picture> [geolocate](https://js-utils.com/geolocate) &nbsp;<a href="https://github.com/toolleeo/cli-apps#networking"><img height=18 src="https://media.js-utils.com/images/badges/awesome/badge.svg?7b16322"></a>
410
+ ### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.geolocatejs.org/images/icons/wire-globe/white/icon32.png?0d36e26"><img height=22 src="https://media.geolocatejs.org/images/icons/wire-globe/black/icon32.png?0d36e26"></picture> [geolocate](https://js-utils.org/geolocate) &nbsp;<a href="https://github.com/toolleeo/cli-apps#networking"><img height=18 src="https://assets.js-utils.org/images/badges/awesome/badge.svg?v=0d36e26"></a>
400
411
 
401
412
  > Fetch IP geolocation data from the CLI.
402
413
  <br>[Install](https://docs.geolocatejs.org/#-installation) /
403
414
  [Readme](https://docs.geolocatejs.org/#readme) /
404
415
  [CLI usage](https://docs.geolocatejs.org/#-command-line-usage) /
405
416
  [API usage](https://docs.geolocatejs.org/#-api-usage) /
406
- [Discuss](https://github.js-utils.com/discussions)
417
+ [Discuss](https://github.com/adamlui/js-utils/discussions)
407
418
 
408
419
  <br>
409
420
 
410
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
421
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
411
422
 
412
- <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/home/white/icon32x27.png?e735b99"><img height=13 src="https://media.js-utils.com/images/icons/home/dark-gray/icon32x27.png?e735b99"></picture> <a href="https://js-utils.com">**More JavaScript utilities**</a> /
413
- <a href="https://github.js-utils.com/discussions">Discuss</a> /
423
+ <picture><source media="(prefers-color-scheme: dark)" srcset="https://assets.js-utils.org/images/icons/home/white/icon32x27.png?v=0d36e26"><img height=13 src="https://assets.js-utils.org/images/icons/home/dark-gray/icon32x27.png?v=0d36e26"></picture> <a href="https://js-utils.org">**More JavaScript utilities**</a> /
424
+ <a href="https://github.com/adamlui/js-utils/discussions">Discuss</a> /
414
425
  <a href="#-generate-ip">Back to top ↑</a>
@@ -1,6 +1,6 @@
1
1
  /**
2
- * © 2024 Adam Lui & contributors under the MIT license.
2
+ * © 2024–2025 Adam Lui & contributors under the MIT license.
3
3
  * Source: https://code.generate-ip.org
4
4
  * Documentation: https://docs.generate-ip.org
5
5
  */
6
- const ipv4={generate:function(o={}){var e={verbose:!0,qty:1};if(validateOptions(o,e,"https://docs.generate-ip.org/#ipv4generateoptions","ipv4.generate({ verbose: false, qty: 3 })")){(o={...e,...o}).verbose&&console.info(`ipv4.generate() » Generating IPv4 address${1<o.qty?"es":""}...`);var t=[];if(1<o.qty)for(let e=0;e<o.qty;e++)t.push(this.generate({...o,qty:1,verbose:!1}));else{var r=[];for(let e=0;e<4;e++)r.push(randomInt(0,256));t.push(r.join("."))}e=1<o.qty?t:t[0];return o.verbose&&(console.info(`ipv4.generate() » IPv4 address${1<o.qty?"es":""} generated!`),console.info("ipv4.generate() » "+(1==o.qty?e:e.join(", ")))),e}},validate:function(e,o={}){var t="https://docs.generate-ip.org/#ipv4validateaddress-options",r={verbose:!0};if("string"!=typeof e)console.error("ipv4.validate() » ERROR: 1st arg <address> must be a string."),console.info("ipv4.validate() » For more help, please visit "+t);else if(validateOptions(o,r,t,"ipv4.validate('0.0.255.255', { verbose: false })"))return(o={...r,...o}).verbose&&console.info(`ipv4.validate() » Validating ${e}...`),r=!(4!=(t=e.split(".")).length||t.some(e=>!/^\d+$/.test(e)||parseInt(e,10)<0||255<parseInt(e,10))),o.verbose&&console.info(`ipv4.validate() » IP is ${r?"":"in"}valid IPv4 address!`),r}},ipv6={generate:function(o={}){var e={verbose:!0,qty:1,leadingZeros:!1,doubleColon:!0};if(validateOptions(o,e,"https://docs.generate-ip.org/#ipv6generateoptions","ipv6.generate({ leadingZeros: true, qty: 5 })")){(o={...e,...o}).verbose&&console.info(`ipv6.generate() » Generating IPv6 address${1<o.qty?"es":""}...`);var t=[];if(1<o.qty)for(let e=0;e<o.qty;e++)t.push(this.generate({...o,qty:1,verbose:!1}));else{const i=[],{qty:n,...s}=o;for(let e=0;e<8;e++){var r=randomHex(4);i.push(r)}t.push(this.format(i.join(":"),{...s,verbose:!1}))}e=1<o.qty?t:t[0];return o.verbose&&(console.info(`ipv6.generate() » IPv6 address${1<o.qty?"es":""} generated!`),console.info("ipv6.generate() » "+(1==o.qty?e:e.join(", ")))),e}},format:function(o,t={}){var r,e="https://docs.generate-ip.org/#ipv6formatipv6address-options",i={verbose:!0,leadingZeros:!1,doubleColon:!0};if("string"!=typeof o)console.error("ipv6.format() » ERROR: 1st arg <ipv6address> must be a string."),console.info("ipv6.format() » For more help, please visit "+e);else if(this.validate(o,{verbose:!1})){if(validateOptions(t,i,e,"ipv6.format('0d::ffff:192.1.56.10/96', { leadingZeros: true, doubleColon: false })")){t={...i,...t};let e=o;if(e=t.doubleColon?(t.verbose&&console.info("ipv6.format() » Replacing zero series w/ '::'..."),e.replace(/:(?:0+:)+/,"::")):(t.verbose&&console.info("ipv6.format() » Expanding '::' into zero series..."),i=e.split(":").filter(Boolean).length,r=t.leadingZeros?"0000":"0",i=Array(8-i).fill(r).join(":"),e.replace("::",`:${i}:`)),t.leadingZeros){t.verbose&&console.info("ipv6.format() » Adding leading zeros...");var n=e.split(":");for(let e=0;e<n.length;e++)for(;n[e].length<4;)n[e]="0"+n[e];e=n.join(":")}else t.verbose&&console.info("ipv6.format() » Stripping leading zeros..."),e=o.replace(/(^|(?<=:))0+(?!:)/g,"$1");return t.verbose&&(e!=o?console.info("ipv6.format() » IP formatted successfully!"):console.info("ipv6.format() » IP already formatted to specs."),console.info("ipv6.format() » "+e)),e}}else console.error(`ipv6.format() » ERROR: ${o} is not a valid IPv6 address.`),console.info("ipv6.format() » For more help, please visit "+e)},validate:function(e,o={}){var t="https://docs.generate-ip.org/#ipv6validateaddress-options",r={verbose:!0};if("string"!=typeof e)console.error("ipv6.validate() » ERROR: 1st arg <address> must be a string."),console.info("ipv6.validate() » For more help, please visit "+t);else if(validateOptions(o,r,t,"ipv6.validate('0:0:0:0:0:ffff:192.1.56.10/96', { verbose: false })")){(o={...r,...o}).verbose&&console.info(`ipv6.validate() » Validating ${e}...`);const i=e.split(/::?/),n=i[i.length-1];t=!(e.includes("::")&&2<e.split("::").length||/:{3,}/g.test(e)||i.length<2||8<i.length||i.some(e=>!(/^[\dA-Fa-f]{1,4}$/.test(e)||e==n&&ipv4.validate(n.replace(/\/(?:0|(?:[1-2]?\d)|32|96)$/,""),{verbose:!1}))));return o.verbose&&console.info(`ipv6.validate() » IP is ${t?"":"in"}valid IPv6 address!`),t}}},mac={generate:function(o={}){var e={verbose:!0,qty:1};if(validateOptions(o,e,"https://docs.generate-ip.org/#macgenerateoptions","mac.generate({ verbose: false, qty: 2 })")){(o={...e,...o}).verbose&&console.info(`mac.generate() » Generating MAC address${1<o.qty?"es":""}...`);var t=[];if(1<o.qty)for(let e=0;e<o.qty;e++)t.push(this.generate({...o,qty:1,verbose:!1}));else{var[e,r]=Array.from({length:2},()=>{var o=[];for(let e=0;e<3;e++)o.push(randomHex(2));return o.join(":")});t.push(e+":"+r)}e=1<o.qty?t:t[0];return o.verbose&&(console.info(`mac.generate() » MAC address${1<o.qty?"es":""} generated!`),console.info("mac.generate() » "+(1==o.qty?e:e.join(", ")))),e}},validate:function(e,o={}){var t="https://docs.generate-ip.org/#macvalidateaddress-options",r={verbose:!0};if("string"!=typeof e)console.error("mac.validate() » ERROR: 1st arg <address> must be a string."),console.info("mac.validate() » For more help, please visit "+t);else if(validateOptions(o,r,t,"mac.validate('00:1A:2B:3C:4D:5E', { verbose: false })"))return(o={...r,...o}).verbose&&console.info(`mac.validate() » Validating ${e}...`),t=/^(?:[\dA-Fa-f]{2}[:-]){5}(?:[\dA-Fa-f]{2})$/.test(e),o.verbose&&console.info(`mac.validate() » Address is ${t?"":"in"}valid MAC address!`),t}};function randomInt(e,o){var t;return"undefined"==typeof require?(t=(window.crypto||window.msCrypto)?.getRandomValues(new Uint32Array(1))[0]/4294967295||Math.random(),Math.floor(t*(o-e))+e):require("crypto").randomInt(e,o)}function randomHex(o){let t="";for(let e=0;e<o;e++)t+=randomInt(0,16).toString(16);return t}function validateOptions(e,o,t,r){const i=JSON.stringify(o,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(o).join(", "),s=Object.keys(o).filter(e=>"boolean"==typeof o[e]),a=Object.keys(o).filter(e=>Number.isInteger(o[e]));let l="validateOptions() » ";try{l=validateOptions.caller?.name+"() » "}catch(e){}var v=r.split(",").findIndex(e=>e.trim().startsWith("{"))+1,p=(v+=["st","nd","rd"][v-1]||"th",()=>{console.info(`${l}Valid options: [ ${n} ]`),console.info(l+"If omitted, default settings are: "+i)}),d=()=>{console.info(l+"For more help, please visit "+t)};if("object"!=typeof e)return console.error(l+`ERROR: ${"0th"==v?"[O":v+" arg [o"}ptions] can only be an object of key/values.`),console.info(l+"Example valid call: "+r),p(),d(),!1;for(const f in e){if(!Object.prototype.hasOwnProperty.call(o,f))return console.error(`${l}ERROR: \`${f}\` is an invalid option.`),p(),d(),!1;if(s.includes(f)&&"boolean"!=typeof e[f])return console.error(`${l}ERROR: [${f}] option can only be \`true\` or \`false\`.`),d(),!1;if(a.includes(f)&&(e[f]=parseInt(e[f],10),isNaN(e[f])||e[f]<1))return console.error(`${l}ERROR: [${f}] option can only be an integer > 0.`),d(),!1}return!0}const gipAliases={ipv4:["ipV4","IPv4","IPV4","Ipv4","IpV4","ip","IP","Ip"],ipv6:["ipV6","IPv6","IPV6","Ipv6","IpV6"],mac:["MAC","Mac","ethernet","Ethernet"]};try{module.exports={ipv4:ipv4,ipv6:ipv6,mac:mac}}catch(e){}try{window.ipv4=ipv4,window.ipv6=ipv6,window.mac=mac}catch(e){}for(const Ma in gipAliases)gipAliases[Ma].forEach(e=>{try{module.exports[e]=module.exports[Ma]}catch(e){}try{window[e]=window[Ma]}catch(e){}});
6
+ const ipv4={generate:function(o={}){var e={verbose:!0,qty:1};if(validateOptions(o,e,"https://docs.generate-ip.org/#ipv4generateoptions","ipv4.generate({ verbose: false, qty: 3 })")){(o={...e,...o}).verbose&&console.info(`ipv4.generate() » Generating IPv4 address${1<o.qty?"es":""}...`);var t=[];if(1<o.qty)for(let e=0;e<o.qty;e++)t.push(this.generate({...o,qty:1,verbose:!1}));else{var r=[];for(let e=0;e<4;e++)r.push(randomInt(0,256));t.push(r.join("."))}e=1<o.qty?t:t[0];return o.verbose&&(console.info(`ipv4.generate() » IPv4 address${1<o.qty?"es":""} generated!`),console.info("ipv4.generate() » "+(1==o.qty?e:e.join(", ")))),e}},validate:function(e,o={}){var t="https://docs.generate-ip.org/#ipv4validateaddress-options",r={verbose:!0};if("string"!=typeof e)console.error("ipv4.validate() » ERROR: 1st arg <address> must be a string."),console.info("ipv4.validate() » For more help, please visit "+t);else if(validateOptions(o,r,t,"ipv4.validate('0.0.255.255', { verbose: false })"))return(o={...r,...o}).verbose&&console.info(`ipv4.validate() » Validating ${e}...`),r=!(4!=(t=e.split(".")).length||t.some(e=>!/^\d+$/.test(e)||parseInt(e,10)<0||255<parseInt(e,10))),o.verbose&&console.info(`ipv4.validate() » IP is ${r?"":"in"}valid IPv4 address!`),r}},ipv6={generate:function(o={}){var e={verbose:!0,qty:1,leadingZeros:!1,doubleColon:!0};if(validateOptions(o,e,"https://docs.generate-ip.org/#ipv6generateoptions","ipv6.generate({ leadingZeros: true, qty: 5 })")){(o={...e,...o}).verbose&&console.info(`ipv6.generate() » Generating IPv6 address${1<o.qty?"es":""}...`);var t=[];if(1<o.qty)for(let e=0;e<o.qty;e++)t.push(this.generate({...o,qty:1,verbose:!1}));else{const i=[],{qty:n,...s}=o;for(let e=0;e<8;e++){var r=randomHex(4);i.push(r)}t.push(this.format(i.join(":"),{...s,verbose:!1}))}e=1<o.qty?t:t[0];return o.verbose&&(console.info(`ipv6.generate() » IPv6 address${1<o.qty?"es":""} generated!`),console.info("ipv6.generate() » "+(1==o.qty?e:e.join(", ")))),e}},format:function(o,t={}){var r,e="https://docs.generate-ip.org/#ipv6formatipv6address-options",i={verbose:!0,leadingZeros:!1,doubleColon:!0};if("string"!=typeof o)console.error("ipv6.format() » ERROR: 1st arg <ipv6address> must be a string."),console.info("ipv6.format() » For more help, please visit "+e);else if(this.validate(o,{verbose:!1})){if(validateOptions(t,i,e,"ipv6.format('0d::ffff:192.1.56.10/96', { leadingZeros: true, doubleColon: false })")){t={...i,...t};let e=o;if(e=t.doubleColon?(t.verbose&&console.info("ipv6.format() » Replacing zero series w/ '::'..."),e.replace(/:(?:0+:)+/,"::")):(t.verbose&&console.info("ipv6.format() » Expanding '::' into zero series..."),i=e.split(":").filter(Boolean).length,r=t.leadingZeros?"0000":"0",i=Array(8-i).fill(r).join(":"),e.replace("::",`:${i}:`)),t.leadingZeros){t.verbose&&console.info("ipv6.format() » Adding leading zeros...");var n=e.split(":");for(let e=0;e<n.length;e++)for(;n[e].length<4;)n[e]="0"+n[e];e=n.join(":")}else t.verbose&&console.info("ipv6.format() » Stripping leading zeros..."),e=o.replace(/(^|(?<=:))0+(?!:)/g,"$1");return t.verbose&&(e!=o?console.info("ipv6.format() » IP formatted successfully!"):console.info("ipv6.format() » IP already formatted to specs."),console.info("ipv6.format() » "+e)),e}}else console.error(`ipv6.format() » ERROR: ${o} is not a valid IPv6 address.`),console.info("ipv6.format() » For more help, please visit "+e)},validate:function(e,o={}){var t="https://docs.generate-ip.org/#ipv6validateaddress-options",r={verbose:!0};if("string"!=typeof e)console.error("ipv6.validate() » ERROR: 1st arg <address> must be a string."),console.info("ipv6.validate() » For more help, please visit "+t);else if(validateOptions(o,r,t,"ipv6.validate('0:0:0:0:0:ffff:192.1.56.10/96', { verbose: false })")){(o={...r,...o}).verbose&&console.info(`ipv6.validate() » Validating ${e}...`);const i=e.split(/::?/),n=i[i.length-1];t=!(e.includes("::")&&2<e.split("::").length||/:{3,}/.test(e)||i.length<2||8<i.length||i.some(e=>!(/^[\da-f]{1,4}$/i.test(e)||e==n&&ipv4.validate(n.replace(/\/(?:12[0-8]|[1-9]?\d)$/,""),{verbose:!1}))));return o.verbose&&console.info(`ipv6.validate() » IP is ${t?"":"in"}valid IPv6 address!`),t}}},mac={generate:function(o={}){var e={verbose:!0,qty:1};if(validateOptions(o,e,"https://docs.generate-ip.org/#macgenerateoptions","mac.generate({ verbose: false, qty: 2 })")){(o={...e,...o}).verbose&&console.info(`mac.generate() » Generating MAC address${1<o.qty?"es":""}...`);var t=[];if(1<o.qty)for(let e=0;e<o.qty;e++)t.push(this.generate({...o,qty:1,verbose:!1}));else{var[e,r]=Array.from({length:2},()=>{var o=[];for(let e=0;e<3;e++)o.push(randomHex(2));return o.join(":")});t.push(e+":"+r)}e=1<o.qty?t:t[0];return o.verbose&&(console.info(`mac.generate() » MAC address${1<o.qty?"es":""} generated!`),console.info("mac.generate() » "+(1==o.qty?e:e.join(", ")))),e}},validate:function(e,o={}){var t="https://docs.generate-ip.org/#macvalidateaddress-options",r={verbose:!0};if("string"!=typeof e)console.error("mac.validate() » ERROR: 1st arg <address> must be a string."),console.info("mac.validate() » For more help, please visit "+t);else if(validateOptions(o,r,t,"mac.validate('00:1A:2B:3C:4D:5E', { verbose: false })"))return(o={...r,...o}).verbose&&console.info(`mac.validate() » Validating ${e}...`),t=/^(?:[\da-f]{2}[:-]){5}[\da-f]{2}$/i.test(e),o.verbose&&console.info(`mac.validate() » Address is ${t?"":"in"}valid MAC address!`),t}};function randomInt(e,o){var t;return"undefined"==typeof require?(t=(window.crypto||window.msCrypto)?.getRandomValues(new Uint32Array(1))[0]/4294967295||Math.random(),Math.floor(t*(o-e))+e):require("crypto").randomInt(e,o)}function randomHex(o){let t="";for(let e=0;e<o;e++)t+=randomInt(0,16).toString(16);return t}function validateOptions(e,o,t,r){const i=JSON.stringify(o,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(o).join(", "),s=Object.keys(o).filter(e=>"boolean"==typeof o[e]),a=Object.keys(o).filter(e=>Number.isInteger(o[e])),l=`${validateOptions.caller?.name||"validateOptions"}() » `;var v=r.split(",").findIndex(e=>e.trim().startsWith("{"))+1,p=(v+=["st","nd","rd"][v-1]||"th",()=>{console.info(l+`Valid options: [ ${n} ]`),console.info(l+"If omitted, default settings are: "+i)}),d=()=>{console.info(l+"For more help, please visit "+t)};if("object"!=typeof e)return console.error(l+`ERROR: ${"0th"==v?"[O":v+" arg [o"}ptions] can only be an object of key/values.`),console.info(l+"Example valid call: "+r),p(),d(),!1;for(const f in e){if(!Object.prototype.hasOwnProperty.call(o,f))return console.error(l+`ERROR: \`${f}\` is an invalid option.`),p(),d(),!1;if(s.includes(f)&&"boolean"!=typeof e[f])return console.error(l+`ERROR: [${f}] option can only be \`true\` or \`false\`.`),d(),!1;if(a.includes(f)&&(e[f]=parseInt(e[f],10),isNaN(e[f])||e[f]<1))return console.error(l+`ERROR: [${f}] option can only be an integer > 0.`),d(),!1}return!0}const gipAliases={ipv4:["ipV4","IPv4","IPV4","Ipv4","IpV4","ip","IP","Ip"],ipv6:["ipV6","IPv6","IPV6","Ipv6","IpV6"],mac:["MAC","Mac","ethernet","Ethernet"]};try{module.exports={ipv4:ipv4,ipv6:ipv6,mac:mac}}catch(e){}try{window.ipv4=ipv4,window.ipv6=ipv6,window.mac=mac}catch(e){}for(const La in gipAliases)gipAliases[La].forEach(e=>{try{module.exports[e]=module.exports[La]}catch(e){}try{window[e]=window[La]}catch(e){}});
package/docs/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 🏛️ MIT License
2
2
 
3
- **Copyright © 2024 [Adam Lui](https://github.com/adamlui) & contributors**
3
+ **Copyright © 2024–2025 [Adam Lui](https://github.com/adamlui) & contributors**
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/docs/README.md CHANGED
@@ -1,18 +1,29 @@
1
- # <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.generate-ip.org/images/icons/node-graph/white/icon55x49.png?b4eb06e"><img height=32 src="https://media.generate-ip.org/images/icons/node-graph/black/icon55x49.png?b4eb06e"></picture> generate-ip
1
+ <div align="center">
2
2
 
3
- ### Randomly generate, format, and validate IPv4 + IPv6 + MAC addresses.
3
+ <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.generate-ip.org/images/logos/generate-ip/white-logo.png?7768152"><img width=700 src="https://media.generate-ip.org/images/logos/generate-ip/black-logo.png?7768152"></picture>
4
4
 
5
- <a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
6
- <a href="https://github.com/adamlui/js-utils/releases/tag/generate-ip-2.4.3"><img height=31 src="https://img.shields.io/badge/Latest_Build-2.4.3-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
7
- <a href="https://www.npmjs.com/package/generate-ip?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/generate-ip?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
8
- <a href="https://github.com/adamlui/js-utils/blob/generate-ip-2.4.3/generate-ip/dist/generate-ip.min.js"><img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/generate-ip/dist/generate-ip.min.js?branch=generate-ip-2.4.3&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
9
- <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:generate-ip/src/generate-ip.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Agenerate-ip%2Fsrc%2Fgenerate-ip.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
10
- <a href="https://github.com/toolleeo/cli-apps#networking"><img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
11
- <a href="https://www.jsdelivr.com/package/npm/generate-ip?tab=stats"><img height=31 src="https://img.shields.io/jsdelivr/npm/hm/generate-ip?style=for-the-badge&logo=jsdelivr&logoColor=white&label=jsDelivr%20Hits&labelColor=464646&color=49c5d8"></a>
5
+ ### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.generate-ip.org/images/icons/node-graph/white/icon55x49.png?b4eb06e"><img width=23 src="https://media.generate-ip.org/images/icons/node-graph/black/icon55x49.png?b4eb06e"></picture> &nbsp;Randomly generate, format, and validate IPv4 + IPv6 + MAC addresses.
12
6
 
13
7
  <br>
14
8
 
15
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
9
+ <a href="#%EF%B8%8F-mit-license">
10
+ <img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
11
+ <a href="https://github.com/adamlui/js-utils/releases/tag/generate-ip-2.4.5">
12
+ <img height=31 src="https://img.shields.io/badge/Latest_Build-2.4.5-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
13
+ <a href="https://www.npmjs.com/package/generate-ip?activeTab=code">
14
+ <img height=31 src="https://img.shields.io/npm/unpacked-size/generate-ip?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
15
+ <a href="https://github.com/adamlui/js-utils/blob/generate-ip-2.4.5/generate-ip/dist/generate-ip.min.js">
16
+ <img height=31 src="https://img.shields.io/github/size/adamlui/js-utils/generate-ip/dist/generate-ip.min.js?branch=generate-ip-2.4.5&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
17
+ <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:generate-ip/src/generate-ip.js">
18
+ <img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Agenerate-ip%2Fsrc%2Fgenerate-ip.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
19
+ <a href="https://github.com/toolleeo/cli-apps#networking">
20
+ <img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
21
+ <a href="https://www.jsdelivr.com/package/npm/generate-ip?tab=stats">
22
+ <img height=31 src="https://img.shields.io/jsdelivr/npm/hm/generate-ip?style=for-the-badge&logo=jsdelivr&logoColor=white&label=jsDelivr%20Hits&labelColor=464646&color=49c5d8"></a>
23
+
24
+ </div>
25
+
26
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
16
27
 
17
28
  ## 💡 About
18
29
 
@@ -23,7 +34,7 @@
23
34
  - **Multi-environment support —** Use in Node.js or the web browser
24
35
  - **Command line usable —** Just type `generate-ip`, that's it
25
36
 
26
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
37
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
27
38
 
28
39
  ## ⚡ Installation
29
40
 
@@ -47,13 +58,13 @@ $ npm install generate-ip
47
58
 
48
59
  <br>
49
60
 
50
- <a href="https://github.com/sponsors/adamlui"><img src="https://media.js-utils.com/images/banners/sponsor/$10/banner1660x260.png?09f5d64"></a>
61
+ <a href="https://github.com/sponsors/adamlui"><img src="https://assets.js-utils.org/images/banners/sponsor/$10/banner1660x260.png?v=0d36e26"></a>
51
62
 
52
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
63
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
53
64
 
54
65
  ## 🔌 Importing the APIs
55
66
 
56
- ### <img height=18 src="https://media.js-utils.com/images/icons/platforms/node.js/icon25x28.png?3e22bae"> Node.js
67
+ ### <img height=18 src="https://assets.js-utils.org/images/icons/platforms/node.js/icon25x28.png?v=0d36e26"> Node.js
57
68
 
58
69
  #### ECMAScript*:
59
70
 
@@ -69,28 +80,28 @@ const { ipv4, ipv6, mac } = require('generate-ip');
69
80
 
70
81
  ###### _*Node.js version 14 or higher required_
71
82
 
72
- ### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/platforms/web/light/icon25.png?3e22bae"><img width=16 src="https://media.js-utils.com/images/icons/platforms/web/dark/icon25.png?3e22bae"></picture> Web
83
+ ### <picture><source media="(prefers-color-scheme: dark)" srcset="https://assets.js-utils.org/images/icons/platforms/web/light/icon25.png?v=0d36e26"><img width=16 src="https://assets.js-utils.org/images/icons/platforms/web/dark/icon25.png?v=0d36e26"></picture> Web
73
84
 
74
85
  #### <> HTML script tag:
75
86
 
76
87
  ```html
77
- <script src="https://cdn.jsdelivr.net/npm/generate-ip@2.4.3/dist/generate-ip.min.js"></script>
88
+ <script src="https://cdn.jsdelivr.net/npm/generate-ip@2.4.5/dist/generate-ip.min.js"></script>
78
89
  ```
79
90
 
80
91
  #### ES6:
81
92
 
82
93
  ```js
83
94
  (async () => {
84
- await import('https://cdn.jsdelivr.net/npm/generate-ip@2.4.3/dist/generate-ip.min.js');
95
+ await import('https://cdn.jsdelivr.net/npm/generate-ip@2.4.5/dist/generate-ip.min.js');
85
96
  // Your code here...
86
97
  })();
87
98
  ```
88
99
 
89
- ### <img height=17 src="https://media.js-utils.com/images/icons/platforms/tampermonkey/icon28.png?4fd2fa7"><img height=17.5 src="https://media.js-utils.com/images/icons/platforms/violentmonkey/icon25.png?2fe972c"> Greasemonkey
100
+ ### <img height=17 src="https://assets.js-utils.org/images/icons/platforms/tampermonkey/icon28.png?v=0d36e26"><img height=17.5 src="https://assets.js-utils.org/images/icons/platforms/violentmonkey/icon25.png?v=0d36e26"> Greasemonkey
90
101
 
91
102
  ```js
92
103
  ...
93
- // @require https://cdn.jsdelivr.net/npm/generate-ip@2.4.3/dist/generate-ip.min.js
104
+ // @require https://cdn.jsdelivr.net/npm/generate-ip@2.4.5/dist/generate-ip.min.js
94
105
  // ==/UserScript==
95
106
 
96
107
  // Your code here...
@@ -98,11 +109,11 @@ const { ipv4, ipv6, mac } = require('generate-ip');
98
109
 
99
110
  <br>
100
111
 
101
- 📝 **Note:** To always import the latest version (not recommended in production!) remove the `@2.4.3` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/generate-ip/dist/generate-ip.min.js`
112
+ 📝 **Note:** To always import the latest version (not recommended in production!) remove the `@2.4.5` version tag from the jsDelivr URL: `https://cdn.jsdelivr.net/npm/generate-ip/dist/generate-ip.min.js`
102
113
 
103
114
  <br>
104
115
 
105
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
116
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
106
117
 
107
118
  ## 📋 API usage
108
119
 
@@ -333,7 +344,7 @@ Name | Type | Description | Default Value
333
344
 
334
345
  <br>
335
346
 
336
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
347
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
337
348
 
338
349
  ## 💻 Command line usage
339
350
 
@@ -345,7 +356,7 @@ $ generate-ip
345
356
 
346
357
  Sample output:
347
358
 
348
- <img src="https://media.generate-ip.org/images/screenshots/cli/generate-ip-cmd-output.png?7b16322">
359
+ <img src="https://media.generate-ip.org/images/screenshots/cli/generate-ip-cmd-output.png?0d36e26">
349
360
 
350
361
  📝 **Note:** To generate other address types, type `generate-ipv6` or `generate-mac`
351
362
 
@@ -369,11 +380,11 @@ Info commands:
369
380
 
370
381
  <br>
371
382
 
372
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
383
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
373
384
 
374
385
  ## 🏛️ MIT License
375
386
 
376
- **Copyright © 2024 [Adam Lui](https://github.com/adamlui) & contributors.**
387
+ **Copyright © 2024–2025 [Adam Lui](https://github.com/adamlui) & contributors.**
377
388
 
378
389
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
379
390
 
@@ -383,32 +394,32 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
383
394
 
384
395
  <br>
385
396
 
386
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
397
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
387
398
 
388
399
  ## 🛠️ Related utilities
389
400
 
390
- ### [🔒 generate-pw](../generate-pw) &nbsp;<a href="https://github.com/toolleeo/cli-apps#password-managers"><img height=18 src="https://media.js-utils.com/images/badges/awesome/badge.svg?7b16322"></a>
401
+ ### [🔒 generate-pw](../generate-pw) &nbsp;<a href="https://github.com/toolleeo/cli-apps#password-managers"><img height=18 src="https://assets.js-utils.org/images/badges/awesome/badge.svg?v=0d36e26"></a>
391
402
 
392
403
  > Randomly generate, strengthen, and validate cryptographically-secure passwords.
393
404
  <br>[Install](https://docs.generatepw.org/#-installation) /
394
405
  [Readme](https://docs.generatepw.org/#readme) /
395
406
  [API usage](https://docs.generatepw.org/#-api-usage) /
396
407
  [CLI usage](https://docs.generatepw.org/#-command-line-usage) /
397
- [Discuss](https://github.js-utils.com/discussions)
408
+ [Discuss](https://github.com/adamlui/js-utils/discussions)
398
409
 
399
- ### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.geolocatejs.org/images/icons/wire-globe/white/icon32.png?e735b99"><img height=22 src="https://media.geolocatejs.org/images/icons/wire-globe/black/icon32.png?e735b99"></picture> [geolocate](https://js-utils.com/geolocate) &nbsp;<a href="https://github.com/toolleeo/cli-apps#networking"><img height=18 src="https://media.js-utils.com/images/badges/awesome/badge.svg?7b16322"></a>
410
+ ### <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.geolocatejs.org/images/icons/wire-globe/white/icon32.png?0d36e26"><img height=22 src="https://media.geolocatejs.org/images/icons/wire-globe/black/icon32.png?0d36e26"></picture> [geolocate](https://js-utils.org/geolocate) &nbsp;<a href="https://github.com/toolleeo/cli-apps#networking"><img height=18 src="https://assets.js-utils.org/images/badges/awesome/badge.svg?v=0d36e26"></a>
400
411
 
401
412
  > Fetch IP geolocation data from the CLI.
402
413
  <br>[Install](https://docs.geolocatejs.org/#-installation) /
403
414
  [Readme](https://docs.geolocatejs.org/#readme) /
404
415
  [CLI usage](https://docs.geolocatejs.org/#-command-line-usage) /
405
416
  [API usage](https://docs.geolocatejs.org/#-api-usage) /
406
- [Discuss](https://github.js-utils.com/discussions)
417
+ [Discuss](https://github.com/adamlui/js-utils/discussions)
407
418
 
408
419
  <br>
409
420
 
410
- <img height=6px width="100%" src="https://media.js-utils.com/images/separators/gradient-aqua.png?c0192d3">
421
+ <img height=6px width="100%" src="https://assets.js-utils.org/images/separators/aqua-gradient.png?v=0d36e26">
411
422
 
412
- <picture><source media="(prefers-color-scheme: dark)" srcset="https://media.js-utils.com/images/icons/home/white/icon32x27.png?e735b99"><img height=13 src="https://media.js-utils.com/images/icons/home/dark-gray/icon32x27.png?e735b99"></picture> <a href="https://js-utils.com">**More JavaScript utilities**</a> /
413
- <a href="https://github.js-utils.com/discussions">Discuss</a> /
423
+ <picture><source media="(prefers-color-scheme: dark)" srcset="https://assets.js-utils.org/images/icons/home/white/icon32x27.png?v=0d36e26"><img height=13 src="https://assets.js-utils.org/images/icons/home/dark-gray/icon32x27.png?v=0d36e26"></picture> <a href="https://js-utils.org">**More JavaScript utilities**</a> /
424
+ <a href="https://github.com/adamlui/js-utils/discussions">Discuss</a> /
414
425
  <a href="#-generate-ip">Back to top ↑</a>
package/docs/SECURITY.md CHANGED
@@ -1,5 +1,3 @@
1
1
  # 🛡️ Security Policy
2
2
 
3
- If you find a vulnerability, please open a [draft security advisory](https://github.js-utils.com/security/advisories/new).
4
-
5
- Pull requests are also welcome, but for safety reasons, send an email to <adam@kudoai.com> and wait for a response before making it public.
3
+ If you find a vulnerability, please follow the reporting instructions @ https://tidelift.com/security
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generate-ip",
3
- "version": "2.4.3",
3
+ "version": "2.4.5",
4
4
  "description": "Randomly generate, format, and validate IPv4 + IPv6 + MAC addresses.",
5
5
  "author": {
6
6
  "name": "Adam Lui",
@@ -9,6 +9,16 @@
9
9
  },
10
10
  "homepage": "https://generate-ip.org",
11
11
  "license": "MIT",
12
+ "funding": [
13
+ {
14
+ "type": "github",
15
+ "url": "http://github.com/sponsors/adamlui"
16
+ },
17
+ {
18
+ "type": "ko-fi",
19
+ "url": "https://ko-fi.com/adamlui"
20
+ }
21
+ ],
12
22
  "main": "dist/generate-ip.min.js",
13
23
  "files": [
14
24
  "docs"
@@ -19,14 +29,10 @@
19
29
  "doc": "./docs"
20
30
  },
21
31
  "scripts": {
22
- "test": "echo \"Error: no test specified\" && exit 1",
23
32
  "build": "bash utils/build.sh",
24
33
  "bump:patch": "bash utils/bump.sh patch",
25
34
  "bump:minor": "bash utils/bump.sh minor",
26
- "bump:major": "bash utils/bump.sh major",
27
- "publish:patch": "bash utils/bump.sh patch --publish",
28
- "publish:minor": "bash utils/bump.sh minor --publish",
29
- "publish:major": "bash utils/bump.sh major --publish"
35
+ "bump:major": "bash utils/bump.sh major"
30
36
  },
31
37
  "repository": {
32
38
  "type": "git",
@@ -45,13 +51,9 @@
45
51
  "mac"
46
52
  ],
47
53
  "bugs": {
48
- "url": "https://js-utils.com/issues"
49
- },
50
- "funding": {
51
- "type": "github",
52
- "url": "https://github.com/sponsors/adamlui"
54
+ "url": "https://support.generate-ip.org"
53
55
  },
54
56
  "devDependencies": {
55
- "@adamlui/minify.js": "^1.8.0"
57
+ "@adamlui/minify.js": "^1.8.5"
56
58
  }
57
59
  }