Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng2-validation

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-validation - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

dist/directives/greater-than.d.ts

8

dist/custom-validators.d.ts

@@ -16,2 +16,10 @@ import { ValidatorFn, AbstractControl } from '@angular/forms';

/**
* Validator that requires controls to have a value greater than a gt value.
*/
static gt(gt: number): ValidatorFn;
/**
* Validator that requires controls to have a value less than a lt value.
*/
static lt(lt: number): ValidatorFn;
/**
* Validator that requires controls to have a value of a range value.

@@ -18,0 +26,0 @@ */

@@ -41,2 +41,24 @@ "use strict";

/**
* Validator that requires controls to have a value greater than a gt value.
*/
CustomValidators.gt = function (gt) {
return function (control) {
if (lang_1.isPresent(forms_1.Validators.required(control)))
return null;
var v = control.value;
return v > gt ? null : { 'gt': true };
};
};
/**
* Validator that requires controls to have a value less than a lt value.
*/
CustomValidators.lt = function (lt) {
return function (control) {
if (lang_1.isPresent(forms_1.Validators.required(control)))
return null;
var v = control.value;
return v < lt ? null : { 'lt': true };
};
};
/**
* Validator that requires controls to have a value of a range value.

@@ -43,0 +65,0 @@ */

4

dist/directives.js

@@ -5,3 +5,5 @@ "use strict";

var min_1 = require('./directives/min');
var greater_than_1 = require('./directives/greater-than');
var max_1 = require('./directives/max');
var less_than_1 = require('./directives/less-than');
var range_1 = require('./directives/range');

@@ -27,3 +29,5 @@ var digits_1 = require('./directives/digits');

min_1.MinValidator,
greater_than_1.GreaterThanValidator,
max_1.MaxValidator,
less_than_1.LessThanValidator,
range_1.RangeValidator,

@@ -30,0 +34,0 @@ digits_1.DigitsValidator,

2

dist/directives.metadata.json

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"CUSTOM_FORM_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/range-length","name":"RangeLengthValidator"},{"__symbolic":"reference","module":"./directives/min","name":"MinValidator"},{"__symbolic":"reference","module":"./directives/max","name":"MaxValidator"},{"__symbolic":"reference","module":"./directives/range","name":"RangeValidator"},{"__symbolic":"reference","module":"./directives/digits","name":"DigitsValidator"},{"__symbolic":"reference","module":"./directives/number","name":"NumberValidator"},{"__symbolic":"reference","module":"./directives/url","name":"UrlValidator"},{"__symbolic":"reference","module":"./directives/email","name":"EmailValidator"},{"__symbolic":"reference","module":"./directives/date","name":"DateValidator"},{"__symbolic":"reference","module":"./directives/min-date","name":"MinDateValidator"},{"__symbolic":"reference","module":"./directives/max-date","name":"MaxDateValidator"},{"__symbolic":"reference","module":"./directives/date-iso","name":"DateISOValidator"},{"__symbolic":"reference","module":"./directives/credit-card","name":"CreditCardValidator"},{"__symbolic":"reference","module":"./directives/json","name":"JSONValidator"},{"__symbolic":"reference","module":"./directives/base64","name":"Base64Validator"},{"__symbolic":"reference","module":"./directives/phone","name":"PhoneValidator"},{"__symbolic":"reference","module":"./directives/uuid","name":"UUIDValidator"},{"__symbolic":"reference","module":"./directives/equal","name":"EqualValidator"},{"__symbolic":"reference","module":"./directives/equal-to","name":"EqualToValidator"},{"__symbolic":"reference","module":"./directives/not-equal-to","name":"NotEqualToValidator"}],"CustomFormsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","name":"CUSTOM_FORM_DIRECTIVES"}],"exports":[{"__symbolic":"reference","name":"CUSTOM_FORM_DIRECTIVES"}]}]}]}}}
{"__symbolic":"module","version":1,"metadata":{"CUSTOM_FORM_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/range-length","name":"RangeLengthValidator"},{"__symbolic":"reference","module":"./directives/min","name":"MinValidator"},{"__symbolic":"reference","module":"./directives/greater-than","name":"GreaterThanValidator"},{"__symbolic":"reference","module":"./directives/max","name":"MaxValidator"},{"__symbolic":"reference","module":"./directives/less-than","name":"LessThanValidator"},{"__symbolic":"reference","module":"./directives/range","name":"RangeValidator"},{"__symbolic":"reference","module":"./directives/digits","name":"DigitsValidator"},{"__symbolic":"reference","module":"./directives/number","name":"NumberValidator"},{"__symbolic":"reference","module":"./directives/url","name":"UrlValidator"},{"__symbolic":"reference","module":"./directives/email","name":"EmailValidator"},{"__symbolic":"reference","module":"./directives/date","name":"DateValidator"},{"__symbolic":"reference","module":"./directives/min-date","name":"MinDateValidator"},{"__symbolic":"reference","module":"./directives/max-date","name":"MaxDateValidator"},{"__symbolic":"reference","module":"./directives/date-iso","name":"DateISOValidator"},{"__symbolic":"reference","module":"./directives/credit-card","name":"CreditCardValidator"},{"__symbolic":"reference","module":"./directives/json","name":"JSONValidator"},{"__symbolic":"reference","module":"./directives/base64","name":"Base64Validator"},{"__symbolic":"reference","module":"./directives/phone","name":"PhoneValidator"},{"__symbolic":"reference","module":"./directives/uuid","name":"UUIDValidator"},{"__symbolic":"reference","module":"./directives/equal","name":"EqualValidator"},{"__symbolic":"reference","module":"./directives/equal-to","name":"EqualToValidator"},{"__symbolic":"reference","module":"./directives/not-equal-to","name":"NotEqualToValidator"}],"CustomFormsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","name":"CUSTOM_FORM_DIRECTIVES"}],"exports":[{"__symbolic":"reference","name":"CUSTOM_FORM_DIRECTIVES"}]}]}]}}}
{
"name": "ng2-validation",
"version": "3.3.0",
"version": "3.4.0",
"description": "angular2 validation",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -24,3 +24,5 @@ # Description

- min
- gt
- max
- lt
- range

@@ -81,2 +83,9 @@ - digits

### gt
```html
<input type="number" [(ngModel)]="model.field" name="field" #field="ngModel" [gt]="10"/>
<p *ngIf="field.errors?.gt">error message</p>
```
### max

@@ -89,2 +98,9 @@

### lt
```html
<input type="number" [(ngModel)]="model.field" name="field" #field="ngModel" [lt]="20"/>
<p *ngIf="field.errors?.lt">error message</p>
```
### range

@@ -307,2 +323,8 @@

### gt
```javascript
new FormControl('', CustomValidators.gt(10))
```
### max

@@ -314,2 +336,8 @@

### lt
```javascript
new FormControl('', CustomValidators.lt(20))
```
### range

@@ -316,0 +344,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc