@ne1410s/codl
Advanced tools
Comparing version 0.1.0 to 0.1.1
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
require('reflect-metadata'); | ||
@@ -384,7 +382,7 @@ | ||
var retVal = { key: key, value: value, valid: true }; | ||
if (!isProvided(value) || value === NaN) { | ||
if (!isProvided(value) || Number.isNaN(value)) { | ||
var required = Reflect.getMetadata(ValidationKey.REQUIRED, proto, key) === true; | ||
if (required) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name_1, " is required"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name, " is required"); | ||
} | ||
@@ -406,4 +404,4 @@ } | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray ? "".concat(name_1, " contains an invalid item") : "".concat(name_1, " is invalid"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray ? "".concat(name, " contains an invalid item") : "".concat(name, " is invalid"); | ||
} | ||
@@ -497,3 +495,3 @@ } | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
var fmtMin = hasMin_1 ? ReflectMetadata.getFormatted(proto, key, min_1) : min_1; | ||
@@ -508,6 +506,6 @@ var fmtMax = hasMax_1 ? ReflectMetadata.getFormatted(proto, key, max_1) : max_1; | ||
hasMin_1 && hasMax_1 | ||
? "".concat(name_1, " must ").concat(rangeImperative, " between ").concat(fmtMin, " and ").concat(fmtMax) | ||
? "".concat(name, " must ").concat(rangeImperative, " between ").concat(fmtMin, " and ").concat(fmtMax) | ||
: hasMin_1 | ||
? "".concat(name_1, " cannot ").concat(boundImperative, " ").concat(compareLT, " ").concat(fmtMin) | ||
: "".concat(name_1, " cannot ").concat(boundImperative, " ").concat(compareGT, " ").concat(fmtMax); | ||
? "".concat(name, " cannot ").concat(boundImperative, " ").concat(compareLT, " ").concat(fmtMin) | ||
: "".concat(name, " cannot ").concat(boundImperative, " ").concat(compareGT, " ").concat(fmtMax); | ||
} | ||
@@ -531,3 +529,3 @@ retVal.valid = !retVal.message; | ||
if (!minOk || !maxOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
var noun = typeof value === 'string' ? 'character' : 'item'; | ||
@@ -537,6 +535,6 @@ var pluraliser = value.length === 1 ? '' : 's'; | ||
hasMinLen && hasMaxLen | ||
? "".concat(name_1, " must contain between ").concat(minLength, " and ").concat(maxLength, " ").concat(noun, "s") | ||
? "".concat(name, " must contain between ").concat(minLength, " and ").concat(maxLength, " ").concat(noun, "s") | ||
: hasMinLen | ||
? "".concat(name_1, " cannot contain fewer than ").concat(minLength, " ").concat(noun).concat(pluraliser) | ||
: "".concat(name_1, " cannot contain more than ").concat(maxLength, " ").concat(noun).concat(pluraliser); | ||
? "".concat(name, " cannot contain fewer than ").concat(minLength, " ").concat(noun).concat(pluraliser) | ||
: "".concat(name, " cannot contain more than ").concat(maxLength, " ").concat(noun).concat(pluraliser); | ||
} | ||
@@ -559,6 +557,6 @@ retVal.valid = !retVal.message; | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray | ||
? "".concat(name_1, " contains an invalid ").concat(type) | ||
: "".concat(name_1, " is not a valid ").concat(type); | ||
? "".concat(name, " contains an invalid ").concat(type) | ||
: "".concat(name, " is not a valid ").concat(type); | ||
} | ||
@@ -580,4 +578,4 @@ } | ||
else if (result === false) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name_1, " is invalid"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name, " is invalid"); | ||
} | ||
@@ -595,4 +593,4 @@ retVal.valid = !retVal.message; | ||
if (forbidden) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name_1, " is forbidden"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name, " is forbidden"); | ||
} | ||
@@ -614,6 +612,6 @@ } | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray | ||
? "".concat(name_1, " contains an invalid option") | ||
: "".concat(name_1, " is an invalid option"); | ||
? "".concat(name, " contains an invalid option") | ||
: "".concat(name, " is an invalid option"); | ||
} | ||
@@ -620,0 +618,0 @@ } |
@@ -380,7 +380,7 @@ import 'reflect-metadata'; | ||
var retVal = { key: key, value: value, valid: true }; | ||
if (!isProvided(value) || value === NaN) { | ||
if (!isProvided(value) || Number.isNaN(value)) { | ||
var required = Reflect.getMetadata(ValidationKey.REQUIRED, proto, key) === true; | ||
if (required) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name_1, " is required"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name, " is required"); | ||
} | ||
@@ -402,4 +402,4 @@ } | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray ? "".concat(name_1, " contains an invalid item") : "".concat(name_1, " is invalid"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray ? "".concat(name, " contains an invalid item") : "".concat(name, " is invalid"); | ||
} | ||
@@ -493,3 +493,3 @@ } | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
var fmtMin = hasMin_1 ? ReflectMetadata.getFormatted(proto, key, min_1) : min_1; | ||
@@ -504,6 +504,6 @@ var fmtMax = hasMax_1 ? ReflectMetadata.getFormatted(proto, key, max_1) : max_1; | ||
hasMin_1 && hasMax_1 | ||
? "".concat(name_1, " must ").concat(rangeImperative, " between ").concat(fmtMin, " and ").concat(fmtMax) | ||
? "".concat(name, " must ").concat(rangeImperative, " between ").concat(fmtMin, " and ").concat(fmtMax) | ||
: hasMin_1 | ||
? "".concat(name_1, " cannot ").concat(boundImperative, " ").concat(compareLT, " ").concat(fmtMin) | ||
: "".concat(name_1, " cannot ").concat(boundImperative, " ").concat(compareGT, " ").concat(fmtMax); | ||
? "".concat(name, " cannot ").concat(boundImperative, " ").concat(compareLT, " ").concat(fmtMin) | ||
: "".concat(name, " cannot ").concat(boundImperative, " ").concat(compareGT, " ").concat(fmtMax); | ||
} | ||
@@ -527,3 +527,3 @@ retVal.valid = !retVal.message; | ||
if (!minOk || !maxOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
var noun = typeof value === 'string' ? 'character' : 'item'; | ||
@@ -533,6 +533,6 @@ var pluraliser = value.length === 1 ? '' : 's'; | ||
hasMinLen && hasMaxLen | ||
? "".concat(name_1, " must contain between ").concat(minLength, " and ").concat(maxLength, " ").concat(noun, "s") | ||
? "".concat(name, " must contain between ").concat(minLength, " and ").concat(maxLength, " ").concat(noun, "s") | ||
: hasMinLen | ||
? "".concat(name_1, " cannot contain fewer than ").concat(minLength, " ").concat(noun).concat(pluraliser) | ||
: "".concat(name_1, " cannot contain more than ").concat(maxLength, " ").concat(noun).concat(pluraliser); | ||
? "".concat(name, " cannot contain fewer than ").concat(minLength, " ").concat(noun).concat(pluraliser) | ||
: "".concat(name, " cannot contain more than ").concat(maxLength, " ").concat(noun).concat(pluraliser); | ||
} | ||
@@ -555,6 +555,6 @@ retVal.valid = !retVal.message; | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray | ||
? "".concat(name_1, " contains an invalid ").concat(type) | ||
: "".concat(name_1, " is not a valid ").concat(type); | ||
? "".concat(name, " contains an invalid ").concat(type) | ||
: "".concat(name, " is not a valid ").concat(type); | ||
} | ||
@@ -576,4 +576,4 @@ } | ||
else if (result === false) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name_1, " is invalid"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name, " is invalid"); | ||
} | ||
@@ -591,4 +591,4 @@ retVal.valid = !retVal.message; | ||
if (forbidden) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name_1, " is forbidden"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name, " is forbidden"); | ||
} | ||
@@ -610,6 +610,6 @@ } | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray | ||
? "".concat(name_1, " contains an invalid option") | ||
: "".concat(name_1, " is an invalid option"); | ||
? "".concat(name, " contains an invalid option") | ||
: "".concat(name, " is an invalid option"); | ||
} | ||
@@ -616,0 +616,0 @@ } |
@@ -384,7 +384,7 @@ (function (global, factory) { | ||
var retVal = { key: key, value: value, valid: true }; | ||
if (!isProvided(value) || value === NaN) { | ||
if (!isProvided(value) || Number.isNaN(value)) { | ||
var required = Reflect.getMetadata(ValidationKey.REQUIRED, proto, key) === true; | ||
if (required) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name_1, " is required"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name, " is required"); | ||
} | ||
@@ -406,4 +406,4 @@ } | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray ? "".concat(name_1, " contains an invalid item") : "".concat(name_1, " is invalid"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray ? "".concat(name, " contains an invalid item") : "".concat(name, " is invalid"); | ||
} | ||
@@ -497,3 +497,3 @@ } | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
var fmtMin = hasMin_1 ? ReflectMetadata.getFormatted(proto, key, min_1) : min_1; | ||
@@ -508,6 +508,6 @@ var fmtMax = hasMax_1 ? ReflectMetadata.getFormatted(proto, key, max_1) : max_1; | ||
hasMin_1 && hasMax_1 | ||
? "".concat(name_1, " must ").concat(rangeImperative, " between ").concat(fmtMin, " and ").concat(fmtMax) | ||
? "".concat(name, " must ").concat(rangeImperative, " between ").concat(fmtMin, " and ").concat(fmtMax) | ||
: hasMin_1 | ||
? "".concat(name_1, " cannot ").concat(boundImperative, " ").concat(compareLT, " ").concat(fmtMin) | ||
: "".concat(name_1, " cannot ").concat(boundImperative, " ").concat(compareGT, " ").concat(fmtMax); | ||
? "".concat(name, " cannot ").concat(boundImperative, " ").concat(compareLT, " ").concat(fmtMin) | ||
: "".concat(name, " cannot ").concat(boundImperative, " ").concat(compareGT, " ").concat(fmtMax); | ||
} | ||
@@ -531,3 +531,3 @@ retVal.valid = !retVal.message; | ||
if (!minOk || !maxOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
var noun = typeof value === 'string' ? 'character' : 'item'; | ||
@@ -537,6 +537,6 @@ var pluraliser = value.length === 1 ? '' : 's'; | ||
hasMinLen && hasMaxLen | ||
? "".concat(name_1, " must contain between ").concat(minLength, " and ").concat(maxLength, " ").concat(noun, "s") | ||
? "".concat(name, " must contain between ").concat(minLength, " and ").concat(maxLength, " ").concat(noun, "s") | ||
: hasMinLen | ||
? "".concat(name_1, " cannot contain fewer than ").concat(minLength, " ").concat(noun).concat(pluraliser) | ||
: "".concat(name_1, " cannot contain more than ").concat(maxLength, " ").concat(noun).concat(pluraliser); | ||
? "".concat(name, " cannot contain fewer than ").concat(minLength, " ").concat(noun).concat(pluraliser) | ||
: "".concat(name, " cannot contain more than ").concat(maxLength, " ").concat(noun).concat(pluraliser); | ||
} | ||
@@ -559,6 +559,6 @@ retVal.valid = !retVal.message; | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray | ||
? "".concat(name_1, " contains an invalid ").concat(type) | ||
: "".concat(name_1, " is not a valid ").concat(type); | ||
? "".concat(name, " contains an invalid ").concat(type) | ||
: "".concat(name, " is not a valid ").concat(type); | ||
} | ||
@@ -580,4 +580,4 @@ } | ||
else if (result === false) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name_1, " is invalid"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name, " is invalid"); | ||
} | ||
@@ -595,4 +595,4 @@ retVal.valid = !retVal.message; | ||
if (forbidden) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name_1, " is forbidden"); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = "".concat(name, " is forbidden"); | ||
} | ||
@@ -614,6 +614,6 @@ } | ||
if (!allOk) { | ||
var name_1 = ReflectMetadata.getDisplayName(proto, key); | ||
var name = ReflectMetadata.getDisplayName(proto, key); | ||
retVal.message = isArray | ||
? "".concat(name_1, " contains an invalid option") | ||
: "".concat(name_1, " is an invalid option"); | ||
? "".concat(name, " contains an invalid option") | ||
: "".concat(name, " is an invalid option"); | ||
} | ||
@@ -814,4 +814,2 @@ } | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); |
{ | ||
"name": "@ne1410s/codl", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Indulge your apps with codl: a component model library", | ||
@@ -18,3 +18,3 @@ "main": "dist/ne14_codl.cjs.min.js", | ||
"build": "npm run clean && npx rollup -c", | ||
"test": "npx rollup -c rollup.test.config.js && mocha --exit", | ||
"test": "npx rollup -c rollup.test.config.mjs && mocha --exit", | ||
"publish-local": "npm run is-pretty && npm run test && npm run build && npm pack", | ||
@@ -27,3 +27,3 @@ "publish-patch": "npm run is-pretty && npm run test && npm run build && npm version patch && npm publish --access public", | ||
"type": "git", | ||
"url": "git+https://github.com/ne1410s/core.codl.git" | ||
"url": "git+https://github.com/ne14-fed/core.codl.git" | ||
}, | ||
@@ -38,14 +38,14 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/ne1410s/core.codl/issues" | ||
"url": "https://github.com/ne14-fed/core.codl/issues" | ||
}, | ||
"homepage": "https://github.com/ne1410s/core.codl#readme", | ||
"homepage": "https://github.com/ne14-fed/core.codl#readme", | ||
"devDependencies": { | ||
"chai": "^4.3.6", | ||
"mocha": "^10.0.0", | ||
"prettier": "^2.7.1", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.78.0", | ||
"rollup-plugin-typescript2": "^0.32.1", | ||
"tslib": "^2.4.0", | ||
"typescript": "^4.7.4" | ||
"chai": "^4.3.7", | ||
"mocha": "^10.2.0", | ||
"prettier": "^2.8.4", | ||
"rimraf": "^4.1.2", | ||
"rollup": "^3.15.0", | ||
"rollup-plugin-typescript2": "^0.34.1", | ||
"tslib": "^2.5.0", | ||
"typescript": "^4.9.5" | ||
}, | ||
@@ -52,0 +52,0 @@ "dependencies": { |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
119859
2641