From 861d9c2b754ce6024766859545323e50c110424e Mon Sep 17 00:00:00 2001 From: imasustink Date: Wed, 1 Nov 2017 11:52:32 -0700 Subject: [PATCH] 0.1.1 --- dist/amd/can-validate-validatejs.js | 38 +++++ dist/amd/can-validate-validatejs.js.map | 1 + dist/cjs/can-validate-validatejs.js | 30 ++++ dist/cjs/can-validate-validatejs.js.map | 1 + dist/global/can-validate-validatejs.js | 173 +++++++++++++++++++++ dist/global/can-validate-validatejs.js.map | 1 + 6 files changed, 244 insertions(+) create mode 100644 dist/amd/can-validate-validatejs.js create mode 100644 dist/amd/can-validate-validatejs.js.map create mode 100644 dist/cjs/can-validate-validatejs.js create mode 100644 dist/cjs/can-validate-validatejs.js.map create mode 100644 dist/global/can-validate-validatejs.js create mode 100644 dist/global/can-validate-validatejs.js.map diff --git a/dist/amd/can-validate-validatejs.js b/dist/amd/can-validate-validatejs.js new file mode 100644 index 0000000..4a3206b --- /dev/null +++ b/dist/amd/can-validate-validatejs.js @@ -0,0 +1,38 @@ +/*can-validate-validatejs@0.1.0#can-validate-validatejs*/ +define([ + 'require', + 'exports', + 'module', + 'can-util/js/each', + 'validate' +], function (require, exports, module) { + var each = require('can-util/js/each'); + var validatejs = require('validate'); + var makeValidator = function (constraints) { + return function (value) { + return validatejs.single(value, constraints); + }; + }; + makeValidator.many = function (constraints) { + return function (values) { + var rawErrors = validatejs(values, constraints, { + format: 'detailed', + fullMessages: false + }); + var errors; + if (rawErrors) { + errors = []; + each(rawErrors, function (error) { + errors.push({ + message: error.options.message || error.error, + related: [error.attribute] + }); + }); + } + return errors; + }; + }; + makeValidator.validatejs = validatejs; + module.exports = makeValidator; +}); +//# sourceMappingURL=can-validate-validatejs.js.map \ No newline at end of file diff --git a/dist/amd/can-validate-validatejs.js.map b/dist/amd/can-validate-validatejs.js.map new file mode 100644 index 0000000..49b1966 --- /dev/null +++ b/dist/amd/can-validate-validatejs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../can-validate-validatejs.js"],"names":["each","require","validatejs","makeValidator","constraints","value","single","many","values","rawErrors","format","fullMessages","errors","error","push","message","options","related","attribute","module","exports"],"mappings":";;;;;;;;IAAA,IAAIA,IAAA,GAAOC,OAAA,CAAQ,kBAAR,CAAX,C;IACA,IAAIC,UAAA,GAAaD,OAAA,CAAQ,UAAR,CAAjB,C;IAEA,IAAIE,aAAA,GAAgB,UAAUC,WAAV,EAAuB;AAAA,QAC1C,OAAO,UAAUC,KAAV,EAAiB;AAAA,YAEvB,OAAOH,UAAA,CAAWI,MAAX,CAAkBD,KAAlB,EAAyBD,WAAzB,CAAP,CAFuB;AAAA,SAAxB,CAD0C;AAAA,KAA3C,C;IAOAD,aAAA,CAAcI,IAAd,GAAqB,UAAUH,WAAV,EAAuB;AAAA,QAC3C,OAAO,UAAUI,MAAV,EAAkB;AAAA,YACxB,IAAIC,SAAA,GAAYP,UAAA,CAAWM,MAAX,EAAmBJ,WAAnB,EAAgC;AAAA,gBAACM,MAAA,EAAQ,UAAT;AAAA,gBAAqBC,YAAA,EAAc,KAAnC;AAAA,aAAhC,CAAhB,CADwB;AAAA,YAExB,IAAIC,MAAJ,CAFwB;AAAA,YAIxB,IAAIH,SAAJ,EAAe;AAAA,gBACdG,MAAA,GAAS,EAAT,CADc;AAAA,gBAEdZ,IAAA,CAAKS,SAAL,EAAgB,UAAUI,KAAV,EAAiB;AAAA,oBAChCD,MAAA,CAAOE,IAAP,CAAY;AAAA,wBAACC,OAAA,EAASF,KAAA,CAAMG,OAAN,CAAcD,OAAd,IAAyBF,KAAA,CAAMA,KAAzC;AAAA,wBAAgDI,OAAA,EAAS,CAACJ,KAAA,CAAMK,SAAP,CAAzD;AAAA,qBAAZ,EADgC;AAAA,iBAAjC,EAFc;AAAA,aAJS;AAAA,YAUxB,OAAON,MAAP,CAVwB;AAAA,SAAzB,CAD2C;AAAA,KAA5C,C;IAeAT,aAAA,CAAcD,UAAd,GAA2BA,UAA3B,C;IAEAiB,MAAA,CAAOC,OAAP,GAAiBjB,aAAjB,C","file":"can-validate-validatejs.js"} \ No newline at end of file diff --git a/dist/cjs/can-validate-validatejs.js b/dist/cjs/can-validate-validatejs.js new file mode 100644 index 0000000..0ba5f04 --- /dev/null +++ b/dist/cjs/can-validate-validatejs.js @@ -0,0 +1,30 @@ +/*can-validate-validatejs@0.1.0#can-validate-validatejs*/ +var each = require('can-util/js/each/each'); +var validatejs = require('validate.js'); +var makeValidator = function (constraints) { + return function (value) { + return validatejs.single(value, constraints); + }; +}; +makeValidator.many = function (constraints) { + return function (values) { + var rawErrors = validatejs(values, constraints, { + format: 'detailed', + fullMessages: false + }); + var errors; + if (rawErrors) { + errors = []; + each(rawErrors, function (error) { + errors.push({ + message: error.options.message || error.error, + related: [error.attribute] + }); + }); + } + return errors; + }; +}; +makeValidator.validatejs = validatejs; +module.exports = makeValidator; +//# sourceMappingURL=can-validate-validatejs.js.map \ No newline at end of file diff --git a/dist/cjs/can-validate-validatejs.js.map b/dist/cjs/can-validate-validatejs.js.map new file mode 100644 index 0000000..1871a15 --- /dev/null +++ b/dist/cjs/can-validate-validatejs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../can-validate-validatejs.js"],"names":["each","require","validatejs","makeValidator","constraints","value","single","many","values","rawErrors","format","fullMessages","errors","error","push","message","options","related","attribute","module","exports"],"mappings":";AAAA,IAAIA,IAAA,GAAOC,OAAA,CAAQ,uBAAR,CAAX;AACA,IAAIC,UAAA,GAAaD,OAAA,CAAQ,aAAR,CAAjB,CADA;AAGA,IAAIE,aAAA,GAAgB,UAAUC,WAAV,EAAuB;AAAA,IAC1C,OAAO,UAAUC,KAAV,EAAiB;AAAA,QAEvB,OAAOH,UAAA,CAAWI,MAAX,CAAkBD,KAAlB,EAAyBD,WAAzB,CAAP,CAFuB;AAAA,KAAxB,CAD0C;AAAA,CAA3C,CAHA;AAUAD,aAAA,CAAcI,IAAd,GAAqB,UAAUH,WAAV,EAAuB;AAAA,IAC3C,OAAO,UAAUI,MAAV,EAAkB;AAAA,QACxB,IAAIC,SAAA,GAAYP,UAAA,CAAWM,MAAX,EAAmBJ,WAAnB,EAAgC;AAAA,YAACM,MAAA,EAAQ,UAAT;AAAA,YAAqBC,YAAA,EAAc,KAAnC;AAAA,SAAhC,CAAhB,CADwB;AAAA,QAExB,IAAIC,MAAJ,CAFwB;AAAA,QAIxB,IAAIH,SAAJ,EAAe;AAAA,YACdG,MAAA,GAAS,EAAT,CADc;AAAA,YAEdZ,IAAA,CAAKS,SAAL,EAAgB,UAAUI,KAAV,EAAiB;AAAA,gBAChCD,MAAA,CAAOE,IAAP,CAAY;AAAA,oBAACC,OAAA,EAASF,KAAA,CAAMG,OAAN,CAAcD,OAAd,IAAyBF,KAAA,CAAMA,KAAzC;AAAA,oBAAgDI,OAAA,EAAS,CAACJ,KAAA,CAAMK,SAAP,CAAzD;AAAA,iBAAZ,EADgC;AAAA,aAAjC,EAFc;AAAA,SAJS;AAAA,QAUxB,OAAON,MAAP,CAVwB;AAAA,KAAzB,CAD2C;AAAA,CAA5C,CAVA;AAyBAT,aAAA,CAAcD,UAAd,GAA2BA,UAA3B,CAzBA;AA2BAiB,MAAA,CAAOC,OAAP,GAAiBjB,aAAjB","file":"can-validate-validatejs.js"} \ No newline at end of file diff --git a/dist/global/can-validate-validatejs.js b/dist/global/can-validate-validatejs.js new file mode 100644 index 0000000..fe865ea --- /dev/null +++ b/dist/global/can-validate-validatejs.js @@ -0,0 +1,173 @@ +/*[global-shim-start]*/ +(function(exports, global, doEval) { + // jshint ignore:line + var origDefine = global.define; + + var get = function(name) { + var parts = name.split("."), + cur = global, + i; + for (i = 0; i < parts.length; i++) { + if (!cur) { + break; + } + cur = cur[parts[i]]; + } + return cur; + }; + var set = function(name, val) { + var parts = name.split("."), + cur = global, + i, + part, + next; + for (i = 0; i < parts.length - 1; i++) { + part = parts[i]; + next = cur[part]; + if (!next) { + next = cur[part] = {}; + } + cur = next; + } + part = parts[parts.length - 1]; + cur[part] = val; + }; + var useDefault = function(mod) { + if (!mod || !mod.__esModule) return false; + var esProps = { __esModule: true, default: true }; + for (var p in mod) { + if (!esProps[p]) return false; + } + return true; + }; + + var hasCjsDependencies = function(deps) { + return ( + deps[0] === "require" && deps[1] === "exports" && deps[2] === "module" + ); + }; + + var modules = + (global.define && global.define.modules) || + (global._define && global._define.modules) || + {}; + var ourDefine = (global.define = function(moduleName, deps, callback) { + var module; + if (typeof deps === "function") { + callback = deps; + deps = []; + } + var args = [], + i; + for (i = 0; i < deps.length; i++) { + args.push( + exports[deps[i]] + ? get(exports[deps[i]]) + : modules[deps[i]] || get(deps[i]) + ); + } + // CJS has no dependencies but 3 callback arguments + if (hasCjsDependencies(deps) || (!deps.length && callback.length)) { + module = { exports: {} }; + args[0] = function(name) { + return exports[name] ? get(exports[name]) : modules[name]; + }; + args[1] = module.exports; + args[2] = module; + } else if (!args[0] && deps[0] === "exports") { + // Babel uses the exports and module object. + module = { exports: {} }; + args[0] = module.exports; + if (deps[1] === "module") { + args[1] = module; + } + } else if (!args[0] && deps[0] === "module") { + args[0] = { id: moduleName }; + } + + global.define = origDefine; + var result = callback ? callback.apply(null, args) : undefined; + global.define = ourDefine; + + // Favor CJS module.exports over the return value + result = module && module.exports ? module.exports : result; + modules[moduleName] = result; + + // Set global exports + var globalExport = exports[moduleName]; + if (globalExport && !get(globalExport)) { + if (useDefault(result)) { + result = result["default"]; + } + set(globalExport, result); + } + }); + global.define.orig = origDefine; + global.define.modules = modules; + global.define.amd = true; + ourDefine("@loader", [], function() { + // shim for @@global-helpers + var noop = function() {}; + return { + get: function() { + return { prepareGlobal: noop, retrieveGlobal: noop }; + }, + global: global, + __exec: function(__load) { + doEval(__load.source, global); + } + }; + }); +})( + {}, + typeof self == "object" && self.Object == Object ? self : window, + function(__$source__, __$global__) { + // jshint ignore:line + eval("(function() { " + __$source__ + " \n }).call(__$global__);"); + } +); + +/*can-validate-validatejs@0.1.0#can-validate-validatejs*/ +define('can-validate-validatejs', [ + 'require', + 'exports', + 'module', + 'can-util/js/each/each', + 'validate.js' +], function (require, exports, module) { + var each = require('can-util/js/each/each'); + var validatejs = require('validate.js'); + var makeValidator = function (constraints) { + return function (value) { + return validatejs.single(value, constraints); + }; + }; + makeValidator.many = function (constraints) { + return function (values) { + var rawErrors = validatejs(values, constraints, { + format: 'detailed', + fullMessages: false + }); + var errors; + if (rawErrors) { + errors = []; + each(rawErrors, function (error) { + errors.push({ + message: error.options.message || error.error, + related: [error.attribute] + }); + }); + } + return errors; + }; + }; + makeValidator.validatejs = validatejs; + module.exports = makeValidator; +}); +/*[global-shim-end]*/ +(function(global) { // jshint ignore:line + global._define = global.define; + global.define = global.define.orig; +} +)(typeof self == "object" && self.Object == Object ? self : window); +//# sourceMappingURL=can-validate-validatejs.js.map \ No newline at end of file diff --git a/dist/global/can-validate-validatejs.js.map b/dist/global/can-validate-validatejs.js.map new file mode 100644 index 0000000..def796b --- /dev/null +++ b/dist/global/can-validate-validatejs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../../can-validate-validatejs.js"],"names":["each","require","validatejs","makeValidator","constraints","value","single","many","values","rawErrors","format","fullMessages","errors","error","push","message","options","related","attribute","module","exports"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA,IAAIA,IAAA,GAAOC,OAAA,CAAQ,uBAAR,CAAX,C;IACA,IAAIC,UAAA,GAAaD,OAAA,CAAQ,aAAR,CAAjB,C;IAEA,IAAIE,aAAA,GAAgB,UAAUC,WAAV,EAAuB;AAAA,QAC1C,OAAO,UAAUC,KAAV,EAAiB;AAAA,YAEvB,OAAOH,UAAA,CAAWI,MAAX,CAAkBD,KAAlB,EAAyBD,WAAzB,CAAP,CAFuB;AAAA,SAAxB,CAD0C;AAAA,KAA3C,C;IAOAD,aAAA,CAAcI,IAAd,GAAqB,UA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