packageurl-js
JavaScript library to parse and build "purl" aka. package URLs. This is a microlibrary implementing the purl spec at https://github.com/package-url
Last updated a year ago by majurg .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install packageurl-js 
SYNC missed versions from official npm registry.

packageurl-js

Installing:

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.

Local Development:

Clone the packageurl-js repo and cd into the directory.

Then run:

npm install

Testing

To run the test suite:

npm test

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.

Current Tags

  • 1.2.1                                ...           latest (a year ago)

14 Versions

  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           3 years ago
  • 0.0.5                                ...           4 years ago
  • 0.0.4                                ...           4 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)

Copyright 2013 - present © cnpmjs.org | Home |