Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@iot9x.com/ipc-utils

iot9x.com76MIT0.1.8TypeScript support: included

九星云、九星小程序、九星配置工具所共用的库方法

jx, utils, Modbus, Modbus RTU, Modbus TCP, Modbus PDU, DL/T645, DL/T645-1997, DL/T645-2007, DLT645, DLT645-1997, DLT645-2007, HJ212, CJ188, CJ/T188, CJT188

readme

描述

九星云、九星小程序、九星配置工具所共用的库方法。

特殊说明

  1. 由于考虑到小程序,所以不要支持Buffer,所以Buffer部分全部使用Int8Array来代替。

如何使用

$ pnpm add @iot9x.com/ipc-utils
import {
    RegularUtil,
    ConversionUtil,
    dataFormatUtil
} from '@iot9x.com/ipc-utils'
// 检查是否为空
RegularUtil.isEmpty(null); // true
RegularUtil.isEmpty({}); // true
RegularUtil.isEmpty([]); // true

// 进制转换
ConversionUtil.hexToStr('31 32 33'); // 123
ConversionUtil.strToHex('123'); // 313233
ConversionUtil.strToHex('123', true); // 31 32 33

// 时间日期转换
dataFormatUtil.formatDate(Date.now()); // 2023-09-07 16:46:22
dataFormatUtil.formatHms(Date.now()); // 16:46:22