From b55a541575ea173e67d3438623eded0170c88094 Mon Sep 17 00:00:00 2001 From: Faf4a Date: Thu, 26 Oct 2023 17:46:54 +0200 Subject: [PATCH] feat: ability to count characters --- src/functions/util/charCount.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/functions/util/charCount.js b/src/functions/util/charCount.js index 6e2f13d6b..80b133930 100644 --- a/src/functions/util/charCount.js +++ b/src/functions/util/charCount.js @@ -1,11 +1,12 @@ -module.exports = async d => { - const data = d.util.aoiFunc(d); +module.exports = async (d) => { + const data = d.util.aoiFunc(d); + const [text, find] = data.inside.splits; - const [text = d.args.join(" ")] = data.inside.splits; + data.result = find + ? (text.split(find).length - 1) * find.length + : text.length; - data.result = text.addBrackets().length - - return { - code: d.util.setCode(data) - } -} \ No newline at end of file + return { + code: d.util.setCode(data), + }; +};