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

prefix-ns

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prefix-ns

Easy access to prefixes and namespaces of prefix.cc.

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
41
decreased by-89.38%
Maintainers
1
Weekly downloads
 
Created
Source

prefix-ns

This npm module gives easy access to the prefixes and namespaces of prefix.cc. Upon installation of this module the latest dump is downloaded from prefix.cc and stored locally. The dump is only updated when the module is re-installed. A default dump (data.json) is available if the download of the dump fails.

Usage

let prefixns = require('prefix-ns');

//The following method returns an array of all prefixes.
let allPrefixes = prefixns.getPrefixes();
console.log(allPrefixes);

// --> ['rdf', 'foaf', ...]

//The following method returns the namespace of a given prefix.
//null is returned when the prefix is not found.
let namespace = prefixns.getNamespaceViaPrefix('foaf');
console.log(namespace);

// --> http://xmlns.com/foaf/0.1/

//The following method returns the prefix of a given namespace.
//null is returned when the namespace is not found.
let prefix = prefixns.getPrefixViaNamespace('http://xmlns.com/foaf/0.1/');
console.log(prefix);

// --> foaf

//The following method returns a map where the prefixes are the keys and the namesapces are the values.
let map = prefixns.asMap();
console.log(map.foaf);

// --> http://xmlns.com/foaf/0.1/

License

MIT

Keywords

FAQs

Package last updated on 27 Apr 2017

Did you know?

Socket

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.

Install

Related posts

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