Javascript String splitLines(splitOptions = removeEmptyEntries: true, trim: true })
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. /**//w ww .j a v a 2s. c o m * Split a string using the cr and lf characters and return them as an array. * By default lines are trimmed and empty lines are removed. * @param {SplitLinesOptions=} splitOptions - Options used for splitting the string. */ String.prototype.splitLines = function (splitOptions = { removeEmptyEntries: true, trim: true }) { let lines = this.split(/\r?\n/g); if (splitOptions && splitOptions.trim) { lines = lines.filter(line => line.trim()); } if (splitOptions && splitOptions.removeEmptyEntries) { lines = lines.filter(line => line.length > 0); } return lines; }; //# sourceMappingURL=extensions.js.map