Skip to content

Commit

Permalink
1.4.1: Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Download committed Nov 7, 2016
1 parent 53e90ad commit b7eaeb0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
13 changes: 0 additions & 13 deletions ComponentInterpolator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
var log = require('./util/createLogger')('preact-i18nline:ComponentInterpolator');

var invariant = require('invariant');
var Component = require('preact').Component;
var h = require('preact').h;
Expand All @@ -10,8 +8,6 @@ var PLACEHOLDER_PATTERN = /(%\{.*?\})/;

// Replace a "$1" text descendant in this tree with the newDescendants
var injectNewDescendants = function(element, newDescendants, props, ensureInjected) {
log.debug(log.name + ': injectNewDescendants', element, newDescendants, props);

newDescendants.injectedCount = newDescendants.injectedCount || 0;
props = props || {};

Expand All @@ -35,7 +31,6 @@ var injectNewDescendants = function(element, newDescendants, props, ensureInject
};

var getInjectIndex = function(children, containerName) {
log.debug(log.name + ': getInjectIndex', children, containerName);
var child, index = -1;
for (var i = 0; i < children.length; i++) {
child = children[i];
Expand All @@ -49,8 +44,6 @@ var getInjectIndex = function(children, containerName) {

class ComponentInterpolator extends Component {
inferChildren() {
log.debug(log.name + ': inferChildren');

var tokens = (this.props.string || '').split(WRAPPER_PATTERN);
this.keyCounter = 0;
var inferredChildren = this.interpolateAllComponents(tokens);
Expand All @@ -64,8 +57,6 @@ class ComponentInterpolator extends Component {
}

interpolateAllComponents(tokens, eof) {
log.debug(log.name + ': interpolateAllComponents', tokens, eof);

var token, child;
var children = [];
var wrappers = this.props.wrappers || {};
Expand Down Expand Up @@ -94,8 +85,6 @@ class ComponentInterpolator extends Component {
}

interpolatePlaceholders(string) {
log.debug(log.name + ': interpolatePlaceholders', string, this.props);

var token, child;
var tokens = string.split(PLACEHOLDER_PATTERN);
var children = [];
Expand Down Expand Up @@ -123,5 +112,3 @@ class ComponentInterpolator extends Component {
}

module.exports = ComponentInterpolator;

log.log('Initialized ' + log.name);
15 changes: 1 addition & 14 deletions dist/ComponentInterpolator.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var log = require('./util/createLogger')('preact-i18nline:ComponentInterpolator');

var invariant = require('invariant');
var Component = require('preact').Component;
var h = require('preact').h;
Expand All @@ -20,8 +18,6 @@ var PLACEHOLDER_PATTERN = /(%\{.*?\})/;

// Replace a "$1" text descendant in this tree with the newDescendants
var injectNewDescendants = function injectNewDescendants(element, newDescendants, props, ensureInjected) {
log.debug(log.name + ': injectNewDescendants', element, newDescendants, props);

newDescendants.injectedCount = newDescendants.injectedCount || 0;
props = props || {};

Expand All @@ -45,7 +41,6 @@ var injectNewDescendants = function injectNewDescendants(element, newDescendants
};

var getInjectIndex = function getInjectIndex(children, containerName) {
log.debug(log.name + ': getInjectIndex', children, containerName);
var child,
index = -1;
for (var i = 0; i < children.length; i++) {
Expand All @@ -70,8 +65,6 @@ var ComponentInterpolator = function (_Component) {
_createClass(ComponentInterpolator, [{
key: 'inferChildren',
value: function inferChildren() {
log.debug(log.name + ': inferChildren');

var tokens = (this.props.string || '').split(WRAPPER_PATTERN);
this.keyCounter = 0;
var inferredChildren = this.interpolateAllComponents(tokens);
Expand All @@ -86,8 +79,6 @@ var ComponentInterpolator = function (_Component) {
}, {
key: 'interpolateAllComponents',
value: function interpolateAllComponents(tokens, eof) {
log.debug(log.name + ': interpolateAllComponents', tokens, eof);

var token, child;
var children = [];
var wrappers = this.props.wrappers || {};
Expand All @@ -108,8 +99,6 @@ var ComponentInterpolator = function (_Component) {
}, {
key: 'interpolatePlaceholders',
value: function interpolatePlaceholders(string) {
log.debug(log.name + ': interpolatePlaceholders', string, this.props);

var token, child;
var tokens = string.split(PLACEHOLDER_PATTERN);
var children = [];
Expand Down Expand Up @@ -137,6 +126,4 @@ var ComponentInterpolator = function (_Component) {
return ComponentInterpolator;
}(Component);

module.exports = ComponentInterpolator;

log.log('Initialized ' + log.name);
module.exports = ComponentInterpolator;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "preact-i18nline",
"version": "1.4.0",
"version": "1.4.1",
"description": "Keep your translations in line - with Preact!",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit b7eaeb0

Please sign in to comment.