angular-errorlookup
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -182,8 +182,10 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var ngModel = model; | ||
if (ngModel && ngModel.controller && typeof ngModel.controller[key] !== 'undefined') { | ||
return ngModel.controller[key]; | ||
if (ngModel) { | ||
if (ngModel.controller && typeof ngModel.controller[key] !== 'undefined') { | ||
return ngModel.controller[key]; | ||
} | ||
if (typeof ngModel[key] !== 'undefined') { | ||
return ngModel[key]; | ||
} | ||
} | ||
if (typeof ngModel[key] !== 'undefined') { | ||
return ngModel[key]; | ||
} | ||
} | ||
@@ -320,2 +322,5 @@ else if (model) { | ||
e = modelByDefinition(e); | ||
if (!e) { | ||
return; | ||
} | ||
if (_.indexOf(already, e) !== -1) { | ||
@@ -484,3 +489,3 @@ return; | ||
else { | ||
throw new ErrorLookupError("Model \"" + name + "\" not found in \"" + group + "\""); | ||
return this.$q.reject(new ErrorLookupError("Model \"" + name + "\" not found in \"" + group + "\"")); | ||
} | ||
@@ -495,8 +500,10 @@ } | ||
else { | ||
throw new ErrorLookupError("Group \"" + group + "\" is undefined"); | ||
return this.$q.reject(new ErrorLookupError("Group \"" + group + "\" is undefined")); | ||
} | ||
return this.$q.when(errors); | ||
}; | ||
/** | ||
* Forcefully set an error on the model, but don't change the ngModel.$error object | ||
*/ | ||
ErrorLookup.prototype.set = function (group, name, errors, reset) { | ||
if (errors === void 0) { errors = {}; } | ||
if (reset === void 0) { reset = true; } | ||
@@ -524,7 +531,7 @@ var model; | ||
else { | ||
throw new ErrorLookupError("Model \"" + model + "\" not found in group \"" + group + "\""); | ||
return this.$q.reject(new ErrorLookupError("Model \"" + model + "\" not found in group \"" + group + "\"")); | ||
} | ||
} | ||
else { | ||
throw new ErrorLookupError("Group \"" + group + "\" is undefined"); | ||
return this.$q.reject(new ErrorLookupError("Group \"" + group + "\" is undefined")); | ||
} | ||
@@ -563,3 +570,2 @@ return this.$q.when(_errors); | ||
validity: function (validity) { | ||
if (validity === void 0) { validity = {}; } | ||
return self.validity(group, name, validity); | ||
@@ -947,5 +953,6 @@ }, | ||
scope.$displaying = function () { | ||
return scope.$parent.$eval(attr['errorLookupShow'], { | ||
var ret = scope.$parent.$eval(attr['errorLookupShow'], { | ||
$model: model.item.controller, | ||
$error: model.error, | ||
$errors: model.item.errors, | ||
$attrs: attr, | ||
@@ -956,5 +963,6 @@ $value: model.item.controller.$viewValue, | ||
}); | ||
return ret; | ||
}; | ||
} | ||
var unwatch = scope.$parent.$watch(function () { | ||
var unwatch = scope.$parent.$watchCollection(function () { | ||
return _.map(error(), function (i) { return i.message; }); | ||
@@ -971,3 +979,3 @@ }, function (e, o) { | ||
} | ||
}, true); | ||
}); | ||
scope.$on('$destroy', function () { | ||
@@ -974,0 +982,0 @@ unwatch(); |
@@ -67,6 +67,6 @@ /// <reference path="typings/tsd.d.ts" /> | ||
error: IErrorGetterSetter; | ||
set(err: any): angular.IPromise<IErrorMessage[]>; | ||
set(err: IList<boolean>): angular.IPromise<IErrorMessage[]>; | ||
label(item: string, name: string): IErrorHelper; | ||
reset(pick?: any): angular.IPromise<IErrorMessage[]>; | ||
validity(validity?: any): angular.IPromise<IErrorMessage[]>; | ||
validity(validity: IList<boolean>): angular.IPromise<IErrorMessage[]>; | ||
remove(): angular.IPromise<void>; | ||
@@ -257,8 +257,10 @@ validate(): boolean; | ||
var ngModel: any = model; | ||
if (ngModel && ngModel.controller && typeof ngModel.controller[key] !== 'undefined') { | ||
return ngModel.controller[key]; | ||
if (ngModel) { | ||
if (ngModel.controller && typeof ngModel.controller[key] !== 'undefined') { | ||
return ngModel.controller[key]; | ||
} | ||
if (typeof ngModel[key] !== 'undefined') { | ||
return ngModel[key]; | ||
} | ||
} | ||
if (typeof ngModel[key] !== 'undefined') { | ||
return ngModel[key]; | ||
} | ||
} else if (model) { | ||
@@ -415,2 +417,6 @@ if (model.controller) { | ||
if (!e) { | ||
return; | ||
} | ||
if (_.indexOf(already, e) !== -1) { | ||
@@ -613,3 +619,3 @@ return; | ||
} else { | ||
throw new ErrorLookupError(`Model "${name}" not found in "${group}"`); | ||
return this.$q.reject(new ErrorLookupError(`Model "${name}" not found in "${group}"`)); | ||
} | ||
@@ -622,3 +628,3 @@ } else { | ||
} else { | ||
throw new ErrorLookupError(`Group "${group}" is undefined`); | ||
return this.$q.reject(new ErrorLookupError(`Group "${group}" is undefined`)); | ||
} | ||
@@ -632,6 +638,3 @@ | ||
*/ | ||
set(group: string, name: string, errors : IList<Function>, reset?: boolean): angular.IPromise<IErrorMessage[]>; | ||
set(group: string, name: string, errors : IList<string>, reset?: boolean): angular.IPromise<IErrorMessage[]>; | ||
set(group: string, name: string, errors : IList<boolean>, reset?: boolean): angular.IPromise<IErrorMessage[]>; | ||
set(group: string, name: any, errors : any = {}, reset: boolean = true): angular.IPromise<IErrorMessage[]> { | ||
set(group: string, name: string, errors : IList<Function|string|boolean>, reset: boolean = true): angular.IPromise<IErrorMessage[]> { | ||
var model: IErrorModel; | ||
@@ -650,3 +653,3 @@ var _errors: IErrorMessage[] = []; | ||
_.forEach<any, string>(errors, (v, k) => { | ||
_.forEach(errors, (v, k) => { | ||
model.forced[k] = v; | ||
@@ -665,6 +668,6 @@ model.state.reset[k] = true; | ||
} else { | ||
throw new ErrorLookupError(`Model "${model}" not found in group "${group}"`); | ||
return this.$q.reject(new ErrorLookupError(`Model "${model}" not found in group "${group}"`)); | ||
} | ||
} else { | ||
throw new ErrorLookupError(`Group "${group}" is undefined`); | ||
return this.$q.reject(new ErrorLookupError(`Group "${group}" is undefined`)); | ||
} | ||
@@ -707,3 +710,3 @@ | ||
}, | ||
validity: function(validity : any = {}) { | ||
validity: function(validity: IList<boolean>) { | ||
return self.validity(group, name, validity); | ||
@@ -1266,5 +1269,6 @@ }, | ||
scope.$displaying = () => { | ||
return scope.$parent.$eval(attr['errorLookupShow'], { | ||
var ret = scope.$parent.$eval(attr['errorLookupShow'], { | ||
$model: model.item.controller, | ||
$error: model.error, | ||
$errors: model.item.errors, | ||
$attrs: attr, | ||
@@ -1275,6 +1279,7 @@ $value: model.item.controller.$viewValue, | ||
}); | ||
return ret; | ||
}; | ||
} | ||
var unwatch = scope.$parent.$watch( | ||
var unwatch = scope.$parent.$watchCollection( | ||
() => { | ||
@@ -1292,4 +1297,3 @@ return _.map(error(), (i) => i.message); | ||
} | ||
}, | ||
true | ||
} | ||
); | ||
@@ -1296,0 +1300,0 @@ |
{ | ||
"name": "angular-mocks", | ||
"version": "1.4.3", | ||
"version": "1.4.6", | ||
"main": "./angular-mocks.js", | ||
"ignore": [], | ||
"dependencies": { | ||
"angular": "1.4.3" | ||
"angular": "1.4.6" | ||
}, | ||
"homepage": "https://github.com/angular/bower-angular-mocks", | ||
"_release": "1.4.3", | ||
"_release": "1.4.6", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "v1.4.3", | ||
"commit": "7e3beec84afceeb060a3c6def0d7ca965727851c" | ||
"tag": "v1.4.6", | ||
"commit": "14a5cb33e87b51ff10ad92ba74fceb257fd2d7ed" | ||
}, | ||
@@ -16,0 +16,0 @@ "_source": "git://github.com/angular/bower-angular-mocks.git", |
{ | ||
"name": "angular-mocks", | ||
"version": "1.4.3", | ||
"version": "1.4.6", | ||
"main": "./angular-mocks.js", | ||
"ignore": [], | ||
"dependencies": { | ||
"angular": "1.4.3" | ||
"angular": "1.4.6" | ||
} | ||
} |
{ | ||
"name": "angular-mocks", | ||
"version": "1.4.3", | ||
"version": "1.4.6", | ||
"description": "AngularJS mocks for testing", | ||
@@ -5,0 +5,0 @@ "main": "angular-mocks.js", |
{ | ||
"name": "angular", | ||
"version": "1.4.3", | ||
"version": "1.4.6", | ||
"main": "./angular.js", | ||
@@ -8,7 +8,7 @@ "ignore": [], | ||
"homepage": "https://github.com/angular/bower-angular", | ||
"_release": "1.4.3", | ||
"_release": "1.4.6", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "v1.4.3", | ||
"commit": "dbd689e8103a6366e53e1f6786727f7c65ccfd75" | ||
"tag": "v1.4.6", | ||
"commit": "0e8a4e9b36704cacad159b99dd06bbcacef94975" | ||
}, | ||
@@ -15,0 +15,0 @@ "_source": "git://github.com/angular/bower-angular.git", |
{ | ||
"name": "angular", | ||
"version": "1.4.3", | ||
"version": "1.4.6", | ||
"main": "./angular.js", | ||
@@ -5,0 +5,0 @@ "ignore": [], |
{ | ||
"name": "angular", | ||
"version": "1.4.3", | ||
"version": "1.4.6", | ||
"description": "HTML enhanced for web apps", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -27,8 +27,8 @@ { | ||
"homepage": "https://github.com/chaijs/chai", | ||
"version": "3.2.0", | ||
"_release": "3.2.0", | ||
"version": "3.3.0", | ||
"_release": "3.3.0", | ||
"_resolution": { | ||
"type": "version", | ||
"tag": "3.2.0", | ||
"commit": "4e18d2a49394f21f49eaea97f556d6a17ecbcc7e" | ||
"tag": "3.3.0", | ||
"commit": "df954ccacf77cc740f45730c04a37bccf7387456" | ||
}, | ||
@@ -35,0 +35,0 @@ "_source": "git://github.com/chaijs/chai.git", |
@@ -20,3 +20,3 @@ { | ||
], | ||
"version": "3.2.0", | ||
"version": "3.3.0", | ||
"repository": { | ||
@@ -23,0 +23,0 @@ "type": "git", |
{ | ||
"name":"angular-errorlookup", | ||
"version":"0.2.2", | ||
"version":"0.3.0", | ||
"description": "Because AngularJS general error messages still suck. ngMessages can kiss my ass.", | ||
@@ -5,0 +5,0 @@ "main": "./angular-errorlookup.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
3987402
149
77778
12
1