JSPM

  • Created
  • Published
  • Downloads 52
  • Score
    100M100P100Q78326F
  • License MIT

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

Package Exports

  • is-html-attribute-closing

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-html-attribute-closing) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-html-attribute-closing

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

Install

npm i is-html-attribute-closing

Quick Take

import { strict as assert } from "assert";
import isAttrClosing from "dist/is-html-attribute-closing.esm";

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 and examples.

Licence

MIT License

Copyright (c) 2010-2020 Roy Revelt and other contributors

ok codsen star