Coder Social home page Coder Social logo

not-valid's People

Contributors

ashrafxcoder avatar davidgruar avatar dependabot[bot] avatar hisuwh avatar jameskmonger avatar thyde1 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

not-valid's Issues

Add documentation for validators

The validators should have documentation around what formats they expect.

This will make it easier for users to understand whether or not their needs are met by the validator

createValidator method

const isRequiredString = createValidator<string>(x => x && x.length > 0, "This field is required.");

Make validator names consistent

Some validators have "UK" in the name but others do not despite being a UK-based thing (e.g. NI number)

It would probably be good to add UK to all of the ones that are UK specific

Relative paths broken in declaration files

In the latest release (1.1.1) some relative paths in declaration files are incorrectly specified - this appears to be due to microsoft/TypeScript#24599. This results in build errors in any project that consumes not-valid.

Example, in bin/create-validator.d.ts:

export declare const createValidator: <T>(predicate: ValidationPredicate<T>, message: string) => (value: T) => import("../../../Code/validation/src/results/validation-result").ValidationResult;
export declare const createValidatorFactory: <T>(predicate: (value: T) => boolean, defaultMessage: string) => (message?: string | undefined) => (value: T) => import("../../../Code/validation/src/results/validation-result").ValidationResult;
export declare const createAsyncValidator: <T>(predicate: (value: T) => Promise<boolean>, message: string) => (value: T) => Promise<import("../../../Code/validation/src/results/validation-result").ValidationResult>;
export declare const createAsyncValidatorFactory: <T>(predicate: (value: T) => Promise<boolean>, defaultMessage: string) => (message?: string | undefined) => (value: T) => Promise<import("../../../Code/validation/src/results/validation-result").ValidationResult>;

Upgrading to typescript@3 fixes this.

Tests alongside code

I think we should move the tests alongside the code:

  • it makes them easier to find
  • easier to import the SUT
  • really obvious if a file doesn't have tests
  • also just to standardise the structure to follow our other packages and internal projects (Momenta, TTC and TeamPrevent are all doing this for there front end code)

Also then build all the test files into another directory to keep the working directory clean.

Example of tsconfig setup: https://github.com/NewOrbit/redux-authorisation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.