From 73441fc0073da2ce0feaa881db6d1f400ef88c3f Mon Sep 17 00:00:00 2001 From: callmeyan Date: Fri, 18 Apr 2025 11:17:22 +0800 Subject: [PATCH] commit dist --- dist/index.cjs | 36 ++++++++++++++++++++++++++++++++++++ dist/index.d.cts | 13 +++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 dist/index.cjs create mode 100644 dist/index.d.cts diff --git a/dist/index.cjs b/dist/index.cjs new file mode 100644 index 0000000..709dc10 --- /dev/null +++ b/dist/index.cjs @@ -0,0 +1,36 @@ +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// libs/index.ts +var index_exports = {}; +__export(index_exports, { + formatMoney: () => formatMoney, + helloWorld: () => helloWorld +}); +module.exports = __toCommonJS(index_exports); +function helloWorld() { + console.log("Hello World!"); +} +function formatMoney(amount) { + return new Intl.NumberFormat("en-US", { style: "decimal", minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(amount); +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + formatMoney, + helloWorld +}); diff --git a/dist/index.d.cts b/dist/index.d.cts new file mode 100644 index 0000000..393764a --- /dev/null +++ b/dist/index.d.cts @@ -0,0 +1,13 @@ +declare function helloWorld(): void; +/** + * 将数字格式化为美式金额表示法 + * 将金额格式化为两位小数,需要处理千分位格式 + * @param amount - 需要格式化的数字金额 + * @returns 返回格式化后的金额字符串,保留2位小数 + * @example + * formatMoney(1234.5) // 返回 "1,234.50" + * formatMoney(1000000) // 返回 "1,000,000.00" + */ +declare function formatMoney(amount: number): string; + +export { formatMoney, helloWorld };