### To check whether or not this is reachable
```js
-var last = require("lodash").last;
-
function isReachable(segment) {
return segment.reachable;
}
// Checks reachable or not.
"ExpressionStatement": function(node) {
- var codePath = last(codePathStack);
+ var codePath = codePathStack[codePathStack.length - 1];
// Checks the current code path segments.
if (!codePath.currentSegments.some(isReachable)) {
Please use a map of information instead.
```js
-var last = require("lodash").last;
-
function hasCb(node, context) {
if (node.type.indexOf("Function") !== -1) {
return context.getDeclaredVariables(node).some(function(v) {
// Manages state of code paths.
"onCodePathSegmentStart": function(segment) {
+ var funcInfo = funcInfoStack[funcInfoStack - 1];
+
// Ignores if `cb` doesn't exist.
- if (!last(funcInfoStack).hasCb) {
+ if (!funcInfo.hasCb) {
return;
}
// Checks reachable or not.
"CallExpression": function(node) {
- var funcInfo = last(funcInfoStack);
+ var funcInfo = funcInfoStack[funcInfoStack - 1];
// Ignores if `cb` doesn't exist.
if (!funcInfo.hasCb) {