# substr-occurrence

> Gets the number of occurrences of a string or character in a string.

Latest version **1.1.0** (published 2018-04-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install substr-occurrence
pnpm add substr-occurrence
yarn add substr-occurrence
bun add substr-occurrence
```

## 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.1.0 |
| Published | 2018-04-17 |
| First published | 2018-04-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.2.4 |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | “Max |
| Maintainers | codetheweb |
| Keywords | substr, substring, string, character, number, occurrence, count |

## Links

- npm: https://www.npmjs.com/package/substr-occurrence
- Repository: https://github.com/codetheweb/substr-occurrence
- Homepage: https://github.com/codetheweb/substr-occurrence#readme
- Issues: https://github.com/codetheweb/substr-occurrence/issues
- npm.io page: https://npm.io/package/substr-occurrence

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2018-04-17

## README

# Substr Occurrence
[![forthebadge](https://forthebadge.com/images/badges/made-with-javascript.svg)](https://forthebadge.com) [![Build Status](https://travis-ci.org/codetheweb/substr-occurrence.svg?branch=master)](https://travis-ci.org/codetheweb/substr-occurrence)

A small, extremely lightweight library that counts the number of occurrences of a substring or single character in a larger string.
Created because [string-occurrence](https://github.com/SamVerschueren/string-occurrence) was too bloated and slow.

## Installation


  `npm install codetheweb/substr-occurrence`

## Usage

```javascript
var occurrence = require('substr-occurrence');

console.log(occurrence('o', 'foo bar');
```

  Output should be `2`.

## Tests

  `npm test`

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