thesimplevalidation 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +207 -269
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +17 -6
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/index.d.ts +8 -8
  6. package/dist/src/index.js +22 -10
  7. package/dist/src/index.js.map +1 -1
  8. package/dist/src/validation-errors-model.d.ts +3 -3
  9. package/dist/src/validation-errors-model.js +2 -2
  10. package/dist/src/validation-model.d.ts +3 -3
  11. package/dist/src/validation-model.js +2 -2
  12. package/dist/src/validation-property-result.d.ts +4 -4
  13. package/dist/src/validation-property-result.js +2 -2
  14. package/dist/src/validation-result.d.ts +8 -8
  15. package/dist/src/validation-result.js +2 -2
  16. package/dist/src/validation-scope.d.ts +19 -17
  17. package/dist/src/validation-scope.js +199 -194
  18. package/dist/src/validation-scope.js.map +1 -1
  19. package/dist/src/validator-setup.d.ts +4 -4
  20. package/dist/src/validator-setup.js +2 -2
  21. package/dist/src/validator.d.ts +8 -8
  22. package/dist/src/validator.js +68 -67
  23. package/dist/src/validator.js.map +1 -1
  24. package/dist/src/validators/boolean/index.d.ts +10 -10
  25. package/dist/src/validators/boolean/index.js +79 -76
  26. package/dist/src/validators/boolean/index.js.map +1 -1
  27. package/dist/src/validators/index.d.ts +5 -5
  28. package/dist/src/validators/index.js +13 -12
  29. package/dist/src/validators/index.js.map +1 -1
  30. package/dist/src/validators/max/index.d.ts +10 -10
  31. package/dist/src/validators/max/index.js +87 -87
  32. package/dist/src/validators/max/index.js.map +1 -1
  33. package/dist/src/validators/min/index.d.ts +10 -10
  34. package/dist/src/validators/min/index.js +88 -87
  35. package/dist/src/validators/min/index.js.map +1 -1
  36. package/dist/src/validators/required/index.d.ts +7 -7
  37. package/dist/src/validators/required/index.js +83 -80
  38. package/dist/src/validators/required/index.js.map +1 -1
  39. package/dist/src/validators/simple/index.d.ts +10 -10
  40. package/dist/src/validators/simple/index.js +75 -72
  41. package/dist/src/validators/simple/index.js.map +1 -1
  42. package/package.json +16 -9
  43. package/src/validation-scope.ts +10 -6
  44. package/src/validators/max/index.ts +6 -9
  45. package/src/validators/min/index.ts +6 -8
  46. package/src/validators/simple/index.ts +1 -1
  47. /package/{simplevalidation.code-workspace → thesimplevalidation.code-workspace} +0 -0
package/README.md CHANGED
@@ -1,355 +1,293 @@
1
- # localizationservice
1
+ # thesimplevalidation
2
2
 
3
- The simple localization service
3
+ The simple validation service
4
4
 
