JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32
  • Score
    100M100P100Q51248F
  • License MIT

Calculate a word string split position index for later highlighting

Package Exports

  • string-bionic-split

Readme

string-bionic-split

Calculate a word string split position index for later highlighting

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 (c) 2010-2022 Roy Revelt and other contributors

ok codsen star