Skip to content

Conversation

@crsanti
Copy link
Member

@crsanti crsanti commented Mar 9, 2017

No description provided.

@crsanti crsanti self-assigned this Mar 9, 2017
(vm: any): ValidationResult;
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space

lib/package.json Outdated
"phantomjs-prebuilt": "^2.1.7",
"rimraf": "^2.5.2",
"sinon": "^1.17.6",
"sinon-chai": "^2.8.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need sinon-chai

}
import { } from 'core-js';

export class FormNameToFieldNameMapping {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this class?

vmFieldName: string;
}

export class FieldValidation {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove this class too because this is an internal entity

lib/src/index.ts Outdated
import { createFormValidation } from './baseFormValidation';

export {
FormNameToFieldNameMapping,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove here too


private parseValidationConstraints(validationConstraints: ValidationConstraints) {
if (validationConstraints && typeof validationConstraints === 'object') {
if (validationConstraints.hasOwnProperty('global') && validationConstraints.global instanceof Array) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you use validationConstraints.hasOwnProperty('global')?

You can't use validationConstraints.global?

});
}

validateField(vm: any, key: string, value: any, filter?: any) {
Copy link
Member

@nasdan nasdan Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before refactor, this method looks like: filter: any = consts.defaultFilter).

Do you remove default value unintentionally?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValidationEngine already does it. It's unnecessary to do this twice.

constructor();
}

export interface IValidationEngine {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove this interface too because this is an internal interface

import { } from 'core-js';
import { FormNameToFieldNameMapping, FormValidationResult, FieldValidationResult, FieldValidation } from "./entities";
import {
FormNameToFieldNameMapping,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

}

validateGlobalFormValidations(vm: any): Array<Promise<FieldValidationResult>> {
validateGlobalFormValidations(vm: any) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending to add returned type? Promise<FieldValidationResult>[]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to discuss here if we should declare it for functions that already returns that value, e.g:

function isNotNull(object: any): boolean {
  return object !== null;
}

function giveMeAPromiseWIthFieldValidationResult(someData: any): Promise<ValidationResult> {
  return new Promise((resolve, reject) => {
    const validationResult = new FieldValidationResult();
    // do some logic here
    resolve(validationResult);
  });
}

import { } from 'core-js';
import { FormNameToFieldNameMapping, FieldValidationResult } from './entities';
import {
FormNameToFieldNameMapping,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

@@ -1,12 +1,7 @@
import { } from 'core-js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

@crsanti crsanti merged commit bdec257 into master Mar 10, 2017
@crsanti crsanti deleted the issue45-factory_based_global_object branch March 10, 2017 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants