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

html-schema-parser

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-schema-parser - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

4

dev_env/src/index.js

@@ -1,2 +0,2 @@

console.log('dev env')
const SchemaParser = require('./../../src/index');

@@ -36,3 +36,3 @@ const schema = [

let scheamParser = new HtmlSchemaParser(schema);
let scheamParser = new SchemaParser(schema);
let htmlStr = scheamParser.getHtml();

@@ -39,0 +39,0 @@

@@ -1,2 +0,2 @@

!function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){var n=r(2),a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var o=Symbol("_schema_"),i=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this[o]=t}return a(e,[{key:"getHtml",value:function(){return n.a.parseSchema(this[o])}}]),e}();window&&!window.HtmlSchemaParser&&(window.HtmlSchemaParser=i),window&&"function"==typeof window.define&&window.define.amd?window.define("HtmlSchemaParser",function(){return i}):e&&e.exports&&(e.exports=i),t.default=i}.call(t,r(1)(e))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,r){"use strict";var n={legalTags:["html","head","title","base","link","meta","style","script","noscript","body","section","nav","article","aside","h1","h2","h3","h4","h5","h6","hgroup","header","footer","address","main","p","hr","pre","blockquote","ol","ul","li","dl","dt","dd","figure","figcaption","div","a","em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","ruby","rt","rp","bdi","bdo","span","br","wbr","ins","del","img","iframe","embed","object","param","video","audio","source","track","canvas","map","area","svg","math","table","caption","colgroup","col","tbody","thead","tfoot","tr","td","th","form","fieldset","legend","label","input","button","select","datalist","optgroup","option","textarea","keygen","output","progress","meter","details","summary","command","menu"],notClosingTags:{area:!0,base:!0,br:!0,col:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,embed:!0}};function a(e){var t=Object.prototype.toString.call(e),r=(t=t.replace(/\[/gi,"").replace(/\]/gi,"")).split(/\s/),n=void 0;return r&&r[1]&&(n=r[1]),n}function o(e){return"Array"===a(e)}function i(e){return"Object"===a(e)}function u(e){return"String"===a(e)}var c={escape:function(e){return e=(e=(e=(e=(e=(e=""+e).replace(/&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/"/g,"&quot;")).replace(/'/g,"&#39;")}};function l(e){var t="";if(!0!==o(e))return t;for(var r=0;r<e.length;r++){var n=e[r];!0===i(n)?t+=s(n):u(n)&&(t+=n)}return t}function s(e){var t="";if(!0!==i(e))return t;var r=e.tag||"div",a=e.content;n.legalTags.indexOf(r)<0&&(r="div");var o=function(e){var t="";if(!0!==i(e))return t;for(var r=Object.keys(e),n=[],a=0;a<r.length;a++){var o=r[a],l=e[o];!0===u(l)&&n.push(o+'="'+c.escape(l)+'"')}return t=n.join(" ")}(e.attribute);return t=!0===n.notClosingTags[r]?"<"+r+" "+o+" />":"<"+r+" "+o+" >"+l(a)+"</"+r+">"}var f={parseSchema:function(e){var t="";return i(e)?t=s(e):o(e)&&(t=l(e)),t}};t.a=f}]);
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=0)}([function(e,t,r){(function(e){var t=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();var n=r(2),i=Symbol("_schema_"),o=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this[i]=t}return t(e,[{key:"getHtml",value:function(){return n.parseSchema(this[i])}}]),e}();window&&!window.HtmlSchemaParser&&(window.HtmlSchemaParser=o),window&&"function"==typeof window.define&&window.define.amd?window.define("HtmlSchemaParser",function(){return o}):e&&e.exports&&(e.exports=o),e.exports=o}).call(t,r(1)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){var n=r(3),i=r(4),o=i.isJSON,a=i.isArray,u=i.isString,c=r(5);function l(e){var t="";if(!0!==a(e))return t;for(var r=0;r<e.length;r++){var n=e[r];!0===o(n)?t+=s(n):u(n)&&(t+=n)}return t}function s(e){var t="";if(!0!==o(e))return t;var r=e.tag||"div",i=e.content;n.legalTags.indexOf(r)<0&&(r="div");var a=function(e){var t="";if(!0!==o(e))return t;for(var r=Object.keys(e),n=[],i=0;i<r.length;i++){var a=r[i],l=e[a];!0===u(l)&&n.push(a+'="'+c.escape(l)+'"')}return t=n.join(" ")}(e.attribute);return t=!0===n.notClosingTags[r]?"<"+r+" "+a+" />":"<"+r+" "+a+" >"+l(i)+"</"+r+">"}var f={parseSchema:function(e){var t="";return o(e)?t=s(e):a(e)&&(t=l(e)),t}};e.exports=f},function(e,t){e.exports={legalTags:["html","head","title","base","link","meta","style","script","noscript","body","section","nav","article","aside","h1","h2","h3","h4","h5","h6","hgroup","header","footer","address","main","p","hr","pre","blockquote","ol","ul","li","dl","dt","dd","figure","figcaption","div","a","em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","ruby","rt","rp","bdi","bdo","span","br","wbr","ins","del","img","iframe","embed","object","param","video","audio","source","track","canvas","map","area","svg","math","table","caption","colgroup","col","tbody","thead","tfoot","tr","td","th","form","fieldset","legend","label","input","button","select","datalist","optgroup","option","textarea","keygen","output","progress","meter","details","summary","command","menu"],notClosingTags:{area:!0,base:!0,br:!0,col:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,embed:!0}}},function(e,t){function r(e){var t=Object.prototype.toString.call(e),r=(t=t.replace(/\[/gi,"").replace(/\]/gi,"")).split(/\s/),n=void 0;return r&&r[1]&&(n=r[1]),n}e.exports={isString:function(e){return"String"===r(e)},isNumber:function(e){return"Number"===r(e)},isNull:function(e){return"Null"===r(e)},isUndefined:function(e){return"Undefined"===r(e)},isArray:function(e){return"Array"===r(e)},isJSON:function(e){return"Object"===r(e)},isFunction:function(e){return"function"==typeof e}}},function(e,t){e.exports={escape:function(e){return e=(e=(e=(e=(e=(e=""+e).replace(/&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/"/g,"&quot;")).replace(/'/g,"&#39;")}}}]);
//# sourceMappingURL=index.js.map
{
"name": "html-schema-parser",
"version": "0.2.0",
"version": "0.2.1",
"description": "A HTML parser based on schema",
"author": "chenshenhai <cshenhai@gmail.com>",
"main": "dist/index.js",
"main": "src/index.js",
"scripts": {

@@ -8,0 +8,0 @@ "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",

@@ -10,2 +10,4 @@ # http-schema-parser

#### Node Usage
```sh

@@ -56,2 +58,14 @@ npm install --save http-schema-parser

#### Browser Usage
```html
<script src="html-schema-parser.js"></script>
<script>
// Code ...
var HtmlSchemaParser = window.HtmlSchemaParser;
var scheamParser = new HtmlSchemaParser(schema);
var html = scheamParser.getHtml();
</script>
```
### Instructions

@@ -74,4 +88,6 @@

### 使用方式
### 使用说明
#### Node 使用方式
```sh

@@ -122,2 +138,13 @@ npm install --save http-schema-parser

#### 浏览器使用方式
```html
<script src="html-schema-parser.js"></script>
<script>
// Code ...
var HtmlSchemaParser = window.HtmlSchemaParser;
var scheamParser = new HtmlSchemaParser(schema);
var html = scheamParser.getHtml();
</script>
### 说明

@@ -124,0 +151,0 @@

@@ -1,2 +0,2 @@

import parser from './lib/parser'
const parser = require('./lib/parser')

@@ -26,2 +26,2 @@ const SCHEMA = Symbol('_schema_')

export default HtmlSchemaParser
module.exports = HtmlSchemaParser

@@ -40,3 +40,3 @@ function getPrototype (data) {

export {
module.exports = {
isString,

@@ -43,0 +43,0 @@ isNumber,

@@ -1,4 +0,4 @@

import tags from './tags'
import { isJSON, isArray, isString } from './is-type'
import util from './util'
const tags = require('./tags')
const { isJSON, isArray, isString } = require('./is-type')
const util = require('./util')

@@ -72,2 +72,2 @@ function parseContent (content) {

export default parser
module.exports = parser

@@ -31,5 +31,5 @@ const legalTags = [

export default {
module.exports = {
legalTags,
notClosingTags
}

@@ -15,2 +15,2 @@ const util = {

export default util
module.exports = util

Sorry, the diff of this file is not supported yet

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