neworbit / not-valid Goto Github PK
View Code? Open in Web Editor NEWExtensible and flexible TypeScript validation
License: MIT License
Extensible and flexible TypeScript validation
License: MIT License
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
const isRequiredString = createValidator<string>(x => x && x.length > 0, "This field is required.");
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
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.
Per https://docs.npmjs.com/misc/scripts#prepublish-and-prepare, npm prepublish
is deprecated because, confusingly, it runs before every npm install
. We should be using prepublishOnly
instead.
@OwenPattison mentioned that we should add more keywords to package.json
in order to have better discoverability on npmjs
I think we should move the tests alongside the 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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.