https://github.com/aleclarson/is-open-comment
Returns true if a string has an unclosed comment
https://github.com/aleclarson/is-open-comment
Last synced: about 1 year ago
JSON representation
Returns true if a string has an unclosed comment
- Host: GitHub
- URL: https://github.com/aleclarson/is-open-comment
- Owner: aleclarson
- License: mit
- Created: 2017-11-24T17:41:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-12-15T09:55:59.000Z (over 7 years ago)
- Last Synced: 2025-03-10T09:11:33.715Z (over 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# is-open-comment v0.1.1
Returns `true` if a string opens a comment without closing it.
- No runtime dependencies.
- Comment syntax within a string literal causes a false positive.
```js
const isOpenComment = require('is-open-comment')
isOpenComment('//') // => true
isOpenComment('/*') // => true
isOpenComment('/* // */') // => false
isOpenComment('/* \n') // => true
isOpenComment('// \n') // => false
```
Look at `test.js` for all supported edge cases.
### Tests
```sh
# Install dev dependencies.
npm i
# Run the tests once.
./test.js -v
# Run the tests when a file changes.
./test.js -w -v
```