string-find-heads-tails
TypeScript icon, indicating that this package has built-in type declarations

6.0.19 • Public • Published

string-find-heads-tails

Finds where are arbitrary templating marker heads and tails located

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, 4.1.0 (npm i string-find-heads-tails@4.1.0).

npm i string-find-heads-tails

Quick Take

import { strict as assert } from "assert";

import { strFindHeadsTails } from "string-find-heads-tails";

// processing an arbitrary, custom templating markup:
assert.deepEqual(
  strFindHeadsTails(
    "some text %%_var1-%% more text %%_var2_%%",
    ["%%_", "%%-"], // two flavours of heads
    ["-%%", "_%%"], // two flavours of tails
  ),
  [
    {
      headsStartAt: 10,
      headsEndAt: 13,
      tailsStartAt: 17,
      tailsEndAt: 20,
    },
    {
      headsStartAt: 31,
      headsEndAt: 34,
      tailsStartAt: 38,
      tailsEndAt: 41,
    },
  ],
);

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.

ok codsen star

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
6.0.19102latest

Version History

VersionDownloads (Last 7 Days)Published
6.0.19102
6.0.180
6.0.170
6.0.160
6.0.150
6.0.140
6.0.130
6.0.120
6.0.110
6.0.100
6.0.90
6.0.80
6.0.71
6.0.64
6.0.50
6.0.40
6.0.30
6.0.20
6.0.10
6.0.00
5.1.720
5.1.60
5.1.50
5.1.40
5.1.31
5.1.20
5.1.10
5.1.00
5.0.180
5.0.170
5.0.160
5.0.150
5.0.140
5.0.130
5.0.120
5.0.110
5.0.100
5.0.70
5.0.60
5.0.50
5.0.40
5.0.30
5.0.21
5.0.10
5.0.00
4.1.0125
4.0.160
4.0.150
4.0.140
4.0.130
4.0.120
4.0.110
4.0.100
4.0.90
4.0.80
4.0.70
4.0.60
4.0.50
4.0.40
4.0.30
4.0.20
4.0.10
4.0.00
3.17.04
3.16.170
3.16.169
3.16.150
3.16.140
3.16.130
3.16.120
3.16.110
3.16.100
3.16.90
3.16.80
3.16.70
3.16.60
3.16.50
3.16.40
3.16.30
3.16.20
3.16.10
3.16.00
3.15.90
3.15.80
3.15.70
3.15.60
3.15.50
3.15.40
3.15.30
3.15.20
3.15.10
3.15.00
3.14.440
3.14.430
3.14.420
3.14.410
3.14.400
3.14.390
3.14.381
3.14.370
3.14.360
3.14.350
3.14.330
3.14.320
3.14.300
3.14.290
3.14.280
3.14.270
3.14.260
3.14.250
3.14.240
3.14.230
3.14.220
3.14.210
3.14.200
3.14.190
3.14.180
3.14.171
3.14.160
3.14.150
3.14.140
3.14.130
3.14.120
3.14.90
3.14.81,256
3.14.70
3.14.60
3.14.51
3.14.40
3.14.30
3.14.20
3.14.01
3.13.30
3.13.20
3.13.10
3.13.00
3.10.70
3.10.60
3.10.50
3.10.40
3.10.30
3.10.20
3.10.10
3.10.00
3.9.00
3.8.31
3.8.20
3.8.10
3.8.00
3.7.00
3.6.00
3.5.70
3.5.60
3.5.50
3.5.40
3.5.30
3.5.20
3.5.10
3.5.00
3.4.20
3.4.10
3.4.00
3.3.00
3.2.00
3.1.00
3.0.00
2.0.00
1.0.10
1.0.00

Package Sidebar

Install

npm i string-find-heads-tails

Weekly Downloads

1,528

Version

6.0.19

License

MIT

Unpacked Size

38.3 kB

Total Files

7

Last publish

Collaborators

  • royston