mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-27 01:11:35 +00:00
缩进
This commit is contained in:
parent
ef2d49e93d
commit
559a897896
@ -20,34 +20,35 @@ import {CommonFunctions} from "../../../utils/checkUtils";
|
||||
|
||||
export class CheckErrorCode {
|
||||
|
||||
static errorCodeList: number[] = [201, 202, 203, 301, 401, 501, 502, 801, 901];
|
||||
static errorCodeList: number[] = [201, 202, 203, 301, 401, 501, 502, 801, 901];
|
||||
|
||||
static isArrayNotEmpty(arr: any): boolean {
|
||||
return Array.isArray(arr) && arr.length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断数组arr1中的每个数字是否在数组arr2中
|
||||
* @param arr1
|
||||
* @param arr2
|
||||
*/
|
||||
static hasNumberInArray(arr1: number[], arr2: number[]): boolean {
|
||||
return arr1.every(num => arr2.includes(num));
|
||||
}
|
||||
|
||||
static checkErrorCode(apiJsdoc: Comment.JsDocInfo): ErrorTagFormat {
|
||||
const checkResult: ErrorTagFormat = {
|
||||
state: true,
|
||||
errorInfo: '',
|
||||
};
|
||||
|
||||
const errorCodes = apiJsdoc.errorCodes.filter(number => number >= 100 && number < 1000);;
|
||||
if (this.isArrayNotEmpty(errorCodes)) {
|
||||
if (!this.hasNumberInArray(errorCodes, this.errorCodeList)) {
|
||||
checkResult.state = false;
|
||||
checkResult.errorInfo = ErrorMessage.ERROR_ERROR_CODE;
|
||||
}
|
||||
}
|
||||
return checkResult;
|
||||
static isArrayNotEmpty(arr: any): boolean {
|
||||
return Array.isArray(arr) && arr.length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断数组arr1中的每个数字是否在数组arr2中
|
||||
* @param arr1
|
||||
* @param arr2
|
||||
*/
|
||||
static hasNumberInArray(arr1: number[], arr2: number[]): boolean {
|
||||
return arr1.every(num => arr2.includes(num));
|
||||
}
|
||||
|
||||
static checkErrorCode(apiJsdoc: Comment.JsDocInfo): ErrorTagFormat {
|
||||
const checkResult: ErrorTagFormat = {
|
||||
state: true,
|
||||
errorInfo: '',
|
||||
};
|
||||
|
||||
const errorCodes = apiJsdoc.errorCodes.filter(number => number >= 100 && number < 1000);
|
||||
;
|
||||
if (this.isArrayNotEmpty(errorCodes)) {
|
||||
if (!this.hasNumberInArray(errorCodes, this.errorCodeList)) {
|
||||
checkResult.state = false;
|
||||
checkResult.errorInfo = ErrorMessage.ERROR_ERROR_CODE;
|
||||
}
|
||||
}
|
||||
return checkResult;
|
||||
}
|
||||
}
|
@ -24,15 +24,15 @@
|
||||
* @since 6
|
||||
*/
|
||||
export interface StartBLEScanOptions {
|
||||
/**
|
||||
* Initializes the connected NFC tag.
|
||||
*
|
||||
* @throws { BusinessError } 209 - Capability not supported.
|
||||
* @throws { BusinessError } 3200101 - Connected NFC tag running state is abnormal in service.
|
||||
* @syscap SystemCapability.Communication.ConnectedTag
|
||||
* @since 9
|
||||
*/
|
||||
initialize(): void;
|
||||
/**
|
||||
* Initializes the connected NFC tag.
|
||||
*
|
||||
* @throws { BusinessError } 209 - Capability not supported.
|
||||
* @throws { BusinessError } 3200101 - Connected NFC tag running state is abnormal in service.
|
||||
* @syscap SystemCapability.Communication.ConnectedTag
|
||||
* @since 9
|
||||
*/
|
||||
initialize(): void;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user