npm.io
4.2.2 • Published 2d ago

is-html-attribute-closing

Licence
MIT
Version
4.2.2
Deps
4
Size
46 kB
Vulns
0
Weekly
0
Stars
213

is-html-attribute-closing

Is a character on a given index a closing of an HTML attribute?

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, 2.3.0 (npm i is-html-attribute-closing@2.3.0).

npm i is-html-attribute-closing

Quick Take

import { strict as assert } from "node:assert";

import { isAttrClosing } from "is-html-attribute-closing";

const str = '<a href="zzz" target="_blank" style="color: black;">';

// <a href="zzz" target="_blank" ...
//                      ^
//                  index 21

// <a href="zzz" target="_blank" ...
//                             ^
//                         index 28

assert.equal(
  isAttrClosing(
    str, // reference string
    21, // known opening (or in absence of a quote, a start of a value)
    28, // we ask, is this a closing on the attribute?
  ),
  true, // the answer
);

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-2026 Roy Revelt and other contributors

ok codsen star

Keywords