reshow-build
Advanced tools
Comparing version 0.16.0 to 0.16.1
@@ -30,2 +30,7 @@ "use strict"; | ||
describe("Test build", function () { | ||
it("test build string", function () { | ||
var vdom = (0, _index["default"])("foo")(); | ||
var actual = (0, _reshowUnit.shallow)(vdom).html(); | ||
(0, _chai.expect)(actual).to.equal("<span>foo</span>"); | ||
}); | ||
it("test function with error", function () { | ||
@@ -32,0 +37,0 @@ var run = function run() { |
"use strict"; | ||
var _interopRequireWildcard = require("reshow-runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("reshow-runtime/helpers/interopRequireDefault"); | ||
@@ -12,3 +14,3 @@ | ||
var _react = require("react"); | ||
var _react = _interopRequireWildcard(require("react")); | ||
@@ -56,2 +58,4 @@ var _reshowConstant = require("reshow-constant"); | ||
var build = function build(component, componentOption) { | ||
var _span; | ||
return function (props, child) { | ||
@@ -71,2 +75,6 @@ if (!component) { | ||
} | ||
} else { | ||
if (_reshowConstant.STRING === (0, _typeof2["default"])(component)) { | ||
component = _span || (_span = /*#__PURE__*/_react["default"].createElement("span", null, component)); | ||
} | ||
} | ||
@@ -73,0 +81,0 @@ |
@@ -15,2 +15,7 @@ import _objectWithoutProperties from "reshow-runtime/es/helpers/objectWithoutProperties"; | ||
describe("Test build", function () { | ||
it("test build string", function () { | ||
var vdom = build("foo")(); | ||
var actual = shallow(vdom).html(); | ||
expect(actual).to.equal("<span>foo</span>"); | ||
}); | ||
it("test function with error", function () { | ||
@@ -17,0 +22,0 @@ var run = function run() { |
import _typeof from "reshow-runtime/es/helpers/typeof"; | ||
import { isValidElement, cloneElement, createElement, Children } from "react"; | ||
import { FUNCTION, T_NULL, T_TRUE, TYPE_ERROR } from "reshow-constant"; | ||
import React, { isValidElement, cloneElement, createElement, Children } from "react"; | ||
import { STRING, FUNCTION, T_NULL, T_TRUE, TYPE_ERROR } from "reshow-constant"; | ||
import { removeEmpty } from "array.merge"; | ||
@@ -43,2 +43,4 @@ | ||
var build = function build(component, componentOption) { | ||
var _span; | ||
return function (props, child) { | ||
@@ -58,2 +60,6 @@ if (!component) { | ||
} | ||
} else { | ||
if (STRING === _typeof(component)) { | ||
component = _span || (_span = /*#__PURE__*/React.createElement("span", null, component)); | ||
} | ||
} | ||
@@ -60,0 +66,0 @@ |
{ | ||
"name": "reshow-build", | ||
"version": "0.16.0", | ||
"version": "0.16.1", | ||
"description": "A simple util help u build or create component from react instance or function", | ||
@@ -35,4 +35,3 @@ "main": "./build/cjs/src/index.js", | ||
"README.md" | ||
], | ||
"gitHead": "be1806f6f2d188920e2c36ff2c150e584ef7d7fc" | ||
] | ||
} |
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
37354
882