hap-nodejs 1.0.0-alpha.16 → 1.0.0-alpha.18
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkName.d.ts","sourceRoot":"","sources":["../../../src/lib/util/checkName.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"checkName.d.ts","sourceRoot":"","sources":["../../../src/lib/util/checkName.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAe7E"}
|
|
@@ -8,17 +8,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.checkName = checkName;
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
10
10
|
function checkName(displayName, name, value) {
|
|
11
|
-
var empty = !value ? true : false; // Check if value is empty
|
|
12
11
|
var validHK = /^[a-zA-Z0-9\s'-.]+$/; // Ensure only letter, numbers, apostrophe, or dash
|
|
13
12
|
var startWith = /^[a-zA-Z0-9]/; // Ensure only letters or numbers are at the beginning of string
|
|
14
13
|
var endWith = /[a-zA-Z0-9]$/; // Ensure only letters or numbers are at the end of string
|
|
15
|
-
var pattern =
|
|
16
|
-
: !
|
|
17
|
-
: !
|
|
18
|
-
:
|
|
19
|
-
if (
|
|
14
|
+
var pattern = !validHK.test(value) ? "doesn't have only letter, numbers, apostrophe, or dash"
|
|
15
|
+
: !startWith.test(value) ? "doesn't start with letter or number,"
|
|
16
|
+
: !endWith.test(value) ? "doesn't end with letter or number,"
|
|
17
|
+
: "";
|
|
18
|
+
if (!validHK.test(value) || !startWith.test(value) || !endWith.test(value)) {
|
|
20
19
|
console.warn("HAP-NodeJS WARNING: The accessory '" + displayName + "' is getting published with the characteristic '" +
|
|
21
|
-
name + "'" + " not following HomeKit naming rules ('" + value + "', " + "with a pattern that'" + pattern + "'." +
|
|
20
|
+
name + "'" + " not following HomeKit naming rules ('" + value + "'), " + "with a pattern that'" + pattern + "'." +
|
|
22
21
|
"Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. " +
|
|
23
22
|
"This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!");
|
|
24
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkName.js","sourceRoot":"","sources":["../../../src/lib/util/checkName.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAGH,
|
|
1
|
+
{"version":3,"file":"checkName.js","sourceRoot":"","sources":["../../../src/lib/util/checkName.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAGH,8BAeC;AAhBD,iHAAiH;AACjH,SAAgB,SAAS,CAAC,WAAmB,EAAE,IAAY,EAAE,KAAU;IACrE,IAAM,OAAO,GAAG,qBAAqB,CAAC,CAAE,mDAAmD;IAC3F,IAAM,SAAS,GAAG,cAAc,CAAC,CAAO,gEAAgE;IACxG,IAAM,OAAO,GAAG,cAAc,CAAC,CAAS,0DAA0D;IAClG,IAAM,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,wDAAwD;QAC7F,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,sCAAsC;YAC/D,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,oCAAoC;gBAC3D,CAAC,CAAC,EAAE,CAAC;IAEX,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3E,OAAO,CAAC,IAAI,CAAC,qCAAqC,GAAG,WAAW,GAAG,kDAAkD;YACnH,IAAI,GAAG,GAAG,GAAG,wCAAwC,GAAG,KAAK,GAAG,MAAM,GAAG,sBAAsB,GAAG,OAAO,GAAG,IAAI;YAChH,4IAA4I;YAC5I,mHAAmH,CAAC,CAAC;IACzH,CAAC;AACH,CAAC"}
|