UIZE JavaScript Framework

TO DO - Uize.Str.Lines

This is a TO DO document for the Uize.Str.Lines module.

1. Possible New Methods

1.1. Uize.Str.Lines.removeLineNumbering ??

Would remove line numbering from all the lines of a multi-line string.

Since this seems kind of esoteric, perhaps it could be put into a Uize.Str.Lines.Numbering module, which would have methods like Uize.Str.Lines.Numbering.addNumbering and Uize.Str.Lines.Numbering.removeNumbering.

1.2. Uize.Str.Lines.consolidateBlanks

Uize.Str.Lines.consolidateBlanks = function (_sourceStr) {
  var _previousIsBlank;
  return _package.modify (
    _sourceStr,
    function (_line) {
      var
        _isBlank = !Uize.Str.Trim.trim (_line),
        _keepLine = !_isBlank || !_previousIsBlank
      ;
      _previousIsBlank = _isBlank;
      return _keepLine;
    }
  );
};

1.3. Uize.Str.Lines.pad

.

1.4. Rearranging Lines

1.4.1. Uize.Str.Lines.sort

function sortMultilineStr (sourceStr) {
  return (
    Uize.Str.Lines.split (sourceStr).sort (
      function (a,b) {return a < b ? -1 : 1}
    ).join (
      Uize.Str.Lines.getLinebreakType (sourceStr)
    )
  );
}

1.4.2. Uize.Str.Lines.reverse

.