Socket
Socket
Sign inDemoInstall

@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.8.0 to 0.9.0

13

CHANGELOG.md

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

# [0.9.0](https://github.com/ing-bank/lion/compare/@lion/validate@0.8.0...@lion/validate@0.9.0) (2020-03-25)
### Features
* refrain from using dynamic vars inside dynamic import ([42c840f](https://github.com/ing-bank/lion/commit/42c840f9498810a81296c9beb8a4f6bbdbc4fa0b))
* update to stable @open-wc/scoped-elements ([10bac56](https://github.com/ing-bank/lion/commit/10bac5672b406d3f08a89a795ee295f5028ca6d0))
* **field:** align (pre)filled and empty, fix filled not working ([e397f8d](https://github.com/ing-bank/lion/commit/e397f8d68b44c2ccb6447a908a97ace6568738ad))
# [0.8.0](https://github.com/ing-bank/lion/compare/@lion/validate@0.7.1...@lion/validate@0.8.0) (2020-03-05)

@@ -8,0 +21,0 @@

9

package.json
{
"name": "@lion/validate",
"version": "0.8.0",
"version": "0.9.0",
"description": "Validate your form elements",

@@ -39,5 +39,4 @@ "author": "ing-bank",

"dependencies": {
"@lion/core": "0.4.5",
"@lion/localize": "0.8.10",
"@open-wc/scoped-elements": "^0.5.0"
"@lion/core": "0.5.0",
"@lion/localize": "0.9.0"
},

@@ -49,3 +48,3 @@ "devDependencies": {

},
"gitHead": "54c4432b818cf1f6023557d0df5c461ae50412da"
"gitHead": "29e1252560d3fda898f98c271a7b685d1e929035"
}
import { localize } from '@lion/localize';
import { DefaultSuccess } from './resultValidators/DefaultSuccess.js';
import {
IsDate,
IsDateDisabled,
MaxDate,
MinDate,
MinMaxDate,
} from './validators/DateValidators.js';
import { IsNumber, MaxNumber, MinMaxNumber, MinNumber } from './validators/NumberValidators.js';
import { Required } from './validators/Required.js';
import {
EqualsLength,
IsEmail,
MaxLength,
MinLength,
MaxLength,
MinMaxLength,
IsEmail,
} from './validators/StringValidators.js';
import { IsNumber, MinNumber, MaxNumber, MinMaxNumber } from './validators/NumberValidators.js';
export { IsNumber, MaxNumber, MinMaxNumber, MinNumber } from './validators/NumberValidators.js';
import {
IsDate,
MinDate,
MaxDate,
MinMaxDate,
IsDateDisabled,
} from './validators/DateValidators.js';
import { DefaultSuccess } from './resultValidators/DefaultSuccess.js';
export { IsNumber, MinNumber, MaxNumber, MinMaxNumber } from './validators/NumberValidators.js';
let loaded = false;

@@ -105,3 +103,3 @@

default:
return import(`../translations/${locale}.js`);
return import(`../translations/en.js`);
}

@@ -108,0 +106,0 @@ },

/* eslint-disable class-methods-use-this, camelcase, no-param-reassign, max-classes-per-file */
import { dedupeMixin, SlotMixin, ScopedElementsMixin, getScopedTagName } from '@lion/core';
import { dedupeMixin, ScopedElementsMixin, SlotMixin } from '@lion/core';
import { localize } from '@lion/localize';

@@ -28,3 +28,3 @@ import { LionValidationFeedback } from './LionValidationFeedback.js';

// eslint-disable-next-line no-unused-vars, no-shadow
class ValidateMixin extends ScopedElementsMixin(SyncUpdatableMixin(SlotMixin(superclass))) {
class ValidateMixin extends SyncUpdatableMixin(SlotMixin(ScopedElementsMixin(superclass))) {
static get scopedElements() {

@@ -121,5 +121,3 @@ return {

feedback: () =>
document.createElement(
getScopedTagName('lion-validation-feedback', this.constructor.scopedElements),
),
document.createElement(this.constructor.getScopedTagName('lion-validation-feedback')),
};

@@ -314,6 +312,8 @@ }

* to trigger formControl.__isEmpty.
* - when __isEmpty returns false, the input was empty. This means we need to stop
* - when __isEmpty returns true, the input was empty. This means we need to stop
* validation here, because all other Validators' execute functions assume the
* value is not empty (there would be nothing to validate).
*/
// TODO: Try to remove this when we have a single lion form core package, because then we can
// depend on FormControlMixin directly, and _isEmpty will always be an existing method on the prototype then
const isEmpty = this.__isEmpty(value);

@@ -431,2 +431,3 @@ if (isEmpty) {

this.validationStates = validationStates;
this.hasFeedbackFor = [...new Set(this.__validationResult.map(v => v.type))];

@@ -494,3 +495,7 @@

// }
return v === null || typeof v === 'undefined' || v === '';
return (
this.modelValue === null ||
typeof this.modelValue === 'undefined' ||
this.modelValue === ''
);
}

@@ -497,0 +502,0 @@

@@ -668,4 +668,4 @@ import { LitElement } from '@lion/core';

class extends ValidateMixin(LitElement) {
_isEmpty(modelValue) {
return modelValue.model === '';
_isEmpty() {
return this.modelValue.model === '';
}

@@ -672,0 +672,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