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

saxophone

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

saxophone - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

6

CHANGELOG.md
<!-- vim: set spelllang=en : -->
# Changelog
## v0.7.2
### Fixed bugs
* Fix parse error when a comment’s ending sequence sits astride two chunks (`--` in the first and `>` in the second).
## v0.7.1

@@ -5,0 +11,0 @@

10

lib/Saxophone.js

@@ -295,3 +295,6 @@ const {Writable} = require('readable-stream');

// upcoming data
if (commentClose === -1) {
if (
commentClose === -1 ||
input[commentClose + 2] === undefined
) {
this._wait(

@@ -305,3 +308,6 @@ Node.comment,

if (input[commentClose + 2] !== '>') {
callback(new Error('Unexpected -- inside comment'));
callback(new Error(
`Unexpected -- inside comment: \
'${input.slice(chunkPos - 4)}'`
));
return;

@@ -308,0 +314,0 @@ }

12

lib/Saxophone.test.js

@@ -82,2 +82,9 @@ const {Readable} = require('readable-stream');

test('should parse comments ending between two chunks', assert => {
expectEvents(assert,
['<!-- this is a comment --', '>'],
[['comment', {contents: ' this is a comment '}]]
);
});
test('should not parse unclosed comments', assert => {

@@ -93,3 +100,6 @@ expectEvents(assert,

'<!-- this is an -- invalid comment ->',
[['error', new Error('Unexpected -- inside comment')]]
[[
'error',
new Error("Unexpected -- inside comment: '<!-- this is an -- i'")
]]
);

@@ -96,0 +106,0 @@ });

@@ -17,2 +17,12 @@ const test = require('tape');

test('should parse attributes values containing ">"', assert => {
assert.deepEqual(
Saxophone.parseAttrs(' assert="5 > 1" '),
{
assert: '5 > 1',
}
);
assert.end();
});
test('should not parse attributes without a value', assert => {

@@ -19,0 +29,0 @@ assert.throws(() => {

{
"name": "saxophone",
"description": "Fast and lightweight event-driven XML parser in pure JavaScript",
"version": "0.7.1",
"version": "0.7.2",
"license": "MIT",

@@ -46,3 +46,3 @@ "main": "lib/index.js",

"common-tags": "^1.8.0",
"eslint": "^7.15.0",
"eslint": "^7.31.0",
"faucet": "0.0.1",

@@ -52,3 +52,3 @@ "lodash.uniq": "^4.5.0",

"tap-spec": "^5.0.0",
"tape": "^5.0.1"
"tape": "^5.2.2"
},

@@ -55,0 +55,0 @@ "dependencies": {

@@ -236,2 +236,3 @@ # Saxophone 🎷

* [winston01](https://github.com/winston01) for spotting and fixing an error in the parser when a tag sits astride two chunks.
* [MattGson](https://github.com/MattGson) for spotting another similar error.

@@ -238,0 +239,0 @@ ## License

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