Improve output: distinguish between failed assertions (failures) and unexpected exceptions (errors), and print a filtered stack trace for any exception.
This commit is contained in:
commit
4f2e303079
1839 changed files with 235630 additions and 0 deletions
87
webapp/web/src/string/common.js
Normal file
87
webapp/web/src/string/common.js
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.string.common");
|
||||
|
||||
dojo.require("dojo.string");
|
||||
|
||||
/**
|
||||
* Trim whitespace from 'str'. If 'wh' > 0,
|
||||
* only trim from start, if 'wh' < 0, only trim
|
||||
* from end, otherwise trim both ends
|
||||
*/
|
||||
dojo.string.trim = function(str, wh){
|
||||
if(!str.replace){ return str; }
|
||||
if(!str.length){ return str; }
|
||||
var re = (wh > 0) ? (/^\s+/) : (wh < 0) ? (/\s+$/) : (/^\s+|\s+$/g);
|
||||
return str.replace(re, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim whitespace at the beginning of 'str'
|
||||
*/
|
||||
dojo.string.trimStart = function(str) {
|
||||
return dojo.string.trim(str, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim whitespace at the end of 'str'
|
||||
*/
|
||||
dojo.string.trimEnd = function(str) {
|
||||
return dojo.string.trim(str, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return 'str' repeated 'count' times, optionally
|
||||
* placing 'separator' between each rep
|
||||
*/
|
||||
dojo.string.repeat = function(str, count, separator) {
|
||||
var out = "";
|
||||
for(var i = 0; i < count; i++) {
|
||||
out += str;
|
||||
if(separator && i < count - 1) {
|
||||
out += separator;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad 'str' to guarantee that it is at least 'len' length
|
||||
* with the character 'c' at either the start (dir=1) or
|
||||
* end (dir=-1) of the string
|
||||
*/
|
||||
dojo.string.pad = function(str, len/*=2*/, c/*='0'*/, dir/*=1*/) {
|
||||
var out = String(str);
|
||||
if(!c) {
|
||||
c = '0';
|
||||
}
|
||||
if(!dir) {
|
||||
dir = 1;
|
||||
}
|
||||
while(out.length < len) {
|
||||
if(dir > 0) {
|
||||
out = c + out;
|
||||
} else {
|
||||
out += c;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** same as dojo.string.pad(str, len, c, 1) */
|
||||
dojo.string.padLeft = function(str, len, c) {
|
||||
return dojo.string.pad(str, len, c, 1);
|
||||
}
|
||||
|
||||
/** same as dojo.string.pad(str, len, c, -1) */
|
||||
dojo.string.padRight = function(str, len, c) {
|
||||
return dojo.string.pad(str, len, c, -1);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue