[upd] plankton

This commit is contained in:
Christian Fraß 2023-07-25 17:36:15 +02:00
parent 7575c37a57
commit b10f7baf68
2 changed files with 15 additions and 0 deletions

View file

@ -658,6 +658,9 @@ declare namespace lib_plankton.string {
length?: int; length?: int;
indicator?: string; indicator?: string;
}): string; }): string;
/**
*/
function slice(str: string, size: int): Array<string>;
} }
/** /**
* @deprecated * @deprecated

View file

@ -1775,6 +1775,18 @@ var lib_plankton;
: (str.slice(0, options.length - options.indicator.length) + options.indicator)); : (str.slice(0, options.length - options.indicator.length) + options.indicator));
} }
string.limit = limit; string.limit = limit;
/**
*/
function slice(str, size) {
let slices = [];
let rest = str;
while (rest.length > 0) {
slices.push(rest.slice(0, size));
rest = rest.slice(size);
}
return slices;
}
string.slice = slice;
})(string = lib_plankton.string || (lib_plankton.string = {})); })(string = lib_plankton.string || (lib_plankton.string = {}));
})(lib_plankton || (lib_plankton = {})); })(lib_plankton || (lib_plankton = {}));
/** /**