diff options
author | Ananya Sen | 2012-02-02 12:59:41 -0800 |
---|---|---|
committer | Ananya Sen | 2012-02-02 12:59:41 -0800 |
commit | 476a25e8a662270dfe5b37c560e4235f02b146e4 (patch) | |
tree | 11fbb125e67e09e8b245c84370c1526e9841188f /js/lib | |
parent | e806afea0eb1b66ac457471983db0e3d5942d222 (diff) | |
download | ninja-476a25e8a662270dfe5b37c560e4235f02b146e4.tar.gz |
uri validation moved to file io apis
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/lib')
-rwxr-xr-x | js/lib/NJUtils.js | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index 960c832f..74039e64 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js | |||
@@ -211,27 +211,6 @@ exports.NJUtils = Object.create(Object.prototype, { | |||
211 | return path.substr(path.lastIndexOf('/') + 1); | 211 | return path.substr(path.lastIndexOf('/') + 1); |
212 | } | 212 | } |
213 | }, | 213 | }, |
214 | |||
215 | /*** | ||
216 | * checks for valid uri pattern | ||
217 | * also flags if Windows uri pattern and Unix uri patterns are mixed | ||
218 | */ | ||
219 | isValidUri:{ | ||
220 | value: function(uri){ | ||
221 | var isWindowsUri=false, isUnixUri=false,status=false; | ||
222 | if(uri !== ""){ | ||
223 | uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces | ||
224 | |||
225 | //for local machine folder uri | ||
226 | isWindowsUri = /^([a-zA-Z]:)(\\[^<>:"/\\|?*]+)*\\?$/gi.test(uri); | ||
227 | isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix | ||
228 | status = isWindowsUri || isUnixUri; | ||
229 | if(isWindowsUri && isUnixUri){status = false;} | ||
230 | } | ||
231 | return status; | ||
232 | } | ||
233 | }, | ||
234 | |||
235 | /*** | 214 | /*** |
236 | * file name validation | 215 | * file name validation |
237 | */ | 216 | */ |