$ gnpm install packageurl-js
To install packageurl-js
in your project, simply run:
npm install packageurl-js
This command will download the packageurl-js
npm package for use in your application.
Clone the packageurl-js
repo and cd
into the directory.
Then run:
npm install
To run the test suite:
npm test
import { PackageURL } from 'packageurl-js';
const { PackageURL } = require('packageurl-js');
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
}
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
try {
PackageURL.fromString('not-a-purl');
} catch(ex) {
console.error(ex.message);
}
=>
purl is missing the required "pkg" scheme component.
Copyright 2013 - present © cnpmjs.org | Home |