Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

packageurl-js

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

packageurl-js - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 0.0.6
### Bug Fixes
* Properly replace all underscore values for PyPI packages [#23](https://github.com/package-url/packageurl-js/issues/23)
# 0.0.5

@@ -2,0 +6,0 @@ ### Changes

2

package.json
{
"name": "packageurl-js",
"version": "0.0.5",
"version": "0.0.6",
"description": "JavaScript library to parse and build \"purl\" aka. package URLs. This is a microlibrary implementing the purl spec at https://github.com/package-url",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -24,1 +24,71 @@ # packageurl-js

```
### Usage Examples
#### Import ES6 Module
```
import { PackageURL } from 'packageurl-js';
```
#### Import CommonJs Module
```
const { PackageURL } = require('packageurl-js');
```
#### Parsing from a string
```
const pkg = PackageURL.fromString('pkg:maven/org.springframework.integration/spring-integration-jms@5.5.5');
console.log(pkg);
```
=>
```
PackageURL {
type: 'maven',
name: 'spring-integration-jms',
namespace: 'org.springframework.integration',
version: '5.5.5',
qualifiers: null,
subpath: null
}
```
#### Constructing
```
const pkg = new PackageURL(
'maven',
'org.springframework.integration',
'spring-integration-jms',
'5.5.5',
undefined,
undefined);
console.log(pkg.toString());
```
=>
```
pkg:maven/org.springframework.integration/spring-integration-jms@5.5.5
```
#### Error Handling
```
try {
PackageURL.fromString('not-a-purl');
} catch(ex) {
console.error(ex.message);
}
```
=>
```
purl is missing the required "pkg" scheme component.
```

@@ -60,3 +60,3 @@ /*

_handlePyPi() {
this.name = this.name.toLowerCase().replace('_', '-');
this.name = this.name.toLowerCase().replace(/_/g, '-');
}

@@ -63,0 +63,0 @@

@@ -73,4 +73,4 @@ /*

assert.strictEqual(purlMixedCasing.toString(), 'pkg:pypi/pyyaml@5.3.0');
const purlWithUnderscore = PackageURL.fromString('pkg:pypi/typing_extensions@1.0.0');
assert.strictEqual(purlWithUnderscore.toString(), 'pkg:pypi/typing-extensions@1.0.0');
const purlWithUnderscore = PackageURL.fromString('pkg:pypi/typing_extensions_blah@1.0.0');
assert.strictEqual(purlWithUnderscore.toString(), 'pkg:pypi/typing-extensions-blah@1.0.0');
});

@@ -77,0 +77,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc