itool
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

i-tools# 介绍

通用函数工具库

安装

npm install itool

导入

import { formatTime, htmlEscape,htmlUnEscape,formatMoney } form 'itool'

格式化时间

//时间格式化
const time = new Date()

const formatTime = formatTime(time) //2022年1月22日 21:03:55

const formatTime = formatTime(time, false) //21:03:55
// 人民币格式化
const formatMoney = formatMoney(12345.678) // ¥12,345.68
// html转义(防止xxs攻击)
const htmlEscape = htmlEscape('<h1>hello</h1>') // &lt;h1&gt;hello&lt;/h1&gt;
// 浏览器缓存
cache.setCache(key, value) // 设置
cache.getCache(key) // 获取
cache.deleceCache(key) // 删除
cache.clearCache() // 清空

开源协议

ISC

/itool/

    Package Sidebar

    Install

    npm i itool

    Weekly Downloads

    1

    Version

    1.0.8

    License

    ISC

    Unpacked Size

    14.6 kB

    Total Files

    10

    Last publish

    Collaborators

    • xiyuer