From 253ee75ae8cfaca8e7ad2f6e648d8240267d28dc Mon Sep 17 00:00:00 2001 From: Aresn Date: Wed, 28 May 2025 20:42:00 +0800 Subject: [PATCH] Wed May 28 20:42:00 CST 2025 inscode --- index.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/index.js b/index.js index db0b75c..375cf2b 100644 --- a/index.js +++ b/index.js @@ -1,17 +1,17 @@ -function equalToken(model) { - let unitPrice = 1/1000000; // 1token 是多少钱 - if (model.currency === 'USD') { - const exchangeRate = 7; - return (model.price / unitPrice) / exchangeRate; - } - return model.price / unitPrice; -} +function listToArray(data) { + const regex = /^-(\s+-)?(.+)/gm; + const matches = data.match(regex); + if (!matches) return []; + return matches.map(line => line.replace(/^-(\s+-)?/, '').trim()); +}; -const model = { - price: 0.0014, - currency: 'USD' -} +const data1 = `- - 《星际穿越》中时间与物理的主题是如何体现的? +- - 电影《肖申克的救赎》中,安迪如何体现了自由与救赎的主题? +- - 在《教父》中,家族与权力的冲突是如何表现的?` -const token = equalToken(model); +const data2 = `- 《星际穿越》中时间与物理的主题是如何体现的? +- 电影《肖申克的救赎》中,安迪如何体现了自由与救赎的主题? +- 在《教父》中,家族与权力的冲突是如何表现的?` -console.log(token); \ No newline at end of file +console.log(listToArray(data1)) +console.log(listToArray(data2)) \ No newline at end of file -- GitLab