From dfdf76082363c1bab26ad7be02b94873dec72a08 Mon Sep 17 00:00:00 2001 From: Nan72 Date: Fri, 14 Feb 2025 12:41:42 +0700 Subject: [PATCH] feat(trim): add trim start --- README.md | 3 ++- build.ts | 1 + package.json | 5 +++++ src/trim-start.ts | 11 +++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/trim-start.ts diff --git a/README.md b/README.md index 563cd5d..68a28ff 100644 --- a/README.md +++ b/README.md @@ -85,4 +85,5 @@ npx kksh@latest verify --publish # Verify some basic settings before publishing See [Documentation](https://docs.kunkun.sh/guides/extensions/publish/design/) for more details on how to publish your extension. You will need to publish your extension package to npm or jsr first with GitHub actioin, then register it on Kunkun's website. # TODO -[ ] padding \ No newline at end of file +[ ] padding +[ ] Truncate \ No newline at end of file diff --git a/build.ts b/build.ts index 03e18b0..81bd84f 100644 --- a/build.ts +++ b/build.ts @@ -13,6 +13,7 @@ const entrypoints = [ "./src/to-upper.ts", "./src/trim.ts", "./src/trim-end.ts", + "./src/trim-start.ts", ]; async function build() { diff --git a/package.json b/package.json index 5819629..a5f5e0f 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,11 @@ "name": "Trim the end of clipboard text", "main": "dist/trim-end.js", "cmds": [] + }, + { + "name": "Trim the start of clipboard text", + "main": "dist/trim-start.js", + "cmds": [] } ] }, diff --git a/src/trim-start.ts b/src/trim-start.ts new file mode 100644 index 0000000..f6bf0ad --- /dev/null +++ b/src/trim-start.ts @@ -0,0 +1,11 @@ +import { expose } from "@kksh/api/headless"; +import trimStart from "lodash/trimStart"; +import { BaseExt } from "./base"; + +class TrimStartExt extends BaseExt { + constructor() { + super(trimStart); + } +} + +expose(new TrimStartExt()); \ No newline at end of file