https://github.com/imcuttle/split-word
Splits words like Microsoft word with state machine
https://github.com/imcuttle/split-word
Last synced: about 1 year ago
JSON representation
Splits words like Microsoft word with state machine
- Host: GitHub
- URL: https://github.com/imcuttle/split-word
- Owner: imcuttle
- License: mit
- Created: 2019-10-16T07:34:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T23:25:48.000Z (over 3 years ago)
- Last Synced: 2025-03-27T17:22:54.376Z (about 1 year ago)
- Language: JavaScript
- Size: 373 KB
- Stars: 7
- Watchers: 1
- Forks: 4
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: License
Awesome Lists containing this project
README
# split-word
[](https://travis-ci.org/imcuttle/split-word)
[](https://codecov.io/github/imcuttle/split-word?branch=master)
[](https://www.npmjs.com/package/split-word)
[](https://www.npmjs.com/package/split-word)
[](https://prettier.io/)
[](https://conventionalcommits.org)
> Splits words like Microsoft word with state machine

## Installation
```bash
npm install split-word
# or use yarn
yarn add split-word
```
## Usage
```javascript
const { wordChunks, wordCount, wordSlice } = require('split-word')
wordCount('你好 hello world') // => 4
wordChunks('你好 hello world') // => ['你', '好 ', 'hello ', 'world']
wordSlice('你好 hello world', 0, 2) // => '你好 '
```
## Contributing
- Fork it!
- Create your new branch:
`git checkout -b feature-new` or `git checkout -b fix-which-bug`
- Start your magic work now
- Make sure npm test passes
- Commit your changes:
`git commit -am 'feat: some description (close #123)'` or `git commit -am 'fix: some description (fix #123)'`
- Push to the branch: `git push`
- Submit a pull request :)
## Authors
This library is written and maintained by imcuttle, moyuyc95@gmail.com.
## License
MIT - [imcuttle](https://github.com/imcuttle) 🐟