summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/xdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/locutus/php/xdiff')
-rw-r--r--node_modules/locutus/php/xdiff/index.js5
-rw-r--r--node_modules/locutus/php/xdiff/index.js.map1
-rw-r--r--node_modules/locutus/php/xdiff/xdiff_string_diff.js438
-rw-r--r--node_modules/locutus/php/xdiff/xdiff_string_diff.js.map1
-rw-r--r--node_modules/locutus/php/xdiff/xdiff_string_patch.js203
-rw-r--r--node_modules/locutus/php/xdiff/xdiff_string_patch.js.map1
6 files changed, 0 insertions, 649 deletions
diff --git a/node_modules/locutus/php/xdiff/index.js b/node_modules/locutus/php/xdiff/index.js
deleted file mode 100644
index c9aa7b3..0000000
--- a/node_modules/locutus/php/xdiff/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-module.exports['xdiff_string_diff'] = require('./xdiff_string_diff');
-module.exports['xdiff_string_patch'] = require('./xdiff_string_patch');
-//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/node_modules/locutus/php/xdiff/index.js.map b/node_modules/locutus/php/xdiff/index.js.map
deleted file mode 100644
index eb448cb..0000000
--- a/node_modules/locutus/php/xdiff/index.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["../../../src/php/xdiff/index.js"],"names":["module","exports","require"],"mappings":";;AAAAA,OAAOC,OAAP,CAAe,mBAAf,IAAsCC,QAAQ,qBAAR,CAAtC;AACAF,OAAOC,OAAP,CAAe,oBAAf,IAAuCC,QAAQ,sBAAR,CAAvC","file":"index.js","sourcesContent":["module.exports['xdiff_string_diff'] = require('./xdiff_string_diff')\nmodule.exports['xdiff_string_patch'] = require('./xdiff_string_patch')\n"]} \ No newline at end of file
diff --git a/node_modules/locutus/php/xdiff/xdiff_string_diff.js b/node_modules/locutus/php/xdiff/xdiff_string_diff.js
deleted file mode 100644
index 5fb5da0..0000000
--- a/node_modules/locutus/php/xdiff/xdiff_string_diff.js
+++ /dev/null
@@ -1,438 +0,0 @@
-'use strict';
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-module.exports = function xdiff_string_diff(oldData, newData, contextLines, minimal) {
- // eslint-disable-line camelcase
- // discuss at: http://locutus.io/php/xdiff_string_diff
- // original by: Brett Zamir (http://brett-zamir.me)
- // based on: Imgen Tata (http://www.myipdf.com/)
- // bugfixed by: Imgen Tata (http://www.myipdf.com/)
- // improved by: Brett Zamir (http://brett-zamir.me)
- // note 1: The minimal argument is not currently supported
- // example 1: xdiff_string_diff('', 'Hello world!')
- // returns 1: '@@ -0,0 +1,1 @@\n+Hello world!'
-
- // (This code was done by Imgen Tata; I have only reformatted for use in Locutus)
-
- // See http://en.wikipedia.org/wiki/Diff#Unified_format
- var i = 0;
- var j = 0;
- var k = 0;
- var oriHunkStart;
- var newHunkStart;
- var oriHunkEnd;
- var newHunkEnd;
- var oriHunkLineNo;
- var newHunkLineNo;
- var oriHunkSize;
- var newHunkSize;
- var MAX_CONTEXT_LINES = Number.POSITIVE_INFINITY; // Potential configuration
- var MIN_CONTEXT_LINES = 0;
- var DEFAULT_CONTEXT_LINES = 3;
- var HEADER_PREFIX = '@@ '; //
- var HEADER_SUFFIX = ' @@';
- var ORIGINAL_INDICATOR = '-';
- var NEW_INDICATOR = '+';
- var RANGE_SEPARATOR = ',';
- var CONTEXT_INDICATOR = ' ';
- var DELETION_INDICATOR = '-';
- var ADDITION_INDICATOR = '+';
- var oriLines;
- var newLines;
- var NEW_LINE = '\n';
-
- var _trim = function _trim(text) {
- if (typeof text !== 'string') {
- throw new Error('String parameter required');
- }
-
- return text.replace(/(^\s*)|(\s*$)/g, '');
- };
-
- var _verifyType = function _verifyType(type) {
- var args = arguments;
- var argsLen = arguments.length;
- var basicTypes = ['number', 'boolean', 'string', 'function', 'object', 'undefined'];
- var basicType;
- var i;
- var j;
- var typeOfType = typeof type === 'undefined' ? 'undefined' : _typeof(type);
- if (typeOfType !== 'string' && typeOfType !== 'function') {
- throw new Error('Bad type parameter');
- }
-
- if (argsLen < 2) {
- throw new Error('Too few arguments');
- }
-
- if (typeOfType === 'string') {
- type = _trim(type);
-
- if (type === '') {
- throw new Error('Bad type parameter');
- }
-
- for (j = 0; j < basicTypes.length; j++) {
- basicType = basicTypes[j];
-
- if (basicType === type) {
- for (i = 1; i < argsLen; i++) {
- if (_typeof(args[i]) !== type) {
- throw new Error('Bad type');
- }
- }
-
- return;
- }
- }
-
- throw new Error('Bad type parameter');
- }
-
- // Not basic type. we need to use instanceof operator
- for (i = 1; i < argsLen; i++) {
- if (!(args[i] instanceof type)) {
- throw new Error('Bad type');
- }
- }
- };
-
- var _hasValue = function _hasValue(array, value) {
- var i;
- _verifyType(Array, array);
-
- for (i = 0; i < array.length; i++) {
- if (array[i] === value) {
- return true;
- }
- }
-
- return false;
- };
-
- var _areTypeOf = function _areTypeOf(type) {
- var args = arguments;
- var argsLen = arguments.length;
- var basicTypes = ['number', 'boolean', 'string', 'function', 'object', 'undefined'];
- var basicType;
- var i;
- var j;
- var typeOfType = typeof type === 'undefined' ? 'undefined' : _typeof(type);
-
- if (typeOfType !== 'string' && typeOfType !== 'function') {
- throw new Error('Bad type parameter');
- }
-
- if (argsLen < 2) {
- throw new Error('Too few arguments');
- }
-
- if (typeOfType === 'string') {
- type = _trim(type);
-
- if (type === '') {
- return false;
- }
-
- for (j = 0; j < basicTypes.length; j++) {
- basicType = basicTypes[j];
-
- if (basicType === type) {
- for (i = 1; i < argsLen; i++) {
- if (_typeof(args[i]) !== type) {
- return false;
- }
- }
-
- return true;
- }
- }
-
- throw new Error('Bad type parameter');
- }
-
- // Not basic type. we need to use instanceof operator
- for (i = 1; i < argsLen; i++) {
- if (!(args[i] instanceof type)) {
- return false;
- }
- }
-
- return true;
- };
-
- var _getInitializedArray = function _getInitializedArray(arraySize, initValue) {
- var array = [];
- var i;
- _verifyType('number', arraySize);
-
- for (i = 0; i < arraySize; i++) {
- array.push(initValue);
- }
-
- return array;
- };
-
- var _splitIntoLines = function _splitIntoLines(text) {
- _verifyType('string', text);
-
- if (text === '') {
- return [];
- }
- return text.split('\n');
- };
-
- var _isEmptyArray = function _isEmptyArray(obj) {
- return _areTypeOf(Array, obj) && obj.length === 0;
- };
-
- /**
- * Finds longest common sequence between two sequences
- * @see {@link http://wordaligned.org/articles/longest-common-subsequence}
- */
- var _findLongestCommonSequence = function _findLongestCommonSequence(seq1, seq2, seq1IsInLcs, seq2IsInLcs) {
- if (!_areTypeOf(Array, seq1, seq2)) {
- throw new Error('Array parameters are required');
- }
-
- // Deal with edge case
- if (_isEmptyArray(seq1) || _isEmptyArray(seq2)) {
- return [];
- }
-
- // Function to calculate lcs lengths
- var lcsLens = function lcsLens(xs, ys) {
- var i;
- var j;
- var prev;
- var curr = _getInitializedArray(ys.length + 1, 0);
-
- for (i = 0; i < xs.length; i++) {
- prev = curr.slice(0);
- for (j = 0; j < ys.length; j++) {
- if (xs[i] === ys[j]) {
- curr[j + 1] = prev[j] + 1;
- } else {
- curr[j + 1] = Math.max(curr[j], prev[j + 1]);
- }
- }
- }
-
- return curr;
- };
-
- // Function to find lcs and fill in the array to indicate the optimal longest common sequence
- var _findLcs = function _findLcs(xs, xidx, xIsIn, ys) {
- var i;
- var xb;
- var xe;
- var llB;
- var llE;
- var pivot;
- var max;
- var yb;
- var ye;
- var nx = xs.length;
- var ny = ys.length;
-
- if (nx === 0) {
- return [];
- }
- if (nx === 1) {
- if (_hasValue(ys, xs[0])) {
- xIsIn[xidx] = true;
- return [xs[0]];
- }
- return [];
- }
- i = Math.floor(nx / 2);
- xb = xs.slice(0, i);
- xe = xs.slice(i);
- llB = lcsLens(xb, ys);
- llE = lcsLens(xe.slice(0).reverse(), ys.slice(0).reverse());
-
- pivot = 0;
- max = 0;
- for (j = 0; j <= ny; j++) {
- if (llB[j] + llE[ny - j] > max) {
- pivot = j;
- max = llB[j] + llE[ny - j];
- }
- }
- yb = ys.slice(0, pivot);
- ye = ys.slice(pivot);
- return _findLcs(xb, xidx, xIsIn, yb).concat(_findLcs(xe, xidx + i, xIsIn, ye));
- };
-
- // Fill in seq1IsInLcs to find the optimal longest common subsequence of first sequence
- _findLcs(seq1, 0, seq1IsInLcs, seq2);
- // Fill in seq2IsInLcs to find the optimal longest common subsequence
- // of second sequence and return the result
- return _findLcs(seq2, 0, seq2IsInLcs, seq1);
- };
-
- // First, check the parameters
- if (_areTypeOf('string', oldData, newData) === false) {
- return false;
- }
-
- if (oldData === newData) {
- return '';
- }
-
- if (typeof contextLines !== 'number' || contextLines > MAX_CONTEXT_LINES || contextLines < MIN_CONTEXT_LINES) {
- contextLines = DEFAULT_CONTEXT_LINES;
- }
-
- oriLines = _splitIntoLines(oldData);
- newLines = _splitIntoLines(newData);
- var oriLen = oriLines.length;
- var newLen = newLines.length;
- var oriIsInLcs = _getInitializedArray(oriLen, false);
- var newIsInLcs = _getInitializedArray(newLen, false);
- var lcsLen = _findLongestCommonSequence(oriLines, newLines, oriIsInLcs, newIsInLcs).length;
- var unidiff = '';
-
- if (lcsLen === 0) {
- // No common sequence
- unidiff = [HEADER_PREFIX, ORIGINAL_INDICATOR, oriLen > 0 ? '1' : '0', RANGE_SEPARATOR, oriLen, ' ', NEW_INDICATOR, newLen > 0 ? '1' : '0', RANGE_SEPARATOR, newLen, HEADER_SUFFIX].join('');
-
- for (i = 0; i < oriLen; i++) {
- unidiff += NEW_LINE + DELETION_INDICATOR + oriLines[i];
- }
-
- for (j = 0; j < newLen; j++) {
- unidiff += NEW_LINE + ADDITION_INDICATOR + newLines[j];
- }
-
- return unidiff;
- }
-
- var leadingContext = [];
- var trailingContext = [];
- var actualLeadingContext = [];
- var actualTrailingContext = [];
-
- // Regularize leading context by the contextLines parameter
- var regularizeLeadingContext = function regularizeLeadingContext(context) {
- if (context.length === 0 || contextLines === 0) {
- return [];
- }
-
- var contextStartPos = Math.max(context.length - contextLines, 0);
-
- return context.slice(contextStartPos);
- };
-
- // Regularize trailing context by the contextLines parameter
- var regularizeTrailingContext = function regularizeTrailingContext(context) {
- if (context.length === 0 || contextLines === 0) {
- return [];
- }
-
- return context.slice(0, Math.min(contextLines, context.length));
- };
-
- // Skip common lines in the beginning
- while (i < oriLen && oriIsInLcs[i] === true && newIsInLcs[i] === true) {
- leadingContext.push(oriLines[i]);
- i++;
- }
-
- j = i;
- // The index in the longest common sequence
- k = i;
- oriHunkStart = i;
- newHunkStart = j;
- oriHunkEnd = i;
- newHunkEnd = j;
-
- while (i < oriLen || j < newLen) {
- while (i < oriLen && oriIsInLcs[i] === false) {
- i++;
- }
- oriHunkEnd = i;
-
- while (j < newLen && newIsInLcs[j] === false) {
- j++;
- }
- newHunkEnd = j;
-
- // Find the trailing context
- trailingContext = [];
- while (i < oriLen && oriIsInLcs[i] === true && j < newLen && newIsInLcs[j] === true) {
- trailingContext.push(oriLines[i]);
- k++;
- i++;
- j++;
- }
-
- if (k >= lcsLen || // No more in longest common lines
- trailingContext.length >= 2 * contextLines) {
- // Context break found
- if (trailingContext.length < 2 * contextLines) {
- // It must be last block of common lines but not a context break
- trailingContext = [];
-
- // Force break out
- i = oriLen;
- j = newLen;
-
- // Update hunk ends to force output to the end
- oriHunkEnd = oriLen;
- newHunkEnd = newLen;
- }
-
- // Output the diff hunk
-
- // Trim the leading and trailing context block
- actualLeadingContext = regularizeLeadingContext(leadingContext);
- actualTrailingContext = regularizeTrailingContext(trailingContext);
-
- oriHunkStart -= actualLeadingContext.length;
- newHunkStart -= actualLeadingContext.length;
- oriHunkEnd += actualTrailingContext.length;
- newHunkEnd += actualTrailingContext.length;
-
- oriHunkLineNo = oriHunkStart + 1;
- newHunkLineNo = newHunkStart + 1;
- oriHunkSize = oriHunkEnd - oriHunkStart;
- newHunkSize = newHunkEnd - newHunkStart;
-
- // Build header
- unidiff += [HEADER_PREFIX, ORIGINAL_INDICATOR, oriHunkLineNo, RANGE_SEPARATOR, oriHunkSize, ' ', NEW_INDICATOR, newHunkLineNo, RANGE_SEPARATOR, newHunkSize, HEADER_SUFFIX, NEW_LINE].join('');
-
- // Build the diff hunk content
- while (oriHunkStart < oriHunkEnd || newHunkStart < newHunkEnd) {
- if (oriHunkStart < oriHunkEnd && oriIsInLcs[oriHunkStart] === true && newIsInLcs[newHunkStart] === true) {
- // The context line
- unidiff += CONTEXT_INDICATOR + oriLines[oriHunkStart] + NEW_LINE;
- oriHunkStart++;
- newHunkStart++;
- } else if (oriHunkStart < oriHunkEnd && oriIsInLcs[oriHunkStart] === false) {
- // The deletion line
- unidiff += DELETION_INDICATOR + oriLines[oriHunkStart] + NEW_LINE;
- oriHunkStart++;
- } else if (newHunkStart < newHunkEnd && newIsInLcs[newHunkStart] === false) {
- // The additional line
- unidiff += ADDITION_INDICATOR + newLines[newHunkStart] + NEW_LINE;
- newHunkStart++;
- }
- }
-
- // Update hunk position and leading context
- oriHunkStart = i;
- newHunkStart = j;
- leadingContext = trailingContext;
- }
- }
-
- // Trim the trailing new line if it exists
- if (unidiff.length > 0 && unidiff.charAt(unidiff.length) === NEW_LINE) {
- unidiff = unidiff.slice(0, -1);
- }
-
- return unidiff;
-};
-//# sourceMappingURL=xdiff_string_diff.js.map \ No newline at end of file
diff --git a/node_modules/locutus/php/xdiff/xdiff_string_diff.js.map b/node_modules/locutus/php/xdiff/xdiff_string_diff.js.map
deleted file mode 100644
index e416386..0000000
--- a/node_modules/locutus/php/xdiff/xdiff_string_diff.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["../../../src/php/xdiff/xdiff_string_diff.js"],"names":["module","exports","xdiff_string_diff","oldData","newData","contextLines","minimal","i","j","k","oriHunkStart","newHunkStart","oriHunkEnd","newHunkEnd","oriHunkLineNo","newHunkLineNo","oriHunkSize","newHunkSize","MAX_CONTEXT_LINES","Number","POSITIVE_INFINITY","MIN_CONTEXT_LINES","DEFAULT_CONTEXT_LINES","HEADER_PREFIX","HEADER_SUFFIX","ORIGINAL_INDICATOR","NEW_INDICATOR","RANGE_SEPARATOR","CONTEXT_INDICATOR","DELETION_INDICATOR","ADDITION_INDICATOR","oriLines","newLines","NEW_LINE","_trim","text","Error","replace","_verifyType","type","args","arguments","argsLen","length","basicTypes","basicType","typeOfType","_hasValue","array","value","Array","_areTypeOf","_getInitializedArray","arraySize","initValue","push","_splitIntoLines","split","_isEmptyArray","obj","_findLongestCommonSequence","seq1","seq2","seq1IsInLcs","seq2IsInLcs","lcsLens","xs","ys","prev","curr","slice","Math","max","_findLcs","xidx","xIsIn","xb","xe","llB","llE","pivot","yb","ye","nx","ny","floor","reverse","concat","oriLen","newLen","oriIsInLcs","newIsInLcs","lcsLen","unidiff","join","leadingContext","trailingContext","actualLeadingContext","actualTrailingContext","regularizeLeadingContext","context","contextStartPos","regularizeTrailingContext","min","charAt"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,iBAAT,CAA4BC,OAA5B,EAAqCC,OAArC,EAA8CC,YAA9C,EAA4DC,OAA5D,EAAqE;AAAE;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,IAAI,CAAR;AACA,MAAIC,YAAJ;AACA,MAAIC,YAAJ;AACA,MAAIC,UAAJ;AACA,MAAIC,UAAJ;AACA,MAAIC,aAAJ;AACA,MAAIC,aAAJ;AACA,MAAIC,WAAJ;AACA,MAAIC,WAAJ;AACA,MAAIC,oBAAoBC,OAAOC,iBAA/B,CAxBoF,CAwBnC;AACjD,MAAIC,oBAAoB,CAAxB;AACA,MAAIC,wBAAwB,CAA5B;AACA,MAAIC,gBAAgB,KAApB,CA3BoF,CA2B1D;AAC1B,MAAIC,gBAAgB,KAApB;AACA,MAAIC,qBAAqB,GAAzB;AACA,MAAIC,gBAAgB,GAApB;AACA,MAAIC,kBAAkB,GAAtB;AACA,MAAIC,oBAAoB,GAAxB;AAC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AAvB,MAAmCV,QAA7D,EAAuE;AACrE4D,cAAUA,QAAQvB,KAAR,CAAc,CAAd,EAAiB,CAAC,CAAlB,CAAV;AACD;;AAED,SAAOuB,OAAP;AACD,CA9cD","file":"xdiff_string_diff.js","sourcesContent":["module.exports = function xdiff_string_diff (oldData, newData, contextLines, minimal) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/xdiff_string_diff\n // original by: Brett Zamir (http://brett-zamir.me)\n // based on: Imgen Tata (http://www.myipdf.com/)\n // bugfixed by: Imgen Tata (http://www.myipdf.com/)\n // improved by: Brett Zamir (http://brett-zamir.me)\n // note 1: The minimal argument is not currently supported\n // example 1: xdiff_string_diff('', 'Hello world!')\n // returns 1: '@@ -0,0 +1,1 @@\\n+Hello world!'\n\n // (This code was done by Imgen Tata; I have only reformatted for use in Locutus)\n\n // See http://en.wikipedia.org/wiki/Diff#Unified_format\n var i = 0\n var j = 0\n var k = 0\n var oriHunkStart\n var newHunkStart\n var oriHunkEnd\n var newHunkEnd\n var oriHunkLineNo\n var newHunkLineNo\n var oriHunkSize\n var newHunkSize\n var MAX_CONTEXT_LINES = Number.POSITIVE_INFINITY // Potential configuration\n var MIN_CONTEXT_LINES = 0\n var DEFAULT_CONTEXT_LINES = 3\n var HEADER_PREFIX = '@@ ' //\n var HEADER_SUFFIX = ' @@'\n var ORIGINAL_INDICATOR = '-'\n var NEW_INDICATOR = '+'\n var RANGE_SEPARATOR = ','\n var CONTEXT_INDICATOR = ' '\n var DELETION_INDICATOR = '-'\n var ADDITION_INDICATOR = '+'\n var oriLines\n var newLines\n var NEW_LINE = '\\n'\n\n var _trim = function (text) {\n if (typeof text !== 'string') {\n throw new Error('String parameter required')\n }\n\n return text.replace(/(^\\s*)|(\\s*$)/g, '')\n }\n\n var _verifyType = function (type) {\n var args = arguments\n var argsLen = arguments.length\n var basicTypes = ['number', 'boolean', 'string', 'function', 'object', 'undefined']\n var basicType\n var i\n var j\n var typeOfType = typeof type\n if (typeOfType !== 'string' && typeOfType !== 'function') {\n throw new Error('Bad type parameter')\n }\n\n if (argsLen < 2) {\n throw new Error('Too few arguments')\n }\n\n if (typeOfType === 'string') {\n type = _trim(type)\n\n if (type === '') {\n throw new Error('Bad type parameter')\n }\n\n for (j = 0; j < basicTypes.length; j++) {\n basicType = basicTypes[j]\n\n if (basicType === type) {\n for (i = 1; i < argsLen; i++) {\n if (typeof args[i] !== type) {\n throw new Error('Bad type')\n }\n }\n\n return\n }\n }\n\n throw new Error('Bad type parameter')\n }\n\n // Not basic type. we need to use instanceof operator\n for (i = 1; i < argsLen; i++) {\n if (!(args[i] instanceof type)) {\n throw new Error('Bad type')\n }\n }\n }\n\n var _hasValue = function (array, value) {\n var i\n _verifyType(Array, array)\n\n for (i = 0; i < array.length; i++) {\n if (array[i] === value) {\n return true\n }\n }\n\n return false\n }\n\n var _areTypeOf = function (type) {\n var args = arguments\n var argsLen = arguments.length\n var basicTypes = ['number', 'boolean', 'string', 'function', 'object', 'undefined']\n var basicType\n var i\n var j\n var typeOfType = typeof type\n\n if (typeOfType !== 'string' && typeOfType !== 'function') {\n throw new Error('Bad type parameter')\n }\n\n if (argsLen < 2) {\n throw new Error('Too few arguments')\n }\n\n if (typeOfType === 'string') {\n type = _trim(type)\n\n if (type === '') {\n return false\n }\n\n for (j = 0; j < basicTypes.length; j++) {\n basicType = basicTypes[j]\n\n if (basicType === type) {\n for (i = 1; i < argsLen; i++) {\n if (typeof args[i] !== type) {\n return false\n }\n }\n\n return true\n }\n }\n\n throw new Error('Bad type parameter')\n }\n\n // Not basic type. we need to use instanceof operator\n for (i = 1; i < argsLen; i++) {\n if (!(args[i] instanceof type)) {\n return false\n }\n }\n\n return true\n }\n\n var _getInitializedArray = function (arraySize, initValue) {\n var array = []\n var i\n _verifyType('number', arraySize)\n\n for (i = 0; i < arraySize; i++) {\n array.push(initValue)\n }\n\n return array\n }\n\n var _splitIntoLines = function (text) {\n _verifyType('string', text)\n\n if (text === '') {\n return []\n }\n return text.split('\\n')\n }\n\n var _isEmptyArray = function (obj) {\n return _areTypeOf(Array, obj) && obj.length === 0\n }\n\n /**\n * Finds longest common sequence between two sequences\n * @see {@link http://wordaligned.org/articles/longest-common-subsequence}\n */\n var _findLongestCommonSequence = function (seq1, seq2, seq1IsInLcs, seq2IsInLcs) {\n if (!_areTypeOf(Array, seq1, seq2)) {\n throw new Error('Array parameters are required')\n }\n\n // Deal with edge case\n if (_isEmptyArray(seq1) || _isEmptyArray(seq2)) {\n return []\n }\n\n // Function to calculate lcs lengths\n var lcsLens = function (xs, ys) {\n var i\n var j\n var prev\n var curr = _getInitializedArray(ys.length + 1, 0)\n\n for (i = 0; i < xs.length; i++) {\n prev = curr.slice(0)\n for (j = 0; j < ys.length; j++) {\n if (xs[i] === ys[j]) {\n curr[j + 1] = prev[j] + 1\n } else {\n curr[j + 1] = Math.max(curr[j], prev[j + 1])\n }\n }\n }\n\n return curr\n }\n\n // Function to find lcs and fill in the array to indicate the optimal longest common sequence\n var _findLcs = function (xs, xidx, xIsIn, ys) {\n var i\n var xb\n var xe\n var llB\n var llE\n var pivot\n var max\n var yb\n var ye\n var nx = xs.length\n var ny = ys.length\n\n if (nx === 0) {\n return []\n }\n if (nx === 1) {\n if (_hasValue(ys, xs[0])) {\n xIsIn[xidx] = true\n return [xs[0]]\n }\n return []\n }\n i = Math.floor(nx / 2)\n xb = xs.slice(0, i)\n xe = xs.slice(i)\n llB = lcsLens(xb, ys)\n llE = lcsLens(xe.slice(0)\n .reverse(), ys.slice(0)\n .reverse())\n\n pivot = 0\n max = 0\n for (j = 0; j <= ny; j++) {\n if (llB[j] + llE[ny - j] > max) {\n pivot = j\n max = llB[j] + llE[ny - j]\n }\n }\n yb = ys.slice(0, pivot)\n ye = ys.slice(pivot)\n return _findLcs(xb, xidx, xIsIn, yb).concat(_findLcs(xe, xidx + i, xIsIn, ye))\n }\n\n // Fill in seq1IsInLcs to find the optimal longest common subsequence of first sequence\n _findLcs(seq1, 0, seq1IsInLcs, seq2)\n // Fill in seq2IsInLcs to find the optimal longest common subsequence\n // of second sequence and return the result\n return _findLcs(seq2, 0, seq2IsInLcs, seq1)\n }\n\n // First, check the parameters\n if (_areTypeOf('string', oldData, newData) === false) {\n return false\n }\n\n if (oldData === newData) {\n return ''\n }\n\n if (typeof contextLines !== 'number' ||\n contextLines > MAX_CONTEXT_LINES ||\n contextLines < MIN_CONTEXT_LINES) {\n contextLines = DEFAULT_CONTEXT_LINES\n }\n\n oriLines = _splitIntoLines(oldData)\n newLines = _splitIntoLines(newData)\n var oriLen = oriLines.length\n var newLen = newLines.length\n var oriIsInLcs = _getInitializedArray(oriLen, false)\n var newIsInLcs = _getInitializedArray(newLen, false)\n var lcsLen = _findLongestCommonSequence(oriLines, newLines, oriIsInLcs, newIsInLcs).length\n var unidiff = ''\n\n if (lcsLen === 0) {\n // No common sequence\n unidiff = [\n HEADER_PREFIX,\n ORIGINAL_INDICATOR,\n (oriLen > 0 ? '1' : '0'),\n RANGE_SEPARATOR,\n oriLen,\n ' ',\n NEW_INDICATOR,\n (newLen > 0 ? '1' : '0'),\n RANGE_SEPARATOR,\n newLen,\n HEADER_SUFFIX\n ].join('')\n\n for (i = 0; i < oriLen; i++) {\n unidiff += NEW_LINE + DELETION_INDICATOR + oriLines[i]\n }\n\n for (j = 0; j < newLen; j++) {\n unidiff += NEW_LINE + ADDITION_INDICATOR + newLines[j]\n }\n\n return unidiff\n }\n\n var leadingContext = []\n var trailingContext = []\n var actualLeadingContext = []\n var actualTrailingContext = []\n\n // Regularize leading context by the contextLines parameter\n var regularizeLeadingContext = function (context) {\n if (context.length === 0 || contextLines === 0) {\n return []\n }\n\n var contextStartPos = Math.max(context.length - contextLines, 0)\n\n return context.slice(contextStartPos)\n }\n\n // Regularize trailing context by the contextLines parameter\n var regularizeTrailingContext = function (context) {\n if (context.length === 0 || contextLines === 0) {\n return []\n }\n\n return context.slice(0, Math.min(contextLines, context.length))\n }\n\n // Skip common lines in the beginning\n while (i < oriLen && oriIsInLcs[i] === true && newIsInLcs[i] === true) {\n leadingContext.push(oriLines[i])\n i++\n }\n\n j = i\n // The index in the longest common sequence\n k = i\n oriHunkStart = i\n newHunkStart = j\n oriHunkEnd = i\n newHunkEnd = j\n\n while (i < oriLen || j < newLen) {\n while (i < oriLen && oriIsInLcs[i] === false) {\n i++\n }\n oriHunkEnd = i\n\n while (j < newLen && newIsInLcs[j] === false) {\n j++\n }\n newHunkEnd = j\n\n // Find the trailing context\n trailingContext = []\n while (i < oriLen && oriIsInLcs[i] === true && j < newLen && newIsInLcs[j] === true) {\n trailingContext.push(oriLines[i])\n k++\n i++\n j++\n }\n\n if (k >= lcsLen || // No more in longest common lines\n trailingContext.length >= 2 * contextLines) {\n // Context break found\n if (trailingContext.length < 2 * contextLines) {\n // It must be last block of common lines but not a context break\n trailingContext = []\n\n // Force break out\n i = oriLen\n j = newLen\n\n // Update hunk ends to force output to the end\n oriHunkEnd = oriLen\n newHunkEnd = newLen\n }\n\n // Output the diff hunk\n\n // Trim the leading and trailing context block\n actualLeadingContext = regularizeLeadingContext(leadingContext)\n actualTrailingContext = regularizeTrailingContext(trailingContext)\n\n oriHunkStart -= actualLeadingContext.length\n newHunkStart -= actualLeadingContext.length\n oriHunkEnd += actualTrailingContext.length\n newHunkEnd += actualTrailingContext.length\n\n oriHunkLineNo = oriHunkStart + 1\n newHunkLineNo = newHunkStart + 1\n oriHunkSize = oriHunkEnd - oriHunkStart\n newHunkSize = newHunkEnd - newHunkStart\n\n // Build header\n unidiff += [\n HEADER_PREFIX,\n ORIGINAL_INDICATOR,\n oriHunkLineNo,\n RANGE_SEPARATOR,\n oriHunkSize,\n ' ',\n NEW_INDICATOR,\n newHunkLineNo,\n RANGE_SEPARATOR,\n newHunkSize,\n HEADER_SUFFIX,\n NEW_LINE\n ].join('')\n\n // Build the diff hunk content\n while (oriHunkStart < oriHunkEnd || newHunkStart < newHunkEnd) {\n if (oriHunkStart < oriHunkEnd &&\n oriIsInLcs[oriHunkStart] === true &&\n newIsInLcs[newHunkStart] === true) {\n // The context line\n unidiff += CONTEXT_INDICATOR + oriLines[oriHunkStart] + NEW_LINE\n oriHunkStart++\n newHunkStart++\n } else if (oriHunkStart < oriHunkEnd && oriIsInLcs[oriHunkStart] === false) {\n // The deletion line\n unidiff += DELETION_INDICATOR + oriLines[oriHunkStart] + NEW_LINE\n oriHunkStart++\n } else if (newHunkStart < newHunkEnd && newIsInLcs[newHunkStart] === false) {\n // The additional line\n unidiff += ADDITION_INDICATOR + newLines[newHunkStart] + NEW_LINE\n newHunkStart++\n }\n }\n\n // Update hunk position and leading context\n oriHunkStart = i\n newHunkStart = j\n leadingContext = trailingContext\n }\n }\n\n // Trim the trailing new line if it exists\n if (unidiff.length > 0 && unidiff.charAt(unidiff.length) === NEW_LINE) {\n unidiff = unidiff.slice(0, -1)\n }\n\n return unidiff\n}\n"]} \ No newline at end of file
diff --git a/node_modules/locutus/php/xdiff/xdiff_string_patch.js b/node_modules/locutus/php/xdiff/xdiff_string_patch.js
deleted file mode 100644
index af40a33..0000000
--- a/node_modules/locutus/php/xdiff/xdiff_string_patch.js
+++ /dev/null
@@ -1,203 +0,0 @@
-'use strict';
-
-module.exports = function xdiff_string_patch(originalStr, patch, flags, errorObj) {
- // eslint-disable-line camelcase
- // discuss at: http://locutus.io/php/xdiff_string_patch/
- // original by: Brett Zamir (http://brett-zamir.me)
- // improved by: Steven Levithan (stevenlevithan.com)
- // note 1: The XDIFF_PATCH_IGNORESPACE flag and the error argument are not
- // note 1: currently supported.
- // note 2: This has not been tested exhaustively yet.
- // note 3: The errorObj parameter (optional) if used must be passed in as a
- // note 3: object. The errors will then be written by reference into it's `value` property
- // example 1: xdiff_string_patch('', '@@ -0,0 +1,1 @@\n+Hello world!')
- // returns 1: 'Hello world!'
-
- // First two functions were adapted from Steven Levithan, also under an MIT license
- // Adapted from XRegExp 1.5.0
- // (c) 2007-2010 Steven Levithan
- // MIT License
- // <http://xregexp.com>
-
- var _getNativeFlags = function _getNativeFlags(regex) {
- // Proposed for ES4; included in AS3
- return [regex.global ? 'g' : '', regex.ignoreCase ? 'i' : '', regex.multiline ? 'm' : '', regex.extended ? 'x' : '', regex.sticky ? 'y' : ''].join('');
- };
-
- var _cbSplit = function _cbSplit(string, sep) {
- // If separator `s` is not a regex, use the native `split`
- if (!(sep instanceof RegExp)) {
- // Had problems to get it to work here using prototype test
- return String.prototype.split.apply(string, arguments);
- }
- var str = String(string);
- var output = [];
- var lastLastIndex = 0;
- var match;
- var lastLength;
- var limit = Infinity;
- var x = sep._xregexp;
- // This is required if not `s.global`, and it avoids needing to set `s.lastIndex` to zero
- // and restore it to its original value when we're done using the regex
- // Brett paring down
- var s = new RegExp(sep.source, _getNativeFlags(sep) + 'g');
- if (x) {
- s._xregexp = {
- source: x.source,
- captureNames: x.captureNames ? x.captureNames.slice(0) : null
- };
- }
-
- while (match = s.exec(str)) {
- // Run the altered `exec` (required for `lastIndex` fix, etc.)
- if (s.lastIndex > lastLastIndex) {
- output.push(str.slice(lastLastIndex, match.index));
-
- if (match.length > 1 && match.index < str.length) {
- Array.prototype.push.apply(output, match.slice(1));
- }
-
- lastLength = match[0].length;
- lastLastIndex = s.lastIndex;
-
- if (output.length >= limit) {
- break;
- }
- }
-
- if (s.lastIndex === match.index) {
- s.lastIndex++;
- }
- }
-
- if (lastLastIndex === str.length) {
- if (!s.test('') || lastLength) {
- output.push('');
- }
- } else {
- output.push(str.slice(lastLastIndex));
- }
-
- return output.length > limit ? output.slice(0, limit) : output;
- };
-
- var i = 0;
- var ll = 0;
- var ranges = [];
- var lastLinePos = 0;
- var firstChar = '';
- var rangeExp = /^@@\s+-(\d+),(\d+)\s+\+(\d+),(\d+)\s+@@$/;
- var lineBreaks = /\r?\n/;
- var lines = _cbSplit(patch.replace(/(\r?\n)+$/, ''), lineBreaks);
- var origLines = _cbSplit(originalStr, lineBreaks);
- var newStrArr = [];
- var linePos = 0;
- var errors = '';
- var optTemp = 0; // Both string & integer (constant) input is allowed
- var OPTS = {
- // Unsure of actual PHP values, so better to rely on string
- 'XDIFF_PATCH_NORMAL': 1,
- 'XDIFF_PATCH_REVERSE': 2,
- 'XDIFF_PATCH_IGNORESPACE': 4
- };
-
- // Input defaulting & sanitation
- if (typeof originalStr !== 'string' || !patch) {
- return false;
- }
- if (!flags) {
- flags = 'XDIFF_PATCH_NORMAL';
- }
-
- if (typeof flags !== 'number') {
- // Allow for a single string or an array of string flags
- flags = [].concat(flags);
- for (i = 0; i < flags.length; i++) {
- // Resolve string input to bitwise e.g. 'XDIFF_PATCH_NORMAL' becomes 1
- if (OPTS[flags[i]]) {
- optTemp = optTemp | OPTS[flags[i]];
- }
- }
- flags = optTemp;
- }
-
- if (flags & OPTS.XDIFF_PATCH_NORMAL) {
- for (i = 0, ll = lines.length; i < ll; i++) {
- ranges = lines[i].match(rangeExp);
- if (ranges) {
- lastLinePos = linePos;
- linePos = ranges[1] - 1;
- while (lastLinePos < linePos) {
- newStrArr[newStrArr.length] = origLines[lastLinePos++];
- }
- while (lines[++i] && rangeExp.exec(lines[i]) === null) {
- firstChar = lines[i].charAt(0);
- switch (firstChar) {
- case '-':
- // Skip including that line
- ++linePos;
- break;
- case '+':
- newStrArr[newStrArr.length] = lines[i].slice(1);
- break;
- case ' ':
- newStrArr[newStrArr.length] = origLines[linePos++];
- break;
- default:
- // Reconcile with returning errrors arg?
- throw new Error('Unrecognized initial character in unidiff line');
- }
- }
- if (lines[i]) {
- i--;
- }
- }
- }
- while (linePos > 0 && linePos < origLines.length) {
- newStrArr[newStrArr.length] = origLines[linePos++];
- }
- } else if (flags & OPTS.XDIFF_PATCH_REVERSE) {
- // Only differs from above by a few lines
- for (i = 0, ll = lines.length; i < ll; i++) {
- ranges = lines[i].match(rangeExp);
- if (ranges) {
- lastLinePos = linePos;
- linePos = ranges[3] - 1;
- while (lastLinePos < linePos) {
- newStrArr[newStrArr.length] = origLines[lastLinePos++];
- }
- while (lines[++i] && rangeExp.exec(lines[i]) === null) {
- firstChar = lines[i].charAt(0);
- switch (firstChar) {
- case '-':
- newStrArr[newStrArr.length] = lines[i].slice(1);
- break;
- case '+':
- // Skip including that line
- ++linePos;
- break;
- case ' ':
- newStrArr[newStrArr.length] = origLines[linePos++];
- break;
- default:
- // Reconcile with returning errrors arg?
- throw new Error('Unrecognized initial character in unidiff line');
- }
- }
- if (lines[i]) {
- i--;
- }
- }
- }
- while (linePos > 0 && linePos < origLines.length) {
- newStrArr[newStrArr.length] = origLines[linePos++];
- }
- }
-
- if (errorObj) {
- errorObj.value = errors;
- }
-
- return newStrArr.join('\n');
-};
-//# sourceMappingURL=xdiff_string_patch.js.map \ No newline at end of file
diff --git a/node_modules/locutus/php/xdiff/xdiff_string_patch.js.map b/node_modules/locutus/php/xdiff/xdiff_string_patch.js.map
deleted file mode 100644
index bf6e88d..0000000
--- a/node_modules/locutus/php/xdiff/xdiff_string_patch.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["../../../src/php/xdiff/xdiff_string_patch.js"],"names":["module","exports","xdiff_string_patch","originalStr","patch","flags","errorObj","_getNativeFlags","regex","global","ignoreCase","multiline","extended","sticky","join","_cbSplit","string","sep","RegExp","String","prototype","split","apply","arguments","str","output","lastLastIndex","match","lastLength","limit","Infinity","x","_xregexp","s","source","captureNames","slice","exec","lastIndex","push","index","length","Array","test","i","ll","ranges","lastLinePos","firstChar","rangeExp","lineBreaks","lines","replace","origLines","newStrArr","linePos","errors","optTemp","OPTS","concat","XDIFF_PATCH_NORMAL","charAt","Error","XDIFF_PATCH_REVERSE","value"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,kBAAT,CAA6BC,WAA7B,EAA0CC,KAA1C,EAAiDC,KAAjD,EAAwDC,QAAxD,EAAkE;AAAE;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,kBAAkB,SAAlBA,eAAkB,CAAUC,KAAV,EAAiB;AACrC;AACA,WAAO,CACJA,MAAMC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M,IAAIO,KAAJ,CAAU,gDAAV,CAAN;AAbJ;AAeD;AACD,YAAIX,MAAMP,CAAN,CAAJ,EAAc;AACZA;AACD;AACF;AACF;AACD,WAAOW,UAAU,CAAV,IAAeA,UAAUF,UAAUZ,MAA1C,EAAkD;AAChDa,gBAAUA,UAAUb,MAApB,IAA8BY,UAAUE,SAAV,CAA9B;AACD;AACF;;AAED,MAAIjD,QAAJ,EAAc;AACZA,aAAS0D,KAAT,GAAiBR,MAAjB;AACD;;AAED,SAAOF,UAAUxC,IAAV,CAAe,IAAf,CAAP;AACD,CA5MD","file":"xdiff_string_patch.js","sourcesContent":["module.exports = function xdiff_string_patch (originalStr, patch, flags, errorObj) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/xdiff_string_patch/\n // original by: Brett Zamir (http://brett-zamir.me)\n // improved by: Steven Levithan (stevenlevithan.com)\n // note 1: The XDIFF_PATCH_IGNORESPACE flag and the error argument are not\n // note 1: currently supported.\n // note 2: This has not been tested exhaustively yet.\n // note 3: The errorObj parameter (optional) if used must be passed in as a\n // note 3: object. The errors will then be written by reference into it's `value` property\n // example 1: xdiff_string_patch('', '@@ -0,0 +1,1 @@\\n+Hello world!')\n // returns 1: 'Hello world!'\n\n // First two functions were adapted from Steven Levithan, also under an MIT license\n // Adapted from XRegExp 1.5.0\n // (c) 2007-2010 Steven Levithan\n // MIT License\n // <http://xregexp.com>\n\n var _getNativeFlags = function (regex) {\n // Proposed for ES4; included in AS3\n return [\n (regex.global ? 'g' : ''),\n (regex.ignoreCase ? 'i' : ''),\n (regex.multiline ? 'm' : ''),\n (regex.extended ? 'x' : ''),\n (regex.sticky ? 'y' : '')\n ].join('')\n }\n\n var _cbSplit = function (string, sep) {\n // If separator `s` is not a regex, use the native `split`\n if (!(sep instanceof RegExp)) {\n // Had problems to get it to work here using prototype test\n return String.prototype.split.apply(string, arguments)\n }\n var str = String(string)\n var output = []\n var lastLastIndex = 0\n var match\n var lastLength\n var limit = Infinity\n var x = sep._xregexp\n // This is required if not `s.global`, and it avoids needing to set `s.lastIndex` to zero\n // and restore it to its original value when we're done using the regex\n // Brett paring down\n var s = new RegExp(sep.source, _getNativeFlags(sep) + 'g')\n if (x) {\n s._xregexp = {\n source: x.source,\n captureNames: x.captureNames ? x.captureNames.slice(0) : null\n }\n }\n\n while ((match = s.exec(str))) {\n // Run the altered `exec` (required for `lastIndex` fix, etc.)\n if (s.lastIndex > lastLastIndex) {\n output.push(str.slice(lastLastIndex, match.index))\n\n if (match.length > 1 && match.index < str.length) {\n Array.prototype.push.apply(output, match.slice(1))\n }\n\n lastLength = match[0].length\n lastLastIndex = s.lastIndex\n\n if (output.length >= limit) {\n break\n }\n }\n\n if (s.lastIndex === match.index) {\n s.lastIndex++\n }\n }\n\n if (lastLastIndex === str.length) {\n if (!s.test('') || lastLength) {\n output.push('')\n }\n } else {\n output.push(str.slice(lastLastIndex))\n }\n\n return output.length > limit ? output.slice(0, limit) : output\n }\n\n var i = 0\n var ll = 0\n var ranges = []\n var lastLinePos = 0\n var firstChar = ''\n var rangeExp = /^@@\\s+-(\\d+),(\\d+)\\s+\\+(\\d+),(\\d+)\\s+@@$/\n var lineBreaks = /\\r?\\n/\n var lines = _cbSplit(patch.replace(/(\\r?\\n)+$/, ''), lineBreaks)\n var origLines = _cbSplit(originalStr, lineBreaks)\n var newStrArr = []\n var linePos = 0\n var errors = ''\n var optTemp = 0 // Both string & integer (constant) input is allowed\n var OPTS = {\n // Unsure of actual PHP values, so better to rely on string\n 'XDIFF_PATCH_NORMAL': 1,\n 'XDIFF_PATCH_REVERSE': 2,\n 'XDIFF_PATCH_IGNORESPACE': 4\n }\n\n // Input defaulting & sanitation\n if (typeof originalStr !== 'string' || !patch) {\n return false\n }\n if (!flags) {\n flags = 'XDIFF_PATCH_NORMAL'\n }\n\n if (typeof flags !== 'number') {\n // Allow for a single string or an array of string flags\n flags = [].concat(flags)\n for (i = 0; i < flags.length; i++) {\n // Resolve string input to bitwise e.g. 'XDIFF_PATCH_NORMAL' becomes 1\n if (OPTS[flags[i]]) {\n optTemp = optTemp | OPTS[flags[i]]\n }\n }\n flags = optTemp\n }\n\n if (flags & OPTS.XDIFF_PATCH_NORMAL) {\n for (i = 0, ll = lines.length; i < ll; i++) {\n ranges = lines[i].match(rangeExp)\n if (ranges) {\n lastLinePos = linePos\n linePos = ranges[1] - 1\n while (lastLinePos < linePos) {\n newStrArr[newStrArr.length] = origLines[lastLinePos++]\n }\n while (lines[++i] && (rangeExp.exec(lines[i])) === null) {\n firstChar = lines[i].charAt(0)\n switch (firstChar) {\n case '-':\n // Skip including that line\n ++linePos\n break\n case '+':\n newStrArr[newStrArr.length] = lines[i].slice(1)\n break\n case ' ':\n newStrArr[newStrArr.length] = origLines[linePos++]\n break\n default:\n // Reconcile with returning errrors arg?\n throw new Error('Unrecognized initial character in unidiff line')\n }\n }\n if (lines[i]) {\n i--\n }\n }\n }\n while (linePos > 0 && linePos < origLines.length) {\n newStrArr[newStrArr.length] = origLines[linePos++]\n }\n } else if (flags & OPTS.XDIFF_PATCH_REVERSE) {\n // Only differs from above by a few lines\n for (i = 0, ll = lines.length; i < ll; i++) {\n ranges = lines[i].match(rangeExp)\n if (ranges) {\n lastLinePos = linePos\n linePos = ranges[3] - 1\n while (lastLinePos < linePos) {\n newStrArr[newStrArr.length] = origLines[lastLinePos++]\n }\n while (lines[++i] && (rangeExp.exec(lines[i])) === null) {\n firstChar = lines[i].charAt(0)\n switch (firstChar) {\n case '-':\n newStrArr[newStrArr.length] = lines[i].slice(1)\n break\n case '+':\n // Skip including that line\n ++linePos\n break\n case ' ':\n newStrArr[newStrArr.length] = origLines[linePos++]\n break\n default:\n // Reconcile with returning errrors arg?\n throw new Error('Unrecognized initial character in unidiff line')\n }\n }\n if (lines[i]) {\n i--\n }\n }\n }\n while (linePos > 0 && linePos < origLines.length) {\n newStrArr[newStrArr.length] = origLines[linePos++]\n }\n }\n\n if (errorObj) {\n errorObj.value = errors\n }\n\n return newStrArr.join('\\n')\n}\n"]} \ No newline at end of file