hap-nodejs 1.0.0-alpha.13 → 1.0.0-alpha.14
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,CAY7E"}
|
|
@@ -8,10 +8,11 @@ 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
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
|
|
11
|
+
var empty = !value ? true : false; // Check if value is empty
|
|
12
|
+
var validHK = /^[a-zA-Z0-9\s'-.]+$/; // Ensure only letter, numbers, apostrophe, or dash
|
|
13
|
+
var startWith = /^[a-zA-Z0-9]/; // Ensure only letters or numbers are at the beginning of string
|
|
14
|
+
var endWith = /[a-zA-Z0-9]$/; // Ensure only letters or numbers are at the end of string
|
|
15
|
+
if (empty || !validHK.test(value) || !startWith.test(value) || !endWith.test(value)) {
|
|
15
16
|
console.warn("HAP-NodeJS WARNING: The accessory '" + displayName + "' is getting published with the characteristic '" +
|
|
16
17
|
name + "'" + " not following HomeKit naming rules ('" + value + "'). " +
|
|
17
18
|
"Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. " +
|
|
@@ -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,8BAYC;AAbD,iHAAiH;AACjH,SAAgB,SAAS,CAAC,WAAmB,EAAE,IAAY,EAAE,KAAU;IACrE,IAAM,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAI,0BAA0B;IAClE,IAAM,OAAO,GAAG,qBAAqB,CAAC,CAAE,mDAAmD;IAC3F,IAAM,SAAS,GAAG,cAAc,CAAC,CAAO,gEAAgE;IACxG,IAAM,OAAO,GAAG,cAAc,CAAC,CAAS,0DAA0D;IAElG,IAAI,KAAK,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;QACpF,OAAO,CAAC,IAAI,CAAC,qCAAqC,GAAG,WAAW,GAAG,kDAAkD;YACnH,IAAI,GAAG,GAAG,GAAG,wCAAwC,GAAG,KAAK,GAAG,MAAM;YACtE,4IAA4I;YAC5I,mHAAmH,CAAC,CAAC;IACzH,CAAC;AACH,CAAC"}
|