Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
oniguruma-to-js
Advanced tools
Convert Oniguruma-flavor Regexp to JavaScript native RegExp.
Supported Oniguruma features:
[:alnum:]
, [:alpha:]
etc. POSIX bracket expressions(?x)
extended, free-spacing mode(?i:..)
flags modifiers(?>..)
atomic group via regex
..*+
possessive quantifiers via regex
\h
\H
hex digit shorthands\p{Blank}
\p{Print}
etc. Oniguruma-flavored unicode property escapesnpm i oniguruma-to-js
import { onigurumaToRegexp } from 'oniguruma-to-js'
const re = onigurumaToRegexp(`[[:alnum:]_]+`)
console.log(re) // /^[a-zA-Z0-9_]+$/
import { construct, syntaxLowering } from 'oniguruma-to-js'
const pattern = syntaxLowering(`(?x:
\d+ # Match one or more digits
\s* # Match zero or more whitespace characters
[A-Z]+ # Match one or more uppercase letters
)`)
console.log(pattern) // "\d+\s*[A-Z]+"
const re = construct(pattern)
console.log(re) // /\d+\s*[A-Z]+/
Traverse all the regex patterns in a TextMate grammar, and apply syntaxLowering
to lower the syntax.
import { loweringTextmateGrammar } from 'oniguruma-to-js/textmate'
import grammar from '../path/to/grammars/json.json'
const lowered = loweringTextmateGrammar(grammar)
Note this function will not guarantee the correctness of the result, you may need to verify the result manually.
MIT License © 2024-PRESENT Anthony Fu
FAQs
Covert Oniguruma-flavor Regexp to JavaScript native RegExp
The npm package oniguruma-to-js receives a total of 258,631 weekly downloads. As such, oniguruma-to-js popularity was classified as popular.
We found that oniguruma-to-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.