1.0.0 • Published 2 years ago

an-utils999 v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

安装

npm install an-utils

yarn add an-utils

导入

const anutils = require('an-utils')

格式化时间

const dtStr = anutils.dateFormat(new Date());
console.log(dtStr);
<!-- 2022-05-23  11:42:48 -->

html 转义 和 转义成 html

const htStr = anutils.htmlEscape("<h1>这是h1标签</h1>");
console.log(htStr);
// &lt;h1&gt;这是h1标签&lt;/h1&gt;

const htStr2 = anutils.htmlUnEscape("&lt;,&gt;");
console.log(htStr2);
// <,>

格式化金钱

const money = anutils.moneyFormat(100);
console.log(money);
// ¥100

开源协议

ISC