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

@lion/validate

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lion/validate - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [0.1.7](https://github.com/ing-bank/lion/compare/@lion/validate@0.1.6...@lion/validate@0.1.7) (2019-05-13)
### Bug Fixes
* add prepublish step to make links absolute for npm docs ([9f2c4f6](https://github.com/ing-bank/lion/commit/9f2c4f6))
## [0.1.6](https://github.com/ing-bank/lion/compare/@lion/validate@0.1.5...@lion/validate@0.1.6) (2019-05-08)

@@ -8,0 +19,0 @@

2

docs/DefaultValidators.md

@@ -29,3 +29,3 @@ # Default Validators

- randomOk
- all default validators have corresponding messages which are translated via the [localize system](../../localize/)
- all default validators have corresponding messages which are translated via the [localize system](https://github.com/ing-bank/lion/blob/master/packages/localize)

@@ -32,0 +32,0 @@ ## How to use

@@ -5,4 +5,4 @@ # Custom Validator Tutorial

They are implemented via pure functions and can be coupled to localized messages.
They should be used in conjunction with a [`Form Control`](../../../field/docs/FormFundaments.md) that implements
the [`ValidateMixin`](../../).
They should be used in conjunction with a [`Form Control`](https://github.com/ing-bank/lion/blob/master/packages/field/docs/FormFundaments.md) that implements
the [`ValidateMixin`](https://github.com/ing-bank/lion/blob/master/packages/validate).

@@ -19,3 +19,3 @@ This tutorial will show you how to build your own custom iban validator, including a factory

reuse.
As can be read in [`Validate`](../ValidationSystem.md), a validator applied to
As can be read in [`Validate`](https://github.com/ing-bank/lion/blob/master/packages/validate/docs/ValidationSystem.md), a validator applied to
`.errorValidators` expects an array with a function, a parameters object and an additional

@@ -47,3 +47,3 @@ configuration object.

As you can see, the first parameter of a validator is always the
[`modelValue`](../../../field/docs/FormattingAndParsing.md). This is the value that our validity should depend upon.
[`modelValue`](https://github.com/ing-bank/lion/blob/master/packages/field/docs/FormattingAndParsing.md). This is the value that our validity should depend upon.
Suppose we want to support 'nl' ibans as well. Since our validator is a pure function,

@@ -77,3 +77,3 @@ we need a parameter for it:

As can be read in [Validate](../../), the `ValidateMixin` considers all namespaces
As can be read in [Validate](https://github.com/ing-bank/lion/blob/master/packages/validate), the `ValidateMixin` considers all namespaces
configured via `get loadNamespaces`. By default, this contains at least the `lion-validate`

@@ -106,3 +106,3 @@ namespace which is added by the `ValidateMixin`. On top of this, for every namespace found, it adds

In order for the localization data to be found, the translation files need to be added to the
manager of [localize](../../../localize/).
manager of [localize](https://github.com/ing-bank/lion/blob/master/packages/localize).
The recommended way to do this (inside your `validators.js` file):

@@ -109,0 +109,0 @@

@@ -18,3 +18,3 @@ # Validation

not always lead to the desired User Experience.
Together with [interaction states](../../field/docs/InteractionStates.md), validity states can determine whether
Together with [interaction states](https://github.com/ing-bank/lion/blob/master/packages/field/docs/InteractionStates.md), validity states can determine whether
a validation message should be shown along the input field.

@@ -43,3 +43,3 @@

A more readable and therefore recommended notation is the factory function, which is described in
detail here: [Custom Validator Tutorial](./tutorials/CustomValidatorsTutorial.md).
detail here: [Custom Validator Tutorial](https://github.com/ing-bank/lion/blob/master/packages/validate/docs/tutorials/CustomValidatorsTutorial.md).
When we talk about validators, we usually refer to factory functions.

@@ -75,3 +75,3 @@

On top of default validators, application developers can write their own.
See [Custom Validator Tutorial](./tutorials/CustomValidatorsTutorial.md) for an example of writing a
See [Custom Validator Tutorial](https://github.com/ing-bank/lion/blob/master/packages/validate/docs/tutorials/CustomValidatorsTutorial.md) for an example of writing a
custom validator.

@@ -81,3 +81,3 @@

The `ValidateMixin` supports localization out of the box via the [localize system](../../localize/).
The `ValidateMixin` supports localization out of the box via the [localize system](https://github.com/ing-bank/lion/blob/master/packages/localize).
By default, all error messages are translated in the following languages (depicted by iso code):

@@ -84,0 +84,0 @@ bg, cs, de, en, es, fr, hu, it, nl, pl, ro ,ru, sk and uk.

{
"name": "@lion/validate",
"version": "0.1.6",
"version": "0.1.7",
"description": "Validate your form elements",

@@ -17,3 +17,3 @@ "author": "ing-bank",

"scripts": {
"prepublishOnly": "../../scripts/insert-header.js"
"prepublishOnly": "../../scripts/npm-prepublish.js"
},

@@ -36,4 +36,4 @@ "keywords": [

"dependencies": {
"@lion/core": "^0.1.3",
"@lion/localize": "^0.1.6"
"@lion/core": "^0.1.4",
"@lion/localize": "^0.1.7"
},

@@ -45,3 +45,3 @@ "devDependencies": {

},
"gitHead": "0f0864b3da2d8d549de18733b597ebe49c9e1fc5"
"gitHead": "97fe0f0aa720bef21fc000e584a44a62302d6871"
}

@@ -18,10 +18,10 @@ # Validate

- multiple validation types(error, warning, info, success)
- [default validators](./docs/DefaultValidators.md)
- [custom validators](./docs/tutorials/CustomValidatorsTutorial.md)
- [default validators](https://github.com/ing-bank/lion/blob/master/packages/validate/docs/DefaultValidators.md)
- [custom validators](https://github.com/ing-bank/lion/blob/master/packages/validate/docs/tutorials/CustomValidatorsTutorial.md)
Validation is applied by default to all [form controls](../field/docs/FormFundaments.md) via the
Validation is applied by default to all [form controls](https://github.com/ing-bank/lion/blob/master/packages/field/docs/FormFundaments.md) via the
ValidateMixin.
For a detailed description of the validation system and the `ValidateMixin`, please see
[ValidationSystem](./docs/ValidationSystem.md).
[ValidationSystem](https://github.com/ing-bank/lion/blob/master/packages/validate/docs/ValidationSystem.md).

@@ -28,0 +28,0 @@ ## How to use

@@ -133,9 +133,9 @@ import { expect } from '@open-wc/testing';

it('provides minDate() to allow only dates earlier then min', () => {
expect(minDate(new Date('2018-02-03'), new Date('2018-02-02'))).to.be.true;
expect(minDate(new Date('2018-02-01'), new Date('2018-02-02'))).to.be.false;
expect(minDate(new Date('2018-02-03'), new Date('2018/02/02'))).to.be.true;
expect(minDate(new Date('2018-02-01'), new Date('2018/02/02'))).to.be.false;
});
it('provides maxDate() to allow only dates before max', () => {
expect(maxDate(new Date('2018-02-01'), new Date('2018-02-02'))).to.be.true;
expect(maxDate(new Date('2018-02-03'), new Date('2018-02-02'))).to.be.false;
expect(maxDate(new Date('2018-02-01'), new Date('2018/02/02'))).to.be.true;
expect(maxDate(new Date('2018-02-03'), new Date('2018/02/02'))).to.be.false;
});

@@ -145,8 +145,8 @@

const minMaxSetting = {
min: new Date('2018-02-02'),
max: new Date('2018-02-04'),
min: new Date('2018/02/02'),
max: new Date('2018/02/04'),
};
expect(minMaxDate(new Date('2018-02-03'), minMaxSetting)).to.be.true;
expect(minMaxDate(new Date('2018-02-01'), minMaxSetting)).to.be.false;
expect(minMaxDate(new Date('2018-02-05'), minMaxSetting)).to.be.false;
expect(minMaxDate(new Date('2018/02/03'), minMaxSetting)).to.be.true;
expect(minMaxDate(new Date('2018/02/01'), minMaxSetting)).to.be.false;
expect(minMaxDate(new Date('2018/02/05'), minMaxSetting)).to.be.false;
});

@@ -160,4 +160,4 @@

minDateValidator,
new Date('2018-02-03'),
new Date('2018-02-02'),
new Date('2018/02/03'),
new Date('2018/02/02'),
);

@@ -167,10 +167,10 @@ smokeTestValidator(

maxDateValidator,
new Date('2018-02-01'),
new Date('2018-02-02'),
new Date('2018/02/01'),
new Date('2018/02/02'),
);
const minMaxSetting = {
min: new Date('2018-02-02'),
max: new Date('2018-02-04'),
min: new Date('2018/02/02'),
max: new Date('2018/02/04'),
};
smokeTestValidator('minMaxDate', minMaxDateValidator, new Date('2018-02-03'), minMaxSetting);
smokeTestValidator('minMaxDate', minMaxDateValidator, new Date('2018/02/03'), minMaxSetting);
});

@@ -177,0 +177,0 @@ });

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