The code runs fine, but Google's closure compiler doesn't like it and spits out errors for both amd-utils/string/lpad and amd-utils/string/rpad. Here's the output:
Apr 27, 2012 7:27:47 PM com.google.javascript.jscomp.parsing.ParserRunner parse
INFO: Error parsing /Users/tcjr/.../utils/string/lpad.js: Compilation produced 7 syntax errors.
(/Users/tcjr/.../utils/string/lpad.js#1)
/Users/tcjr/.../utils/string/lpad.js:7: ERROR - Parse error. missing formal parameter
function lpad(str, minLen, char) {
^
/Users/tcjr/.../utils/string/lpad.js:7: ERROR - Parse error. missing } after function body
function lpad(str, minLen, char) {
^
/Users/tcjr/.../utils/string/lpad.js:8: ERROR - Parse error. syntax error
char = char || ' ';
^
/Users/tcjr/.../utils/string/lpad.js:9: ERROR - Parse error. invalid return
return (str.length < minLen)? repeat(char, minLen - str.length) + str : str;
^
/Users/tcjr/.../utils/string/lpad.js:9: ERROR - Parse error. identifier is a reserved word
return (str.length < minLen)? repeat(char, minLen - str.length) + str : str;
^
/Users/tcjr/.../utils/string/lpad.js:10: ERROR - Parse error. syntax error
}
/Users/tcjr/.../utils/string/lpad.js:14: ERROR - Parse error. syntax error
});
^
7 error(s), 0 warning(s)