babel-plugin-jsx-dom-expressions
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -437,3 +437,3 @@ // Shamelessly lifted straight from SurplusJS https://github.com/adamhaile/surplus | ||
current = null; | ||
return options.wrapContent(accessor, function(value) { | ||
return options.wrapExpr(accessor, function(value) { | ||
var array, child, j, l, len1, len2, t; | ||
@@ -506,3 +506,3 @@ if (value === current) { | ||
nodes = []; | ||
return options.wrapContent(accessor, function(value) { | ||
return options.wrapExpr(accessor, function(value) { | ||
var array, child, i, j, len1, marker, node, ref, ref1, ref2, t; | ||
@@ -581,3 +581,6 @@ marker = null; | ||
var runtime; | ||
// options are wrap, wrapContent | ||
// options are wrapExpr, sanitize | ||
options.sanitize || (options.sanitize = function(i) { | ||
return i; | ||
}); | ||
return runtime = { | ||
@@ -601,5 +604,9 @@ assign: function(a) { | ||
}, | ||
wrap: options.wrap, | ||
wrap: function(accessor, fn) { | ||
return options.wrapExpr(accessor, function(value) { | ||
return fn(options.sanitize(value)); | ||
}); | ||
}, | ||
spread: function(node, accessor) { | ||
return options.wrap(accessor, function(props) { | ||
return options.wrapExpr(accessor, function(props) { | ||
var className, info, prop, value; | ||
@@ -626,3 +633,3 @@ for (prop in props) { | ||
} | ||
node[prop] = value; | ||
node[prop] = options.sanitize(value); | ||
} | ||
@@ -629,0 +636,0 @@ }); |
@@ -439,3 +439,3 @@ 'use strict'; | ||
current = null; | ||
return options.wrapContent(accessor, function(value) { | ||
return options.wrapExpr(accessor, function(value) { | ||
var array, child, j, l, len1, len2, t; | ||
@@ -508,3 +508,3 @@ if (value === current) { | ||
nodes = []; | ||
return options.wrapContent(accessor, function(value) { | ||
return options.wrapExpr(accessor, function(value) { | ||
var array, child, i, j, len1, marker, node, ref, ref1, ref2, t; | ||
@@ -583,3 +583,6 @@ marker = null; | ||
var runtime; | ||
// options are wrap, wrapContent | ||
// options are wrapExpr, sanitize | ||
options.sanitize || (options.sanitize = function(i) { | ||
return i; | ||
}); | ||
return runtime = { | ||
@@ -603,5 +606,9 @@ assign: function(a) { | ||
}, | ||
wrap: options.wrap, | ||
wrap: function(accessor, fn) { | ||
return options.wrapExpr(accessor, function(value) { | ||
return fn(options.sanitize(value)); | ||
}); | ||
}, | ||
spread: function(node, accessor) { | ||
return options.wrap(accessor, function(props) { | ||
return options.wrapExpr(accessor, function(props) { | ||
var className, info, prop, value; | ||
@@ -628,3 +635,3 @@ for (prop in props) { | ||
} | ||
node[prop] = value; | ||
node[prop] = options.sanitize(value); | ||
} | ||
@@ -631,0 +638,0 @@ }); |
{ | ||
"name": "babel-plugin-jsx-dom-expressions", | ||
"description": "A JSX to DOM plugin that wraps expressions for fine grained render libraries", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"author": "Ryan Carniato", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -15,9 +15,9 @@ # Babel Plugin JSX DOM Expressions | ||
### wrap(accessor, fn) | ||
### wrapExpr(accessor, fn) : void | ||
This is called around attribute expressions. Call fn with the resolved value. | ||
This is called around all expressions. This is typically where you wrap the expression with a computation in the desired library and handle any value preparsing. Call fn with the resolved value. This is required. | ||
### wrapContent(accessor, fn) | ||
### sanitize(value) : value | ||
This called around content expressions. Call fn with the resolved value. | ||
This called whenever a value is going to be assigned to a element property. It lets you clean up the value (like remove nested observables etc..) before you pass it to element. This is optional. | ||
@@ -24,0 +24,0 @@ ## Work in Progress |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53449
1537