@aclai4067/utilities 中文文档教程
Ashley Claiborne's Utilities NPM Library
Install
$ npm install @aclai4067/utilities
Usage
printToDom - 用于从 javascript 文件构建 html 的可重用代码 传入一个要打印的元素 id,然后传入一个包含 html 的变量名以打印
printToDom(div1, htmlStringVariable);
arrayToList - 循环遍历不包含对象的数组并将每个条目打印为 li 元素 传入您的数组名称,然后传入目标 UL 或 OL 元素的 id
arrayToList(arrayVariable, ulId1);
usCurrencyFormatter - 将数字转换为美国货币格式
usCurrencyFormatter.format(18793);
Ashley Claiborne's Utilities NPM Library
Install
$ npm install @aclai4067/utilities
Usage
printToDom - reusable code for building html from your javascript file Pass in an element id where you would like to print, then a variable name which holds html to print
printToDom(div1, htmlStringVariable);
arrayToList - loops through an array that does not contain objects and prints each entry as an li element Pass in your array name, then an id for your target UL or OL element
arrayToList(arrayVariable, ulId1);
usCurrencyFormatter - converts a number to US currency format
usCurrencyFormatter.format(18793);