1.0.1 • Published 8 years ago

hyperscript-string-async v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

hyperscript-string-async

Build status NPM version XO code style

An async/promisified version of hyperscript-string

Installation

Install hyperscript-string-async using npm:

npm install --save hyperscript-string-async

Usage

Module usage

const h = require('hyperscript-string-async');

h('ul.list', [
	h('li.item', 'Lorem ipsum'),
	h('li.item', {title: 'Second item'}, 'Dolor sit'),
	h('li.item', 'Amet')
])
.then(html => {
	/*
	<ul class="list">
		<li class="item">Lorem ipsum</li>
		<li title="Second item" class="item">Dolor sit</li>
		<li class="item">Amet</li>
	</ul>
	*/
});

Related packages

API

ha(selector[, attrs, children])

NameTypeDescription
selectorString or Promise<String>Contains at least the HTML tag name
attrsObject or Promise<Object> or Object<Promise>Attributes for the HTML tag
childrenString or Array or Promise<String> or Promise<Array> or Array<Promise>The children for the HTML tag

Returns: Promise<String>, the generated HTML.

License

MIT © Joakim Carlstein