/space-kata

Primary LanguageJavaScript

Space Kata

The goal of this kata is to write a small algorithm that splits a given text into chunks with a given maximum length (width);

  1. Never split between characters, split only at whitespaces
  2. You are allowed to split a word at a dash, as long as the dash is preserved (in the first line)

Bonus Tasks

  1. Write an extension to the method that fills spaces with additional whitespaces until the line's length is equal to the allowed width.
  2. (German) words, that exceed the line length, should be wrapped at the maximum width (e.g. rindfleischetikettierungsüberwachungsaufgabenübertragungsgesetz)

NodeJS Template: