@xyo-network/shared 2.75.15 → 2.75.16
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/dist/docs.json +58 -58
- package/package.json +4 -4
- package/dist/browser/IdLogger.cjs +0 -79
- package/dist/browser/IdLogger.cjs.map +0 -1
- package/dist/browser/IdLogger.js +0 -56
- package/dist/browser/IdLogger.js.map +0 -1
- package/dist/browser/Job/Job.cjs +0 -19
- package/dist/browser/Job/Job.cjs.map +0 -1
- package/dist/browser/Job/Job.js +0 -1
- package/dist/browser/Job/Job.js.map +0 -1
- package/dist/browser/Job/JobProvider.cjs +0 -19
- package/dist/browser/Job/JobProvider.cjs.map +0 -1
- package/dist/browser/Job/JobProvider.js +0 -1
- package/dist/browser/Job/JobProvider.js.map +0 -1
- package/dist/browser/Job/Task.cjs +0 -19
- package/dist/browser/Job/Task.cjs.map +0 -1
- package/dist/browser/Job/Task.js +0 -1
- package/dist/browser/Job/Task.js.map +0 -1
- package/dist/browser/Job/index.cjs +0 -19
- package/dist/browser/Job/index.cjs.map +0 -1
- package/dist/browser/Job/index.js +0 -1
- package/dist/browser/Job/index.js.map +0 -1
- package/dist/browser/Logger.cjs +0 -46
- package/dist/browser/Logger.cjs.map +0 -1
- package/dist/browser/Logger.js +0 -25
- package/dist/browser/Logger.js.map +0 -1
- package/dist/browser/dump.cjs +0 -42
- package/dist/browser/dump.cjs.map +0 -1
- package/dist/browser/dump.js +0 -21
- package/dist/browser/dump.js.map +0 -1
- package/dist/browser/is-ip/index.cjs +0 -67
- package/dist/browser/is-ip/index.cjs.map +0 -1
- package/dist/browser/is-ip/index.js +0 -44
- package/dist/browser/is-ip/index.js.map +0 -1
- package/dist/browser/is-ip/ip-regex.cjs +0 -48
- package/dist/browser/is-ip/ip-regex.cjs.map +0 -1
- package/dist/browser/is-ip/ip-regex.js +0 -27
- package/dist/browser/is-ip/ip-regex.js.map +0 -1
- package/dist/browser/is-ip/is-ip.cjs +0 -67
- package/dist/browser/is-ip/is-ip.cjs.map +0 -1
- package/dist/browser/is-ip/is-ip.js +0 -44
- package/dist/browser/is-ip/is-ip.js.map +0 -1
- package/dist/node/IdLogger.js +0 -89
- package/dist/node/IdLogger.js.map +0 -1
- package/dist/node/IdLogger.mjs +0 -62
- package/dist/node/IdLogger.mjs.map +0 -1
- package/dist/node/Job/Job.js +0 -19
- package/dist/node/Job/Job.js.map +0 -1
- package/dist/node/Job/Job.mjs +0 -1
- package/dist/node/Job/Job.mjs.map +0 -1
- package/dist/node/Job/JobProvider.js +0 -19
- package/dist/node/Job/JobProvider.js.map +0 -1
- package/dist/node/Job/JobProvider.mjs +0 -1
- package/dist/node/Job/JobProvider.mjs.map +0 -1
- package/dist/node/Job/Task.js +0 -19
- package/dist/node/Job/Task.js.map +0 -1
- package/dist/node/Job/Task.mjs +0 -1
- package/dist/node/Job/Task.mjs.map +0 -1
- package/dist/node/Job/index.js +0 -19
- package/dist/node/Job/index.js.map +0 -1
- package/dist/node/Job/index.mjs +0 -1
- package/dist/node/Job/index.mjs.map +0 -1
- package/dist/node/Logger.js +0 -51
- package/dist/node/Logger.js.map +0 -1
- package/dist/node/Logger.mjs +0 -26
- package/dist/node/Logger.mjs.map +0 -1
- package/dist/node/dump.js +0 -46
- package/dist/node/dump.js.map +0 -1
- package/dist/node/dump.mjs +0 -21
- package/dist/node/dump.mjs.map +0 -1
- package/dist/node/is-ip/index.js +0 -74
- package/dist/node/is-ip/index.js.map +0 -1
- package/dist/node/is-ip/index.mjs +0 -44
- package/dist/node/is-ip/index.mjs.map +0 -1
- package/dist/node/is-ip/ip-regex.js +0 -52
- package/dist/node/is-ip/ip-regex.js.map +0 -1
- package/dist/node/is-ip/ip-regex.mjs +0 -27
- package/dist/node/is-ip/ip-regex.mjs.map +0 -1
- package/dist/node/is-ip/is-ip.js +0 -74
- package/dist/node/is-ip/is-ip.js.map +0 -1
- package/dist/node/is-ip/is-ip.mjs +0 -44
- package/dist/node/is-ip/is-ip.mjs.map +0 -1
package/dist/browser/IdLogger.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// src/Logger.ts
|
|
2
|
-
import { handleError } from "@xyo-network/error";
|
|
3
|
-
var getFunctionName = (depth = 2) => {
|
|
4
|
-
try {
|
|
5
|
-
throw Error();
|
|
6
|
-
} catch (ex) {
|
|
7
|
-
return handleError(ex, (error) => {
|
|
8
|
-
let newIndex = void 0;
|
|
9
|
-
const stackParts = error.stack?.split("\n")[depth].split(" ");
|
|
10
|
-
const funcName = stackParts?.find((item, index) => {
|
|
11
|
-
if (item.length > 0 && item !== "at") {
|
|
12
|
-
if (item === "new") {
|
|
13
|
-
newIndex = index;
|
|
14
|
-
}
|
|
15
|
-
return item;
|
|
16
|
-
}
|
|
17
|
-
}) ?? "<unknown>";
|
|
18
|
-
return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// src/IdLogger.ts
|
|
24
|
-
var IdLogger = class {
|
|
25
|
-
_id;
|
|
26
|
-
_logger;
|
|
27
|
-
constructor(logger, id) {
|
|
28
|
-
this._logger = logger;
|
|
29
|
-
this._id = id;
|
|
30
|
-
}
|
|
31
|
-
set id(id) {
|
|
32
|
-
this._id = () => id;
|
|
33
|
-
}
|
|
34
|
-
debug(message) {
|
|
35
|
-
this._logger?.debug(this.generate(message, getFunctionName(3)));
|
|
36
|
-
}
|
|
37
|
-
error(message) {
|
|
38
|
-
this._logger?.error(this.generate(message, getFunctionName(3)));
|
|
39
|
-
}
|
|
40
|
-
info(message) {
|
|
41
|
-
this._logger?.info(this.generate(message, getFunctionName(3)));
|
|
42
|
-
}
|
|
43
|
-
log(message) {
|
|
44
|
-
this._logger?.log(this.generate(message, getFunctionName(3)));
|
|
45
|
-
}
|
|
46
|
-
warn(message) {
|
|
47
|
-
this._logger?.warn(this.generate(message, getFunctionName(3)));
|
|
48
|
-
}
|
|
49
|
-
generate(message, tag) {
|
|
50
|
-
return `${tag} ${this._id ? `[${this._id}] ` : ""}${typeof message === "string" ? message : typeof message === "object" ? JSON.stringify(message, null, 2) : `${message}`}`;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
export {
|
|
54
|
-
IdLogger
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=IdLogger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Logger.ts","../../src/IdLogger.ts"],"sourcesContent":["export type LogFunction = (message?: unknown) => void\nimport { handleError } from '@xyo-network/error'\n\n/**\n * Interface to handle overlap between Winston &\n * `console` with as much congruency as possible.\n */\nexport interface Logger {\n debug: LogFunction\n error: LogFunction\n info: LogFunction\n log: LogFunction\n // trace: LogFunction\n warn: LogFunction\n}\n\nexport const getFunctionName = (depth = 2) => {\n try {\n throw Error()\n } catch (ex) {\n return handleError(ex, (error) => {\n let newIndex: number | undefined = undefined\n const stackParts = error.stack?.split('\\n')[depth].split(' ')\n const funcName =\n stackParts?.find((item, index) => {\n if (item.length > 0 && item !== 'at') {\n //check if constructor\n if (item === 'new') {\n newIndex = index\n }\n return item\n }\n }) ?? '<unknown>'\n return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName\n })\n }\n}\n","import { getFunctionName, Logger } from './Logger'\n\nexport class IdLogger implements Logger {\n private _id?: () => string\n private _logger: Logger\n\n constructor(logger: Logger, id?: () => string) {\n this._logger = logger\n this._id = id\n }\n\n set id(id: string) {\n this._id = () => id\n }\n\n debug(message?: unknown) {\n this._logger?.debug(this.generate(message, getFunctionName(3)))\n }\n error(message?: unknown) {\n this._logger?.error(this.generate(message, getFunctionName(3)))\n }\n info(message?: unknown) {\n this._logger?.info(this.generate(message, getFunctionName(3)))\n }\n log(message?: unknown) {\n this._logger?.log(this.generate(message, getFunctionName(3)))\n }\n warn(message?: unknown) {\n this._logger?.warn(this.generate(message, getFunctionName(3)))\n }\n\n private generate(message?: unknown, tag?: string) {\n return `${tag} ${this._id ? `[${this._id}] ` : ''}${\n typeof message === 'string' ? message : typeof message === 'object' ? JSON.stringify(message, null, 2) : `${message}`\n }`\n }\n}\n"],"mappings":";AACA,SAAS,mBAAmB;AAerB,IAAM,kBAAkB,CAAC,QAAQ,MAAM;AAC5C,MAAI;AACF,UAAM,MAAM;AAAA,EACd,SAAS,IAAI;AACX,WAAO,YAAY,IAAI,CAAC,UAAU;AAChC,UAAI,WAA+B;AACnC,YAAM,aAAa,MAAM,OAAO,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG;AAC5D,YAAM,WACJ,YAAY,KAAK,CAAC,MAAM,UAAU;AAChC,YAAI,KAAK,SAAS,KAAK,SAAS,MAAM;AAEpC,cAAI,SAAS,OAAO;AAClB,uBAAW;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,MACF,CAAC,KAAK;AACR,aAAO,WAAW,GAAG,QAAQ,IAAI,aAAa,WAAW,CAAC,CAAC,KAAK;AAAA,IAClE,CAAC;AAAA,EACH;AACF;;;AClCO,IAAM,WAAN,MAAiC;AAAA,EAC9B;AAAA,EACA;AAAA,EAER,YAAY,QAAgB,IAAmB;AAC7C,SAAK,UAAU;AACf,SAAK,MAAM;AAAA,EACb;AAAA,EAEA,IAAI,GAAG,IAAY;AACjB,SAAK,MAAM,MAAM;AAAA,EACnB;AAAA,EAEA,MAAM,SAAmB;AACvB,SAAK,SAAS,MAAM,KAAK,SAAS,SAAS,gBAAgB,CAAC,CAAC,CAAC;AAAA,EAChE;AAAA,EACA,MAAM,SAAmB;AACvB,SAAK,SAAS,MAAM,KAAK,SAAS,SAAS,gBAAgB,CAAC,CAAC,CAAC;AAAA,EAChE;AAAA,EACA,KAAK,SAAmB;AACtB,SAAK,SAAS,KAAK,KAAK,SAAS,SAAS,gBAAgB,CAAC,CAAC,CAAC;AAAA,EAC/D;AAAA,EACA,IAAI,SAAmB;AACrB,SAAK,SAAS,IAAI,KAAK,SAAS,SAAS,gBAAgB,CAAC,CAAC,CAAC;AAAA,EAC9D;AAAA,EACA,KAAK,SAAmB;AACtB,SAAK,SAAS,KAAK,KAAK,SAAS,SAAS,gBAAgB,CAAC,CAAC,CAAC;AAAA,EAC/D;AAAA,EAEQ,SAAS,SAAmB,KAAc;AAChD,WAAO,GAAG,GAAG,IAAI,KAAK,MAAM,IAAI,KAAK,GAAG,OAAO,EAAE,GAC/C,OAAO,YAAY,WAAW,UAAU,OAAO,YAAY,WAAW,KAAK,UAAU,SAAS,MAAM,CAAC,IAAI,GAAG,OAAO,EACrH;AAAA,EACF;AACF;","names":[]}
|
package/dist/browser/Job/Job.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/Job/Job.ts
|
|
17
|
-
var Job_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(Job_exports);
|
|
19
|
-
//# sourceMappingURL=Job.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Job/Job.ts"],"sourcesContent":["import { Task } from './Task'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type VoidFunction = (...args: any[]) => void\n\nexport interface Job {\n name: string\n onComplete?: VoidFunction\n onFail?: VoidFunction\n onStart?: VoidFunction\n onSuccess?: VoidFunction\n schedule: string\n task: Task\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/browser/Job/Job.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=Job.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/Job/JobProvider.ts
|
|
17
|
-
var JobProvider_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(JobProvider_exports);
|
|
19
|
-
//# sourceMappingURL=JobProvider.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Job/JobProvider.ts"],"sourcesContent":["import { Job } from './Job'\n\nexport interface JobProvider {\n get jobs(): Job[]\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=JobProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/Job/Task.ts
|
|
17
|
-
var Task_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(Task_exports);
|
|
19
|
-
//# sourceMappingURL=Task.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Job/Task.ts"],"sourcesContent":["export type Task = () => Promise<void>\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/browser/Job/Task.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=Task.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/Job/index.ts
|
|
17
|
-
var Job_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(Job_exports);
|
|
19
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Job/index.ts"],"sourcesContent":["export * from './Job'\nexport * from './JobProvider'\nexport * from './Task'\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/browser/Logger.cjs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/Logger.ts
|
|
21
|
-
var Logger_exports = {};
|
|
22
|
-
__export(Logger_exports, {
|
|
23
|
-
getFunctionName: () => getFunctionName
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(Logger_exports);
|
|
26
|
-
var import_error = require("@xyo-network/error");
|
|
27
|
-
var getFunctionName = (depth = 2) => {
|
|
28
|
-
try {
|
|
29
|
-
throw Error();
|
|
30
|
-
} catch (ex) {
|
|
31
|
-
return (0, import_error.handleError)(ex, (error) => {
|
|
32
|
-
let newIndex = void 0;
|
|
33
|
-
const stackParts = error.stack?.split("\n")[depth].split(" ");
|
|
34
|
-
const funcName = stackParts?.find((item, index) => {
|
|
35
|
-
if (item.length > 0 && item !== "at") {
|
|
36
|
-
if (item === "new") {
|
|
37
|
-
newIndex = index;
|
|
38
|
-
}
|
|
39
|
-
return item;
|
|
40
|
-
}
|
|
41
|
-
}) ?? "<unknown>";
|
|
42
|
-
return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=Logger.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Logger.ts"],"sourcesContent":["export type LogFunction = (message?: unknown) => void\nimport { handleError } from '@xyo-network/error'\n\n/**\n * Interface to handle overlap between Winston &\n * `console` with as much congruency as possible.\n */\nexport interface Logger {\n debug: LogFunction\n error: LogFunction\n info: LogFunction\n log: LogFunction\n // trace: LogFunction\n warn: LogFunction\n}\n\nexport const getFunctionName = (depth = 2) => {\n try {\n throw Error()\n } catch (ex) {\n return handleError(ex, (error) => {\n let newIndex: number | undefined = undefined\n const stackParts = error.stack?.split('\\n')[depth].split(' ')\n const funcName =\n stackParts?.find((item, index) => {\n if (item.length > 0 && item !== 'at') {\n //check if constructor\n if (item === 'new') {\n newIndex = index\n }\n return item\n }\n }) ?? '<unknown>'\n return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4B;AAerB,IAAM,kBAAkB,CAAC,QAAQ,MAAM;AAC5C,MAAI;AACF,UAAM,MAAM;AAAA,EACd,SAAS,IAAI;AACX,eAAO,0BAAY,IAAI,CAAC,UAAU;AAChC,UAAI,WAA+B;AACnC,YAAM,aAAa,MAAM,OAAO,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG;AAC5D,YAAM,WACJ,YAAY,KAAK,CAAC,MAAM,UAAU;AAChC,YAAI,KAAK,SAAS,KAAK,SAAS,MAAM;AAEpC,cAAI,SAAS,OAAO;AAClB,uBAAW;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,MACF,CAAC,KAAK;AACR,aAAO,WAAW,GAAG,QAAQ,IAAI,aAAa,WAAW,CAAC,CAAC,KAAK;AAAA,IAClE,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/dist/browser/Logger.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// src/Logger.ts
|
|
2
|
-
import { handleError } from "@xyo-network/error";
|
|
3
|
-
var getFunctionName = (depth = 2) => {
|
|
4
|
-
try {
|
|
5
|
-
throw Error();
|
|
6
|
-
} catch (ex) {
|
|
7
|
-
return handleError(ex, (error) => {
|
|
8
|
-
let newIndex = void 0;
|
|
9
|
-
const stackParts = error.stack?.split("\n")[depth].split(" ");
|
|
10
|
-
const funcName = stackParts?.find((item, index) => {
|
|
11
|
-
if (item.length > 0 && item !== "at") {
|
|
12
|
-
if (item === "new") {
|
|
13
|
-
newIndex = index;
|
|
14
|
-
}
|
|
15
|
-
return item;
|
|
16
|
-
}
|
|
17
|
-
}) ?? "<unknown>";
|
|
18
|
-
return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
getFunctionName
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=Logger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Logger.ts"],"sourcesContent":["export type LogFunction = (message?: unknown) => void\nimport { handleError } from '@xyo-network/error'\n\n/**\n * Interface to handle overlap between Winston &\n * `console` with as much congruency as possible.\n */\nexport interface Logger {\n debug: LogFunction\n error: LogFunction\n info: LogFunction\n log: LogFunction\n // trace: LogFunction\n warn: LogFunction\n}\n\nexport const getFunctionName = (depth = 2) => {\n try {\n throw Error()\n } catch (ex) {\n return handleError(ex, (error) => {\n let newIndex: number | undefined = undefined\n const stackParts = error.stack?.split('\\n')[depth].split(' ')\n const funcName =\n stackParts?.find((item, index) => {\n if (item.length > 0 && item !== 'at') {\n //check if constructor\n if (item === 'new') {\n newIndex = index\n }\n return item\n }\n }) ?? '<unknown>'\n return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName\n })\n }\n}\n"],"mappings":";AACA,SAAS,mBAAmB;AAerB,IAAM,kBAAkB,CAAC,QAAQ,MAAM;AAC5C,MAAI;AACF,UAAM,MAAM;AAAA,EACd,SAAS,IAAI;AACX,WAAO,YAAY,IAAI,CAAC,UAAU;AAChC,UAAI,WAA+B;AACnC,YAAM,aAAa,MAAM,OAAO,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG;AAC5D,YAAM,WACJ,YAAY,KAAK,CAAC,MAAM,UAAU;AAChC,YAAI,KAAK,SAAS,KAAK,SAAS,MAAM;AAEpC,cAAI,SAAS,OAAO;AAClB,uBAAW;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,MACF,CAAC,KAAK;AACR,aAAO,WAAW,GAAG,QAAQ,IAAI,aAAa,WAAW,CAAC,CAAC,KAAK;AAAA,IAClE,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/dist/browser/dump.cjs
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/dump.ts
|
|
21
|
-
var dump_exports = {};
|
|
22
|
-
__export(dump_exports, {
|
|
23
|
-
dump: () => dump
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(dump_exports);
|
|
26
|
-
var dump = (obj) => {
|
|
27
|
-
const cache = [];
|
|
28
|
-
return JSON.stringify(
|
|
29
|
-
obj,
|
|
30
|
-
(key, value) => {
|
|
31
|
-
if (typeof value === "object" && value !== null) {
|
|
32
|
-
if (cache.includes(value)) {
|
|
33
|
-
return "[circular]";
|
|
34
|
-
}
|
|
35
|
-
cache.push(value);
|
|
36
|
-
}
|
|
37
|
-
return value;
|
|
38
|
-
},
|
|
39
|
-
2
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=dump.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/dump.ts"],"sourcesContent":["export const dump = (obj: unknown) => {\n const cache: unknown[] = []\n return JSON.stringify(\n obj,\n (key, value) => {\n if (typeof value === 'object' && value !== null) {\n // Duplicate reference found, discard key\n if (cache.includes(value)) {\n return '[circular]'\n }\n\n // Store value in our collection\n cache.push(value)\n }\n return value\n },\n 2,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,OAAO,CAAC,QAAiB;AACpC,QAAM,QAAmB,CAAC;AAC1B,SAAO,KAAK;AAAA,IACV;AAAA,IACA,CAAC,KAAK,UAAU;AACd,UAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAE/C,YAAI,MAAM,SAAS,KAAK,GAAG;AACzB,iBAAO;AAAA,QACT;AAGA,cAAM,KAAK,KAAK;AAAA,MAClB;AACA,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
package/dist/browser/dump.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// src/dump.ts
|
|
2
|
-
var dump = (obj) => {
|
|
3
|
-
const cache = [];
|
|
4
|
-
return JSON.stringify(
|
|
5
|
-
obj,
|
|
6
|
-
(key, value) => {
|
|
7
|
-
if (typeof value === "object" && value !== null) {
|
|
8
|
-
if (cache.includes(value)) {
|
|
9
|
-
return "[circular]";
|
|
10
|
-
}
|
|
11
|
-
cache.push(value);
|
|
12
|
-
}
|
|
13
|
-
return value;
|
|
14
|
-
},
|
|
15
|
-
2
|
|
16
|
-
);
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
dump
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=dump.js.map
|
package/dist/browser/dump.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/dump.ts"],"sourcesContent":["export const dump = (obj: unknown) => {\n const cache: unknown[] = []\n return JSON.stringify(\n obj,\n (key, value) => {\n if (typeof value === 'object' && value !== null) {\n // Duplicate reference found, discard key\n if (cache.includes(value)) {\n return '[circular]'\n }\n\n // Store value in our collection\n cache.push(value)\n }\n return value\n },\n 2,\n )\n}\n"],"mappings":";AAAO,IAAM,OAAO,CAAC,QAAiB;AACpC,QAAM,QAAmB,CAAC;AAC1B,SAAO,KAAK;AAAA,IACV;AAAA,IACA,CAAC,KAAK,UAAU;AACd,UAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAE/C,YAAI,MAAM,SAAS,KAAK,GAAG;AACzB,iBAAO;AAAA,QACT;AAGA,cAAM,KAAK,KAAK;AAAA,MAClB;AACA,aAAO;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/is-ip/index.ts
|
|
21
|
-
var is_ip_exports = {};
|
|
22
|
-
__export(is_ip_exports, {
|
|
23
|
-
ipVersion: () => ipVersion,
|
|
24
|
-
isIP: () => isIP,
|
|
25
|
-
isIPv4: () => isIPv4,
|
|
26
|
-
isIPv6: () => isIPv6
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(is_ip_exports);
|
|
29
|
-
|
|
30
|
-
// src/is-ip/ip-regex.ts
|
|
31
|
-
var word = "[a-fA-F\\d:]";
|
|
32
|
-
var boundry = (options) => options && options.includeBoundaries ? `(?:(?<=\\s|^)(?=${word})|(?<=${word})(?=\\s|$))` : "";
|
|
33
|
-
var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
|
|
34
|
-
var v6segment = "[a-fA-F\\d]{1,4}";
|
|
35
|
-
var v6 = `
|
|
36
|
-
(?:
|
|
37
|
-
(?:${v6segment}:){7}(?:${v6segment}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
38
|
-
(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
39
|
-
(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
40
|
-
(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
41
|
-
(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
42
|
-
(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
43
|
-
(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
44
|
-
(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
45
|
-
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
46
|
-
`.replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
|
|
47
|
-
var v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`);
|
|
48
|
-
var v4exact = new RegExp(`^${v4}$`);
|
|
49
|
-
var v6exact = new RegExp(`^${v6}$`);
|
|
50
|
-
var ipRegex = (options) => options && options.exact ? v46Exact : new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, "g");
|
|
51
|
-
ipRegex.v4 = (options) => options && options.exact ? v4exact : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, "g");
|
|
52
|
-
ipRegex.v6 = (options) => options && options.exact ? v6exact : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, "g");
|
|
53
|
-
|
|
54
|
-
// src/is-ip/is-ip.ts
|
|
55
|
-
function isIP(value) {
|
|
56
|
-
return ipRegex({ exact: true }).test(value);
|
|
57
|
-
}
|
|
58
|
-
function isIPv6(value) {
|
|
59
|
-
return ipRegex.v6({ exact: true }).test(value);
|
|
60
|
-
}
|
|
61
|
-
function isIPv4(value) {
|
|
62
|
-
return ipRegex.v4({ exact: true }).test(value);
|
|
63
|
-
}
|
|
64
|
-
function ipVersion(value) {
|
|
65
|
-
return isIP(value) ? isIPv6(value) ? 6 : 4 : void 0;
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/is-ip/index.ts","../../../src/is-ip/ip-regex.ts","../../../src/is-ip/is-ip.ts"],"sourcesContent":["export * from './is-ip'\n","const word = '[a-fA-F\\\\d:]'\n\nexport interface Options {\n readonly exact?: boolean\n readonly includeBoundaries?: boolean\n}\n\nconst boundry = (options: Options) => (options && options.includeBoundaries ? `(?:(?<=\\\\s|^)(?=${word})|(?<=${word})(?=\\\\s|$))` : '')\n\nconst v4 = '(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}'\n\nconst v6segment = '[a-fA-F\\\\d]{1,4}'\n\nconst v6 = `\n(?:\n(?:${v6segment}:){7}(?:${v6segment}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`\n .replace(/\\s*\\/\\/.*$/gm, '')\n .replace(/\\n/g, '')\n .trim()\n\n// Pre-compile only the exact regexes because adding a global flag make regexes stateful\nconst v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`)\nconst v4exact = new RegExp(`^${v4}$`)\nconst v6exact = new RegExp(`^${v6}$`)\n\nexport const ipRegex = (options: Options) =>\n options && options.exact\n ? v46Exact\n : new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, 'g')\n\nipRegex.v4 = (options: Options) => (options && options.exact ? v4exact : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, 'g'))\nipRegex.v6 = (options: Options) => (options && options.exact ? v6exact : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, 'g'))\n","import { ipRegex } from './ip-regex'\n\nexport function isIP(value: string) {\n return ipRegex({ exact: true }).test(value)\n}\n\nexport function isIPv6(value: string) {\n return ipRegex.v6({ exact: true }).test(value)\n}\n\nexport function isIPv4(value: string) {\n return ipRegex.v4({ exact: true }).test(value)\n}\n\nexport function ipVersion(value: string) {\n return isIP(value) ? (isIPv6(value) ? 6 : 4) : undefined\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAM,OAAO;AAOb,IAAM,UAAU,CAAC,YAAsB,WAAW,QAAQ,oBAAoB,mBAAmB,IAAI,SAAS,IAAI,gBAAgB;AAElI,IAAM,KAAK;AAEX,IAAM,YAAY;AAElB,IAAM,KAAK;AAAA;AAAA,KAEN,SAAS,WAAW,SAAS;AAAA,KAC7B,SAAS,WAAW,EAAE,KAAK,SAAS;AAAA,KACpC,SAAS,YAAY,EAAE,QAAQ,SAAS;AAAA,KACxC,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,aACtD,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA;AAAA,EAGhD,QAAQ,gBAAgB,EAAE,EAC1B,QAAQ,OAAO,EAAE,EACjB,KAAK;AAGR,IAAM,WAAW,IAAI,OAAO,OAAO,EAAE,UAAU,EAAE,IAAI;AACrD,IAAM,UAAU,IAAI,OAAO,IAAI,EAAE,GAAG;AACpC,IAAM,UAAU,IAAI,OAAO,IAAI,EAAE,GAAG;AAE7B,IAAM,UAAU,CAAC,YACtB,WAAW,QAAQ,QACf,WACA,IAAI,OAAO,MAAM,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,QAAQ,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,KAAK,GAAG;AAEvH,QAAQ,KAAK,CAAC,YAAsB,WAAW,QAAQ,QAAQ,UAAU,IAAI,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,IAAI,GAAG;AACtI,QAAQ,KAAK,CAAC,YAAsB,WAAW,QAAQ,QAAQ,UAAU,IAAI,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,IAAI,GAAG;;;ACtC/H,SAAS,KAAK,OAAe;AAClC,SAAO,QAAQ,EAAE,OAAO,KAAK,CAAC,EAAE,KAAK,KAAK;AAC5C;AAEO,SAAS,OAAO,OAAe;AACpC,SAAO,QAAQ,GAAG,EAAE,OAAO,KAAK,CAAC,EAAE,KAAK,KAAK;AAC/C;AAEO,SAAS,OAAO,OAAe;AACpC,SAAO,QAAQ,GAAG,EAAE,OAAO,KAAK,CAAC,EAAE,KAAK,KAAK;AAC/C;AAEO,SAAS,UAAU,OAAe;AACvC,SAAO,KAAK,KAAK,IAAK,OAAO,KAAK,IAAI,IAAI,IAAK;AACjD;","names":[]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// src/is-ip/ip-regex.ts
|
|
2
|
-
var word = "[a-fA-F\\d:]";
|
|
3
|
-
var boundry = (options) => options && options.includeBoundaries ? `(?:(?<=\\s|^)(?=${word})|(?<=${word})(?=\\s|$))` : "";
|
|
4
|
-
var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
|
|
5
|
-
var v6segment = "[a-fA-F\\d]{1,4}";
|
|
6
|
-
var v6 = `
|
|
7
|
-
(?:
|
|
8
|
-
(?:${v6segment}:){7}(?:${v6segment}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
9
|
-
(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
10
|
-
(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
11
|
-
(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
12
|
-
(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
13
|
-
(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
14
|
-
(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
15
|
-
(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
16
|
-
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
17
|
-
`.replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
|
|
18
|
-
var v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`);
|
|
19
|
-
var v4exact = new RegExp(`^${v4}$`);
|
|
20
|
-
var v6exact = new RegExp(`^${v6}$`);
|
|
21
|
-
var ipRegex = (options) => options && options.exact ? v46Exact : new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, "g");
|
|
22
|
-
ipRegex.v4 = (options) => options && options.exact ? v4exact : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, "g");
|
|
23
|
-
ipRegex.v6 = (options) => options && options.exact ? v6exact : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, "g");
|
|
24
|
-
|
|
25
|
-
// src/is-ip/is-ip.ts
|
|
26
|
-
function isIP(value) {
|
|
27
|
-
return ipRegex({ exact: true }).test(value);
|
|
28
|
-
}
|
|
29
|
-
function isIPv6(value) {
|
|
30
|
-
return ipRegex.v6({ exact: true }).test(value);
|
|
31
|
-
}
|
|
32
|
-
function isIPv4(value) {
|
|
33
|
-
return ipRegex.v4({ exact: true }).test(value);
|
|
34
|
-
}
|
|
35
|
-
function ipVersion(value) {
|
|
36
|
-
return isIP(value) ? isIPv6(value) ? 6 : 4 : void 0;
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
ipVersion,
|
|
40
|
-
isIP,
|
|
41
|
-
isIPv4,
|
|
42
|
-
isIPv6
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/is-ip/ip-regex.ts","../../../src/is-ip/is-ip.ts"],"sourcesContent":["const word = '[a-fA-F\\\\d:]'\n\nexport interface Options {\n readonly exact?: boolean\n readonly includeBoundaries?: boolean\n}\n\nconst boundry = (options: Options) => (options && options.includeBoundaries ? `(?:(?<=\\\\s|^)(?=${word})|(?<=${word})(?=\\\\s|$))` : '')\n\nconst v4 = '(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}'\n\nconst v6segment = '[a-fA-F\\\\d]{1,4}'\n\nconst v6 = `\n(?:\n(?:${v6segment}:){7}(?:${v6segment}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`\n .replace(/\\s*\\/\\/.*$/gm, '')\n .replace(/\\n/g, '')\n .trim()\n\n// Pre-compile only the exact regexes because adding a global flag make regexes stateful\nconst v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`)\nconst v4exact = new RegExp(`^${v4}$`)\nconst v6exact = new RegExp(`^${v6}$`)\n\nexport const ipRegex = (options: Options) =>\n options && options.exact\n ? v46Exact\n : new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, 'g')\n\nipRegex.v4 = (options: Options) => (options && options.exact ? v4exact : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, 'g'))\nipRegex.v6 = (options: Options) => (options && options.exact ? v6exact : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, 'g'))\n","import { ipRegex } from './ip-regex'\n\nexport function isIP(value: string) {\n return ipRegex({ exact: true }).test(value)\n}\n\nexport function isIPv6(value: string) {\n return ipRegex.v6({ exact: true }).test(value)\n}\n\nexport function isIPv4(value: string) {\n return ipRegex.v4({ exact: true }).test(value)\n}\n\nexport function ipVersion(value: string) {\n return isIP(value) ? (isIPv6(value) ? 6 : 4) : undefined\n}\n"],"mappings":";AAAA,IAAM,OAAO;AAOb,IAAM,UAAU,CAAC,YAAsB,WAAW,QAAQ,oBAAoB,mBAAmB,IAAI,SAAS,IAAI,gBAAgB;AAElI,IAAM,KAAK;AAEX,IAAM,YAAY;AAElB,IAAM,KAAK;AAAA;AAAA,KAEN,SAAS,WAAW,SAAS;AAAA,KAC7B,SAAS,WAAW,EAAE,KAAK,SAAS;AAAA,KACpC,SAAS,YAAY,EAAE,QAAQ,SAAS;AAAA,KACxC,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,aACtD,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA;AAAA,EAGhD,QAAQ,gBAAgB,EAAE,EAC1B,QAAQ,OAAO,EAAE,EACjB,KAAK;AAGR,IAAM,WAAW,IAAI,OAAO,OAAO,EAAE,UAAU,EAAE,IAAI;AACrD,IAAM,UAAU,IAAI,OAAO,IAAI,EAAE,GAAG;AACpC,IAAM,UAAU,IAAI,OAAO,IAAI,EAAE,GAAG;AAE7B,IAAM,UAAU,CAAC,YACtB,WAAW,QAAQ,QACf,WACA,IAAI,OAAO,MAAM,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,QAAQ,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,KAAK,GAAG;AAEvH,QAAQ,KAAK,CAAC,YAAsB,WAAW,QAAQ,QAAQ,UAAU,IAAI,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,IAAI,GAAG;AACtI,QAAQ,KAAK,CAAC,YAAsB,WAAW,QAAQ,QAAQ,UAAU,IAAI,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,IAAI,GAAG;;;ACtC/H,SAAS,KAAK,OAAe;AAClC,SAAO,QAAQ,EAAE,OAAO,KAAK,CAAC,EAAE,KAAK,KAAK;AAC5C;AAEO,SAAS,OAAO,OAAe;AACpC,SAAO,QAAQ,GAAG,EAAE,OAAO,KAAK,CAAC,EAAE,KAAK,KAAK;AAC/C;AAEO,SAAS,OAAO,OAAe;AACpC,SAAO,QAAQ,GAAG,EAAE,OAAO,KAAK,CAAC,EAAE,KAAK,KAAK;AAC/C;AAEO,SAAS,UAAU,OAAe;AACvC,SAAO,KAAK,KAAK,IAAK,OAAO,KAAK,IAAI,IAAI,IAAK;AACjD;","names":[]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/is-ip/ip-regex.ts
|
|
21
|
-
var ip_regex_exports = {};
|
|
22
|
-
__export(ip_regex_exports, {
|
|
23
|
-
ipRegex: () => ipRegex
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(ip_regex_exports);
|
|
26
|
-
var word = "[a-fA-F\\d:]";
|
|
27
|
-
var boundry = (options) => options && options.includeBoundaries ? `(?:(?<=\\s|^)(?=${word})|(?<=${word})(?=\\s|$))` : "";
|
|
28
|
-
var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
|
|
29
|
-
var v6segment = "[a-fA-F\\d]{1,4}";
|
|
30
|
-
var v6 = `
|
|
31
|
-
(?:
|
|
32
|
-
(?:${v6segment}:){7}(?:${v6segment}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
33
|
-
(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
34
|
-
(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
35
|
-
(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
36
|
-
(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
37
|
-
(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
38
|
-
(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
39
|
-
(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
40
|
-
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
41
|
-
`.replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
|
|
42
|
-
var v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`);
|
|
43
|
-
var v4exact = new RegExp(`^${v4}$`);
|
|
44
|
-
var v6exact = new RegExp(`^${v6}$`);
|
|
45
|
-
var ipRegex = (options) => options && options.exact ? v46Exact : new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, "g");
|
|
46
|
-
ipRegex.v4 = (options) => options && options.exact ? v4exact : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, "g");
|
|
47
|
-
ipRegex.v6 = (options) => options && options.exact ? v6exact : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, "g");
|
|
48
|
-
//# sourceMappingURL=ip-regex.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/is-ip/ip-regex.ts"],"sourcesContent":["const word = '[a-fA-F\\\\d:]'\n\nexport interface Options {\n readonly exact?: boolean\n readonly includeBoundaries?: boolean\n}\n\nconst boundry = (options: Options) => (options && options.includeBoundaries ? `(?:(?<=\\\\s|^)(?=${word})|(?<=${word})(?=\\\\s|$))` : '')\n\nconst v4 = '(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}'\n\nconst v6segment = '[a-fA-F\\\\d]{1,4}'\n\nconst v6 = `\n(?:\n(?:${v6segment}:){7}(?:${v6segment}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`\n .replace(/\\s*\\/\\/.*$/gm, '')\n .replace(/\\n/g, '')\n .trim()\n\n// Pre-compile only the exact regexes because adding a global flag make regexes stateful\nconst v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`)\nconst v4exact = new RegExp(`^${v4}$`)\nconst v6exact = new RegExp(`^${v6}$`)\n\nexport const ipRegex = (options: Options) =>\n options && options.exact\n ? v46Exact\n : new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, 'g')\n\nipRegex.v4 = (options: Options) => (options && options.exact ? v4exact : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, 'g'))\nipRegex.v6 = (options: Options) => (options && options.exact ? v6exact : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, 'g'))\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAM,OAAO;AAOb,IAAM,UAAU,CAAC,YAAsB,WAAW,QAAQ,oBAAoB,mBAAmB,IAAI,SAAS,IAAI,gBAAgB;AAElI,IAAM,KAAK;AAEX,IAAM,YAAY;AAElB,IAAM,KAAK;AAAA;AAAA,KAEN,SAAS,WAAW,SAAS;AAAA,KAC7B,SAAS,WAAW,EAAE,KAAK,SAAS;AAAA,KACpC,SAAS,YAAY,EAAE,QAAQ,SAAS;AAAA,KACxC,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,aACtD,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA;AAAA,EAGhD,QAAQ,gBAAgB,EAAE,EAC1B,QAAQ,OAAO,EAAE,EACjB,KAAK;AAGR,IAAM,WAAW,IAAI,OAAO,OAAO,EAAE,UAAU,EAAE,IAAI;AACrD,IAAM,UAAU,IAAI,OAAO,IAAI,EAAE,GAAG;AACpC,IAAM,UAAU,IAAI,OAAO,IAAI,EAAE,GAAG;AAE7B,IAAM,UAAU,CAAC,YACtB,WAAW,QAAQ,QACf,WACA,IAAI,OAAO,MAAM,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,QAAQ,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,KAAK,GAAG;AAEvH,QAAQ,KAAK,CAAC,YAAsB,WAAW,QAAQ,QAAQ,UAAU,IAAI,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,IAAI,GAAG;AACtI,QAAQ,KAAK,CAAC,YAAsB,WAAW,QAAQ,QAAQ,UAAU,IAAI,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,IAAI,GAAG;","names":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// src/is-ip/ip-regex.ts
|
|
2
|
-
var word = "[a-fA-F\\d:]";
|
|
3
|
-
var boundry = (options) => options && options.includeBoundaries ? `(?:(?<=\\s|^)(?=${word})|(?<=${word})(?=\\s|$))` : "";
|
|
4
|
-
var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
|
|
5
|
-
var v6segment = "[a-fA-F\\d]{1,4}";
|
|
6
|
-
var v6 = `
|
|
7
|
-
(?:
|
|
8
|
-
(?:${v6segment}:){7}(?:${v6segment}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
9
|
-
(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
10
|
-
(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
11
|
-
(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
12
|
-
(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
13
|
-
(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
14
|
-
(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
15
|
-
(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
16
|
-
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
17
|
-
`.replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
|
|
18
|
-
var v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`);
|
|
19
|
-
var v4exact = new RegExp(`^${v4}$`);
|
|
20
|
-
var v6exact = new RegExp(`^${v6}$`);
|
|
21
|
-
var ipRegex = (options) => options && options.exact ? v46Exact : new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, "g");
|
|
22
|
-
ipRegex.v4 = (options) => options && options.exact ? v4exact : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, "g");
|
|
23
|
-
ipRegex.v6 = (options) => options && options.exact ? v6exact : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, "g");
|
|
24
|
-
export {
|
|
25
|
-
ipRegex
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=ip-regex.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/is-ip/ip-regex.ts"],"sourcesContent":["const word = '[a-fA-F\\\\d:]'\n\nexport interface Options {\n readonly exact?: boolean\n readonly includeBoundaries?: boolean\n}\n\nconst boundry = (options: Options) => (options && options.includeBoundaries ? `(?:(?<=\\\\s|^)(?=${word})|(?<=${word})(?=\\\\s|$))` : '')\n\nconst v4 = '(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)(?:\\\\.(?:25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]\\\\d|\\\\d)){3}'\n\nconst v6segment = '[a-fA-F\\\\d]{1,4}'\n\nconst v6 = `\n(?:\n(?:${v6segment}:){7}(?:${v6segment}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`\n .replace(/\\s*\\/\\/.*$/gm, '')\n .replace(/\\n/g, '')\n .trim()\n\n// Pre-compile only the exact regexes because adding a global flag make regexes stateful\nconst v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`)\nconst v4exact = new RegExp(`^${v4}$`)\nconst v6exact = new RegExp(`^${v6}$`)\n\nexport const ipRegex = (options: Options) =>\n options && options.exact\n ? v46Exact\n : new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, 'g')\n\nipRegex.v4 = (options: Options) => (options && options.exact ? v4exact : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, 'g'))\nipRegex.v6 = (options: Options) => (options && options.exact ? v6exact : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, 'g'))\n"],"mappings":";AAAA,IAAM,OAAO;AAOb,IAAM,UAAU,CAAC,YAAsB,WAAW,QAAQ,oBAAoB,mBAAmB,IAAI,SAAS,IAAI,gBAAgB;AAElI,IAAM,KAAK;AAEX,IAAM,YAAY;AAElB,IAAM,KAAK;AAAA;AAAA,KAEN,SAAS,WAAW,SAAS;AAAA,KAC7B,SAAS,WAAW,EAAE,KAAK,SAAS;AAAA,KACpC,SAAS,YAAY,EAAE,QAAQ,SAAS;AAAA,KACxC,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,KAC9D,SAAS,eAAe,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA,aACtD,SAAS,UAAU,EAAE,QAAQ,SAAS;AAAA;AAAA,EAGhD,QAAQ,gBAAgB,EAAE,EAC1B,QAAQ,OAAO,EAAE,EACjB,KAAK;AAGR,IAAM,WAAW,IAAI,OAAO,OAAO,EAAE,UAAU,EAAE,IAAI;AACrD,IAAM,UAAU,IAAI,OAAO,IAAI,EAAE,GAAG;AACpC,IAAM,UAAU,IAAI,OAAO,IAAI,EAAE,GAAG;AAE7B,IAAM,UAAU,CAAC,YACtB,WAAW,QAAQ,QACf,WACA,IAAI,OAAO,MAAM,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,QAAQ,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,KAAK,GAAG;AAEvH,QAAQ,KAAK,CAAC,YAAsB,WAAW,QAAQ,QAAQ,UAAU,IAAI,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,IAAI,GAAG;AACtI,QAAQ,KAAK,CAAC,YAAsB,WAAW,QAAQ,QAAQ,UAAU,IAAI,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,EAAE,GAAG,QAAQ,OAAO,CAAC,IAAI,GAAG;","names":[]}
|