string-bionic-split
v2.0.10
Published
Calculate a word string split position index for later highlighting
Downloads
127
Maintainers
Readme
Install
This package is pure ESM.
npm i string-bionic-split
Quick Take
import { strict as assert } from "assert";
import { split } from "string-bionic-split";
const sources = [
"the",
"quick",
"brown",
"fox",
"jumps",
"over",
"a",
"lazy",
"dog",
];
const splitSources = sources.map(
(str) => `${str.slice(0, split(str))} + ${str.slice(split(str))}`,
);
assert.deepEqual(splitSources, [
"t + he",
"qui + ck",
"bro + wn",
"f + ox",
"jum + ps",
"ov + er",
"a + ",
"la + zy",
"d + og",
]);
Documentation
Please visit codsen.com for a full description of the API.
Contributing
To report bugs or request features or assistance, raise an issue on GitHub.
Licence
MIT License.
Copyright © 2010-2024 Roy Revelt and other contributors.