# @xiping/pinyin-search

A utility package for Chinese Pinyin search functionality, supporting flexible matching and TypeScript integration.

## Installation

You can install this package using your preferred package manager:

### npm
```bash
npm install @xiping/pinyin-search
```

### yarn
```bash
yarn add @xiping/pinyin-search
```

### pnpm
```bash
pnpm add @xiping/pinyin-search
```

## Usage

```typescript
import { pinyinSearch, pinyinMatch } from '@xiping/pinyin-search';

// Search in array of objects
const list = [
  { name: '张三' },
  { name: '李四' },
  { name: '王五' }
];
const result = pinyinSearch(list, 'name', 'zhang');
console.log(result); // [{ name: '张三' }]

// Direct pinyin matching
const isMatch = pinyinMatch('你好', 'nihao');
console.log(isMatch); // true
```

## Features

- Array search support: Search through arrays of objects using Pinyin
- Direct matching: Check if a Chinese string matches a Pinyin search text
- TypeScript ready: Full TypeScript type definitions included
- Simple API: Just two main functions for different search needs

## API Reference

### pinyinSearch(list: object[], key: string, text: string)
Search through an array of objects using a specific key and Pinyin text.

### pinyinMatch(text: string, searchText: string)
Direct matching between Chinese text and Pinyin search text.

## License

MIT

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.