1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
function (objt, where) {
var i = 0,
objtLength = objt.length,
str = "",
inObjt = [],
inCond = [];
for(; i < objtLength; i++) {
if(objt[i] == '(') {
inObjt.push(str);
str = "";
var pOpen = 0,
cond = "";
do {
if(objt[i] == '(')
pOpen++;
else if(objt[i] == ')')
pOpen--;
cond += objt[i++];
} while(pOpen > 0)
inCond.push(cond.replace(/^(\()|(\))$/g, ''));// les parentheses autour ne nous interesse pas
}
else if(objt[i] == '.') {
inObjt.push(str);
str = "";
}
else {
str += objt[i];
}
}
} |