Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@commitlint/ensure
Advanced tools
@commitlint/ensure is a utility package that provides functions to validate and ensure certain conditions on strings, such as checking if a string is a valid URL, if it matches a specific pattern, or if it adheres to a certain length. It is commonly used in conjunction with commitlint to enforce commit message conventions.
isUrl
The `isUrl` function checks if a given string is a valid URL. In this example, it returns `true` for a valid URL.
const { isUrl } = require('@commitlint/ensure');
const result = isUrl('https://example.com');
console.log(result); // true
isLongerThan
The `isLongerThan` function checks if a given string is longer than a specified length. In this example, it returns `true` because 'hello' is longer than 3 characters.
const { isLongerThan } = require('@commitlint/ensure');
const result = isLongerThan('hello', 3);
console.log(result); // true
matches
The `matches` function checks if a given string matches a specified regular expression pattern. In this example, it returns `true` because 'hello' starts with 'h'.
const { matches } = require('@commitlint/ensure');
const result = matches('hello', /^h/);
console.log(result); // true
The `validator` package provides a comprehensive set of string validation and sanitization functions. It offers similar functionalities to @commitlint/ensure, such as URL validation, string length checks, and pattern matching, but with a broader range of validation options.
The `joi` package is a powerful schema description language and data validator for JavaScript. While it is more complex and feature-rich compared to @commitlint/ensure, it can be used to validate strings, including checking for patterns, lengths, and formats like URLs.
The `yup` package is a JavaScript schema builder for value parsing and validation. Similar to `joi`, it provides extensive validation capabilities, including string validation, pattern matching, and length checks, making it a more versatile but also more complex alternative to @commitlint/ensure.
17.4.0 (2023-01-04)
FAQs
Lint your commit messages
The npm package @commitlint/ensure receives a total of 2,007,187 weekly downloads. As such, @commitlint/ensure popularity was classified as popular.
We found that @commitlint/ensure demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.