make Ox.doc report arrays as '[...]' instead of 'array[...]', and arrays with unspecified types as '[values]' instead of 'array[any]'

This commit is contained in:
rolux 2012-04-07 12:47:40 +02:00
parent ee5f89ca86
commit 7474ac9783

View file

@ -52,7 +52,7 @@ Ox.doc = (function() {
a: 'array', b: 'boolean', d: 'date',
e: 'element', f: 'function', n: 'number',
o: 'object', r: 'regexp', s: 'string',
u: 'undefined', '*': 'any', '!': 'event'
u: 'undefined', '*': 'value', '!': 'event'
};
function decodeLinebreaks(match, submatch) {
return (submatch || match).replace(/\u21A9/g, '\n');
@ -225,12 +225,10 @@ Ox.doc = (function() {
}
});
function unwrap(str) {
return (isArray = /^\[.+\]$/.test(str)) ?
str = str.substr(1, str.length - 2) : str;
return (isArray = /^\[.+\]$/.test(str)) ? Ox.sub(str, 1, -1) : str;
}
function wrap(str) {
return isArray ?
'array[' + str + (str != 'any' ? 's' : '') + ']' : str;
return isArray ? '[' + str + 's' + ']' : str;
}
return ret;
}