Socket
Socket
Sign inDemoInstall

saxes

Package Overview
Dependencies
1
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.2.0

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="2.2.0"></a>
# [2.2.0](https://github.com/lddubeau/saxes/compare/v2.1.0...v2.2.0) (2018-08-20)
### Features
* add the `resolvePrefix` option ([90301fb](https://github.com/lddubeau/saxes/commit/90301fb))
<a name="2.1.0"></a>

@@ -2,0 +12,0 @@ # [2.1.0](https://github.com/lddubeau/saxes/compare/v2.0.0...v2.1.0) (2018-08-20)

19

lib/saxes.js

@@ -226,2 +226,10 @@ "use strict";

/**
* @callback ResolvePrefix
*
* @param {string} prefix The prefix to check.
*
* @returns {string|undefined} The URI corresponding to the prefix, if any.
*/
/**
* @typedef SaxesOptions

@@ -239,2 +247,5 @@ *

*
* @property {ResolvePrefix} [resolvePrefix] A function that will be used if the
* parser cannot resolve a namespace prefix on its own.
*
* @property {boolean} [position] Whether to track positions. Unset means

@@ -1574,3 +1585,9 @@ * ``true``.

return this.ns[prefix];
uri = this.ns[prefix];
if (uri) {
return uri;
}
const { resolvePrefix } = this.opt;
return resolvePrefix ? resolvePrefix(prefix) : undefined;
}

@@ -1577,0 +1594,0 @@

2

package.json

@@ -5,3 +5,3 @@ {

"author": "Louis-Dominique Dubeau <ldd@lddubeau.com>",
"version": "2.1.0",
"version": "2.2.0",
"main": "lib/saxes.js",

@@ -8,0 +8,0 @@ "types": "lib/saxes.d.ts",

@@ -181,3 +181,3 @@ # saxes

fragments. However, there are usage scenarios in which it is desirable to parse
fragments. In order to allow this, saxes provides two initialization options.
fragments. In order to allow this, saxes provides three initialization options.

@@ -191,5 +191,14 @@ If you pass the option `fragment: true` to the parser constructor, the parser

The other option is `additionalNamespaces`, which allows you to define
additional prefix-to-URI bindings known before parsing starts.
The option `additionalNamespaces` allows you to define additional prefix-to-URI
bindings known before parsing starts. You would use this over `resolvePrefix` if
you have at the ready a series of namespaces bindings to use.
The option `resolvePrefix` allows you to pass a function which saxes will use if
it is unable to resolve a namespace prefix by itself. You would use this over
`additionalNamespaces` in a context where getting a complete list of defined
namespaces is onerous.
Note that you can use `additionalNamespaces` and `resolvePrefix` together if you
want. `additionalNamespaces` applies before `resolvePrefix`.
## FAQ

@@ -196,0 +205,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc