Installation

View source
Install @movk/core with your preferred package manager and start importing tree-shakable TypeScript utilities into your project in minutes.

Getting Started

Add @movk/core to your project with your preferred package manager.

pnpm add @movk/core

Usage

@movk/core is fully modular and supports on-demand imports. All functions support Tree-Shaking.

In a TypeScript/JavaScript Project

utils.ts
import { camelCase, chunk, debounce, parseUrl } from '@movk/core'

// Array operations
const items = [1, 2, 3, 4, 5, 6]
const chunked = chunk(items, 2) // => [[1, 2], [3, 4], [5, 6]]

// Async control
const handleSearch = debounce((query: string) => {
  console.log('Search:', query)
}, 300)

// URL handling
const url = parseUrl('https://example.com/path?foo=bar')
console.log(url.pathname) // => '/path'

// String transformation
const text = camelCase('hello-world') // => 'helloWorld'

In a Vue Project

In addition to general utilities, you can use composables in Vue projects:

MyComponent.vue
<script setup lang="ts">
import { debounce, upperFirst, useAppStorage } from '@movk/core'
import { ref } from 'vue'

// General utilities
const text = ref('hello world')
const capitalizedText = upperFirst(text.value) // => 'Hello world'

const handleInput = debounce(() => {
  console.log('Debounced input')
}, 300)

// Vue composable
const appState = useAppStorage('app-state', {
  theme: 'dark',
  count: 0
})

function increment() {
  appState.value.count++
}
</script>
All functions support Tree-Shaking. In a production build, only the code you actually import and use will be bundled.
Copyright © 2024 - 2026 YiXuan - MIT License