MCPcopy Create free account
hub / github.com/RubaXa/Pilot / _urlProcessing

Function _urlProcessing

Pilot.js:1053–1070  ·  view source on GitHub ↗
(rules, target, req)

Source from the content-addressed store, hash-verified

1051 * @private
1052 */
1053 var _urlProcessing = function (rules, target, req) {
1054 return Object.keys(rules).every(function (name) {
1055 var rule = rules[name],
1056 value = target[name];
1057
1058 if (value === void 0) {
1059 if (rule['default'] != null) {
1060 target[name] = rule['default'];
1061 }
1062
1063 return true;
1064 }
1065
1066 target[name] = value = (rule.decode ? rule.decode(value, req) : value);
1067
1068 return !rule.validate || rule.validate(value, req);
1069 });
1070 };
1071
1072 var _cleanUrl = function (url) {
1073 return url.replace(/\/+$/, '/');

Callers 1

Pilot.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected