19b256929Sopenharmony_ci/*
29b256929Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
39b256929Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49b256929Sopenharmony_ci * you may not use this file except in compliance with the License.
59b256929Sopenharmony_ci * You may obtain a copy of the License at
69b256929Sopenharmony_ci *
79b256929Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
89b256929Sopenharmony_ci *
99b256929Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109b256929Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119b256929Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129b256929Sopenharmony_ci * See the License for the specific language governing permissions and
139b256929Sopenharmony_ci * limitations under the License.
149b256929Sopenharmony_ci */
159b256929Sopenharmony_ci
169b256929Sopenharmony_ciexport class CheckEmptyUtils {
179b256929Sopenharmony_ci
189b256929Sopenharmony_ci  /**
199b256929Sopenharmony_ci     * Check obj is empty.
209b256929Sopenharmony_ci     *
219b256929Sopenharmony_ci     * @param {Object} obj need checked object
229b256929Sopenharmony_ci     * @return {boolean} true(empty)
239b256929Sopenharmony_ci     */
249b256929Sopenharmony_ci  static isEmpty(obj) {
259b256929Sopenharmony_ci    return (typeof obj === 'undefined' || obj === null || obj === '' || Object.keys(obj).length === 0);
269b256929Sopenharmony_ci  }
279b256929Sopenharmony_ci
289b256929Sopenharmony_ci  /**
299b256929Sopenharmony_ci     * Check str is empty.
309b256929Sopenharmony_ci     *
319b256929Sopenharmony_ci     * @param {string} str need checked string
329b256929Sopenharmony_ci     * @return {boolean} true(empty)
339b256929Sopenharmony_ci     */
349b256929Sopenharmony_ci  static checkStrIsEmpty(str) {
359b256929Sopenharmony_ci    return str.trim().length === 0;
369b256929Sopenharmony_ci  }
379b256929Sopenharmony_ci
389b256929Sopenharmony_ci  /**
399b256929Sopenharmony_ci     * Check array is empty.
409b256929Sopenharmony_ci     *
419b256929Sopenharmony_ci     * @param {Array} arr need checked array
429b256929Sopenharmony_ci     * @return {boolean} true(empty)
439b256929Sopenharmony_ci     */
449b256929Sopenharmony_ci  static isEmptyArr(arr) {
459b256929Sopenharmony_ci    return arr.length === 0;
469b256929Sopenharmony_ci  }
479b256929Sopenharmony_ci}