Skip to content

Commit 1b923c9

Browse files
committed
renaming variables
1 parent 7f65508 commit 1b923c9

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/lib/helpers/doIfElseOperation.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import React from 'react';
22
import { isTrusy } from './utils';
33

44
export function doIfElseOperation(props, Component) {
5-
const { $if, $else, ...restProps } = props;
5+
const { $if: condition, $else: elseBlock, ...restProps } = props;
66

7-
if (isTrusy($if)) {
7+
if (isTrusy(condition)) {
88
return React.createElement(Component, restProps);
99
}
1010

11-
if (!$if) {
12-
if (typeof $else === 'function') {
13-
return React.createElement($else, restProps);
11+
if (!condition) {
12+
if (typeof elseBlock === 'function') {
13+
return React.createElement(elseBlock, restProps);
1414
}
15-
return $else || null;
15+
return elseBlock || null;
1616
}
1717
}

src/lib/helpers/doSwitchCaseOperation.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React from 'react';
22
import { isTrusy, isUndefined } from './utils';
33

44
export function doSwitchCaseOperation(props, Component) {
5-
const { $switch, children, ...restProps } = props;
6-
const switchValue = $switch;
5+
const { $switch: switchValue, children, ...restProps } = props;
6+
77
let targetChildNode = null;
88

99
const totalNoOfNode = React.Children.count(children);
@@ -12,13 +12,13 @@ export function doSwitchCaseOperation(props, Component) {
1212

1313
if (!React.isValidElement(child)) continue;
1414

15-
const { $case, $default } = child.props;
15+
const { $case: caseValue, $default: defaultValue } = child.props;
1616

17-
if (isUndefined($case) && isUndefined($default)) {
17+
if (isUndefined(caseValue) && isUndefined(defaultValue)) {
1818
throw new Error('$case or $default is missing', child);
1919
}
2020

21-
if (isTrusy($default) || $case === switchValue) {
21+
if (isTrusy(defaultValue) || caseValue === switchValue) {
2222
targetChildNode = child;
2323
break;
2424
}

0 commit comments

Comments
 (0)