![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
expressive-ts
Advanced tools
A functional programming library designed to simplify building complex regular expressions
expressive-ts
is a functional programming library designed to simplify building complex regular expressions.
Table of contents
npm install fp-ts expressive-ts
or
yarn add fp-ts expressive-ts
Note: fp-ts
is a peer dependency of expressive-ts
The expressive nature of the expressive-ts
API makes it incredibly easy to understand the purpose of an otherwise cryptic regular expression. Function composition is a core component of the API. By composing together the various functions provided by expressive-ts
, extremely complex regular expressions can be built easily.
Lets imagine that we would like to recognize and validate a basic URL. Here's how it would look using expressive-ts
.
import { pipe } from 'fp-ts/lib/function'
import * as E from 'expressive-ts/lib/Expression'
const expression = pipe(
E.compile, // expressions always begin with a call to `compile`
E.startOfInput,
E.string('http'),
E.maybe('s'),
E.string('://'),
E.maybe('www.'),
E.anythingBut(' '),
E.endOfInput,
E.toRegex
)
assert.strictEqual(expression.test('https://www.google.com'), true)
assert.strictEqual(expression.test('https://google.com'), true)
assert.strictEqual(expression.test('http://google.com'), true)
assert.strictEqual(expression.test('http:/google.com'), false)
assert.strictEqual(expression.test('http://goog le.com'), false)
0.0.2
FAQs
A functional programming library designed to simplify building complex regular expressions
We found that expressive-ts demonstrated a not healthy version release cadence and project activity because the last version was released 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.