/**
 * @description: 对象拷贝
 * @author ChenRui
 * @date 2020/7/29 18:46
 */
class BeanUtilsService {
  /**
   * @description: 对象拷贝
   * @author ChenRui
   * @date 2020/8/29 19:54
   */
  copy(obj: any): any {
    if (obj != null) {
      return JSON.parse(JSON.stringify(obj));
    }
    return "";
  }

  /**
   * @description: 字符串转对象
   * @author ChenRui
   * @date 2020/8/29 19:54
   */
  parse(str: string | null): any {
    if (str != null && str !== "") {
      return JSON.parse(str);
    }
    return null;
  }

  /**
   * @description: 对象转字符串
   * @author ChenRui
   * @date 2020/8/29 19:54
   */
  stringify(obj: any): string {
    if (obj != null) {
      return JSON.stringify(obj);
    }
    return "";
  }
}
const beanUtilsService = new BeanUtilsService();
export default beanUtilsService;
