Sha256: 80bf20d1c9918ef2e4304d5f0c08067c34cce221b0065d3daf9bc01e95e14b0b
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
(function() { var __slice = Array.prototype.slice; $.buildPath = function() { var extraParams, lastParam, params, paramsHash, path; path = arguments[0], params = 2 <= arguments.length ? __slice.call(arguments, 1) : []; extraParams = {}; paramsHash = {}; if ($.isPlainObject(lastParam = params.pop())) { paramsHash = lastParam; } else { params.push(lastParam); } $.each(params, function(_, value) { var replacement; replacement = "/" + value; return path = path.replace(/\/:[\w_]+/, replacement); }); $.each(paramsHash, function(name, value) { var pattern, replacement; if (path.match(new RegExp(":" + name))) { pattern = "(.*?)\\(?([\\.\\/]?):" + name + "(\\(.*?\\)|[^\\)]*)?(.*)"; replacement = "$1$2" + value + "$3$4"; return path = path.replace(new RegExp(pattern), replacement); } else { return extraParams[name] = value; } }); path = path.replace(/\(.*\)/, ''); if (!$.isEmptyObject(extraParams)) { path += "?" + ($.param(extraParams)); } return path; }; }).call(this);
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
js_routes-0.1.5 | lib/assets/javascripts/jquery.pathBuilder.js |