Commit | Line | Data |
---|---|---|
629a09ae DV |
1 | IO.include("frame/Opt.js"); |
2 | IO.include("frame/Chain.js"); | |
3 | IO.include("frame/Link.js"); | |
4 | IO.include("frame/String.js"); | |
5 | IO.include("frame/Hash.js"); | |
6 | IO.include("frame/Namespace.js"); | |
7 | //IO.include("frame/Reflection.js"); | |
8 | ||
9 | /** A few helper functions to make life a little easier. */ | |
10 | ||
11 | function defined(o) { | |
12 | return (o !== undefined); | |
13 | } | |
14 | ||
15 | function copy(o) { // todo check for circular refs | |
16 | if (o == null || typeof(o) != 'object') return o; | |
17 | var c = new o.constructor(); | |
18 | for(var p in o) c[p] = copy(o[p]); | |
19 | return c; | |
20 | } | |
21 | ||
22 | function isUnique(arr) { | |
23 | var l = arr.length; | |
24 | for(var i = 0; i < l; i++ ) { | |
25 | if (arr.lastIndexOf(arr[i]) > i) return false; | |
26 | } | |
27 | return true; | |
28 | } | |
29 | ||
30 | /** Returns the given string with all regex meta characters backslashed. */ | |
31 | RegExp.escapeMeta = function(str) { | |
32 | return str.replace(/([$^\\\/()|?+*\[\]{}.-])/g, "\\$1"); | |
33 | } |