
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@workplus/compare-versions
Advanced tools
A simple version comparison tool.
The comparison principle is very simple, the version string is converted into a string of the same length, the default is 10, and then directly determine the size. But if the version of the type is inconsistent, such as 3.13.1
and 3.14
, may get unexpected results, So, please make sure the version type you entered is the same.
'3.13.1'
=> '0000000003.0000000013.0000000001'
Judgment rules and return results are as follows:
npm install -S @workplus/compare-versions
// ES6
import compareVersions from '@workplus/compare-versions';
// Node
const compareVersions = require('@workplus/compare-versions');
/**
* compareVersions(a, b, c)
*
* @param {string} a version
* @param {string} b another version
* @param {number} c string length, default 10
*/
compareVersions('3.13.1', '3.13.0', 10); // 1
compareVersions('3.14.1', '3.14.1', 2); // 0
compareVersions('3.14.1', '4.14.1'); // -1
compareVersions('3.14.1', '4.14'); // null
MIT Hejx
FAQs
A simple version comparison tool.
We found that @workplus/compare-versions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.