Socket
Socket
Sign inDemoInstall

jsx.js

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jsx.js

a light and extendable jsx compiler


Version published
Maintainers
1
Install size
17.1 kB
Created

Readme

Source

jsx.js

a light and extendable jsx compiler.

  • ~3kb minified
  • ~1.5kb minified + gzipped

API

jsx(
	str, {string}
	extend: {(Object<string, function>|string)}
);

This method recieves a string and optional extend object/string that is used to create a custom mapping for the javascript output, for example...

jsx(str, {
	text: function (children) {
	 	// return string
	},
	element: function (type, props, children) {
	 	// return string
	},
	component: function (type, props, children) {
		// return string
	}
	props: function (props, node) {
		// return string
	}
	node: function (node) {
		// return string
	}
});

jsx(str, 'React.createElement');

If the input string has a pragma comment, for example/* @jsx h */ it will use that for the output mapping, if no pragma comment/custom mapping has been specicifed it defaults to hyperscript h(...).

Keywords

FAQs

Last updated on 17 May 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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