leo-jsutils
v1.0.5
Published
js工具
Downloads
8
Readme
安装
npm install leo-jsutils -S
引入方式
import { DateTimeUtil, ObjectUtil } from "leo-jsutils";
例如:DateTimeUtil.formatDate(new Date(), "yyyy-MM-dd hh:mm:ss"); // 2022-03-22 09:00:00
ObjectUtil.isEmptyObject({}); // true
DateTimeUtil模块包含的方法
| 方法 | 返回值 | 示例 | | ---- | ---- | ---- | | formatDate(date:DateObject, fmt:String) | 将日期按指定方式格式化后的字符串 | DateTimeUtil.getDateTimeNow(new Date(), 'yyyy-MM-dd hh-mm-ss') // 2022-03-22 09:00:00|
ObjectUtil模块包含的方法
| 方法 | 返回值 | 示例 | | ---- | ---- | ---- | | isString(str) | true/false | ObjectUtil.isString('abc') // true| | isArray(obj) | true/false | ObjectUtil.isArray(['abc']) // true| | isObject(obj) | true/false | ObjectUtil.isObject({"key": "value"}) // true| | isFunction(obj) | true/false | ObjectUtil.isFunction('abc') // false| | isEmptyObject(obj) | true/false | ObjectUtil.isEmptyObject({}) // true| | isEmptyArray(arr) | true/false | ObjectUtil.isEmptyArray([]) // true|