Socket
Socket
Sign inDemoInstall

himalaya

Package Overview
Dependencies
0
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

bin/himalaya.js

29

index.js

@@ -42,3 +42,3 @@

} else {
if(!str.indexOf(commentStart)) {
if(startsWithCommentStart(str)) {
// comment

@@ -99,3 +99,3 @@ var end = str.indexOf(commentEnd);

if(!str.indexOf('/>')) {
if(startsWithSelfClose(str)) {
str = str.slice(2);

@@ -136,3 +136,3 @@ } else {

attrs.style = parseStyle(value);
} else if (!property.indexOf('data-')) {
} else if (startsWithDataDash(property)) {
attrs.dataset = attrs.dataset || {};

@@ -209,2 +209,25 @@ var key = camelCase(property.slice(5));

function startsWithCommentStart(s) {
return (
s.charAt(0) === '<' &&
s.charAt(1) === '!' &&
s.charAt(2) === '-' &&
s.charAt(3) === '-');
}
function startsWithSelfClose(s) {
return (
s.charAt(0) === '/' &&
s.charAt(1) === '>');
}
function startsWithDataDash(s) {
return (
s.charAt(0) === 'd' &&
s.charAt(1) === 'a' &&
s.charAt(2) === 't' &&
s.charAt(3) === 'a' &&
s.charAt(4) === '-');
}
module.exports = {

@@ -211,0 +234,0 @@ parse: parse,

5

package.json
{
"name": "himalaya",
"version": "0.1.1",
"version": "0.1.2",
"description": "HTML to JSON parser",
"main": "index.js",
"bin": {
"himalaya": "./bin/himalaya.js"
},
"scripts": {

@@ -7,0 +10,0 @@ "test": "mocha"

@@ -11,3 +11,3 @@ # Himalaya

```javascript
```js
var himalaya = require('himalaya');

@@ -18,2 +18,10 @@ var html = require('fs').readFileSync('/webpage.html');

Installed globally, Himalaya can also be used from the command-line to convert HTML files to JSON files.
```bash
himalaya webpage.html webpage.json
```
Run `himalaya --help` for more information.
## Parser AST Specification

@@ -20,0 +28,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