Socket
Socket
Sign inDemoInstall

@thi.ng/sax

Package Overview
Dependencies
Maintainers
1
Versions
276
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/sax - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

<a name="0.5.0"></a>
# [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/sax@0.4.1...@thi.ng/sax@0.5.0) (2018-09-25)
### Features
* **sax:** add opt support for boolean attribs, add tests ([5119b67](https://github.com/thi-ng/umbrella/commit/5119b67))
<a name="0.4.1"></a>

@@ -8,0 +20,0 @@ ## [0.4.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/sax@0.4.0...@thi.ng/sax@0.4.1) (2018-09-24)

@@ -27,3 +27,10 @@ import { IObjectOf } from "@thi.ng/api";

trim: boolean;
/**
* If `true`, HTML5 boolean attributes are supported.
*
* Default: false
*/
boolean: boolean;
}
export declare const VOID_TAGS: Set<string>;
export interface ParseElement {

@@ -30,0 +37,0 @@ tag: string;

30

index.js

@@ -5,2 +5,3 @@ "use strict";

const iterator_1 = require("@thi.ng/transducers/iterator");
exports.VOID_TAGS = new Set("area base br col command embed hr img input keygen link meta param source track wbr".split(" "));
var Type;

@@ -278,6 +279,3 @@ (function (Type) {

if (ch === ">") {
state.state = 6 /* ELEM_BODY */;
state.scope.push({ tag: state.tag, attribs: state.attribs, children: [] });
state.body = "";
return [{ type: Type.ELEM_START, tag: state.tag, attribs: state.attribs }];
return beginElementBody(state);
}

@@ -301,2 +299,20 @@ else if (ch === "/") {

}
else if (state.opts.boolean) {
if (ch === " ") {
state.attribs[state.name] = true;
state.state = 7 /* MAYBE_ATTRIB */;
}
else if (ch === "/") {
state.attribs[state.name] = true;
state.state = 5 /* ELEM_SINGLE */;
return;
}
else if (ch === ">") {
state.attribs[state.name] = true;
return beginElementBody(state);
}
else {
return unexpected(state, ch);
}
}
else {

@@ -463,1 +479,7 @@ return unexpected(state, ch);

};
const beginElementBody = (state) => {
state.state = 6 /* ELEM_BODY */;
state.scope.push({ tag: state.tag, attribs: state.attribs, children: [] });
state.body = "";
return [{ type: Type.ELEM_START, tag: state.tag, attribs: state.attribs }];
};

8

package.json
{
"name": "@thi.ng/sax",
"version": "0.4.1",
"version": "0.5.0",
"description": "Transducer-based, SAX-like, non-validating, speedy & tiny XML parser",

@@ -32,4 +32,4 @@ "main": "./index.js",

"@thi.ng/api": "^4.2.1",
"@thi.ng/transducers": "^2.1.4",
"@thi.ng/transducers-fsm": "^0.2.22"
"@thi.ng/transducers": "^2.1.5",
"@thi.ng/transducers-fsm": "^0.2.23"
},

@@ -48,3 +48,3 @@ "keywords": [

},
"gitHead": "febe3c36d4c7e5a5f71ca89a68d27eeb8278397d"
"gitHead": "04872dbe30d6c521c59ebaef57acb61b9cd0ae40"
}
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