@string-searching/brute-force
Version:
Brute-force string searching for JavaScript
41 lines (31 loc) • 2.86 kB
Markdown
:muscle: [@string-searching/brute-force](https://string-searching.github.io/brute-force)
==
Brute-force string searching for JavaScript.
See [docs](https://string-searching.github.io/brute-force/index.html).
> :warning: Depending on your environment, the code may require
> `regeneratorRuntime` to be defined, for instance by importing
> [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime).
```js
import {findAll} from '@string-searching/brute-force';
const string = 'aaabaaa';
const pattern = 'aa';
for (const i of findAll(string, 0, string.length, pattern, 0, pattern.length)) {
// yields 0 1 4 5
}
import {startsWith} from '@string-searching/brute-force';
startsWith(pattern, 0, 2, string, 3); // false
startsWith(pattern, 0, 2, string, 4); // true
```
[](https://raw.githubusercontent.com/string-searching/brute-force/main/LICENSE)
[](https://www.npmjs.org/package/@string-searching/brute-force)
[](https://github.com/string-searching/brute-force/actions/workflows/ci:test.yml?query=branch:main)
[](https://david-dm.org/string-searching/brute-force)
[](https://david-dm.org/string-searching/brute-force?type=dev)
[](https://github.com/string-searching/brute-force/issues)
[](https://www.npmjs.org/package/@string-searching/brute-force)
[](https://codeclimate.com/github/string-searching/brute-force/issues)
[](https://codeclimate.com/github/string-searching/brute-force/trends/churn)
[](https://codecov.io/gh/string-searching/brute-force)
[](https://codeclimate.com/github/string-searching/brute-force/trends/technical_debt)
[](https://string-searching.github.io/brute-force/source.html)
[](https://bundlephobia.com/result?p=@string-searching/brute-force)