From 25224c1a040ea7bcd244183bb12dba30efc6d1bb Mon Sep 17 00:00:00 2001 From: Umed Khudoiberdiev Date: Mon, 18 Jul 2016 14:57:31 +0500 Subject: [PATCH 1/5] added sync validation support, refactored custom decorators signature and other small refactorings --- README.md | 83 ++++++--- doc/release-notes.md | 10 +- package.json | 4 +- .../sample6-custom-decorator/IsLongerThan.ts | 10 +- .../IsUserAlreadyExist.ts | 24 ++- src/container.ts | 63 +++++++ src/decorator/decorators.ts | 5 +- src/index.ts | 161 ++++-------------- src/metadata/ConstraintMetadata.ts | 8 +- src/register-decorator.ts | 84 +++++++++ src/validation/ValidationExecutor.ts | 29 ++-- src/validation/Validator.ts | 46 ++++- 12 files changed, 338 insertions(+), 189 deletions(-) create mode 100644 src/container.ts create mode 100644 src/register-decorator.ts diff --git a/README.md b/README.md index 6138ca1e13..804355976a 100644 --- a/README.md +++ b/README.md @@ -6,24 +6,45 @@ [![Dependency Status](https://david-dm.org/pleerock/class-validator.svg)](https://david-dm.org/pleerock/class-validator) [![devDependency Status](https://david-dm.org/pleerock/class-validator/dev-status.svg)](https://david-dm.org/pleerock/class-validator#info=devDependencies) -Allows use of decorator and non-decorator based validation. Internally uses [validator.js][1] to perform validation. +Allows use of decorator and non-decorator based validation. +Internally uses [validator.js][1] to perform validation. +Class-validator works on both browser and node.js platforms. ## Installation -1. Install module: +Install module: - `npm install class-validator --save` +`npm install class-validator --save` -2. ES6 features are used, so you may want to install [es6-shim](https://github.com/paulmillr/es6-shim) too: +#### Old versions of node.js/browser - `npm install es6-shim --save` +ES6 features are used, if you are using old versions of node (or browser) you may want to install [es6-shim](https://github.com/paulmillr/es6-shim) too: - and use it somewhere in the global place of your app: +`npm install es6-shim --save` - * for nodejs: `require("es6-shim")` (or `import "es6-shim";`) in your app's entry point (for example in `app.ts`) - * for browser: `