You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

interpolate-components

Package Overview
Dependencies
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

interpolate-components - npm Package Compare versions

Comparing version

to
1.1.1-alpha.2

1

CHANGELOG.md

@@ -6,2 +6,3 @@ # Changelog

* Bump to allow for React ^16.0.0
* Drop deprecated React.createClass, React.DOM from test

@@ -8,0 +9,0 @@ ## 1.1.0

25

lib/index.js

@@ -7,5 +7,5 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; /**
* External Dependencies
*/
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /**
* External Dependencies
*/

@@ -56,3 +56,2 @@

var children = [],
childrenObject = {},
openComponent,

@@ -93,3 +92,5 @@ clonedOpenComponent,

// componentSelfClosing token
children.push(components[token.value]);
if (components[token.value]) {
children.push(_react2.default.cloneElement(components[token.value], { key: i }));
}
continue;

@@ -102,3 +103,3 @@ }

grandChildren = buildChildren(grandChildTokens, components);
clonedOpenComponent = _react2.default.cloneElement(openComponent, {}, grandChildren);
clonedOpenComponent = _react2.default.cloneElement(openComponent, { key: openIndex }, grandChildren);
children.push(clonedOpenComponent);

@@ -117,13 +118,9 @@

return children.map(function (child, index) {
if (child) {
return _react2.default.cloneElement(child, { key: 'interpolation-child-' + index }, child.props !== undefined ? child.props.children : undefined);
}
});
return children;
}
function interpolate(options) {
var mixedString = options.mixedString;
var components = options.components;
var throwErrors = options.throwErrors;
var mixedString = options.mixedString,
components = options.components,
throwErrors = options.throwErrors;

@@ -130,0 +127,0 @@

{
"name": "interpolate-components",
"version": "1.1.1-alpha.1",
"version": "1.1.1-alpha.2",
"description": "Convert strings into structured React components.",

@@ -5,0 +5,0 @@ "repository": {

@@ -14,12 +14,9 @@ /**

describe( 'interpolate-components', () => {
const input = React.DOM.input();
const div = React.DOM.div();
const input = <input />;
const div = <div />;
const link = <a href="#" />;
const em = <em />;
const CustomComponentClass = React.createClass( {
displayName: 'CustomComponentClass',
render() {
return <span className="special">{ this.props.intro }{ this.props.children }</span>;
}
} );
const CustomComponentClass = ( { children, intro } ) => (
<span className="special">{ intro }{ children }</span>
);

@@ -26,0 +23,0 @@ describe( 'with default container', () => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet