Created
April 26, 2013 06:13
-
-
Save darkowlzz/5465332 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
258 let labelledItemRules = mix(baseItemRules, { | |
259 label: { | |
260 map: stringOrNull, | |
261 is: ["string"], | |
262 ok: function (v) !!v, | |
263 msg: "The item must have a non-empty string label." | |
264 }, | |
265 image: { | |
266 map: stringOrNull, | |
267 is: ["string", "undefined", "null"], | |
268 ok: function (url) { | |
269 if (!url) | |
270 return false; | |
271 return isLocalURL(url); | |
272 //return true; | |
273 } | |
274 } | |
275 }); | |
276 | |
277 // Validation for image URL | |
278 function isLocalURL(url) { | |
279 try { | |
280 return ['resource', 'data'].indexOf(URL(url).scheme) > -1; | |
281 } | |
282 catch(e) {} | |
283 return false; | |
284 } | |
285 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment