UNPKG

the-math

Version:

TheMath is an extensive math library for JavaScript and Node.js. It features a flexible expression parser

22 lines (21 loc) 609 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBracketOperation = void 0; function getBracketOperation(fragments) { var openIndex = -1; var closeIndex = -1; fragments.every(function (fragment, index) { if (fragment === '(') { openIndex = index; } if (fragment === ')') { closeIndex = index; } if (openIndex !== -1 && closeIndex !== -1) { return false; } return true; }); return [openIndex, closeIndex]; } exports.getBracketOperation = getBracketOperation;