From e920da7e25dc2e56d2f55851afc072161766ab4c Mon Sep 17 00:00:00 2001 From: Nan72 Date: Fri, 14 Feb 2025 12:34:38 +0700 Subject: [PATCH] feat(snake): add snake case --- README.md | 3 +++ build.ts | 1 + package.json | 5 +++++ src/snake-case.ts | 11 +++++++++++ 4 files changed, 20 insertions(+) create mode 100644 src/snake-case.ts diff --git a/README.md b/README.md index 3759e95..563cd5d 100644 --- a/README.md +++ b/README.md @@ -83,3 +83,6 @@ 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 diff --git a/build.ts b/build.ts index f822f33..4aa7dfc 100644 --- a/build.ts +++ b/build.ts @@ -8,6 +8,7 @@ const entrypoints = [ "./src/capitalize.ts", "./src/kebab.ts", "./src/lower-case.ts", + "./src/snake-case.ts", ]; async function build() { diff --git a/package.json b/package.json index caf85d2..50901eb 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,11 @@ "name": "Convert clipboard text to lower case", "main": "dist/lower-case.js", "cmds": [] + }, + { + "name": "Convert clipboard text to snake_case", + "main": "dist/snake-case.js", + "cmds": [] } ] }, diff --git a/src/snake-case.ts b/src/snake-case.ts new file mode 100644 index 0000000..9eb9e55 --- /dev/null +++ b/src/snake-case.ts @@ -0,0 +1,11 @@ +import { expose } from "@kksh/api/headless"; +import snakeCase from "lodash/snakeCase"; +import { BaseExt } from "./base"; + +class SnakeCaseExt extends BaseExt { + constructor() { + super(snakeCase); + } +} + +expose(new SnakeCaseExt()); \ No newline at end of file