1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1 1 3 3 1 | define(['../lang/toString', './lowerCase', './upperCase'], function(toString, lowerCase, upperCase){ /** * UPPERCASE first char of each sentence and lowercase other chars. */ function sentenceCase(str){ str = toString(str); // Replace first char of each sentence (new line or after '.\s+') to // UPPERCASE return lowerCase(str).replace(/(^\w)|\.\s+(\w)/gm, upperCase); } return sentenceCase; }); |