@cat5th/get-comments
TypeScript icon, indicating that this package has built-in type declarations

0.2.4 • Public • Published

get-comments

npm version coverage npm downloads Build Status

A script that gets document comments

Installation

yarn add @cat5th/get-comments

or

npm i @cat5th/get-comments

Usage

<!DOCTYPE HTML>
<html>
<head></head>
<body>
  <!--hello-->
  <!--hello2-->  
</body>
</html>
import { getComment, getComments } from '@cat5th/get-comments'

// get a single element
getComment('hello') // => <!--hello-->

// get comments
getComments('hello') // => <!--hello-->,<!--hello2-->

// by function
getComments((elem) => {
  // you can filter elem here 
  return true
}) // => <!--hello-->,<!--hello2-->

// or regexp
getComment(/hello/)

// or undefined means all comments
getComments(undefined)
getComments()

// the 2nd param is used to limit the lookup context
getComments(undefined, document.querySelector('div'))

Package Sidebar

Install

npm i @cat5th/get-comments

Weekly Downloads

7

Version

0.2.4

License

MIT

Unpacked Size

263 kB

Total Files

20

Last publish

Collaborators

  • alphmega