# indicesof

> Just like indexOf(), but returns an array of all occurrences. Works on both strings and buffers.

Latest version **1.0.0** (published 2018-06-10) · GPLv3+ license · 0 weekly downloads

## Install

```sh
npm install indicesof
pnpm add indicesof
yarn add indicesof
bun add indicesof
```

## 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 | 2018-06-10 |
| First published | 2014-03-16 |
| Weekly downloads | 0 |
| License | GPLv3+ |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 41.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alfred Godoy |
| Maintainers | alfredgodoy |
| Keywords | indexOf, indicesOf |

## Links

- npm: https://www.npmjs.com/package/indicesof
- Repository: https://github.com/alfreddatakillen/js-indicesof
- Issues: https://github.com/alfreddatakillen/js-indicesof/issues
- npm.io page: https://npm.io/package/indicesof

## Recent versions

- 1.0.0 (latest) — 2018-06-10
- 0.0.2 — 2014-03-16
- 0.0.1 — 2014-03-16

## README

js-indicesof
============

Just like `indexOf()`, but returns an array of all occurrences.

Will return an empty array if there is no match.

Install
-------

	npm i indicesof

Syntax
------

	function (needle, haystack, startOffset, endOffset ]);

* `haystack` can be a string or a buffer.
* `startOffset` is optional. Default is 0.
* `endOffset` is optional. Default is the haystack length. Note
  that the entire length of the needle must be within the
  offsets to be a match. Also, the offset is not inclusive.

Strings vs Buffers
------------------

Note that the byte position is returned for Buffers, which
might not be the same as the char position for strings:

	indicesOf('l', 'Älg'); // Returns [ 1 ]
	indicesOf('l', Buffer.from('Älg', 'utf8')); // Returns [ 2 ]

Example
-------

	var indicesOf = require('indicesof');
	var haystack = "If I Can't Dance It's Not My Revolution";
	indicesOf('n', haystack); // [ 7, 13, 38 ]
	indicesOf('an', haystack); // [ 6, 12 ]
	indicesOf('Dan', haystack); // [ 11 ]
	indicesOf('dan', haystack); // [ ]

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