Easy handling of JavaScript regular expressions.
npm install @essentialib/pattern
const Pattern = require("@essentialib/pattern");
// same as /-?(\d+)/
const isInteger = Pattern(_ => _
.maybe('-')
.capture(g1 => g1
.digit().oneOrMore()
)
);
console.log(isInteger.test('-34')); // true
See the wiki for more information