# num-lines

> Count the number of lines in a string

Latest version **1.0.0** (published 2016-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install num-lines
pnpm add num-lines
yarn add num-lines
bun add num-lines
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-04-15 |
| First published | 2016-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | James Talmage |
| Maintainers | jamestalmage |
| Keywords | lines, count, string |

## Links

- npm: https://www.npmjs.com/package/num-lines
- Repository: https://github.com/jamestalmage/num-lines
- Homepage: https://github.com/jamestalmage/num-lines#readme
- Issues: https://github.com/jamestalmage/num-lines/issues
- npm.io page: https://npm.io/package/num-lines

## Dependencies (1)

- [split-lines](https://npm.io/package/split-lines.md) ^1.0.0

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-04-15

## README

# num-lines [![Build Status](https://travis-ci.org/jamestalmage/num-lines.svg?branch=master)](https://travis-ci.org/jamestalmage/num-lines)

> Count the number of lines in a string.

Cross platform. Accounts for `\n` and `\r\n` line separators.

## Install

```
$ npm install --save num-lines
```


## Usage

```js
const numLines = require('num-lines');

numLines('foo');
//=> 1

numLines('foo \n bar');
//=> 2

numLines('foo \r\n bar');
//=> 2
```


## API

### numLines(str)

Returns the number of lines in `str`.

#### str

Type: `string`

A string who's lines you'd like to count!

## License

MIT © [James Talmage](http://github.com/jamestalmage)

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