From 877c766d4f60727dda45233b72e1b4768453bd7c Mon Sep 17 00:00:00 2001 From: kieranwv Date: Sat, 4 Jan 2025 09:36:23 +0800 Subject: [PATCH] feat: add toLowerCase utility function and update README --- README.md | 10 ++++++---- src/format.ts | 3 +++ src/index.ts | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 src/format.ts diff --git a/README.md b/README.md index f7de14a..870357b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # @kieranwv/utils -[![Version](https://img.shields.io/github/v/release/kieranwv/utils?style=flat&label=released&color=%2309090b)](https://github.com/kieranwv/utils/releases) -[![Version](https://img.shields.io/npm/v/@kieranwv/utils?style=flat&label=npm&color=09090b)](https://www.npmjs.com/package/@kieranwv/utils) +[![GitHub Release Version](https://img.shields.io/github/v/release/kieranwv/utils?label=Release&color=%42b883)](https://github.com/kieranwv/utils/releases) +[![NPM Version](https://img.shields.io/npm/v/starter-lib-vue3?style=flat&label=npm&color=%42b883)](https://www.npmjs.com/package/starter-lib-vue3) +[![Build Status](https://github.com/kieranwv/utils/actions/workflows/ci.yml/badge.svg?branch=main&color=%42b883)](https://github.com/kieranwv/utils/actions/workflows/ci.yml) Collection of common JavaScript / TypeScript utils by @kieranwv. @@ -19,9 +20,10 @@ const db = new IndexedDB() ## Utils -| name | description | -| -------------------------------- | -------------------------------------- | +| name | description | +| ---------------------------------- | ---------------------------------------- | | [`IndexedDB`](./src/indexed-db.ts) | The CRUD class for indexedDB in browser. | +| [`toLowerCase`](./src/format.ts) | Converts string characters to lowercase. | ## License diff --git a/src/format.ts b/src/format.ts new file mode 100644 index 0000000..2cd4f98 --- /dev/null +++ b/src/format.ts @@ -0,0 +1,3 @@ +export function toLowerCase(input: string): string { + return input.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase().replace(/\s+/g, '-') +} diff --git a/src/index.ts b/src/index.ts index c103aa7..d15154d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1,2 @@ +export * from './format' export * from './indexed-db'