Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

str-indexes-of-plus

codsen1.1kMIT5.1.0TypeScript support: included

Like indexOf but returns array and counts per-grapheme

array, astral, emoji, find, in, indexes, plus, search, string, unicode

readme

str-indexes-of-plus

Like indexOf but returns array and counts per-grapheme

page on codsen.com page on npm page on github Downloads per month changelog MIT Licence

Install

This package is pure ESM. If you're not ready yet, install an older version of this program, 3.1.0 (npm i str-indexes-of-plus@3.1.0).

npm i str-indexes-of-plus

Quick Take

import { strict as assert } from "assert";

import { strIndexesOfPlus } from "str-indexes-of-plus";

// searches for string in a string, returns array:
assert.deepEqual(strIndexesOfPlus("abc-abc-abc-abc", "abc"), [0, 4, 8, 12]);

// all graphemes are counted as one, emoji too:
assert.deepEqual(
  strIndexesOfPlus("🐴-🦄", "🦄"),
  [2], // not [3] considering unicorn is 2-characters long
);

// you can offset the start of a search:
assert.deepEqual(strIndexesOfPlus("abczabc", "abc", 3), [4]);

Documentation

Please visit codsen.com for a full description of the API. If you’re looking for the Changelog, it’s here.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License

Copyright © 2010-2025 Roy Revelt and other contributors

ok codsen star

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

5.1.0 (2025-10-15)

Features

  • if value to be added is a number, keep it as is, don't stringify (ce3e1a5)

5.0.0 (2022-12-01)

BREAKING CHANGES

  • Minimum supported Node version is v14.18; we're dropping v12 support

4.1.0 (2022-08-12)

Features

4.0.0 (2021-09-09)

Features

BREAKING CHANGES

  • programs now are in ES Modules and won't work with Common JS require()

3.1.0 (2021-05-24)

Features

  • config file based major bump blacklisting (e15f9bb)

3.0.15 (2021-04-11)

Reverts

  • Revert "chore: setup refresh" (23cf206)

3.0.1 (2021-01-28)

Fixed

  • add testStats to npmignore (f3c84e9)

3.0.0 (2021-01-23)

Features

  • rewrite in TS and start using named exports (2bde77a)

BREAKING CHANGES

  • previously: import strIndexesOfPlus from ... - now import { strIndexesOfPlus } from ...

2.11.0 (2020-11-28)

Accidental version bump during migration to SourceHut. Sorry about that.

2.10.0 (2020-02-01)

Features

  • remove the last dependency (d2e66d1)

2.9.0 (2019-01-20)

  • Various documentation and setup tweaks after we migrated to monorepo
  • Setup refresh: updated dependencies and all config files using automated tools

2.3.0 (2018-10-25)

  • Update all dependencies
  • Restore coveralls.io reporting
  • Restore unit test linting

2.2.0 (2018-06-16)

GitHub sold us out. In the meantime, we:

  • Migrated to BitBucket (to host repo + perform CI) and Codacy (for code quality audit)
  • Dropped BitHound (RIP) and Travis

2.1.0 (2018-05-26)

  • Set up Prettier on a custom ESLint rule set.
  • Removed package.lock and .editorconfig
  • Wired Rollup to remove comments from non-dev builds. This means we can now leave the console.logs in the source code — there's no need to comment-out console.log statements or care about them not spilling into production. Now it's done automatically.
  • Unit tests are pointing at ES modules build, which means that code coverage is correct now, without Babel functions being missed. This is important because now code coverage is real again and now there are no excuses not to perfect it.

2.0.0 (2017-12-03)

  • Rebased the source to be in ES modules
  • Set up Rollup to generate three flavours: CommonJS, UMD and native ES Modules (source)
  • Removed JS Standard because it's a wrapper and therefore it sucks. Switched to raw ESLint on airbnb-base preset and turned off semicolons. Fixed all newly-found issues.
  • Updated many other files including readme.

1.0.0 (2017-03-23)

  • First public release