refactor: remove null comparisons

This commit is contained in:
Evan You
2020-03-18 18:14:51 -04:00
parent 811f28a7d1
commit ba9a91c48c
18 changed files with 104 additions and 119 deletions

View File

@@ -139,7 +139,7 @@ function setText(node: TestText, text: string) {
function insert(child: TestNode, parent: TestElement, ref?: TestNode | null) {
let refIndex
if (ref != null) {
if (ref) {
refIndex = parent.children.indexOf(ref)
if (refIndex === -1) {
console.error('ref: ', ref)
@@ -168,7 +168,7 @@ function insert(child: TestNode, parent: TestElement, ref?: TestNode | null) {
function remove(child: TestNode, logOp: boolean = true) {
const parent = child.parentNode
if (parent != null) {
if (parent) {
if (logOp) {
logNodeOp({
type: NodeOpTypes.REMOVE,