Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add nslookup function for checking whether a uri matches the default …

…for a namespace.
  • Loading branch information...
commit 2e60e6498168e2d2a1b08f78a08a2ca1bb68da9a 1 parent 0c2a15a
@danmactough authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 utils.js
View
15 utils.js
@@ -3,6 +3,7 @@
* Module dependencies.
*/
var URL = require('url')
+ , NS = require('./namespaces')
;
/**
@@ -94,4 +95,16 @@ exports.get = get;
function resolve (baseUrl, pathUrl) {
return URL.resolve(baseUrl, pathUrl);
}
-exports.resolve = resolve;
+exports.resolve = resolve;
+
+/*
+ * Check whether a given namespace URI matches the given default
+ *
+ * @param {String} URI
+ * @param {String} default, e.g., 'atom'
+ * @return {Boolean}
+ */
+function nslookup (uri, def) {
+ return NS[uri] === def;
+}
+exports.nslookup = nslookup;
Please sign in to comment.
Something went wrong with that request. Please try again.