【文件属性】:
文件名称:comment-regex:用于匹配JavaScript注释的正则表达式
文件大小:4KB
文件格式:ZIP
更新时间:2021-05-26 08:00:37
JavaScript
注释正则表达式
用于匹配JavaScript注释的正则表达式
这是非常脆弱的,并且是出于性能原因而创建的,在这种情况下,使用真正的解析器可能会显得过大。
安装
$ npm install comment-regex
用法
const commentRegex = require ( 'comment-regex' ) ;
// Contains a comment
commentRegex ( ) . test ( '/* unicorn */\nvar foo = true;' ) ;
//=> true
// Get the contents of a comment
commentRegex ( ) . exec ( '/* unicorn */\nvar foo = true;' ) [ 2 ] . trim ( ) ;
// Get all the comments
'/*
【文件预览】:
comment-regex-main
----index.js(235B)
----test.js(632B)
----package.json(639B)
----readme.md(985B)
----.github()
--------workflows()
----license(1KB)
----.gitignore(23B)
----.npmrc(19B)
----.editorconfig(175B)
----.gitattributes(19B)