5
- [![Build Status](https://travis-ci.org/ripenko/localizationservice.svg?branch=master)](https://travis-ci.org/ripenko/localizationservice)
6
-
7
- Also there is `localizationkeys-webpack` that generates typescript class of localization keys. See [https://github.com/ripenko/localizationkeys-webpack].
5
+ [![Build Status](https://travis-ci.org/ripenko/thesimplevalidation.svg?branch=master)](https://travis-ci.org/ripenko/thesimplevalidation)
8
6
 
9
7
  ## Installation
10
-
11
8
  ```
12
- npm install --save localizationservice
9
+ npm install --save thesimplevalidation
13
10
  ```
14
11
 
15
- ## Usage
12
+ ## Setup
13
+ There are paar steps to enable validation.
16
14
 
17
- ### Simple usage
18
- method `localize`
15
+ ### 1. Create a model
19
16
  ```typescript
20
- import LocalizationService from "localizationservice";
17
+ interface IModel {
18
+ title: string;
19
+ description: string;
20
+ }
21
+ ```
21
22
 
22
- const defaultLanguage = {
23
- "Key1": "Value 1",
24
- "Key2": {
25
- "Key21": "Value 21"
26
- }
23
+ ### 2. Create or use state, or something similar where we store user model values
24
+ ```typescript
25
+ this.model: IModel = {
26
+ title: "",
27
+ description: ""
27
28
  };
28
-
29
- const service = new LocalizationService({
30
- importedLanguages: {
31
- [LocalizationService.DEFAULT_CULTURE_NAME]: defaultLanguage
32
- },
33
- currentLanguage: defaultLanguage
34
- });
35
-
36
- const localized: string = service.localize("Key2.Key21");
37
- console.log(localized); // "Value 21"
38
-
39
29
  ```
40
30
 
41
- ### Example. The facade pattern with event bus integration
42
- The events bus is `eventservice`. See [https://github.com/ripenko/eventservice]
43
-
44
- There are two localization files `default.jsonc` and `de-de.json`. To generate localization keys from `default.jsonc` file we can use webpack plugin [https://github.com/ripenko/localizationkeys-webpack].
45
-
46
- The `Localization.ts` file in your app.
31
+ ### 3. Create validation model, validation errors model
47
32
  ```typescript
48
- import LocalizationService from "localizationservice";
49
- import EventService from "eventservice";
33
+ import { ValidationModel } from "thesimplevalidation";
50
34
 
51
- export default class Localization {
52
-
53
- private static service: LocalizationService | null = null;
54
-
55
- public static localize<T = string>(key: string, ...formatArgs: string[]): T {
56
- if (Localization.service == null) initService();
57
- return Localization.service.localize(key, formatArgs);
58
- }
35
+ this.validation: ValidationModel<IModel> = {
36
+ title: false,
37
+ description: true
38
+ };
59
39
 
60
- private static initService(): void {
61
- const defaultLanguage = require("localization/default.jsonc");
62
- const germanLanguage = require("localization/de-de.jsonc");
63
- Localization.service = new LocalizationService({
64
- importedLanguages: {
65
- [LocalizationService.DEFAULT_CULTURE_NAME]: defaultLanguage,
66
- "de-de": germanLanguage
67
- },
68
- onLanguageChanged: (languageName: string, language: ILocalizationLanguage): Promise<void> => {
69
- // we can notify subscribers that the current language has been changed.
70
- // if we use momentjs then we can change locale by `moment.locale(languageName);`
71
- // or numeraljs, etc...
72
- return EventService.fire("Events.Localization.LanguageChanged", { name: languageName, langauge: language });
73
- },
74
- onLanguageImported: (languageName: string, language: ILocalizationLanguage): Promise<void> => {
75
- // we can load language from api or some another place async to import it by `service.importLanguage` method
76
- // when new language will be imported we can update UI by refreshing a list of available languages
77
- return EventService.fire("Events.Localization.LanguageImported", { name: languageName, langauge: language });
78
- },
79
- onLocalizationMissing: (key: string, _languageName: string, _language: ILocalizationLanguage | null, _formatArgs: string[]): string => {
80
- // When localization has been not found in current language we return just key.
81
- // The testers could find easy such unlocalizated places.
82
- // Or we can notify insights about missing values.
83
- // Or we can try to get value from default language.
84
- // Or write in the console, etc...
85
- return key;
86
- }
87
- });
88
- }
40
+ this.validationErrors: ValidationErrorsModel<IModel> = {
41
+ title: [];
42
+ description: [];
43
+ };
89
44
 
90
- }
45
+ this.allValidationErrors: string [] = [];
91
46
 
47
+ this.isValid: boolean = false;
92
48
  ```
93
49
 
94
- ### Return localized object instead of certain string
95
- Method `localize`. By default return type of method `localize<T = string>` is string.
96
- If we pass a localization key that point doesn't point to string, but it points to the parent nested object, then localized result will be object.
97
- Typically usecases:
98
-
99
- - dynamic key. if localization key is computed
100
- - localized object should be passed to some component. (Example: Globalization, or localization of some Telerik control)
101
50
 
51
+ ### 4. Creating Validation Scope
102
52
  ```typescript
103
- import LocalizationService from "localizationservice";
53
+ import { ValidationScope } from "thesimplevalidation";
104
54
 
105
- interface IFeatureString {
106
- Title: string;
107
- Description: string;
108
- }
55
+ const scope = new ValidationScope<IModel>({
56
+ getModel: (): IModel => this.model
57
+ });
109
58
 
110
- const defaultLanguage = {
111
- "Feature": {
112
- "Title": "Some Title",
113
- "Description": "Some Description"
114
- }
115
- };
59
+ ```
116
60
 
117
- const service = new LocalizationService({
118
- importedLanguages: {
119
- [LocalizationService.DEFAULT_CULTURE_NAME]: defaultLanguage
120
- },
121
- currentLanguage: defaultLanguage
122
- });
61
+ ### 5. Add validators to model property(ies)
62
+ There are some built-in validators like `RequiredValidator`, `MinValidator`, `MaxValidator`, `SimpleValidator`, `BooleanValidator`. You can create own by yourself. It is easy.
63
+ So. To add validators we use validation scope method `useValidators`.
64
+ ```typescript
65
+ import { RequiredValidator } from "thesimplevalidation";
123
66
 
124
- const result: IFeatureString = service.localize<IFeatureString>("Feature");
125
- console.log(result); // -> { Title: "Some Title", Description: "Some Description" }
67
+ this.scope.useValidators("title", new RequiredValidator());
126
68
 
127
69
  ```
128
70
 
129
- ### Changing the current language
130
- method `changeLanguage`
71
+ ### 6. Do validation
131
72
  ```typescript
132
- import LocalizationService from "localizationservice";
73
+ const result: IValidationResult<IModel> = await this.scope.isValid();
74
+ console.log(result.isValid, result);
75
+ // -> false, { isValid: false, properties: { title: { isValid: false, errors: [] }, description: { isValid: true, errors: [] } }, errors: [] }
76
+ ```
133
77
 
134
- const defaultLanguage = {
135
- "Key1": "Value 1",
136
- "Key2": {
137
- "Key21": "Value 21"
138
- }
139
- };
78
+ ## Usage
140
79
 
141
- const germanLanguage = {
142
- "Key1": "Wert 1",
143
- "Key2": {
144
- "Key21": "Wert 21"
80
+ ### ValidationScope
81
+ This class is main point to define validation. Possible to define more than one scope in the form. As you wish.
82
+ ```typescript
83
+ const scope = new ValidationScope<IModel>({
84
+ getModel: (): IModel => this.model
85
+ onValidationChanged: async (result: IValidationResult<TModel>): Promise<void> => {
86
+ const properties: Array<keyof TModel> = keys(result.properties) as Array<keyof TModel>;
87
+ const validation: ValidationModel<TModel> = {} as ValidationModel<TModel>;
88
+ const validationErrors: ValidationErrorsModel<TModel> = {} as ValidationErrorsModel<TModel>;
89
+
90
+ for (const property of properties) {
91
+ if (!result.properties.hasOwnProperty(property)) continue;
92
+
93
+ validation[property] = result.properties[property].isValid;
94
+ validationErrors[property] = result.properties[property].errors;
95
+ }
96
+
97
+ this.isValid = result.isValid;
98
+ this.validation = validation;
99
+ this.validationErrors = validationErrors;
100
+ this.allValidationErrors = result.errors;
145
101
  }
146
- }
147
-
148
- const service = new LocalizationService({
149
- importedLanguages: {
150
- [LocalizationService.DEFAULT_CULTURE_NAME]: defaultLanguage,
151
- "de-de": germanLanguage
152
- },
153
- currentLanguage: defaultLanguage
154
102
  });
155
-
156
- await service.changeLanguage("de-DE"); // language name case will be lowered => de-de
157
-
158
- const localized: string = service.localize("Key2.Key21");
159
- console.log(localized); // "Wert 21"
160
-
161
103
  ```
104
+ `getModel` is invoked on validation by method `isValid`.
105
+ `onValidationChanged` Optional. To handle validation result. It is invoked before `isValid` method is completed.
162
106
 
163
- ### Using onChangeLanguage handler. When the current language has been changed
164
- method `changeLanguage` and constructor options property `onChangeLanguage`.
107
+ ### `isValid`
108
+ Validates the whole model.
165
109
  ```typescript
166
- import LocalizationService from "localizationservice";
167
-
168
- const defaultLanguage = {
169
- "Key1": "Value 1",
170
- "Key2": {
171
- "Key21": "Value 21"
172
- }
173
- };
174
-
175
- const germanLanguage = {
176
- "Key1": "Wert 1",
177
- "Key2": {
178
- "Key21": "Wert 21"
179
- }
180
- }
110
+ const result: IValidationResult<IModel> = await this.scope.isValid();
111
+ console.log(result.isValid); // -> false
112
+ ```
181
113
 
182
- const service = new LocalizationService({
183
- importedLanguages: {
184
- [LocalizationService.DEFAULT_CULTURE_NAME]: defaultLanguage,
185
- "de-de": germanLanguage
186
- },
187
- currentLanguage: defaultLanguage,
188
- onChangeLanguage: async (languageName: string, language: ILocalizationLanguage | null): Promise<void> => {
189
- console.info(languageName, language);
190
- }
191
- });
114
+ #### `isPropertyValid`
115
+ Validates only a specific property.
116
+ ```typescript
117
+ const propertyResult: IValidationPropertyResult = await this.scope.isPropertyValid("description");
118
+ console.log(propertyResult.isValid); // -> false
119
+ ```
192
120
 
193
- await service.changeLanguage("de-DE"); // language name case will be lowered => de-de
194
- // -> de-de { Key1: "Wert 1", Key2: { Key21: "Wert 21" } }
121
+ #### `useValidators`
122
+ Use this method to set validators for property.
123
+ ```typescript
124
+ this.scope.useValidators(
125
+ "title", // property
126
+ new RequiredValidator(),
127
+ new MaxValidator({ maxValue: () => 10 }),
128
+ // add more validators if you need
129
+ );
130
+ ```
195
131
 
132
+ #### `useOriginal`
133
+ You have built-in ability to check if the property has been changed or not. `isDirty`.
134
+ To do it scope save a deep cloned copy of the model on init. When we invoke `isDirty`, then `isDirty` method compares value to saved copy.
135
+ `useOriginal` resets saved cloned copy of model.
136
+ ```typescript
137
+ this.scope.useOriginal(newModel);
196
138
  ```
197
139
 
198
- ### Importing new language using language property `__cultureName__`
199
- method `importLanguage`.
140
+ #### `isPropertyDirty`
141
+ The method of the validation scope allows to check if property has been changed (dirty).
200
142
  ```typescript
201
- import LocalizationService from "localizationservice";
143
+ this.model.title = "New Title";
144
+ let isTitleDirty: boolean = this.scope.isPropertyDirty("title");
145
+ console.log(isTitleDirty); // -> true
202
146
 
203
- const defaultLanguage = {
204
- "Key1": "Value 1",
205
- "Key2": {
206
- "Key21": "Value 21"
207
- }
208
- };
147
+ this.scope.useOriginal(this.model);
148
+ isTitleDirty = this.scope.isPropertyDirty("title");
149
+ console.log(isTitleDirty); // -> false
150
+ ```
209
151
 
210
- const germanLanguage = {
211
- __cultureName__: "de-de",
212
- "Key1": "Wert 1",
213
- "Key2": {
214
- "Key21": "Wert 21"
215
- }
216
- }
152
+ This method has optional `key` parameter. It uses to use nested value if property is object with nested object-properties. Example `someProperty.someNestedProperty.key`, `arrayProperty.key`.
217
153
 
218
- const service = new LocalizationService({
219
- importedLanguages: {
220
- [LocalizationService.DEFAULT_CULTURE_NAME]: defaultLanguage
221
- },
222
- currentLanguage: defaultLanguage
223
- });
224
154
 
225
- // `__cultureName__` of `germanLanguage` will be used to definde language name
226
- // The method doesn't change the current language. See `changeLanguage`.
227
- // The language name detection priority is language property `__cultureName__`,
228
- // if there is no, then parameter `name`. If the parameter `name` is undefined,
229
- // then `LocalizationService.DEFAULT_CULTURE_NAME`
230
- await service.importLanguage(germanLanguage);
155
+ #### `getOriginalProperty`
156
+ Gets property from saved cloned model.
157
+ ```typescript
158
+ const originalTitle = this.scope.getOriginalProperty("title");
159
+ ```
231
160
 
232
- const localized: string = service.localize("Key2.Key21");
233
- console.log(localized); // "Value 21"
161
+ #### `isDirty`
162
+ Checks if model or model properties have been changed (dirty).
234
163
 
164
+ Checks the whole model
165
+ ```typescript
166
+ this.scope.isDirty();
167
+ ```
168
+ or checks only `title` property
169
+ ```typescript
170
+ this.scope.isDirty("title");
171
+ ```
172
+ or checks multiple properties
173
+ ```typescript
174
+ this.scope.isDirty("title", "description");
235
175
  ```
236
176
 
237
- ### Importing new language using optional method parameter `name`
238
- method `importLanguage`.
177
+ ### Validators
178
+ You can create own validator using the followed template:
239
179
  ```typescript
240
- import LocalizationService from "localizationservice";
180
+ import { IValidationPropertyResult, IValidatorSetup, Validator } from "thesimplevalidation";
181
+
182
+ // if you need to pass extra data you can put here.
183
+ export interface IMyValidatorSetup<TModel, K extends keyof TModel> extends IValidatorSetup<TModel, K> {
184
+ extraParam: () => number;
185
+ }
241
186
 
242
- const defaultLanguage = {
243
- "Key1": "Value 1",
244
- "Key2": {
245
- "Key21": "Value 21"
187
+ export class MyValidator<TModel, K extends keyof TModel> extends Validator<TModel, K, IMyValidatorSetup<TModel, K>> {
188
+ constructor(setup: IMyValidatorSetup<TModel, K>) {
189
+ super(setup);
246
190
  }
247
- };
248
191
 
249
- const germanLanguage = {
250
- "Key1": "Wert 1",
251
- "Key2": {
252
- "Key21": "Wert 21"
192
+ public async isValidInternal(_value: TModel[K]): Promise<IValidationPropertyResult> {
193
+ let isValid: boolean = true;
194
+
195
+ //... add validation core here to set isValid
196
+
197
+ return {
198
+ isValid: isValid,
199
+ errors: [] // You can add errors here, or use `setup.getErrors` method
200
+ };
253
201
  }
254
202
  }
255
203
 
256
- const service = new LocalizationService({
257
- importedLanguages: {
258
- [LocalizationService.DEFAULT_CULTURE_NAME]: defaultLanguage
259
- },
260
- currentLanguage: defaultLanguage
261
- });
204
+ ```
262
205
 
263
- // There is no `__cultureName__` of `germanLanguage`,
264
- // then parameter `name` will be used to definde language name `de-de` (case will be lowered).
265
- // The method doesn't change the current language. See `changeLanguage`.
266
- await service.importLanguage(germanLanguage, "de-DE");
206
+ #### `IMyValidatorSetup<TModel, K>`
207
+ The base options of validators.
267
208
 
268
- const localized: string = service.localize("Key2.Key21");
269
- console.log(localized); // "Value 21"
209
+ `isDisabled?: (value: TModel[K]) => boolean;` is used to disable validator based on some logic-function.
210
+ Could be nice if validation logic is depended on some values, logic, etc...
270
211
 
271
- ```
212
+ `getErrors?: (value: TModel[K]) => string[];` is used to define error messages.
272
213
 
273
- ### Importing new default language
274
- method `importLanguage`.
275
- ```typescript
276
- import LocalizationService from "localizationservice";
214
+ #### RequiredValidator
215
+ Validates property against `""`, `null`, `undefined`, `0`, array.`length`.
277
216
 
278
- const defaultLanguage = {
279
- "Key1": "Value 1",
280
- "Key2": {
281
- "Key21": "Value 21"
282
- }
283
- };
217
+ #### MinValidator
218
+ Validates the minimum value of property.
284
219
 
285
- const germanLanguage = {
286
- "Key1": "Wert 1",
287
- "Key2": {
288
- "Key21": "Wert 21"
289
- }
290
- }
220
+ Property value is a string then the validator checks the string length.
221
+ If an array then the validator checks the array length.
222
+ If a number then the validator validate against min value.
291
223
 
292
- const service = new LocalizationService({
293
- importedLanguages: {
294
- [LocalizationService.DEFAULT_CULTURE_NAME]: defaultLanguage
295
- },
296
- currentLanguage: defaultLanguage
224
+ ```typescript
225
+ new MinValidator({
226
+ minValue: () => 10
297
227
  });
228
+ ```
298
229
 
299
- // `__cultureName__` of `germanLanguage` will be used to definde language name
300
- // The method doesn't change the current language. See `changeLanguage`.
301
- await service.importLanguage(germanLanguage);
302
-
303
- // To apply updated language you have to refresh current language
304
- await service.changeLanguage();
230
+ #### MaxValidator
231
+ Validates the maximum value of property.
305
232
 
306
- const localized: string = service.localize("Key2.Key21");
307
- console.log(localized); // "Wert 21"
233
+ Property value is a string then the validator checks the string length.
234
+ If an array then the validator checks the array length.
235
+ If a number then the validator validate against max value.
308
236
 
237
+ ```typescript
238
+ new MaxValidator({
239
+ maxValue: () => 255
240
+ });
309
241
  ```
310
242
 
311
- ### Using on `onLanguageImported` handler. When the language has been imported.
312
- constructor option `onLanguageImported` or property `onLanguageImported`.
243
+ #### BooleanValidator
244
+ Validates if the model boolean property value is the same if some boolean value
313
245
  ```typescript
314
- import LocalizationService from "localizationservice";
246
+ new MaxValidator({
247
+ target: () => true
248
+ });
249
+ ```
315
250
 
316
- const defaultLanguage = {
317
- "Key1": "Value 1",
318
- "Key2": {
319
- "Key21": "Value 21"
320
- }
321
- };
251
+ #### SimpleValidator
252
+ The simpliest validator that option `getValidation` boolean value will be used as isValid of validation. The model property value is not used.
253
+ See implementation:
254
+ ```typescript
255
+ export interface ISimpleValidatorSetup<TModel, K extends keyof TModel> extends IValidatorSetup<TModel, K> {
256
+ getValidation: () => boolean;
257
+ }
322
258
 
323
- const service = new LocalizationService({
324
- onLanguageImported: async (name: string, language: ILocalizationLanguage): Promise<void> => {
325
- console.log(name, language);
259
+ export class SimpleValidator<TModel, K extends keyof TModel> extends Validator<TModel, K, ISimpleValidatorSetup<TModel, K>> {
260
+ constructor(setup: ISimpleValidatorSetup<TModel, K>) {
261
+ super(setup);
326
262
  }
327
- });
328
263
 
329
- // `__cultureName__` of `defaultLanguage` will be used to definde language name
330
- // The method doesn't change the current language. See `changeLanguage`.
331
- await service.importLanguage(defaultLanguage);
332
- // -> "" { Key1: "Value 1", Key2: { Key21: "Value 21" } }
264
+ public async isValidInternal(_value: TModel[K]): Promise<IValidationPropertyResult> {
265
+ const isValid: boolean = this.setup.getValidation();
333
266
 
267
+ return {
268
+ isValid: isValid,
269
+ errors: []
270
+ };
271
+ }
272
+ }
334
273
  ```
335
274
 
336
- ### Using on `onLocalizationMissing` handler. When localization string has been not found
337
- constructor option `onLocalizationMissing` or property `onLocalizationMissing`.
275
+ Example:
338
276
  ```typescript
339
- import LocalizationService from "localizationservice";
340
-
341
- const service = new LocalizationService({
342
- // name will be `LocalizationService.DEFAULT_CULTURE_NAME`, language is `{}`
343
- onLocalizationMissing: (key: string, name: string, language: ILocalizationLanguage): string => {
344
- return `Missed '${key}' for default language`;
345
- }
277
+ new SimpleValidator({
278
+ getValidation: () => true
346
279
  });
347
-
348
- const result: string = service.localize("SomeKey");
349
- console.log(result); // -> "Missed 'SomeKey' for default language"
350
-
280
+ // -> isValid = true
281
+ ```
282
+ or
283
+ ```typescript
284
+ new SimpleValidator({
285
+ getValidation: () => false
286
+ });
287
+ // -> isValid = false
351
288
  ```
352
289
 
290
+
353
291
  ## Credits
354
292
  [Alexey Ripenko](http://ripenko.ru/), [GitHub](https://github.com/ripenko/)
355
293
 
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./src";
1
+ export * from "./src";
package/dist/index.js CHANGED
@@ -1,7 +1,18 @@
1
- "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- __export(require("./src"));
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src"), exports);
7
18
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;AAAA,2BAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB"}
@@ -1,8 +1,8 @@
1
- export { ValidationScope } from "./validation-scope";
2
- export { ValidationErrorsModel } from "./validation-errors-model";
3
- export { ValidationModel } from "./validation-model";
4
- export { IValidationPropertyResult } from "./validation-property-result";
5
- export { IValidationResult } from "./validation-result";
6
- export { Validator } from "./validator";
7
- export { IValidatorSetup } from "./validator-setup";
8
- export * from "./validators";
1
+ export { ValidationScope } from "./validation-scope";
2
+ export { ValidationErrorsModel } from "./validation-errors-model";
3
+ export { ValidationModel } from "./validation-model";
4
+ export { IValidationPropertyResult } from "./validation-property-result";
5
+ export { IValidationResult } from "./validation-result";
6
+ export { Validator } from "./validator";
7
+ export { IValidatorSetup } from "./validator-setup";
8
+ export * from "./validators";
package/dist/src/index.js CHANGED
@@ -1,11 +1,23 @@
1
- "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var validation_scope_1 = require("./validation-scope");
7
- exports.ValidationScope = validation_scope_1.ValidationScope;
8
- var validator_1 = require("./validator");
9
- exports.Validator = validator_1.Validator;
10
- __export(require("./validators"));
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Validator = exports.ValidationScope = void 0;
18
+ var validation_scope_1 = require("./validation-scope");
19
+ Object.defineProperty(exports, "ValidationScope", { enumerable: true, get: function () { return validation_scope_1.ValidationScope; } });
20
+ var validator_1 = require("./validator");
21
+ Object.defineProperty(exports, "Validator", { enumerable: true, get: function () { return validator_1.Validator; } });
22
+ __exportStar(require("./validators"), exports);
11
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAAA,uDAAqD;AAA5C,6CAAA,eAAe,CAAA;AAKxB,yCAAwC;AAA/B,gCAAA,SAAS,CAAA;AAGlB,kCAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AAKxB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAGlB,+CAA6B"}