string-match-left-right

Match substrings on the left or right of a given index, ignoring whitespace

MIT 189 个版本
安装
npm install string-match-left-right
yarn add string-match-left-right
pnpm add string-match-left-right
bun add string-match-left-right
README

string-match-left-right

Match substrings on the left or right of a given index, ignoring whitespace

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, 7.1.0 (npm i string-match-left-right@7.1.0).

npm i string-match-left-right

Quick Take

import { strict as assert } from "assert";

import {
  matchLeftIncl,
  matchRightIncl,
  matchLeft,
  matchRight,
} from "string-match-left-right";

// 3rd character is "d" because indexes start from zero.
// We're checking the string to the left of it, "bcd", inclusive of current character ("d").
// This means, "bcd" has to end with existing character and the other chars to the left
// must match exactly:
assert.equal(matchLeftIncl("abcdefghi", 3, ["bcd"]), "bcd");

// neither "ab" nor "zz" are to the left of 3rd index, "d":
assert.equal(matchLeft("abcdefghi", 3, ["ab", "zz"]), false);

// "def" is to the right of 3rd index (including it), "d":
assert.equal(matchRightIncl("abcdefghi", 3, ["def", "zzz"]), "def");

// One of values, "ef" is exactly to the right of 3rd index, "d":
assert.equal(matchRight("abcdefghi", 3, ["ef", "zz"]), "ef");

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

版本列表
9.1.3 2026-01-15
9.1.0 2025-10-15
9.0.34 2025-10-12
9.0.33 2025-10-08
9.0.32 2025-10-07
9.0.23 2025-07-21
9.0.22 2025-03-02
9.0.19 2024-03-30
9.0.18 2024-01-31
9.0.17 2024-01-05
9.0.16 2023-12-20
9.0.15 2023-09-11
9.0.14 2023-07-14
9.0.13 2023-05-21
9.0.12 2023-05-13
9.0.11 2023-04-16
9.0.10 2023-04-12
9.0.9 2023-03-12
9.0.8 2023-02-22
9.0.7 2023-02-04
9.0.6 2022-12-27
9.0.5 2022-12-27
9.0.4 2022-12-26
9.0.3 2022-12-22
9.0.2 2022-12-06
9.0.1 2022-12-06
9.0.0 2022-12-01
8.2.7 2022-11-03
8.2.6 2022-11-02
8.2.5 2022-10-31
8.2.4 2022-10-23
8.2.3 2022-10-22
8.2.2 2022-08-27
8.2.1 2022-08-18
8.2.0 2022-08-12
8.1.4 2022-07-05
8.1.3 2022-05-04
8.1.2 2022-04-18
8.1.1 2022-04-17
8.1.0 2022-04-10
8.0.12 2022-01-22
8.0.11 2022-01-11
8.0.10 2021-12-24
8.0.7 2021-11-30
8.0.6 2021-11-22
8.0.5 2021-11-08
8.0.4 2021-11-04
8.0.3 2021-11-02
8.0.2 2021-09-20
8.0.1 2021-09-13
8.0.0 2021-09-09
7.1.0 2021-05-24
7.0.10 2021-04-14
7.0.9 2021-04-11
7.0.8 2021-04-04
7.0.7 2021-04-03
7.0.6 2021-03-31
7.0.5 2021-03-28
7.0.4 2021-03-25
7.0.3 2021-03-23
7.0.2 2021-03-14
7.0.1 2021-03-07
7.0.0 2021-02-27
6.0.5 2021-02-14
6.0.4 2021-02-09
6.0.3 2021-02-07
6.0.2 2021-01-28
6.0.1 2021-01-28
6.0.0 2021-01-23
5.0.0 2020-11-28
4.0.15 2020-11-10
4.0.14 2020-09-27
4.0.13 2020-09-25
4.0.12 2020-09-24
4.0.11 2020-09-07
4.0.10 2020-08-16
4.0.9 2020-08-08
4.0.8 2020-05-11
4.0.7 2020-05-08
4.0.6 2020-05-06
4.0.5 2020-04-26
4.0.4 2020-04-18
4.0.3 2020-04-13
4.0.2 2020-04-04
4.0.1 2020-03-24
4.0.0 2020-03-16
3.11.19 2020-02-01
3.11.18 2020-01-26
3.11.17 2019-12-21
3.11.16 2019-12-14
3.11.15 2019-12-09
3.11.14 2019-11-27
3.11.13 2019-11-18
3.11.12 2019-11-11
3.11.11 2019-11-04
3.11.10 2019-10-21
3.11.9 2019-10-05
3.11.8 2019-10-02
3.11.7 2019-09-17
3.11.6 2019-09-11
3.11.5 2019-09-04
3.11.4 2019-08-26
3.11.3 2019-08-24
3.11.2 2019-08-18
3.11.1 2019-08-15
3.11.0 2019-08-08
3.10.36 2019-07-29
3.10.35 2019-07-25
3.10.33 2019-07-24
3.10.32 2019-07-19
3.10.30 2019-07-15
3.10.29 2019-07-06
3.10.28 2019-06-29
3.10.27 2019-06-24
3.10.26 2019-06-21
3.10.25 2019-06-18
3.10.24 2019-06-01
3.10.23 2019-06-01
3.10.22 2019-06-01
3.10.21 2019-04-10
3.10.20 2019-04-06
3.10.19 2019-03-22
3.10.18 2019-03-22
3.10.17 2019-03-17
3.10.16 2019-03-17
3.10.15 2019-03-17
3.10.14 2019-03-17
3.10.13 2019-03-17
3.10.12 2019-03-10
3.10.9 2019-03-04
3.10.8 2019-02-26
3.10.7 2019-02-10
3.10.6 2019-02-05
3.10.5 2019-02-01
3.10.4 2019-01-31
3.10.3 2019-01-28
3.10.2 2019-01-27
3.10.0 2019-01-20
3.9.3 2019-01-16
3.9.2 2019-01-16
3.9.1 2019-01-13
3.9.0 2019-01-11
3.6.6 2019-01-02
3.6.5 2019-01-01
3.6.4 2018-12-29
3.6.3 2018-12-29
3.6.2 2018-12-27
3.6.1 2018-12-27
3.6.0 2018-12-26
3.5.0 2018-12-05
3.4.0 2018-06-11
3.3.1 2018-05-26
3.3.0 2018-05-15
3.2.0 2018-05-15
3.1.1 2018-03-06
3.1.0 2018-03-01
3.0.3 2018-02-10
3.0.2 2018-01-31
3.0.1 2018-01-26
3.0.0 2018-01-15
2.0.6 2017-12-28
2.0.5 2017-12-28
2.0.4 2017-12-28
2.0.3 2017-12-24
2.0.2 2017-12-21
2.0.1 2017-12-21
2.0.0 2017-12-21
1.4.4 2017-12-20
1.4.3 2017-12-13
1.4.2 2017-12-10
1.4.1 2017-12-10
1.4.0 2017-12-10
1.3.6 2017-12-09
1.3.5 2017-11-24
1.3.4 2017-11-24
1.3.3 2017-11-24
1.3.2 2017-11-24
1.3.0 2017-11-22
1.2.0 2017-11-22
1.1.5 2017-10-29
1.1.4 2017-10-29
1.1.3 2017-10-28
1.1.2 2017-10-28
1.1.1 2017-10-28
1.1.0 2017-10-28
1.0.4 2017-10-28
1.0.3 2017-10-28
1.0.2 2017-10-28
1.0.1 2017-10-28