Socket
Socket
Sign inDemoInstall

hastscript

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hastscript - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

5

history.md

@@ -5,3 +5,8 @@ <!--remark setext-->

1.0.1 / 2016-02-25
==================
* Fix property/node detection ([`1f3b063`](https://github.com/wooorm/hastscript/commit/1f3b063))
1.0.0 / 2016-02-24
==================

32

index.js

@@ -181,2 +181,28 @@ /**

/**
* Check if `value` is a valid child node of
* `tagName`.
*
* @param {string} tagName - Parent tag-name.
* @param {Object} value - Node or properties like value.
* @return {boolean} - Whether `value` is a node.
*/
function isNode(tagName, value) {
var type = value.type;
if (tagName === 'input' || !type || typeof type !== 'string') {
return false;
}
if (typeof value.children === 'object' && 'length' in value.children) {
return true;
}
if (tagName === 'button') {
return type !== 'submit' && type !== 'reset' && type !== 'button';
}
return 'value' in value;
}
/**
* Hyperscript compatible DSL for creating virtual HAST

@@ -201,7 +227,3 @@ * trees.

'length' in properties ||
// Only allow a node at the `properties`
// position when it isn’t an `input`, as those
// use HTML `type` and `value` attributes too
// and are void.
(node.tagName !== 'input' && 'type' in properties)
isNode(node.tagName, properties)
)

@@ -208,0 +230,0 @@ ) {

2

package.json
{
"name": "hastscript",
"version": "1.0.0",
"version": "1.0.1",
"description": "Hyperscript compatible DSL for creating virtual HAST trees",

@@ -5,0 +5,0 @@ "license": "MIT",

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