@xapp/arachne-utils 1.1.1 → 1.2.2

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.
@@ -0,0 +1,7 @@
1
+ /*! Copyright (c) 2024, XAPP AI */
2
+ /**
3
+ * Looks for common hallucinated phone numbers.
4
+ * @param number
5
+ * @returns
6
+ */
7
+ export declare function isHallucinatedPhoneNumber(number: string): boolean;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ /*! Copyright (c) 2024, XAPP AI */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.isHallucinatedPhoneNumber = void 0;
5
+ /**
6
+ * Looks for common hallucinated phone numbers.
7
+ * @param number
8
+ * @returns
9
+ */
10
+ function isHallucinatedPhoneNumber(number) {
11
+ // Remove non-digit characters from the input
12
+ const digits = number.replace(/\D/g, '');
13
+ // Check for hallucinated numbers
14
+ const hallucinatedPatterns = [
15
+ /^555\d{7}$/, // 10 digits starting with '555'
16
+ /^1?555\d{7}$/, // 10 or 11 digits with optional '1', starting with '555'
17
+ /1?\d{3}555\d{4}$/,
18
+ /555\d{4}$/,
19
+ /^(0123456789|1234567890|9876543210)$/, // 10 digits sequential
20
+ /(01234567|1234567|7654321|9876543|3214567)/, // 7 digits sequential
21
+ /(0{10}|1{10}|2{10}|3{10}|4{10}|5{10}|6{10}|7{10}|8{10}|9{10})/, // 10 digits repeated
22
+ /(0{7}|1{7}|2{7}|3{7}|4{7}|5{7}|6{7}|7{7}|8{7}|9{7})/, // 7 digits repeated
23
+ /^(\d)\1{2}\1{3}\1{4}$/, // '5555555555' pattern
24
+ /^1?(\d)\1{2}\1{2}\1{3}$/, // '15555555555' pattern
25
+ /^(\d)\1{2}\1{3}$/, // '5555555' pattern
26
+ /^1\d{2}555\d{4}$/, // '12125550183' pattern
27
+ ];
28
+ return hallucinatedPatterns.some(pattern => pattern.test(digits));
29
+ }
30
+ exports.isHallucinatedPhoneNumber = isHallucinatedPhoneNumber;
31
+ //# sourceMappingURL=hallucinationDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hallucinationDetector.js","sourceRoot":"","sources":["../src/hallucinationDetector.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;AAElC;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,MAAc;IACpD,6CAA6C;IAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAEzC,iCAAiC;IACjC,MAAM,oBAAoB,GAAG;QACzB,YAAY,EAAE,gCAAgC;QAC9C,cAAc,EAAE,yDAAyD;QACzE,kBAAkB;QAClB,WAAW;QACX,sCAAsC,EAAE,uBAAuB;QAC/D,4CAA4C,EAAE,sBAAsB;QACpE,+DAA+D,EAAE,qBAAqB;QACtF,qDAAqD,EAAE,oBAAoB;QAC3E,uBAAuB,EAAE,uBAAuB;QAChD,yBAAyB,EAAE,wBAAwB;QACnD,kBAAkB,EAAE,oBAAoB;QACxC,kBAAkB,EAAE,wBAAwB;KAC/C,CAAC;IAEF,OAAO,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AACtE,CAAC;AArBD,8DAqBC"}
package/lib/index.d.ts CHANGED
@@ -2,3 +2,4 @@
2
2
  export * from "./ArachneURLPattern";
3
3
  export * from "./normalizeURL";
4
4
  export * from "./promiseWithTimeout";
5
+ export * from "./hallucinationDetector";
package/lib/index.js CHANGED
@@ -18,4 +18,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  __exportStar(require("./ArachneURLPattern"), exports);
19
19
  __exportStar(require("./normalizeURL"), exports);
20
20
  __exportStar(require("./promiseWithTimeout"), exports);
21
+ __exportStar(require("./hallucinationDetector"), exports);
21
22
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;;;;;AAElC,sDAAoC;AACpC,iDAA+B;AAC/B,uDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;;;;;AAElC,sDAAoC;AACpC,iDAA+B;AAC/B,uDAAqC;AACrC,0DAAwC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xapp/arachne-utils",
3
- "version": "1.1.1",
3
+ "version": "1.2.2",
4
4
  "types": "lib/index",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -17,11 +17,11 @@
17
17
  "@microsoft/api-extractor": "7.39.1",
18
18
  "@types/chai": "4.3.11",
19
19
  "@types/mocha": "10.0.6",
20
- "@types/node": "18.19.6",
20
+ "@types/node": "18.19.8",
21
21
  "@types/sinon": "17.0.3",
22
22
  "@types/sinon-chai": "3.2.12",
23
23
  "@xapp/config": "0.2.3",
24
- "chai": "4.4.0",
24
+ "chai": "4.4.1",
25
25
  "mocha": "10.2.0",
26
26
  "sinon": "17.0.1",
27
27
  "sinon-chai": "3.7.0",
@@ -38,5 +38,5 @@
38
38
  "clean": "rm -rf ./lib/*",
39
39
  "test": "mocha --recursive -r ts-node/register \"./src/**/*.test.ts\""
40
40
  },
41
- "gitHead": "56a747b7077c81612b7968e5ace16b886b006f76"
41
+ "gitHead": "3b4279e8e24beba12e3f8e29275f83ef1ce02086"
42
42
  }