From ba77f677605e4da2c601e84cfa15e951479d4578 Mon Sep 17 00:00:00 2001 From: Ahmed Bankole Date: Mon, 31 Aug 2020 04:50:18 +0100 Subject: [PATCH] replace null to undefined I made use of undefined instead of null to give a better output for values that don't return a value. --- lib/Symbols.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Symbols.js b/lib/Symbols.js index 1129e5be..48fd403c 100644 --- a/lib/Symbols.js +++ b/lib/Symbols.js @@ -19,7 +19,7 @@ Symbols.getSymbolsInExpression = function(expression) { }; // Iterates through a node and returns the last term with the symbol name -// Returns null if no terms with the symbol name are in the node. +// Returns undefined if no terms with the symbol name are in the node. // e.g. 4x^2 + 2x + y + 2 with `symbolName=x` would return 2x Symbols.getLastSymbolTerm = function(node, symbolName) { // First check if the node itself is a polyomial term with symbolName @@ -43,7 +43,7 @@ Symbols.getLastSymbolTerm = function(node, symbolName) { return Symbols.getLastSymbolTerm(node.content, symbolName); } - return null; + return undefined; }; // Iterates through a node and returns the last term that does not have the @@ -57,7 +57,7 @@ Symbols.getLastNonSymbolTerm = function(node, symbolName) { return new Node.PolynomialTerm(node).getCoeffNode(); } else if (hasDenominatorSymbol(node, symbolName)) { - return null; + return undefined; } else if (Node.Type.isOperator(node)) { for (let i = node.args.length - 1; i >= 0 ; i--) { @@ -71,7 +71,7 @@ Symbols.getLastNonSymbolTerm = function(node, symbolName) { } } - return null; + return undefined; }; // Iterates through a node and returns the denominator if it has a @@ -98,7 +98,7 @@ Symbols.getLastDenominatorWithSymbolTerm = function(node, symbolName) { } } } - return null; + return undefined; }; // Returns if `node` is a term with symbol `symbolName`