Nodejs String Split splitchunks(s)

Here you can find the source of splitchunks(s)

Method Source Code

String.prototype.splitchunks = function(s) {
  return s.split(/\n\n+/) 
}

Related

  1. splitLines(splitOptions = removeEmptyEntries: true, trim: true })
    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;
    ...
    
  2. splitOnce(delimiter)
    String.prototype.splitOnce = function (delimiter) {
        var components = this.split(delimiter);
        return [components.shift(), components.join(delimiter)];
    };
    if (!String.prototype.endsWith) {
      String.prototype.endsWith = function(searchString, position) {
          var subjectString = this.toString();
          if (position === undefined || position > subjectString.length) {
              position = subjectString.length;
    ...
    
  3. splitOnce(regex)
    String.prototype.splitOnce = function (regex) {
        var match = this.match(regex);
        if (match) {
            var match_i = this.indexOf(match[0]);
            return [this.substring(0, match_i),
            this.substring(match_i + match[0].length)];
        } else {
            return [this, ""];
    
  4. splitStr(delimiter)
    function reverseWords(str) {
      var result = "";
      var wordArray = str.split(" ");
      for (var i = wordArray.length - 1; i >= 0; i--) {
        result += wordArray[i] + " ";
      return result.trim(); 
    String.prototype.splitStr = function (delimiter) {
    ...
    
  5. splitWord()
    String.prototype.splitWord = function () {
      return this.split(/(?=[A-Z])/).join(' ');
    };
    
  6. splitenum(separator)
    String.prototype.splitenum = function(separator){
        var tokens = this.split(separator);
        var obj = {}
        for (var i=0; i< tokens.length; i++ ){
            obj[i] = tokens[i];
        return obj;
    
  7. splitlines(s)
    String.prototype.splitlines = function(s) {
      return s.split('\n') 
    
  8. rsplit(sep, maxsplit)
    String.prototype.rsplit = function(sep, maxsplit) {
      var split = this.split(sep);
      return maxsplit ? [ split.slice(0, -maxsplit).join(sep) ].concat(split.slice(-maxsplit)) : split;
    };
    
  9. rsplit(sep, maxsplit)
    String.prototype.rsplit = function(sep, maxsplit) {
        var split = this.split(sep);
        return maxsplit ? [ split.slice(0, -maxsplit).join(sep) ].concat(split.slice(-maxsplit)) : split;
    var graphs = [];
    var URL_SEP = "/";
    var blank_uuid = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
    function swapLastPart(url, lastPart) {
      return swapLastParts(url, [lastPart]);
    ...