]> git.wh0rd.org - tt-rss.git/blame - lib/dojo/data/util/filter.js
add dijit/dojo stuff; initial ui mockup
[tt-rss.git] / lib / dojo / data / util / filter.js
CommitLineData
2f01fe57
AD
1/*
2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
5*/
6
7
8if(!dojo._hasResource["dojo.data.util.filter"]){
9dojo._hasResource["dojo.data.util.filter"]=true;
10dojo.provide("dojo.data.util.filter");
11dojo.data.util.filter.patternToRegExp=function(_1,_2){
12var _3="^";
13var c=null;
14for(var i=0;i<_1.length;i++){
15c=_1.charAt(i);
16switch(c){
17case "\\":
18_3+=c;
19i++;
20_3+=_1.charAt(i);
21break;
22case "*":
23_3+=".*";
24break;
25case "?":
26_3+=".";
27break;
28case "$":
29case "^":
30case "/":
31case "+":
32case ".":
33case "|":
34case "(":
35case ")":
36case "{":
37case "}":
38case "[":
39case "]":
40_3+="\\";
41default:
42_3+=c;
43}
44}
45_3+="$";
46if(_2){
47return new RegExp(_3,"mi");
48}else{
49return new RegExp(_3,"m");
50}
51};
52}