# qm-txt-splitbyhyphen

> tiny module for splitting string by its hyphen (and hyphen like chars)

Latest version **0.2.0** (published 2018-04-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install qm-txt-splitbyhyphen
pnpm add qm-txt-splitbyhyphen
yarn add qm-txt-splitbyhyphen
bun add qm-txt-splitbyhyphen
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2018-04-28 |
| First published | 2018-01-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | qaraluch |
| Maintainers | qaraluch |
| Keywords | string, split, hyphen, dash |

## Links

- npm: https://www.npmjs.com/package/qm-txt-splitbyhyphen
- Repository: https://github.com/qaraluch/qm-txt-splitByHyphen
- Issues: https://github.com/qaraluch/qm-txt-splitByHyphen/issues
- npm.io page: https://npm.io/package/qm-txt-splitbyhyphen

## Dependencies (1)

- [babel-runtime](https://npm.io/package/babel-runtime.md) 6.26.0

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2018-04-28
- 0.1.0 — 2018-01-22

## README

![logo-qm](./pic/logo-qm.jpg)

# qm-txt-splitByHyphen [![npm version](https://badge.fury.io/js/qm-txt-splitbyhyphen.svg)](https://badge.fury.io/js/qm-txt-splitbyhyphen) [![Build Status](https://travis-ci.org/qaraluch/qm-txt-splitByHyphen.svg?branch=master)](https://travis-ci.org/qaraluch/qm-txt-splitByHyphen) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

> Tiny module for splitting string by its hyphen (and hyphen-like chars). It is recognizing following characters:

* `\u002D` - HYPHEN-MINUS (-)
* `\u2010` - HYPHEN (‐)
* `\u2011` - NON-BREAKING HYPHEN (‑)
* `\u2012` - FIGURE DASH (‒)
* `\u2013` - EN DASH (–)
* `\u2014` - EM DASH (—)
* `\u2015` - HORIZONTAL BAR (―)
* `\u2E3A` - TWO-EM DASH (⸺)
* `\u2E3B` - THREE-EM DASH (⸻)
* `\uFE58` - SMALL EM DASH (﹘)
* `\uFE63` - SMALL HYPHEN-MINUS (﹣)
* `\uFF0D` - FULLWIDTH HYPHEN-MINUS (－)

## Installation

```sh
$ npm i -S qm-txt-splitbyhyphen
```

## Usage

```js
const splitByHyphen = require("qm-txt-splitbyhyphen");
```

```js
splitByHyphen("tere|fere"); //-> undefined
splitByHyphen("tere - fere"); //-> ["tere", "fere"]
splitByHyphen("a-b‐c‑d‒e–f⸺g"); //-> ["a", "b", "c", "d", "e", "f", "g"]
```

TitleSplit mode in witch splits string by only one hyphen e.g:

```js
splitByHyphen("a-b-c-d-e-f-g", 1); // -> ["a", "b-c-d-e-f-g"]
splitByHyphen("a-b-c-d-e-f-g", 2); // -> ["a-b", "c-d-e-f-g"]
splitByHyphen("a-b-c-d-e-f-g", 3); // -> ["a-b-c", "d-e-f-g"]
splitByHyphen("a-b-c-d-e-f-g", 0); // default it is off -> ["a", "b", "c", "d", "e", "f", "g"]
splitByHyphen("a-b-c-d-e-f-g", 99); // -> ["a", "b", "c", "d", "e", "f", "g"]
```

## API

### splitByHyphen(string, titleSplitAt = 0)

## License

MIT © [qaraluch](https://github.com/qaraluch)

---
_Source: https://npm.io/package/qm-txt-splitbyhyphen · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
