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 3.0.1 to 3.1.0

LICENSE

28

index.js

@@ -1,13 +0,3 @@

/**
* @author Titus Wormer
* @copyright 2016 Titus Wormer
* @license MIT
* @module hastscript
* @fileoverview Hyperscript compatible DSL for creating
* virtual HAST trees.
*/
'use strict';
/* Dependencies. */
var parseSelector = require('hast-util-parse-selector');

@@ -19,15 +9,6 @@ var camelcase = require('camelcase');

/* Expose. */
module.exports = h;
/**
* Hyperscript compatible DSL for creating virtual HAST
* trees.
*
* @param {string?} selector - Simple CSS selector to parse.
* @param {Object?} properties - HTML attributes to add.
* @param {string|Array.<string|Node>} children - List of
* children to add.
* @return {Node} - HAST node.
*/
/* Hyperscript compatible DSL for creating virtual HAST
* trees. */
function h(selector, properties, children) {

@@ -58,2 +39,7 @@ var node = parseSelector(selector);

if (node.tagName === 'template') {
node.content = {type: 'root', children: node.children};
node.children = [];
}
return node;

@@ -60,0 +46,0 @@ }

{
"name": "hastscript",
"version": "3.0.1",
"version": "3.1.0",
"description": "Hyperscript compatible DSL for creating virtual HAST trees",

@@ -16,4 +16,4 @@ "license": "MIT",

],
"repository": "https://github.com/wooorm/hastscript",
"bugs": "https://github.com/wooorm/hastscript/issues",
"repository": "https://github.com/syntax-tree/hastscript",
"bugs": "https://github.com/syntax-tree/hastscript/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",

@@ -34,12 +34,12 @@ "contributors": [

"devDependencies": {
"browserify": "^13.0.0",
"browserify": "^14.3.0",
"esmangle": "^1.0.0",
"nyc": "^8.1.0",
"remark-cli": "^2.0.0",
"remark-preset-wooorm": "^1.0.0",
"nyc": "^11.0.0",
"remark-cli": "^4.0.0",
"remark-preset-wooorm": "^3.0.0",
"tape": "^4.0.0",
"xo": "^0.16.0"
"xo": "^0.18.0"
},
"scripts": {
"build-md": "remark . --quiet --frail",
"build-md": "remark . -qfo",
"build-bundle": "browserify index.js --bare -s hastscript > hastscript.js",

@@ -61,6 +61,6 @@ "build-mangle": "esmangle hastscript.js > hastscript.min.js",

"space": true,
"esnext": false,
"rules": {
"no-self-compare": "off",
"guard-for-in": "off",
"max-lines": "off"
"guard-for-in": "off"
},

@@ -72,5 +72,6 @@ "ignores": [

"remarkConfig": {
"output": true,
"presets": "wooorm"
"plugins": [
"preset-wooorm"
]
}
}

@@ -16,21 +16,12 @@ # hastscript [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]

Dependencies:
```javascript
var h = require('hastscript');
```
AST:
```javascript
var tree = h('.foo#some-id', [
h('span', 'some text'),
h('input', {
'type': 'text',
'value': 'foo'
}),
h('a.alpha', {
'class': 'bravo charlie',
'download': 'download'
}, ['delta', 'echo'])
h('span', 'some text'),
h('input', {type: 'text', value: 'foo'}),
h('a.alpha', {
class: 'bravo charlie',
download: 'download'
}, ['delta', 'echo'])
]);

@@ -68,18 +59,22 @@ ```

###### Parameters
##### Parameters
* `selector` (`string`, optional)
— Simple CSS selector, e.g., tag names (`foo`), IDs (`#bar`)
and classes (`.baz`) are supported,
defaults to a `div` element.
* `properties` (`Object.<string, *>`, optional)
— Map of properties;
* `children` (`string`, `Node`, `Array.<string|Node>`, optional)
— (List of) child nodes, when strings are encountered,
they are normalised to [`text`][text] nodes.
###### `selector`
###### Returns
Simple CSS selector (`string`, optional). Can contain a tag name (`foo`), IDs
(`#bar`), and classes (`.baz`), defaults to a `div` element.
[`Node`][hast-node] — A HAST node.
###### `properties`
Map of properties (`Object.<string, *>`, optional).
###### `children`
(List of) child nodes (`string`, `Node`, `Array.<string|Node>`, optional).
When strings are encountered, they are normalised to [`text`][text] nodes.
##### Returns
[`Element`][element].
## License

@@ -91,9 +86,9 @@

[travis-badge]: https://img.shields.io/travis/wooorm/hastscript.svg
[travis-badge]: https://img.shields.io/travis/syntax-tree/hastscript.svg
[travis]: https://travis-ci.org/wooorm/hastscript
[travis]: https://travis-ci.org/syntax-tree/hastscript
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/hastscript.svg
[codecov-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hastscript.svg
[codecov]: https://codecov.io/github/wooorm/hastscript
[codecov]: https://codecov.io/github/syntax-tree/hastscript

@@ -106,5 +101,5 @@ [npm]: https://docs.npmjs.com/cli/install

[hast]: https://github.com/wooorm/hast
[hast]: https://github.com/syntax-tree/hast
[hast-node]: https://github.com/wooorm/hast#node
[element]: https://github.com/syntax-tree/hast#element

@@ -115,2 +110,2 @@ [virtual-hyperscript]: https://github.com/Matt-Esch/virtual-dom/tree/master/virtual-hyperscript

[text]: https://github.com/wooorm/hast#text
[text]: https://github.com/syntax-tree/unist#text
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