annotate src/implab/Uri.js @ 17:9c21e656cbec

Разработка кнопки выбора координат с карт
author nickolay
date Tue, 19 Sep 2017 20:37:56 +0300
parents 00779cb63b12
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
1 define(
3
00779cb63b12 formatting
cin
parents: 0
diff changeset
2 [ "./declare" ],
0
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
3 function(declare) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
4 function parseURI(uri) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
5 var schema, host, port, path, query, hash, i;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
6 if (typeof (uri) == "string") {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
7 if ((i = uri.indexOf(":")) >= 0 &&
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
8 uri.substr(0, i).match(/^\w+$/)) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
9 schema = uri.substr(0, i);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
10 uri = uri.substr(i + 1);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
11 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
12
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
13 if (uri.indexOf("//") === 0) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
14 uri = uri.substr(2);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
15 if ((i = uri.indexOf("/")) >= 0) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
16 host = uri.substr(0, i);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
17 uri = uri.substr(i);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
18 } else {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
19 host = uri;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
20 uri = "";
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
21 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
22 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
23
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
24 if ((i = uri.indexOf("?")) >= 0) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
25 path = uri.substr(0, i);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
26 uri = uri.substr(i + 1);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
27
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
28 } else {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
29 path = uri;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
30 uri = "";
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
31
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
32 if ((i = path.indexOf("#")) >= 0) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
33 hash = path.substr(i + 1);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
34 path = path.substr(0, i);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
35 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
36 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
37
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
38 if ((i = uri.indexOf("#")) >= 0) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
39 query = uri.substr(0, i);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
40 hash = uri.substr(i + 1);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
41 } else {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
42 query = uri;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
43 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
44 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
45
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
46 if (host && (i = host.lastIndexOf(":")) >= 0) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
47 port = host.substr(i + 1);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
48 host = host.substr(0, i);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
49 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
50
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
51 return {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
52 schema : schema,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
53 host : host,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
54 port : port,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
55 path : path,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
56 query : query,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
57 hash : hash
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
58 };
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
59 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
60
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
61 function makeURI(options) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
62 var uri = [];
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
63
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
64 if (options.schema)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
65 uri.push(options.schema, ":");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
66 if (options.host)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
67 uri.push("//", options.host);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
68 if (options.host && options.port)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
69 uri.push(":", options.port);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
70
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
71 if (options.path) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
72 if (options.host && options.path[0] != "/")
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
73 uri.push("/");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
74 uri.push(options.path);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
75 } else if (options.host) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
76 uri.push("/");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
77 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
78
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
79 if (options.query)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
80 uri.push("?", options.query);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
81 if (options.hash)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
82 uri.push("#", options.hash);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
83
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
84 return uri.join("");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
85 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
86
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
87 function reducePath(parts) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
88 var balance = 0, result = [], isRoot;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
89
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
90 for (var i = 0; i < parts.length; i++) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
91 var part = parts[i];
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
92 switch (part) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
93 case "..":
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
94 if (balance > 0) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
95 result.pop();
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
96 } else {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
97 if (isRoot)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
98 throw new Error("Unbalanced path: " + parts);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
99
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
100 result.push(part);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
101 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
102 balance--;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
103 break;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
104 case ".":
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
105 break;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
106 case "":
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
107 if (i === 0) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
108 isRoot = true;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
109 result.push(part);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
110 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
111 break;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
112 default:
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
113 result.push(part);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
114 balance++;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
115 break;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
116 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
117 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
118
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
119 return result.join("/");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
120 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
121
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
122 var meta = {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
123 schema : null,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
124 host : null,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
125 port : null,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
126 path : null,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
127 query : null,
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
128 hash : null
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
129 };
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
130
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
131 var URI = declare(null, {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
132 constructor : function(opts) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
133 if (typeof (opts) == "string")
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
134 opts = parseURI(opts);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
135 for ( var p in meta)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
136 if (p in opts)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
137 this[p] = opts[p];
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
138 },
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
139
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
140 clone : function() {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
141 return new URI(this);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
142 },
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
143
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
144 combine : function(rel) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
145 var me = this;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
146
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
147 if (typeof (rel) === "string")
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
148 rel = new URI(rel);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
149 else
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
150 rel = rel.clone();
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
151
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
152 // //some.host:123/path?q=a#123
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
153 if (rel.host)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
154 return rel;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
155
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
156 // /abs/path?q=a#123
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
157 if (rel.path && rel.path[0] == "/") {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
158 if (me.host) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
159 rel.schema = me.schema;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
160 rel.host = me.host;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
161 rel.port = me.port;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
162 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
163 return rel;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
164 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
165
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
166 var base = me.clone();
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
167
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
168 // rel/path?a=b#cd
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
169 if (rel.path) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
170 var segments = base.getSegments();
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
171 segments.pop();
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
172 segments.push.apply(segments, rel.getSegments());
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
173
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
174 base.path = reducePath(segments);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
175 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
176
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
177 // ?q=a#123
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
178 if (rel.query)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
179 base.query = rel.query;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
180 if (rel.hash)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
181 base.hase = rel.hash;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
182
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
183 return base;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
184 },
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
185
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
186 optimize : function() {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
187 this.path = reducePath(this.getSegments());
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
188 },
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
189
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
190 getSegments : function() {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
191 if (typeof (this.path) === "string")
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
192 return this.path.split("/");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
193 else
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
194 return [];
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
195 },
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
196
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
197 toString : function() {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
198 var uri = [], me = this;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
199
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
200 if (me.schema)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
201 uri.push(me.schema, ":");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
202 if (me.host)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
203 uri.push("//", me.host);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
204 if (me.host && me.port)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
205 uri.push(":", me.port);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
206
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
207 if (me.path) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
208 if (me.host && me.path[0] != "/")
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
209 uri.push("/");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
210 uri.push(me.path);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
211 } else if (me.host) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
212 uri.push("/");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
213 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
214
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
215 if (me.query)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
216 uri.push("?", me.query);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
217 if (me.hash)
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
218 uri.push("#", me.hash);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
219
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
220 return uri.join("");
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
221 }
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
222
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
223 });
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
224
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
225 URI.combine = function(base, rel) {
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
226 if (typeof (base) === "string")
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
227 base = new URI(base);
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
228 return base.combine(rel).toString();
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
229 };
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
230
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
231 return URI;
fc2517695ee1 Initial commit, draft import of existing work
cin
parents:
diff changeset
232 });