From 3a17380b0b0e90769fb575fe757dacca48094ec0 Mon Sep 17 00:00:00 2001 From: Nan72 Date: Wed, 26 Feb 2025 15:59:55 +0700 Subject: [PATCH] feat(reverse): add command --- build.ts | 1 + package.json | 5 +++++ src/headless/reverse.ts | 10 ++++++++++ 3 files changed, 16 insertions(+) create mode 100644 src/headless/reverse.ts diff --git a/build.ts b/build.ts index 7436267..0c30b81 100644 --- a/build.ts +++ b/build.ts @@ -16,6 +16,7 @@ const entrypoints = [ "./src/headless/trim-start.ts", "./src/headless/random-case.ts", "./src/headless/lorem.ts", + "./src/headless/reverse.ts", "./src/preference/truncate.ts", "./src/preference/pad.ts", "./src/preference/repeat.ts", diff --git a/package.json b/package.json index 578228c..c03f9aa 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,11 @@ "main": "dist/lorem.js", "name": "Generate a Lorem Ipsum sentence into your clipboard", "cmds": [] + }, + { + "name": "Reverse clipboard text", + "main": "dist/reverse.js", + "cmds": [] } ], "templateUiCmds": [ diff --git a/src/headless/reverse.ts b/src/headless/reverse.ts new file mode 100644 index 0000000..ab5ab8d --- /dev/null +++ b/src/headless/reverse.ts @@ -0,0 +1,10 @@ +import { expose } from "@kksh/api/headless"; +import { BaseExt } from "./base"; + +class ReverseExt extends BaseExt { + constructor() { + super((text: string) => text.split('').reverse().join('')); + } +} + +expose(new ReverseExt()); \ No newline at end of file