├── .editorconfig ├── .gitignore ├── .idea ├── codeStyleSettings.xml ├── dictionaries │ └── jeff.xml ├── inspectionProfiles │ └── Project_Default.xml ├── misc.xml ├── modules.xml ├── validx.iml ├── vcs.xml └── watcherTasks.xml ├── .npmignore ├── .nycrc ├── .travis.yml ├── .vscode └── settings.json ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── examples ├── babel │ ├── .babelrc │ ├── package.json │ ├── src │ │ └── index.js │ └── yarn.lock └── typescript │ ├── package.json │ ├── src │ └── index.ts │ ├── tsconfig.json │ └── yarn.lock ├── package-lock.json ├── package.json ├── src ├── __tests__ │ ├── utils.spec.ts │ └── validation.spec.ts ├── index.ts ├── utils.ts ├── validation.ts └── validators │ ├── __tests__ │ ├── funcValidator.spec.ts │ ├── patternValidator.spec.ts │ └── requiredValidator.spec.ts │ ├── funcValidator.ts │ ├── patternValidator.ts │ └── requiredValidator.ts ├── tsconfig.build.json ├── tsconfig.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | coverage 4 | .nyc_output 5 | lib 6 | .test-out 7 | .DS_Store 8 | .idea/workspace.xml 9 | -------------------------------------------------------------------------------- /.idea/codeStyleSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/dictionaries/jeff.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | automagically 5 | lodash 6 | quotemark 7 | todos 8 | truthy 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/validx.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/watcherTasks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | examples 2 | test 3 | coverage 4 | .test-out 5 | src 6 | -------------------------------------------------------------------------------- /.nycrc: -------------------------------------------------------------------------------- 1 | { 2 | "sourceMap": true, 3 | "instrument": true, 4 | "extension": [ 5 | ".ts" 6 | ], 7 | "reporter": [ 8 | "text", 9 | "lcov" 10 | ], 11 | "include": [ 12 | ".test-out/src/**/*.js" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | # Node 18 binaries require glibc >= 2.28 4 | dist: focal 5 | 6 | node_js: 7 | - 'stable' 8 | - '16' 9 | 10 | cache: 11 | directories: 12 | - node_modules 13 | 14 | # Set INIT_CWD for Husky due to Npm 7 not including it. 15 | before_install: 16 | - export INIT_CWD="$(pwd)" 17 | 18 | # Lint errors should trigger a failure. 19 | before_script: npm run lint && npm run build 20 | 21 | # Code coverage 22 | script: npm run coveralls 23 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib" 3 | } 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 1.0.0-alpha.2 4 | 5 | * Upgraded to MobX 6 6 | * Removed `peerDependencies` in favor of BYOM (Bring Your Own MobX) 7 | * Overhaul build, lint and test infra 8 | 9 | ## 1.0.0 10 | 11 | * Upgraded to MobX v4, breaks compatibility with MobX <= 3 12 | 13 | ## 0.2.0 14 | 15 | * Added `clearErrors(field: string)` to the context, lets you remove errors for a particular field. 16 | 17 | ## 0.1.4 18 | 19 | * Added `url` pattern validator. 20 | * Added `func` validator 21 | * More documentation 22 | 23 | ## 0.1.3 24 | 25 | * Skip falsy values in schema. 26 | 27 | ## 0.1.2 28 | 29 | * Moved mobx to peerDependencies. 30 | 31 | ## 0.1.1 32 | 33 | * Updated npm description. 34 | 35 | ## 0.1.0 36 | 37 | * Added `validation.getErrors()`. 38 | * Added `validation.getError()`. 39 | * Removed `lodash` dependency. 40 | 41 | ## 0.0.4 42 | 43 | * First official release. 44 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) Jeff Hansen 2017 to present. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # validx 2 | 3 | [![npm](https://img.shields.io/npm/v/validx.svg?maxAge=1000)](https://www.npmjs.com/package/validx) 4 | [![dependency Status](https://img.shields.io/david/jeffijoe/validx.svg?maxAge=1000)](https://david-dm.org/jeffijoe/validx) 5 | [![devDependency Status](https://img.shields.io/david/dev/jeffijoe/validx.svg?maxAge=1000)](https://david-dm.org/jeffijoe/validx) 6 | [![Build Status](https://img.shields.io/travis/jeffijoe/validx.svg?maxAge=1000)](https://travis-ci.org/jeffijoe/validx) 7 | [![Coveralls](https://img.shields.io/coveralls/jeffijoe/validx.svg?maxAge=1000)](https://coveralls.io/github/jeffijoe/validx) 8 | [![npm](https://img.shields.io/npm/dt/validx.svg?maxAge=1000)](https://www.npmjs.com/package/validx) 9 | [![npm](https://img.shields.io/npm/l/validx.svg?maxAge=1000)](https://github.com/jeffijoe/validx/blob/master/LICENSE.md) 10 | [![node](https://img.shields.io/node/v/validx.svg?maxAge=1000)](https://www.npmjs.com/package/validx) 11 | 12 | Validation library for [MobX](https://github.com/mobxjs/mobx). 13 | 14 | ## Install 15 | 16 | ``` 17 | # Bring your own MobX 18 | npm install --save mobx validx 19 | ``` 20 | 21 | Table of Contents 22 | ================= 23 | 24 | * [Why?](#why) 25 | * [Examples](#examples) 26 | * [API documentation](#api-documentation) 27 | * [The ValidationContext](#the-validationcontext) 28 | * [`validate()`](#validate) 29 | * [`reset()`](#reset) 30 | * [`addErrors()`](#adderrors) 31 | * [`getErrors()`](#geterrors) 32 | * [`getError()`](#geterror) 33 | * [`clearErrors()`](#clearerrors) 34 | * [`errors`](#errors) 35 | * [`isValid`](#isvalid) 36 | * [Validators](#validators) 37 | * [Built-in validators](#built-in-validators) 38 | * [`required`](#required) 39 | * [`pattern`](#pattern) 40 | * [`func`](#func) 41 | * [Bound `ValidationContext`](#bound-validationcontext) 42 | * [Author](#author) 43 | 44 | # Why? 45 | 46 | We want to reactively display validation issues in our UI when using MobX. You can use 47 | any (non-DOM) validation library, but then you still need to make it reactive. 48 | 49 | **ValidX** is built for [MobX](https://github.com/mobxjs/mobx) and is easy to use, yet 50 | powerful enough to add any validation you'd like. 51 | 52 | # Examples 53 | 54 | See the [TypeScript example][ts-example] and [Babel example][babel-example] for runnable examples (in Node). 55 | 56 | # API documentation 57 | 58 | ## The `ValidationContext` 59 | 60 | The meat of the library is the validation context. To create one, you can either use 61 | 62 | ```js 63 | import { ValidationContext } from 'validx' 64 | const validation = new ValidationContext() 65 | ``` 66 | 67 | Or use the factory function 68 | 69 | ```js 70 | import { validationContext } from 'validx' 71 | const validation = validationContext() 72 | ``` 73 | 74 | The properties on the context are reactive (observables/computeds powered by MobX). 75 | 76 | ### `validate()` 77 | 78 | Given an object and a schema, validates the object and returns itself. 79 | `validate()` is a MobX `action`. 80 | 81 | Calling it will populate the `errors` property with any validation errors 82 | found on the object 83 | 84 | There are multiple ways to use `validate()`, see [Bound ValidationContext](#bound-validationcontext). 85 | 86 | ```js 87 | import { validationContext, required, pattern } from 'validx' 88 | 89 | const validation = validationContext() 90 | 91 | // For good measure, reset the internal state. 92 | validation.reset() 93 | 94 | // validate takes 2 parameters: 95 | // - the object to validate 96 | // - the schema. 97 | const schema = { 98 | // The schema maps to the fields we are validating. 99 | name: [ 100 | // Each field you wish to validate is an array of validation 101 | // functions. 102 | // `required` is just a function returning a validator function. 103 | required({ msg: 'Name is required' }) 104 | ], 105 | email: [ 106 | required({ msg: 'Email is required' }), 107 | // The `pattern` validator can be used to validate 108 | // emails and other regexps. 109 | pattern({ pattern: 'email', msg: 'Not a valid email' }) 110 | ] 111 | } 112 | 113 | validation.validate({ 114 | name: '', 115 | email: '' 116 | }, schema) 117 | ``` 118 | 119 | 120 | Now that we have validated our object, we can pull the errors 121 | from the context. 122 | 123 | ```js 124 | console.log(validation.isValid) 125 | // false 126 | 127 | console.log(validation.errors.name) 128 | // ['Name is required'] 129 | 130 | console.log(validation.errors.email) 131 | // ['Email is required', 'Not a valid email'] 132 | ``` 133 | 134 | To validate again, we need to reset the context and then call validate. 135 | 136 | ```js 137 | validation.reset().validate({ 138 | name: 'Jeff', 139 | email: 'test' 140 | }, schema) 141 | 142 | console.log(validation.isValid) 143 | // false 144 | 145 | console.log(validation.errors.name) 146 | // [] 147 | 148 | console.log(validation.errors.email) 149 | // ['Not a valid email'] 150 | ``` 151 | 152 | Let's see what the errors are like when we 153 | log them after resetting. 154 | 155 | ```js 156 | validation.reset() 157 | console.log(validation.isValid) 158 | // true 159 | console.log(validation.errors.name) 160 | // undefined 161 | 162 | console.log(validation.errors.email) 163 | // undefined 164 | ``` 165 | 166 | They are undefined because we don't know 167 | what fields will be validated yet. 168 | 169 | ```js 170 | validation.validate({ 171 | name: 'Jeff', 172 | email: 'test' 173 | }, schema) 174 | 175 | console.log(validation.isValid) 176 | // false 177 | 178 | console.log(validation.errors.name) 179 | // [] 180 | 181 | console.log(validation.errors.email) 182 | // ['Not a valid email'] 183 | ``` 184 | 185 | ### `reset()` 186 | 187 | Resets the internal state of the context. You usually use this before 188 | starting a new validation. `reset()` is a MobX `action`. 189 | 190 | ```js 191 | const validation = validationContext() 192 | validation.validate({ name: '' }, { 193 | name: [required()] 194 | }) 195 | console.log(validation.errors.name) 196 | // ['This field is invalid'] 197 | validation.reset() 198 | console.log(validation.errors.name) 199 | // undefined 200 | ``` 201 | 202 | **Use case:** sharing a validation context in a class hierarchy. 203 | 204 | ```js 205 | class Element { 206 | @observable label = '' 207 | 208 | validation = validationContext(this) 209 | 210 | @action validate () { 211 | this.validation.validate({ 212 | label: [required({ msg: 'Label required' })] 213 | }) 214 | } 215 | } 216 | 217 | class TextElement extends Element { 218 | @observable placeholder = '' 219 | 220 | @action validate () { 221 | // reset before caling super 222 | this.validation.reset().validate({ 223 | placeholder: [required({ msg: 'Placeholder required' })] 224 | }) 225 | super.validate() 226 | } 227 | } 228 | 229 | const textElement = new TextElement() 230 | textElement.validate() 231 | console.log(textElement.validation.errors) 232 | // { label: ['Label required'], placeholder: ['Placeholder required'] } 233 | 234 | textElement.label = 'First name' 235 | textElement.validate() 236 | console.log(textElement.validation.errors) 237 | // { placeholder: ['Placeholder required'] } 238 | ``` 239 | 240 | ### `addErrors()` 241 | 242 | If you at some point want to add errors without calling validate, this 243 | is how to do it. `addErrors()` is a MobX `action`. 244 | 245 | ```js 246 | const obj = {} 247 | const validation = validationContext(obj, { 248 | }) 249 | 250 | if (usernameIsTaken) { 251 | validation.addErrors({ 252 | username: ['Username is taken'] 253 | }) 254 | } 255 | 256 | console.log(validation.errors.username) 257 | // ['Username is taken'] 258 | ``` 259 | 260 | ### `getErrors()` 261 | 262 | Safer way to get errors for a field rather than using `errors.field`, 263 | as this will return an empty array in case there are no errors. 264 | 265 | ```js 266 | const validation = validationContext() 267 | validation.addErrors({ name: ['Not cool'] }) 268 | 269 | validation.getErrors('name') 270 | // ['Not cool'] 271 | 272 | validation.reset() 273 | validation.getErrors('name') 274 | // [] 275 | ``` 276 | 277 | ### `getError()` 278 | 279 | Convenience method for `getErrors('field')[0]`. 280 | Returns `undefined` if the error is not found. 281 | 282 | ```js 283 | const validation = validationContext() 284 | validation.addErrors({ name: ['Not cool'] }) 285 | 286 | validation.getError('name') 287 | // 'Not cool' 288 | 289 | validation.reset() 290 | validation.getError('name') 291 | // undefined 292 | ``` 293 | 294 | ### `clearErrors()` 295 | 296 | Clear errors for a single field, instead of reseting the whole context. 297 | 298 | ```js 299 | const validation = validationContext() 300 | validation.addErrors({ name: ['Not cool'], language: ['Must be JS'] }) 301 | 302 | validation.getError('name') 303 | // 'Not cool' 304 | 305 | validation.clearErrors('name') 306 | 307 | validation.getError('name') 308 | // 'Not cool' 309 | 310 | validation.getError('language') 311 | // 'Must be JS' 312 | ``` 313 | 314 | ### `errors` 315 | 316 | A MobX `computed` map of field -> errors. When `validate` discovers validation errors, it 317 | puts them in here. 318 | 319 | If a field has not been validated, or the context has just been reset, there 320 | will be no keys. 321 | 322 | ```js 323 | const validation = validationContext(obj, { 324 | name: [required()] 325 | }) 326 | console.log(validation.errors) 327 | // {} 328 | 329 | validation.validate() 330 | console.log(validation.errors) 331 | // { name: ['This field is invalid'] } 332 | validation.validate() 333 | // { name: ['This field is invalid', 'This field is invalid] } 334 | // that's why you need to remember to `reset()` first! 335 | ``` 336 | 337 | ### `isValid` 338 | 339 | A MobX `computed` property that determines whether the context 340 | has any errors or not. 341 | 342 | ```js 343 | const validation = validationContext() 344 | console.log(validation.isValid) 345 | // true 346 | validation.validate({ }, { name: [required()] }) 347 | console.log(validation.isValid) 348 | // false 349 | ``` 350 | 351 | ## Validators 352 | 353 | Validators are just plain functions that take an object 354 | with the rule configuration as a parameter and returns 355 | either true for success, false for failure, or a string 356 | for a failure with a specific message. 357 | 358 | ```js 359 | const validation = validationContext() 360 | const schema = { 361 | age: [ 362 | required({ msg: 'Age is required' }), 363 | (opts) => opts.value >= 13 || 'Must be 13 years or older' 364 | ] 365 | } 366 | 367 | validation.validate({ 368 | age: 8 369 | }, schema) 370 | 371 | console.log(validation.errors.age) 372 | // ['Must be 13 years or older'] 373 | ``` 374 | 375 | ## Built-in validators 376 | 377 | ### `required` 378 | 379 | Takes a string (error message) or an object in the form of `{ required: boolean, msg: string }`. 380 | 381 | If `required === false`, the validator will always return true. 382 | 383 | ```js 384 | { 385 | // default message 386 | firstName: [required()], 387 | // shorthand 388 | lastName: [required('Last name, please?')], 389 | // Fully-fledged, only enabled if `this.getSmsNotifications` is `true` 390 | phoneNumber: [ 391 | required({ 392 | msg: 'Please enter your number so we can send you those notifications', 393 | required: this.getSmsNotifications, 394 | }) 395 | ] 396 | } 397 | ``` 398 | 399 | ### `pattern` 400 | 401 | Let's you specify a named pattern or your own regex. Supports simple and config signatures. 402 | 403 | Named patterns: 404 | 405 | * `'email'` (uses `email-validator`) 406 | * `'url'` (uses `is-url`) 407 | 408 | Example: 409 | 410 | ```js 411 | { 412 | // simple 413 | email: [pattern('email')], 414 | // simple with message 415 | homepage: [pattern('url', 'Not a valid URL, come on!')], 416 | // simple regex with message 417 | bio: [pattern(/javascript/i, 'Sorry - no JS, no job.')], 418 | // config with regex and message 419 | twitterHandle: [ 420 | pattern({ 421 | pattern: /^@/, 422 | msg: 'Twitter handles start with an @' 423 | }) 424 | ] 425 | } 426 | ``` 427 | 428 | ### `func` 429 | 430 | If you dislike the `boolean || 'message'` approach to custom validators, you can use `func`. 431 | 432 | Example: 433 | 434 | ```js 435 | { 436 | knownLibraries: [ 437 | // Without func. 438 | (opts) => opts.value.includes('react') || 'Sorry, only React devs here!', 439 | // With func. 440 | func( 441 | (opts) => opts.value.includes('react'), 442 | 'Sorry, only React devs here!' 443 | ) 444 | ] 445 | } 446 | ``` 447 | 448 | ## Bound `ValidationContext` 449 | 450 | By passing either 1 or 2 parameters to `validationContext`, you can "pre-bind" it 451 | to an object and a schema. 452 | 453 | ```js 454 | // Not bound to anything. 455 | const obj = { name: '' } 456 | const validation = validationContext() 457 | 458 | validation.validate(obj, { 459 | name: [required()] 460 | }) 461 | ``` 462 | 463 | ```js 464 | // Bound to an object 465 | const obj = { name: '' } 466 | const validation = validationContext(obj) 467 | 468 | validation.validate({ 469 | name: [required()] 470 | }) 471 | ``` 472 | 473 | ```js 474 | // Bound to an object and a schema 475 | const obj = { name: '' } 476 | const validation = validationContext(obj, { 477 | name: [required()] 478 | }) 479 | 480 | validation.validate() 481 | ``` 482 | 483 | # Author 484 | 485 | Jeff Hansen - [@Jeffijoe](https://twitter.com/Jeffijoe) 486 | 487 | [ts-example]: /examples/typescript 488 | [babel-example]: /examples/babel 489 | -------------------------------------------------------------------------------- /examples/babel/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-2"] 3 | } 4 | -------------------------------------------------------------------------------- /examples/babel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "babel-node src/index.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "moment": "^2.17.1" 14 | }, 15 | "devDependencies": { 16 | "babel-cli": "^6.23.0", 17 | "babel-preset-es2015": "^6.22.0", 18 | "babel-preset-stage-2": "^6.22.0" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/babel/src/index.js: -------------------------------------------------------------------------------- 1 | import { validationContext, required, pattern } from '../../../lib' 2 | import { action, autorun } from 'mobx' 3 | import { inspect } from 'util' 4 | 5 | // Does not have to be an observable, 6 | // so to demonstrate I'll use a plain object. 7 | const obj = {} 8 | 9 | // First parameter is the object to validate, second 10 | // is the validation schema. 11 | const validation = validationContext(obj, { 12 | name: [required({ msg: 'Name is required' })], 13 | email: [ 14 | required('Email is required'), // shorthand message parameter for the required validator. 15 | pattern({ pattern: 'email', msg: 'That is not a valid email' }), 16 | ], 17 | age: [ 18 | required('Age is required'), 19 | pattern({ 20 | pattern: /\d/, // regex pattern for numbers 21 | msg: 'Age must be a number', 22 | }), 23 | // And a custom validator. 24 | (opts) => { 25 | // Validators return either true for success, and false (for the default error message) 26 | // or a string (for a custom error message) 27 | return opts.value >= 13 || 'You must be over 13 years of age to sign up.' 28 | }, 29 | ], 30 | }) 31 | 32 | // Let's set up an autorun that will log whenever 33 | // our validation state changes. 34 | // Keep in mind the first output will say all is well, 35 | // but thats because we didnt start validating yet. 36 | autorun(() => { 37 | console.log('') 38 | console.log('') 39 | console.log('-------- Validation Summary ---------') 40 | console.log('Bad field count: ', Object.keys(validation.errors).length) 41 | Object.keys(validation.errors).map((key) => { 42 | // errors[key] is an observable array. 43 | // using slice to print them nicely in the console. 44 | console.log( 45 | `Errors for ${key}: `, 46 | // Add some color to the console output. :) 47 | inspect(validation.errors[key].slice(), { colors: true }) 48 | ) 49 | }) 50 | console.log( 51 | '-- So is it valid?', 52 | validation.isValid ? 'Yes it is!' : 'Hell naw!' 53 | ) 54 | }) 55 | 56 | // The context needs to be reset every time we validate 57 | // from scratch. See the docs as to why this is useful. 58 | // Wrap it in an action so we batch the resetting and validating. 59 | const validate = action(() => validation.reset().validate()) 60 | 61 | // First round 62 | validation.validate() 63 | 64 | // Let's add our name. 65 | obj.name = 'Jeff' 66 | 67 | // We need to validate again. 68 | validate() 69 | 70 | // Add an email, except it's not really an email.. 71 | obj.email = 'test' 72 | validate() 73 | 74 | // Much better! 75 | obj.email = 'test@test.com' 76 | validate() 77 | 78 | // Alright now the age.. 79 | obj.age = 'twentytwo' 80 | validate() 81 | 82 | // Oh, it has to be a number. 83 | obj.age = 2 84 | validate() 85 | 86 | // Woops, forgot a digit. 87 | obj.age = 22 88 | validate() 89 | 90 | // And we're good! 91 | -------------------------------------------------------------------------------- /examples/babel/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | abbrev@1: 6 | version "1.1.0" 7 | resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.0.tgz#d0554c2256636e2f56e7c2e5ad183f859428d81f" 8 | 9 | ansi-regex@^2.0.0: 10 | version "2.1.1" 11 | resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" 12 | 13 | ansi-styles@^2.2.1: 14 | version "2.2.1" 15 | resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" 16 | 17 | anymatch@^1.3.0: 18 | version "1.3.0" 19 | resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507" 20 | dependencies: 21 | arrify "^1.0.0" 22 | micromatch "^2.1.5" 23 | 24 | aproba@^1.0.3: 25 | version "1.1.1" 26 | resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.1.1.tgz#95d3600f07710aa0e9298c726ad5ecf2eacbabab" 27 | 28 | are-we-there-yet@~1.1.2: 29 | version "1.1.2" 30 | resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz#80e470e95a084794fe1899262c5667c6e88de1b3" 31 | dependencies: 32 | delegates "^1.0.0" 33 | readable-stream "^2.0.0 || ^1.1.13" 34 | 35 | arr-diff@^2.0.0: 36 | version "2.0.0" 37 | resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" 38 | dependencies: 39 | arr-flatten "^1.0.1" 40 | 41 | arr-flatten@^1.0.1: 42 | version "1.0.1" 43 | resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.0.1.tgz#e5ffe54d45e19f32f216e91eb99c8ce892bb604b" 44 | 45 | array-unique@^0.2.1: 46 | version "0.2.1" 47 | resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" 48 | 49 | arrify@^1.0.0: 50 | version "1.0.1" 51 | resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" 52 | 53 | asn1@~0.2.3: 54 | version "0.2.3" 55 | resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" 56 | 57 | assert-plus@^0.2.0: 58 | version "0.2.0" 59 | resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" 60 | 61 | assert-plus@^1.0.0: 62 | version "1.0.0" 63 | resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" 64 | 65 | async-each@^1.0.0: 66 | version "1.0.1" 67 | resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" 68 | 69 | asynckit@^0.4.0: 70 | version "0.4.0" 71 | resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" 72 | 73 | aws-sign2@~0.6.0: 74 | version "0.6.0" 75 | resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" 76 | 77 | aws4@^1.2.1: 78 | version "1.6.0" 79 | resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" 80 | 81 | babel-cli@^6.23.0: 82 | version "6.23.0" 83 | resolved "https://registry.yarnpkg.com/babel-cli/-/babel-cli-6.23.0.tgz#52ff946a2b0f64645c35e7bd5eea267aa0948c0f" 84 | dependencies: 85 | babel-core "^6.23.0" 86 | babel-polyfill "^6.23.0" 87 | babel-register "^6.23.0" 88 | babel-runtime "^6.22.0" 89 | commander "^2.8.1" 90 | convert-source-map "^1.1.0" 91 | fs-readdir-recursive "^1.0.0" 92 | glob "^7.0.0" 93 | lodash "^4.2.0" 94 | output-file-sync "^1.1.0" 95 | path-is-absolute "^1.0.0" 96 | slash "^1.0.0" 97 | source-map "^0.5.0" 98 | v8flags "^2.0.10" 99 | optionalDependencies: 100 | chokidar "^1.6.1" 101 | 102 | babel-code-frame@^6.22.0: 103 | version "6.22.0" 104 | resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" 105 | dependencies: 106 | chalk "^1.1.0" 107 | esutils "^2.0.2" 108 | js-tokens "^3.0.0" 109 | 110 | babel-core@^6.23.0: 111 | version "6.23.1" 112 | resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.23.1.tgz#c143cb621bb2f621710c220c5d579d15b8a442df" 113 | dependencies: 114 | babel-code-frame "^6.22.0" 115 | babel-generator "^6.23.0" 116 | babel-helpers "^6.23.0" 117 | babel-messages "^6.23.0" 118 | babel-register "^6.23.0" 119 | babel-runtime "^6.22.0" 120 | babel-template "^6.23.0" 121 | babel-traverse "^6.23.1" 122 | babel-types "^6.23.0" 123 | babylon "^6.11.0" 124 | convert-source-map "^1.1.0" 125 | debug "^2.1.1" 126 | json5 "^0.5.0" 127 | lodash "^4.2.0" 128 | minimatch "^3.0.2" 129 | path-is-absolute "^1.0.0" 130 | private "^0.1.6" 131 | slash "^1.0.0" 132 | source-map "^0.5.0" 133 | 134 | babel-generator@^6.23.0: 135 | version "6.23.0" 136 | resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.23.0.tgz#6b8edab956ef3116f79d8c84c5a3c05f32a74bc5" 137 | dependencies: 138 | babel-messages "^6.23.0" 139 | babel-runtime "^6.22.0" 140 | babel-types "^6.23.0" 141 | detect-indent "^4.0.0" 142 | jsesc "^1.3.0" 143 | lodash "^4.2.0" 144 | source-map "^0.5.0" 145 | trim-right "^1.0.1" 146 | 147 | babel-helper-bindify-decorators@^6.22.0: 148 | version "6.22.0" 149 | resolved "https://registry.yarnpkg.com/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.22.0.tgz#d7f5bc261275941ac62acfc4e20dacfb8a3fe952" 150 | dependencies: 151 | babel-runtime "^6.22.0" 152 | babel-traverse "^6.22.0" 153 | babel-types "^6.22.0" 154 | 155 | babel-helper-builder-binary-assignment-operator-visitor@^6.22.0: 156 | version "6.22.0" 157 | resolved "https://registry.yarnpkg.com/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.22.0.tgz#29df56be144d81bdeac08262bfa41d2c5e91cdcd" 158 | dependencies: 159 | babel-helper-explode-assignable-expression "^6.22.0" 160 | babel-runtime "^6.22.0" 161 | babel-types "^6.22.0" 162 | 163 | babel-helper-call-delegate@^6.22.0: 164 | version "6.22.0" 165 | resolved "https://registry.yarnpkg.com/babel-helper-call-delegate/-/babel-helper-call-delegate-6.22.0.tgz#119921b56120f17e9dae3f74b4f5cc7bcc1b37ef" 166 | dependencies: 167 | babel-helper-hoist-variables "^6.22.0" 168 | babel-runtime "^6.22.0" 169 | babel-traverse "^6.22.0" 170 | babel-types "^6.22.0" 171 | 172 | babel-helper-define-map@^6.23.0: 173 | version "6.23.0" 174 | resolved "https://registry.yarnpkg.com/babel-helper-define-map/-/babel-helper-define-map-6.23.0.tgz#1444f960c9691d69a2ced6a205315f8fd00804e7" 175 | dependencies: 176 | babel-helper-function-name "^6.23.0" 177 | babel-runtime "^6.22.0" 178 | babel-types "^6.23.0" 179 | lodash "^4.2.0" 180 | 181 | babel-helper-explode-assignable-expression@^6.22.0: 182 | version "6.22.0" 183 | resolved "https://registry.yarnpkg.com/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.22.0.tgz#c97bf76eed3e0bae4048121f2b9dae1a4e7d0478" 184 | dependencies: 185 | babel-runtime "^6.22.0" 186 | babel-traverse "^6.22.0" 187 | babel-types "^6.22.0" 188 | 189 | babel-helper-explode-class@^6.22.0: 190 | version "6.22.0" 191 | resolved "https://registry.yarnpkg.com/babel-helper-explode-class/-/babel-helper-explode-class-6.22.0.tgz#646304924aa6388a516843ba7f1855ef8dfeb69b" 192 | dependencies: 193 | babel-helper-bindify-decorators "^6.22.0" 194 | babel-runtime "^6.22.0" 195 | babel-traverse "^6.22.0" 196 | babel-types "^6.22.0" 197 | 198 | babel-helper-function-name@^6.22.0, babel-helper-function-name@^6.23.0: 199 | version "6.23.0" 200 | resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.23.0.tgz#25742d67175c8903dbe4b6cb9d9e1fcb8dcf23a6" 201 | dependencies: 202 | babel-helper-get-function-arity "^6.22.0" 203 | babel-runtime "^6.22.0" 204 | babel-template "^6.23.0" 205 | babel-traverse "^6.23.0" 206 | babel-types "^6.23.0" 207 | 208 | babel-helper-get-function-arity@^6.22.0: 209 | version "6.22.0" 210 | resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.22.0.tgz#0beb464ad69dc7347410ac6ade9f03a50634f5ce" 211 | dependencies: 212 | babel-runtime "^6.22.0" 213 | babel-types "^6.22.0" 214 | 215 | babel-helper-hoist-variables@^6.22.0: 216 | version "6.22.0" 217 | resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.22.0.tgz#3eacbf731d80705845dd2e9718f600cfb9b4ba72" 218 | dependencies: 219 | babel-runtime "^6.22.0" 220 | babel-types "^6.22.0" 221 | 222 | babel-helper-optimise-call-expression@^6.23.0: 223 | version "6.23.0" 224 | resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.23.0.tgz#f3ee7eed355b4282138b33d02b78369e470622f5" 225 | dependencies: 226 | babel-runtime "^6.22.0" 227 | babel-types "^6.23.0" 228 | 229 | babel-helper-regex@^6.22.0: 230 | version "6.22.0" 231 | resolved "https://registry.yarnpkg.com/babel-helper-regex/-/babel-helper-regex-6.22.0.tgz#79f532be1647b1f0ee3474b5f5c3da58001d247d" 232 | dependencies: 233 | babel-runtime "^6.22.0" 234 | babel-types "^6.22.0" 235 | lodash "^4.2.0" 236 | 237 | babel-helper-remap-async-to-generator@^6.22.0: 238 | version "6.22.0" 239 | resolved "https://registry.yarnpkg.com/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.22.0.tgz#2186ae73278ed03b8b15ced089609da981053383" 240 | dependencies: 241 | babel-helper-function-name "^6.22.0" 242 | babel-runtime "^6.22.0" 243 | babel-template "^6.22.0" 244 | babel-traverse "^6.22.0" 245 | babel-types "^6.22.0" 246 | 247 | babel-helper-replace-supers@^6.22.0, babel-helper-replace-supers@^6.23.0: 248 | version "6.23.0" 249 | resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-6.23.0.tgz#eeaf8ad9b58ec4337ca94223bacdca1f8d9b4bfd" 250 | dependencies: 251 | babel-helper-optimise-call-expression "^6.23.0" 252 | babel-messages "^6.23.0" 253 | babel-runtime "^6.22.0" 254 | babel-template "^6.23.0" 255 | babel-traverse "^6.23.0" 256 | babel-types "^6.23.0" 257 | 258 | babel-helpers@^6.23.0: 259 | version "6.23.0" 260 | resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.23.0.tgz#4f8f2e092d0b6a8808a4bde79c27f1e2ecf0d992" 261 | dependencies: 262 | babel-runtime "^6.22.0" 263 | babel-template "^6.23.0" 264 | 265 | babel-messages@^6.23.0: 266 | version "6.23.0" 267 | resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" 268 | dependencies: 269 | babel-runtime "^6.22.0" 270 | 271 | babel-plugin-check-es2015-constants@^6.22.0: 272 | version "6.22.0" 273 | resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a" 274 | dependencies: 275 | babel-runtime "^6.22.0" 276 | 277 | babel-plugin-syntax-async-functions@^6.8.0: 278 | version "6.13.0" 279 | resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" 280 | 281 | babel-plugin-syntax-async-generators@^6.5.0: 282 | version "6.13.0" 283 | resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz#6bc963ebb16eccbae6b92b596eb7f35c342a8b9a" 284 | 285 | babel-plugin-syntax-class-properties@^6.8.0: 286 | version "6.13.0" 287 | resolved "https://registry.yarnpkg.com/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz#d7eb23b79a317f8543962c505b827c7d6cac27de" 288 | 289 | babel-plugin-syntax-decorators@^6.13.0: 290 | version "6.13.0" 291 | resolved "https://registry.yarnpkg.com/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz#312563b4dbde3cc806cee3e416cceeaddd11ac0b" 292 | 293 | babel-plugin-syntax-dynamic-import@^6.18.0: 294 | version "6.18.0" 295 | resolved "https://registry.yarnpkg.com/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz#8d6a26229c83745a9982a441051572caa179b1da" 296 | 297 | babel-plugin-syntax-exponentiation-operator@^6.8.0: 298 | version "6.13.0" 299 | resolved "https://registry.yarnpkg.com/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de" 300 | 301 | babel-plugin-syntax-object-rest-spread@^6.8.0: 302 | version "6.13.0" 303 | resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" 304 | 305 | babel-plugin-syntax-trailing-function-commas@^6.22.0: 306 | version "6.22.0" 307 | resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" 308 | 309 | babel-plugin-transform-async-generator-functions@^6.22.0: 310 | version "6.22.0" 311 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.22.0.tgz#a720a98153a7596f204099cd5409f4b3c05bab46" 312 | dependencies: 313 | babel-helper-remap-async-to-generator "^6.22.0" 314 | babel-plugin-syntax-async-generators "^6.5.0" 315 | babel-runtime "^6.22.0" 316 | 317 | babel-plugin-transform-async-to-generator@^6.22.0: 318 | version "6.22.0" 319 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.22.0.tgz#194b6938ec195ad36efc4c33a971acf00d8cd35e" 320 | dependencies: 321 | babel-helper-remap-async-to-generator "^6.22.0" 322 | babel-plugin-syntax-async-functions "^6.8.0" 323 | babel-runtime "^6.22.0" 324 | 325 | babel-plugin-transform-class-properties@^6.22.0: 326 | version "6.23.0" 327 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.23.0.tgz#187b747ee404399013563c993db038f34754ac3b" 328 | dependencies: 329 | babel-helper-function-name "^6.23.0" 330 | babel-plugin-syntax-class-properties "^6.8.0" 331 | babel-runtime "^6.22.0" 332 | babel-template "^6.23.0" 333 | 334 | babel-plugin-transform-decorators@^6.22.0: 335 | version "6.22.0" 336 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.22.0.tgz#c03635b27a23b23b7224f49232c237a73988d27c" 337 | dependencies: 338 | babel-helper-explode-class "^6.22.0" 339 | babel-plugin-syntax-decorators "^6.13.0" 340 | babel-runtime "^6.22.0" 341 | babel-template "^6.22.0" 342 | babel-types "^6.22.0" 343 | 344 | babel-plugin-transform-es2015-arrow-functions@^6.22.0: 345 | version "6.22.0" 346 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221" 347 | dependencies: 348 | babel-runtime "^6.22.0" 349 | 350 | babel-plugin-transform-es2015-block-scoped-functions@^6.22.0: 351 | version "6.22.0" 352 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz#bbc51b49f964d70cb8d8e0b94e820246ce3a6141" 353 | dependencies: 354 | babel-runtime "^6.22.0" 355 | 356 | babel-plugin-transform-es2015-block-scoping@^6.22.0: 357 | version "6.23.0" 358 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.23.0.tgz#e48895cf0b375be148cd7c8879b422707a053b51" 359 | dependencies: 360 | babel-runtime "^6.22.0" 361 | babel-template "^6.23.0" 362 | babel-traverse "^6.23.0" 363 | babel-types "^6.23.0" 364 | lodash "^4.2.0" 365 | 366 | babel-plugin-transform-es2015-classes@^6.22.0: 367 | version "6.23.0" 368 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.23.0.tgz#49b53f326202a2fd1b3bbaa5e2edd8a4f78643c1" 369 | dependencies: 370 | babel-helper-define-map "^6.23.0" 371 | babel-helper-function-name "^6.23.0" 372 | babel-helper-optimise-call-expression "^6.23.0" 373 | babel-helper-replace-supers "^6.23.0" 374 | babel-messages "^6.23.0" 375 | babel-runtime "^6.22.0" 376 | babel-template "^6.23.0" 377 | babel-traverse "^6.23.0" 378 | babel-types "^6.23.0" 379 | 380 | babel-plugin-transform-es2015-computed-properties@^6.22.0: 381 | version "6.22.0" 382 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.22.0.tgz#7c383e9629bba4820c11b0425bdd6290f7f057e7" 383 | dependencies: 384 | babel-runtime "^6.22.0" 385 | babel-template "^6.22.0" 386 | 387 | babel-plugin-transform-es2015-destructuring@^6.22.0: 388 | version "6.23.0" 389 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz#997bb1f1ab967f682d2b0876fe358d60e765c56d" 390 | dependencies: 391 | babel-runtime "^6.22.0" 392 | 393 | babel-plugin-transform-es2015-duplicate-keys@^6.22.0: 394 | version "6.22.0" 395 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.22.0.tgz#672397031c21610d72dd2bbb0ba9fb6277e1c36b" 396 | dependencies: 397 | babel-runtime "^6.22.0" 398 | babel-types "^6.22.0" 399 | 400 | babel-plugin-transform-es2015-for-of@^6.22.0: 401 | version "6.23.0" 402 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz#f47c95b2b613df1d3ecc2fdb7573623c75248691" 403 | dependencies: 404 | babel-runtime "^6.22.0" 405 | 406 | babel-plugin-transform-es2015-function-name@^6.22.0: 407 | version "6.22.0" 408 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.22.0.tgz#f5fcc8b09093f9a23c76ac3d9e392c3ec4b77104" 409 | dependencies: 410 | babel-helper-function-name "^6.22.0" 411 | babel-runtime "^6.22.0" 412 | babel-types "^6.22.0" 413 | 414 | babel-plugin-transform-es2015-literals@^6.22.0: 415 | version "6.22.0" 416 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz#4f54a02d6cd66cf915280019a31d31925377ca2e" 417 | dependencies: 418 | babel-runtime "^6.22.0" 419 | 420 | babel-plugin-transform-es2015-modules-amd@^6.22.0: 421 | version "6.22.0" 422 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.22.0.tgz#bf69cd34889a41c33d90dfb740e0091ccff52f21" 423 | dependencies: 424 | babel-plugin-transform-es2015-modules-commonjs "^6.22.0" 425 | babel-runtime "^6.22.0" 426 | babel-template "^6.22.0" 427 | 428 | babel-plugin-transform-es2015-modules-commonjs@^6.22.0: 429 | version "6.23.0" 430 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.23.0.tgz#cba7aa6379fb7ec99250e6d46de2973aaffa7b92" 431 | dependencies: 432 | babel-plugin-transform-strict-mode "^6.22.0" 433 | babel-runtime "^6.22.0" 434 | babel-template "^6.23.0" 435 | babel-types "^6.23.0" 436 | 437 | babel-plugin-transform-es2015-modules-systemjs@^6.22.0: 438 | version "6.23.0" 439 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.23.0.tgz#ae3469227ffac39b0310d90fec73bfdc4f6317b0" 440 | dependencies: 441 | babel-helper-hoist-variables "^6.22.0" 442 | babel-runtime "^6.22.0" 443 | babel-template "^6.23.0" 444 | 445 | babel-plugin-transform-es2015-modules-umd@^6.22.0: 446 | version "6.23.0" 447 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.23.0.tgz#8d284ae2e19ed8fe21d2b1b26d6e7e0fcd94f0f1" 448 | dependencies: 449 | babel-plugin-transform-es2015-modules-amd "^6.22.0" 450 | babel-runtime "^6.22.0" 451 | babel-template "^6.23.0" 452 | 453 | babel-plugin-transform-es2015-object-super@^6.22.0: 454 | version "6.22.0" 455 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.22.0.tgz#daa60e114a042ea769dd53fe528fc82311eb98fc" 456 | dependencies: 457 | babel-helper-replace-supers "^6.22.0" 458 | babel-runtime "^6.22.0" 459 | 460 | babel-plugin-transform-es2015-parameters@^6.22.0: 461 | version "6.23.0" 462 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.23.0.tgz#3a2aabb70c8af945d5ce386f1a4250625a83ae3b" 463 | dependencies: 464 | babel-helper-call-delegate "^6.22.0" 465 | babel-helper-get-function-arity "^6.22.0" 466 | babel-runtime "^6.22.0" 467 | babel-template "^6.23.0" 468 | babel-traverse "^6.23.0" 469 | babel-types "^6.23.0" 470 | 471 | babel-plugin-transform-es2015-shorthand-properties@^6.22.0: 472 | version "6.22.0" 473 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.22.0.tgz#8ba776e0affaa60bff21e921403b8a652a2ff723" 474 | dependencies: 475 | babel-runtime "^6.22.0" 476 | babel-types "^6.22.0" 477 | 478 | babel-plugin-transform-es2015-spread@^6.22.0: 479 | version "6.22.0" 480 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz#d6d68a99f89aedc4536c81a542e8dd9f1746f8d1" 481 | dependencies: 482 | babel-runtime "^6.22.0" 483 | 484 | babel-plugin-transform-es2015-sticky-regex@^6.22.0: 485 | version "6.22.0" 486 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.22.0.tgz#ab316829e866ee3f4b9eb96939757d19a5bc4593" 487 | dependencies: 488 | babel-helper-regex "^6.22.0" 489 | babel-runtime "^6.22.0" 490 | babel-types "^6.22.0" 491 | 492 | babel-plugin-transform-es2015-template-literals@^6.22.0: 493 | version "6.22.0" 494 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz#a84b3450f7e9f8f1f6839d6d687da84bb1236d8d" 495 | dependencies: 496 | babel-runtime "^6.22.0" 497 | 498 | babel-plugin-transform-es2015-typeof-symbol@^6.22.0: 499 | version "6.23.0" 500 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz#dec09f1cddff94b52ac73d505c84df59dcceb372" 501 | dependencies: 502 | babel-runtime "^6.22.0" 503 | 504 | babel-plugin-transform-es2015-unicode-regex@^6.22.0: 505 | version "6.22.0" 506 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.22.0.tgz#8d9cc27e7ee1decfe65454fb986452a04a613d20" 507 | dependencies: 508 | babel-helper-regex "^6.22.0" 509 | babel-runtime "^6.22.0" 510 | regexpu-core "^2.0.0" 511 | 512 | babel-plugin-transform-exponentiation-operator@^6.22.0: 513 | version "6.22.0" 514 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.22.0.tgz#d57c8335281918e54ef053118ce6eb108468084d" 515 | dependencies: 516 | babel-helper-builder-binary-assignment-operator-visitor "^6.22.0" 517 | babel-plugin-syntax-exponentiation-operator "^6.8.0" 518 | babel-runtime "^6.22.0" 519 | 520 | babel-plugin-transform-object-rest-spread@^6.22.0: 521 | version "6.23.0" 522 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz#875d6bc9be761c58a2ae3feee5dc4895d8c7f921" 523 | dependencies: 524 | babel-plugin-syntax-object-rest-spread "^6.8.0" 525 | babel-runtime "^6.22.0" 526 | 527 | babel-plugin-transform-regenerator@^6.22.0: 528 | version "6.22.0" 529 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.22.0.tgz#65740593a319c44522157538d690b84094617ea6" 530 | dependencies: 531 | regenerator-transform "0.9.8" 532 | 533 | babel-plugin-transform-strict-mode@^6.22.0: 534 | version "6.22.0" 535 | resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.22.0.tgz#e008df01340fdc87e959da65991b7e05970c8c7c" 536 | dependencies: 537 | babel-runtime "^6.22.0" 538 | babel-types "^6.22.0" 539 | 540 | babel-polyfill@^6.23.0: 541 | version "6.23.0" 542 | resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.23.0.tgz#8364ca62df8eafb830499f699177466c3b03499d" 543 | dependencies: 544 | babel-runtime "^6.22.0" 545 | core-js "^2.4.0" 546 | regenerator-runtime "^0.10.0" 547 | 548 | babel-preset-es2015@^6.22.0: 549 | version "6.22.0" 550 | resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.22.0.tgz#af5a98ecb35eb8af764ad8a5a05eb36dc4386835" 551 | dependencies: 552 | babel-plugin-check-es2015-constants "^6.22.0" 553 | babel-plugin-transform-es2015-arrow-functions "^6.22.0" 554 | babel-plugin-transform-es2015-block-scoped-functions "^6.22.0" 555 | babel-plugin-transform-es2015-block-scoping "^6.22.0" 556 | babel-plugin-transform-es2015-classes "^6.22.0" 557 | babel-plugin-transform-es2015-computed-properties "^6.22.0" 558 | babel-plugin-transform-es2015-destructuring "^6.22.0" 559 | babel-plugin-transform-es2015-duplicate-keys "^6.22.0" 560 | babel-plugin-transform-es2015-for-of "^6.22.0" 561 | babel-plugin-transform-es2015-function-name "^6.22.0" 562 | babel-plugin-transform-es2015-literals "^6.22.0" 563 | babel-plugin-transform-es2015-modules-amd "^6.22.0" 564 | babel-plugin-transform-es2015-modules-commonjs "^6.22.0" 565 | babel-plugin-transform-es2015-modules-systemjs "^6.22.0" 566 | babel-plugin-transform-es2015-modules-umd "^6.22.0" 567 | babel-plugin-transform-es2015-object-super "^6.22.0" 568 | babel-plugin-transform-es2015-parameters "^6.22.0" 569 | babel-plugin-transform-es2015-shorthand-properties "^6.22.0" 570 | babel-plugin-transform-es2015-spread "^6.22.0" 571 | babel-plugin-transform-es2015-sticky-regex "^6.22.0" 572 | babel-plugin-transform-es2015-template-literals "^6.22.0" 573 | babel-plugin-transform-es2015-typeof-symbol "^6.22.0" 574 | babel-plugin-transform-es2015-unicode-regex "^6.22.0" 575 | babel-plugin-transform-regenerator "^6.22.0" 576 | 577 | babel-preset-stage-2@^6.22.0: 578 | version "6.22.0" 579 | resolved "https://registry.yarnpkg.com/babel-preset-stage-2/-/babel-preset-stage-2-6.22.0.tgz#ccd565f19c245cade394b21216df704a73b27c07" 580 | dependencies: 581 | babel-plugin-syntax-dynamic-import "^6.18.0" 582 | babel-plugin-transform-class-properties "^6.22.0" 583 | babel-plugin-transform-decorators "^6.22.0" 584 | babel-preset-stage-3 "^6.22.0" 585 | 586 | babel-preset-stage-3@^6.22.0: 587 | version "6.22.0" 588 | resolved "https://registry.yarnpkg.com/babel-preset-stage-3/-/babel-preset-stage-3-6.22.0.tgz#a4e92bbace7456fafdf651d7a7657ee0bbca9c2e" 589 | dependencies: 590 | babel-plugin-syntax-trailing-function-commas "^6.22.0" 591 | babel-plugin-transform-async-generator-functions "^6.22.0" 592 | babel-plugin-transform-async-to-generator "^6.22.0" 593 | babel-plugin-transform-exponentiation-operator "^6.22.0" 594 | babel-plugin-transform-object-rest-spread "^6.22.0" 595 | 596 | babel-register@^6.23.0: 597 | version "6.23.0" 598 | resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.23.0.tgz#c9aa3d4cca94b51da34826c4a0f9e08145d74ff3" 599 | dependencies: 600 | babel-core "^6.23.0" 601 | babel-runtime "^6.22.0" 602 | core-js "^2.4.0" 603 | home-or-tmp "^2.0.0" 604 | lodash "^4.2.0" 605 | mkdirp "^0.5.1" 606 | source-map-support "^0.4.2" 607 | 608 | babel-runtime@^6.18.0, babel-runtime@^6.22.0: 609 | version "6.23.0" 610 | resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" 611 | dependencies: 612 | core-js "^2.4.0" 613 | regenerator-runtime "^0.10.0" 614 | 615 | babel-template@^6.22.0, babel-template@^6.23.0: 616 | version "6.23.0" 617 | resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.23.0.tgz#04d4f270adbb3aa704a8143ae26faa529238e638" 618 | dependencies: 619 | babel-runtime "^6.22.0" 620 | babel-traverse "^6.23.0" 621 | babel-types "^6.23.0" 622 | babylon "^6.11.0" 623 | lodash "^4.2.0" 624 | 625 | babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-traverse@^6.23.1: 626 | version "6.23.1" 627 | resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" 628 | dependencies: 629 | babel-code-frame "^6.22.0" 630 | babel-messages "^6.23.0" 631 | babel-runtime "^6.22.0" 632 | babel-types "^6.23.0" 633 | babylon "^6.15.0" 634 | debug "^2.2.0" 635 | globals "^9.0.0" 636 | invariant "^2.2.0" 637 | lodash "^4.2.0" 638 | 639 | babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0: 640 | version "6.23.0" 641 | resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" 642 | dependencies: 643 | babel-runtime "^6.22.0" 644 | esutils "^2.0.2" 645 | lodash "^4.2.0" 646 | to-fast-properties "^1.0.1" 647 | 648 | babylon@^6.11.0, babylon@^6.15.0: 649 | version "6.15.0" 650 | resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e" 651 | 652 | balanced-match@^0.4.1: 653 | version "0.4.2" 654 | resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" 655 | 656 | bcrypt-pbkdf@^1.0.0: 657 | version "1.0.1" 658 | resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" 659 | dependencies: 660 | tweetnacl "^0.14.3" 661 | 662 | binary-extensions@^1.0.0: 663 | version "1.8.0" 664 | resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.8.0.tgz#48ec8d16df4377eae5fa5884682480af4d95c774" 665 | 666 | block-stream@*: 667 | version "0.0.9" 668 | resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" 669 | dependencies: 670 | inherits "~2.0.0" 671 | 672 | boom@2.x.x: 673 | version "2.10.1" 674 | resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" 675 | dependencies: 676 | hoek "2.x.x" 677 | 678 | brace-expansion@^1.0.0: 679 | version "1.1.6" 680 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9" 681 | dependencies: 682 | balanced-match "^0.4.1" 683 | concat-map "0.0.1" 684 | 685 | braces@^1.8.2: 686 | version "1.8.5" 687 | resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" 688 | dependencies: 689 | expand-range "^1.8.1" 690 | preserve "^0.2.0" 691 | repeat-element "^1.1.2" 692 | 693 | buffer-shims@^1.0.0: 694 | version "1.0.0" 695 | resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" 696 | 697 | caseless@~0.11.0: 698 | version "0.11.0" 699 | resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" 700 | 701 | chalk@^1.1.0, chalk@^1.1.1: 702 | version "1.1.3" 703 | resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" 704 | dependencies: 705 | ansi-styles "^2.2.1" 706 | escape-string-regexp "^1.0.2" 707 | has-ansi "^2.0.0" 708 | strip-ansi "^3.0.0" 709 | supports-color "^2.0.0" 710 | 711 | chokidar@^1.6.1: 712 | version "1.6.1" 713 | resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2" 714 | dependencies: 715 | anymatch "^1.3.0" 716 | async-each "^1.0.0" 717 | glob-parent "^2.0.0" 718 | inherits "^2.0.1" 719 | is-binary-path "^1.0.0" 720 | is-glob "^2.0.0" 721 | path-is-absolute "^1.0.0" 722 | readdirp "^2.0.0" 723 | optionalDependencies: 724 | fsevents "^1.0.0" 725 | 726 | code-point-at@^1.0.0: 727 | version "1.1.0" 728 | resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" 729 | 730 | combined-stream@^1.0.5, combined-stream@~1.0.5: 731 | version "1.0.5" 732 | resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" 733 | dependencies: 734 | delayed-stream "~1.0.0" 735 | 736 | commander@^2.8.1, commander@^2.9.0: 737 | version "2.9.0" 738 | resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" 739 | dependencies: 740 | graceful-readlink ">= 1.0.0" 741 | 742 | concat-map@0.0.1: 743 | version "0.0.1" 744 | resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" 745 | 746 | console-control-strings@^1.0.0, console-control-strings@~1.1.0: 747 | version "1.1.0" 748 | resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" 749 | 750 | convert-source-map@^1.1.0: 751 | version "1.4.0" 752 | resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.4.0.tgz#e3dad195bf61bfe13a7a3c73e9876ec14a0268f3" 753 | 754 | core-js@^2.4.0: 755 | version "2.4.1" 756 | resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" 757 | 758 | core-util-is@~1.0.0: 759 | version "1.0.2" 760 | resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" 761 | 762 | cryptiles@2.x.x: 763 | version "2.0.5" 764 | resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" 765 | dependencies: 766 | boom "2.x.x" 767 | 768 | dashdash@^1.12.0: 769 | version "1.14.1" 770 | resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" 771 | dependencies: 772 | assert-plus "^1.0.0" 773 | 774 | debug@^2.1.1, debug@^2.2.0: 775 | version "2.6.1" 776 | resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.1.tgz#79855090ba2c4e3115cc7d8769491d58f0491351" 777 | dependencies: 778 | ms "0.7.2" 779 | 780 | debug@~2.2.0: 781 | version "2.2.0" 782 | resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" 783 | dependencies: 784 | ms "0.7.1" 785 | 786 | deep-extend@~0.4.0: 787 | version "0.4.1" 788 | resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.1.tgz#efe4113d08085f4e6f9687759810f807469e2253" 789 | 790 | delayed-stream@~1.0.0: 791 | version "1.0.0" 792 | resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" 793 | 794 | delegates@^1.0.0: 795 | version "1.0.0" 796 | resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" 797 | 798 | detect-indent@^4.0.0: 799 | version "4.0.0" 800 | resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" 801 | dependencies: 802 | repeating "^2.0.0" 803 | 804 | ecc-jsbn@~0.1.1: 805 | version "0.1.1" 806 | resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" 807 | dependencies: 808 | jsbn "~0.1.0" 809 | 810 | escape-string-regexp@^1.0.2: 811 | version "1.0.5" 812 | resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" 813 | 814 | esutils@^2.0.2: 815 | version "2.0.2" 816 | resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" 817 | 818 | expand-brackets@^0.1.4: 819 | version "0.1.5" 820 | resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" 821 | dependencies: 822 | is-posix-bracket "^0.1.0" 823 | 824 | expand-range@^1.8.1: 825 | version "1.8.2" 826 | resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" 827 | dependencies: 828 | fill-range "^2.1.0" 829 | 830 | extend@~3.0.0: 831 | version "3.0.0" 832 | resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4" 833 | 834 | extglob@^0.3.1: 835 | version "0.3.2" 836 | resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" 837 | dependencies: 838 | is-extglob "^1.0.0" 839 | 840 | extsprintf@1.0.2: 841 | version "1.0.2" 842 | resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550" 843 | 844 | filename-regex@^2.0.0: 845 | version "2.0.0" 846 | resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.0.tgz#996e3e80479b98b9897f15a8a58b3d084e926775" 847 | 848 | fill-range@^2.1.0: 849 | version "2.2.3" 850 | resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" 851 | dependencies: 852 | is-number "^2.1.0" 853 | isobject "^2.0.0" 854 | randomatic "^1.1.3" 855 | repeat-element "^1.1.2" 856 | repeat-string "^1.5.2" 857 | 858 | for-in@^0.1.5: 859 | version "0.1.6" 860 | resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.6.tgz#c9f96e89bfad18a545af5ec3ed352a1d9e5b4dc8" 861 | 862 | for-own@^0.1.4: 863 | version "0.1.4" 864 | resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.4.tgz#0149b41a39088c7515f51ebe1c1386d45f935072" 865 | dependencies: 866 | for-in "^0.1.5" 867 | 868 | forever-agent@~0.6.1: 869 | version "0.6.1" 870 | resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" 871 | 872 | form-data@~2.1.1: 873 | version "2.1.2" 874 | resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.2.tgz#89c3534008b97eada4cbb157d58f6f5df025eae4" 875 | dependencies: 876 | asynckit "^0.4.0" 877 | combined-stream "^1.0.5" 878 | mime-types "^2.1.12" 879 | 880 | fs-readdir-recursive@^1.0.0: 881 | version "1.0.0" 882 | resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.0.0.tgz#8cd1745c8b4f8a29c8caec392476921ba195f560" 883 | 884 | fs.realpath@^1.0.0: 885 | version "1.0.0" 886 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" 887 | 888 | fsevents@^1.0.0: 889 | version "1.1.0" 890 | resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.0.tgz#85195de56ccbc4778da3b3d83d8d1d186eba24ce" 891 | dependencies: 892 | nan "^2.3.0" 893 | node-pre-gyp "^0.6.29" 894 | 895 | fstream-ignore@~1.0.5: 896 | version "1.0.5" 897 | resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" 898 | dependencies: 899 | fstream "^1.0.0" 900 | inherits "2" 901 | minimatch "^3.0.0" 902 | 903 | fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10: 904 | version "1.0.10" 905 | resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.10.tgz#604e8a92fe26ffd9f6fae30399d4984e1ab22822" 906 | dependencies: 907 | graceful-fs "^4.1.2" 908 | inherits "~2.0.0" 909 | mkdirp ">=0.5 0" 910 | rimraf "2" 911 | 912 | gauge@~2.7.1: 913 | version "2.7.3" 914 | resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.3.tgz#1c23855f962f17b3ad3d0dc7443f304542edfe09" 915 | dependencies: 916 | aproba "^1.0.3" 917 | console-control-strings "^1.0.0" 918 | has-unicode "^2.0.0" 919 | object-assign "^4.1.0" 920 | signal-exit "^3.0.0" 921 | string-width "^1.0.1" 922 | strip-ansi "^3.0.1" 923 | wide-align "^1.1.0" 924 | 925 | generate-function@^2.0.0: 926 | version "2.0.0" 927 | resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" 928 | 929 | generate-object-property@^1.1.0: 930 | version "1.2.0" 931 | resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" 932 | dependencies: 933 | is-property "^1.0.0" 934 | 935 | getpass@^0.1.1: 936 | version "0.1.6" 937 | resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.6.tgz#283ffd9fc1256840875311c1b60e8c40187110e6" 938 | dependencies: 939 | assert-plus "^1.0.0" 940 | 941 | glob-base@^0.3.0: 942 | version "0.3.0" 943 | resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" 944 | dependencies: 945 | glob-parent "^2.0.0" 946 | is-glob "^2.0.0" 947 | 948 | glob-parent@^2.0.0: 949 | version "2.0.0" 950 | resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" 951 | dependencies: 952 | is-glob "^2.0.0" 953 | 954 | glob@^7.0.0, glob@^7.0.5: 955 | version "7.1.1" 956 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" 957 | dependencies: 958 | fs.realpath "^1.0.0" 959 | inflight "^1.0.4" 960 | inherits "2" 961 | minimatch "^3.0.2" 962 | once "^1.3.0" 963 | path-is-absolute "^1.0.0" 964 | 965 | globals@^9.0.0: 966 | version "9.16.0" 967 | resolved "https://registry.yarnpkg.com/globals/-/globals-9.16.0.tgz#63e903658171ec2d9f51b1d31de5e2b8dc01fb80" 968 | 969 | graceful-fs@^4.1.2, graceful-fs@^4.1.4: 970 | version "4.1.11" 971 | resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" 972 | 973 | "graceful-readlink@>= 1.0.0": 974 | version "1.0.1" 975 | resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" 976 | 977 | har-validator@~2.0.6: 978 | version "2.0.6" 979 | resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-2.0.6.tgz#cdcbc08188265ad119b6a5a7c8ab70eecfb5d27d" 980 | dependencies: 981 | chalk "^1.1.1" 982 | commander "^2.9.0" 983 | is-my-json-valid "^2.12.4" 984 | pinkie-promise "^2.0.0" 985 | 986 | has-ansi@^2.0.0: 987 | version "2.0.0" 988 | resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" 989 | dependencies: 990 | ansi-regex "^2.0.0" 991 | 992 | has-unicode@^2.0.0: 993 | version "2.0.1" 994 | resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" 995 | 996 | hawk@~3.1.3: 997 | version "3.1.3" 998 | resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" 999 | dependencies: 1000 | boom "2.x.x" 1001 | cryptiles "2.x.x" 1002 | hoek "2.x.x" 1003 | sntp "1.x.x" 1004 | 1005 | hoek@2.x.x: 1006 | version "2.16.3" 1007 | resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" 1008 | 1009 | home-or-tmp@^2.0.0: 1010 | version "2.0.0" 1011 | resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" 1012 | dependencies: 1013 | os-homedir "^1.0.0" 1014 | os-tmpdir "^1.0.1" 1015 | 1016 | http-signature@~1.1.0: 1017 | version "1.1.1" 1018 | resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" 1019 | dependencies: 1020 | assert-plus "^0.2.0" 1021 | jsprim "^1.2.2" 1022 | sshpk "^1.7.0" 1023 | 1024 | inflight@^1.0.4: 1025 | version "1.0.6" 1026 | resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" 1027 | dependencies: 1028 | once "^1.3.0" 1029 | wrappy "1" 1030 | 1031 | inherits@2, inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1: 1032 | version "2.0.3" 1033 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" 1034 | 1035 | ini@~1.3.0: 1036 | version "1.3.4" 1037 | resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" 1038 | 1039 | invariant@^2.2.0: 1040 | version "2.2.2" 1041 | resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" 1042 | dependencies: 1043 | loose-envify "^1.0.0" 1044 | 1045 | is-binary-path@^1.0.0: 1046 | version "1.0.1" 1047 | resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" 1048 | dependencies: 1049 | binary-extensions "^1.0.0" 1050 | 1051 | is-buffer@^1.0.2: 1052 | version "1.1.4" 1053 | resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b" 1054 | 1055 | is-dotfile@^1.0.0: 1056 | version "1.0.2" 1057 | resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.2.tgz#2c132383f39199f8edc268ca01b9b007d205cc4d" 1058 | 1059 | is-equal-shallow@^0.1.3: 1060 | version "0.1.3" 1061 | resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" 1062 | dependencies: 1063 | is-primitive "^2.0.0" 1064 | 1065 | is-extendable@^0.1.1: 1066 | version "0.1.1" 1067 | resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" 1068 | 1069 | is-extglob@^1.0.0: 1070 | version "1.0.0" 1071 | resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" 1072 | 1073 | is-finite@^1.0.0: 1074 | version "1.0.2" 1075 | resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" 1076 | dependencies: 1077 | number-is-nan "^1.0.0" 1078 | 1079 | is-fullwidth-code-point@^1.0.0: 1080 | version "1.0.0" 1081 | resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" 1082 | dependencies: 1083 | number-is-nan "^1.0.0" 1084 | 1085 | is-glob@^2.0.0, is-glob@^2.0.1: 1086 | version "2.0.1" 1087 | resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" 1088 | dependencies: 1089 | is-extglob "^1.0.0" 1090 | 1091 | is-my-json-valid@^2.12.4: 1092 | version "2.15.0" 1093 | resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz#936edda3ca3c211fd98f3b2d3e08da43f7b2915b" 1094 | dependencies: 1095 | generate-function "^2.0.0" 1096 | generate-object-property "^1.1.0" 1097 | jsonpointer "^4.0.0" 1098 | xtend "^4.0.0" 1099 | 1100 | is-number@^2.0.2, is-number@^2.1.0: 1101 | version "2.1.0" 1102 | resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" 1103 | dependencies: 1104 | kind-of "^3.0.2" 1105 | 1106 | is-posix-bracket@^0.1.0: 1107 | version "0.1.1" 1108 | resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" 1109 | 1110 | is-primitive@^2.0.0: 1111 | version "2.0.0" 1112 | resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" 1113 | 1114 | is-property@^1.0.0: 1115 | version "1.0.2" 1116 | resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" 1117 | 1118 | is-typedarray@~1.0.0: 1119 | version "1.0.0" 1120 | resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" 1121 | 1122 | isarray@1.0.0, isarray@~1.0.0: 1123 | version "1.0.0" 1124 | resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" 1125 | 1126 | isobject@^2.0.0: 1127 | version "2.1.0" 1128 | resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" 1129 | dependencies: 1130 | isarray "1.0.0" 1131 | 1132 | isstream@~0.1.2: 1133 | version "0.1.2" 1134 | resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" 1135 | 1136 | jodid25519@^1.0.0: 1137 | version "1.0.2" 1138 | resolved "https://registry.yarnpkg.com/jodid25519/-/jodid25519-1.0.2.tgz#06d4912255093419477d425633606e0e90782967" 1139 | dependencies: 1140 | jsbn "~0.1.0" 1141 | 1142 | js-tokens@^3.0.0: 1143 | version "3.0.1" 1144 | resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" 1145 | 1146 | jsbn@~0.1.0: 1147 | version "0.1.1" 1148 | resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" 1149 | 1150 | jsesc@^1.3.0: 1151 | version "1.3.0" 1152 | resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" 1153 | 1154 | jsesc@~0.5.0: 1155 | version "0.5.0" 1156 | resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" 1157 | 1158 | json-schema@0.2.3: 1159 | version "0.2.3" 1160 | resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" 1161 | 1162 | json-stringify-safe@~5.0.1: 1163 | version "5.0.1" 1164 | resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" 1165 | 1166 | json5@^0.5.0: 1167 | version "0.5.1" 1168 | resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" 1169 | 1170 | jsonpointer@^4.0.0: 1171 | version "4.0.1" 1172 | resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" 1173 | 1174 | jsprim@^1.2.2: 1175 | version "1.3.1" 1176 | resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.3.1.tgz#2a7256f70412a29ee3670aaca625994c4dcff252" 1177 | dependencies: 1178 | extsprintf "1.0.2" 1179 | json-schema "0.2.3" 1180 | verror "1.3.6" 1181 | 1182 | kind-of@^3.0.2: 1183 | version "3.1.0" 1184 | resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47" 1185 | dependencies: 1186 | is-buffer "^1.0.2" 1187 | 1188 | lodash@^4.2.0: 1189 | version "4.17.4" 1190 | resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" 1191 | 1192 | loose-envify@^1.0.0: 1193 | version "1.3.1" 1194 | resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" 1195 | dependencies: 1196 | js-tokens "^3.0.0" 1197 | 1198 | micromatch@^2.1.5: 1199 | version "2.3.11" 1200 | resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" 1201 | dependencies: 1202 | arr-diff "^2.0.0" 1203 | array-unique "^0.2.1" 1204 | braces "^1.8.2" 1205 | expand-brackets "^0.1.4" 1206 | extglob "^0.3.1" 1207 | filename-regex "^2.0.0" 1208 | is-extglob "^1.0.0" 1209 | is-glob "^2.0.1" 1210 | kind-of "^3.0.2" 1211 | normalize-path "^2.0.1" 1212 | object.omit "^2.0.0" 1213 | parse-glob "^3.0.4" 1214 | regex-cache "^0.4.2" 1215 | 1216 | mime-db@~1.26.0: 1217 | version "1.26.0" 1218 | resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.26.0.tgz#eaffcd0e4fc6935cf8134da246e2e6c35305adff" 1219 | 1220 | mime-types@^2.1.12, mime-types@~2.1.7: 1221 | version "2.1.14" 1222 | resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.14.tgz#f7ef7d97583fcaf3b7d282b6f8b5679dab1e94ee" 1223 | dependencies: 1224 | mime-db "~1.26.0" 1225 | 1226 | minimatch@^3.0.0, minimatch@^3.0.2: 1227 | version "3.0.3" 1228 | resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" 1229 | dependencies: 1230 | brace-expansion "^1.0.0" 1231 | 1232 | minimist@0.0.8: 1233 | version "0.0.8" 1234 | resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" 1235 | 1236 | minimist@^1.2.0: 1237 | version "1.2.0" 1238 | resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" 1239 | 1240 | "mkdirp@>=0.5 0", mkdirp@^0.5.1, mkdirp@~0.5.1: 1241 | version "0.5.1" 1242 | resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" 1243 | dependencies: 1244 | minimist "0.0.8" 1245 | 1246 | moment@^2.17.1: 1247 | version "2.17.1" 1248 | resolved "https://registry.yarnpkg.com/moment/-/moment-2.17.1.tgz#fed9506063f36b10f066c8b59a144d7faebe1d82" 1249 | 1250 | ms@0.7.1: 1251 | version "0.7.1" 1252 | resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" 1253 | 1254 | ms@0.7.2: 1255 | version "0.7.2" 1256 | resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" 1257 | 1258 | nan@^2.3.0: 1259 | version "2.5.1" 1260 | resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.1.tgz#d5b01691253326a97a2bbee9e61c55d8d60351e2" 1261 | 1262 | node-pre-gyp@^0.6.29: 1263 | version "0.6.33" 1264 | resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.33.tgz#640ac55198f6a925972e0c16c4ac26a034d5ecc9" 1265 | dependencies: 1266 | mkdirp "~0.5.1" 1267 | nopt "~3.0.6" 1268 | npmlog "^4.0.1" 1269 | rc "~1.1.6" 1270 | request "^2.79.0" 1271 | rimraf "~2.5.4" 1272 | semver "~5.3.0" 1273 | tar "~2.2.1" 1274 | tar-pack "~3.3.0" 1275 | 1276 | nopt@~3.0.6: 1277 | version "3.0.6" 1278 | resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" 1279 | dependencies: 1280 | abbrev "1" 1281 | 1282 | normalize-path@^2.0.1: 1283 | version "2.0.1" 1284 | resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.0.1.tgz#47886ac1662760d4261b7d979d241709d3ce3f7a" 1285 | 1286 | npmlog@^4.0.1: 1287 | version "4.0.2" 1288 | resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.0.2.tgz#d03950e0e78ce1527ba26d2a7592e9348ac3e75f" 1289 | dependencies: 1290 | are-we-there-yet "~1.1.2" 1291 | console-control-strings "~1.1.0" 1292 | gauge "~2.7.1" 1293 | set-blocking "~2.0.0" 1294 | 1295 | number-is-nan@^1.0.0: 1296 | version "1.0.1" 1297 | resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" 1298 | 1299 | oauth-sign@~0.8.1: 1300 | version "0.8.2" 1301 | resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" 1302 | 1303 | object-assign@^4.1.0: 1304 | version "4.1.1" 1305 | resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" 1306 | 1307 | object.omit@^2.0.0: 1308 | version "2.0.1" 1309 | resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" 1310 | dependencies: 1311 | for-own "^0.1.4" 1312 | is-extendable "^0.1.1" 1313 | 1314 | once@^1.3.0: 1315 | version "1.4.0" 1316 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" 1317 | dependencies: 1318 | wrappy "1" 1319 | 1320 | once@~1.3.3: 1321 | version "1.3.3" 1322 | resolved "https://registry.yarnpkg.com/once/-/once-1.3.3.tgz#b2e261557ce4c314ec8304f3fa82663e4297ca20" 1323 | dependencies: 1324 | wrappy "1" 1325 | 1326 | os-homedir@^1.0.0: 1327 | version "1.0.2" 1328 | resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" 1329 | 1330 | os-tmpdir@^1.0.1: 1331 | version "1.0.2" 1332 | resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" 1333 | 1334 | output-file-sync@^1.1.0: 1335 | version "1.1.2" 1336 | resolved "https://registry.yarnpkg.com/output-file-sync/-/output-file-sync-1.1.2.tgz#d0a33eefe61a205facb90092e826598d5245ce76" 1337 | dependencies: 1338 | graceful-fs "^4.1.4" 1339 | mkdirp "^0.5.1" 1340 | object-assign "^4.1.0" 1341 | 1342 | parse-glob@^3.0.4: 1343 | version "3.0.4" 1344 | resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" 1345 | dependencies: 1346 | glob-base "^0.3.0" 1347 | is-dotfile "^1.0.0" 1348 | is-extglob "^1.0.0" 1349 | is-glob "^2.0.0" 1350 | 1351 | path-is-absolute@^1.0.0: 1352 | version "1.0.1" 1353 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" 1354 | 1355 | pinkie-promise@^2.0.0: 1356 | version "2.0.1" 1357 | resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" 1358 | dependencies: 1359 | pinkie "^2.0.0" 1360 | 1361 | pinkie@^2.0.0: 1362 | version "2.0.4" 1363 | resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" 1364 | 1365 | preserve@^0.2.0: 1366 | version "0.2.0" 1367 | resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" 1368 | 1369 | private@^0.1.6: 1370 | version "0.1.7" 1371 | resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1" 1372 | 1373 | process-nextick-args@~1.0.6: 1374 | version "1.0.7" 1375 | resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" 1376 | 1377 | punycode@^1.4.1: 1378 | version "1.4.1" 1379 | resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" 1380 | 1381 | qs@~6.3.0: 1382 | version "6.3.1" 1383 | resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.1.tgz#918c0b3bcd36679772baf135b1acb4c1651ed79d" 1384 | 1385 | randomatic@^1.1.3: 1386 | version "1.1.6" 1387 | resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.6.tgz#110dcabff397e9dcff7c0789ccc0a49adf1ec5bb" 1388 | dependencies: 1389 | is-number "^2.0.2" 1390 | kind-of "^3.0.2" 1391 | 1392 | rc@~1.1.6: 1393 | version "1.1.7" 1394 | resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.7.tgz#c5ea564bb07aff9fd3a5b32e906c1d3a65940fea" 1395 | dependencies: 1396 | deep-extend "~0.4.0" 1397 | ini "~1.3.0" 1398 | minimist "^1.2.0" 1399 | strip-json-comments "~2.0.1" 1400 | 1401 | "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2: 1402 | version "2.2.2" 1403 | resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" 1404 | dependencies: 1405 | buffer-shims "^1.0.0" 1406 | core-util-is "~1.0.0" 1407 | inherits "~2.0.1" 1408 | isarray "~1.0.0" 1409 | process-nextick-args "~1.0.6" 1410 | string_decoder "~0.10.x" 1411 | util-deprecate "~1.0.1" 1412 | 1413 | readable-stream@~2.1.4: 1414 | version "2.1.5" 1415 | resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0" 1416 | dependencies: 1417 | buffer-shims "^1.0.0" 1418 | core-util-is "~1.0.0" 1419 | inherits "~2.0.1" 1420 | isarray "~1.0.0" 1421 | process-nextick-args "~1.0.6" 1422 | string_decoder "~0.10.x" 1423 | util-deprecate "~1.0.1" 1424 | 1425 | readdirp@^2.0.0: 1426 | version "2.1.0" 1427 | resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78" 1428 | dependencies: 1429 | graceful-fs "^4.1.2" 1430 | minimatch "^3.0.2" 1431 | readable-stream "^2.0.2" 1432 | set-immediate-shim "^1.0.1" 1433 | 1434 | regenerate@^1.2.1: 1435 | version "1.3.2" 1436 | resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.2.tgz#d1941c67bad437e1be76433add5b385f95b19260" 1437 | 1438 | regenerator-runtime@^0.10.0: 1439 | version "0.10.3" 1440 | resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.3.tgz#8c4367a904b51ea62a908ac310bf99ff90a82a3e" 1441 | 1442 | regenerator-transform@0.9.8: 1443 | version "0.9.8" 1444 | resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.9.8.tgz#0f88bb2bc03932ddb7b6b7312e68078f01026d6c" 1445 | dependencies: 1446 | babel-runtime "^6.18.0" 1447 | babel-types "^6.19.0" 1448 | private "^0.1.6" 1449 | 1450 | regex-cache@^0.4.2: 1451 | version "0.4.3" 1452 | resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.3.tgz#9b1a6c35d4d0dfcef5711ae651e8e9d3d7114145" 1453 | dependencies: 1454 | is-equal-shallow "^0.1.3" 1455 | is-primitive "^2.0.0" 1456 | 1457 | regexpu-core@^2.0.0: 1458 | version "2.0.0" 1459 | resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240" 1460 | dependencies: 1461 | regenerate "^1.2.1" 1462 | regjsgen "^0.2.0" 1463 | regjsparser "^0.1.4" 1464 | 1465 | regjsgen@^0.2.0: 1466 | version "0.2.0" 1467 | resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.2.0.tgz#6c016adeac554f75823fe37ac05b92d5a4edb1f7" 1468 | 1469 | regjsparser@^0.1.4: 1470 | version "0.1.5" 1471 | resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.1.5.tgz#7ee8f84dc6fa792d3fd0ae228d24bd949ead205c" 1472 | dependencies: 1473 | jsesc "~0.5.0" 1474 | 1475 | repeat-element@^1.1.2: 1476 | version "1.1.2" 1477 | resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" 1478 | 1479 | repeat-string@^1.5.2: 1480 | version "1.6.1" 1481 | resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" 1482 | 1483 | repeating@^2.0.0: 1484 | version "2.0.1" 1485 | resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" 1486 | dependencies: 1487 | is-finite "^1.0.0" 1488 | 1489 | request@^2.79.0: 1490 | version "2.79.0" 1491 | resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" 1492 | dependencies: 1493 | aws-sign2 "~0.6.0" 1494 | aws4 "^1.2.1" 1495 | caseless "~0.11.0" 1496 | combined-stream "~1.0.5" 1497 | extend "~3.0.0" 1498 | forever-agent "~0.6.1" 1499 | form-data "~2.1.1" 1500 | har-validator "~2.0.6" 1501 | hawk "~3.1.3" 1502 | http-signature "~1.1.0" 1503 | is-typedarray "~1.0.0" 1504 | isstream "~0.1.2" 1505 | json-stringify-safe "~5.0.1" 1506 | mime-types "~2.1.7" 1507 | oauth-sign "~0.8.1" 1508 | qs "~6.3.0" 1509 | stringstream "~0.0.4" 1510 | tough-cookie "~2.3.0" 1511 | tunnel-agent "~0.4.1" 1512 | uuid "^3.0.0" 1513 | 1514 | rimraf@2, rimraf@~2.5.1, rimraf@~2.5.4: 1515 | version "2.5.4" 1516 | resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" 1517 | dependencies: 1518 | glob "^7.0.5" 1519 | 1520 | semver@~5.3.0: 1521 | version "5.3.0" 1522 | resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" 1523 | 1524 | set-blocking@~2.0.0: 1525 | version "2.0.0" 1526 | resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" 1527 | 1528 | set-immediate-shim@^1.0.1: 1529 | version "1.0.1" 1530 | resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" 1531 | 1532 | signal-exit@^3.0.0: 1533 | version "3.0.2" 1534 | resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" 1535 | 1536 | slash@^1.0.0: 1537 | version "1.0.0" 1538 | resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" 1539 | 1540 | sntp@1.x.x: 1541 | version "1.0.9" 1542 | resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" 1543 | dependencies: 1544 | hoek "2.x.x" 1545 | 1546 | source-map-support@^0.4.2: 1547 | version "0.4.11" 1548 | resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.11.tgz#647f939978b38535909530885303daf23279f322" 1549 | dependencies: 1550 | source-map "^0.5.3" 1551 | 1552 | source-map@^0.5.0, source-map@^0.5.3: 1553 | version "0.5.6" 1554 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" 1555 | 1556 | sshpk@^1.7.0: 1557 | version "1.10.2" 1558 | resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.10.2.tgz#d5a804ce22695515638e798dbe23273de070a5fa" 1559 | dependencies: 1560 | asn1 "~0.2.3" 1561 | assert-plus "^1.0.0" 1562 | dashdash "^1.12.0" 1563 | getpass "^0.1.1" 1564 | optionalDependencies: 1565 | bcrypt-pbkdf "^1.0.0" 1566 | ecc-jsbn "~0.1.1" 1567 | jodid25519 "^1.0.0" 1568 | jsbn "~0.1.0" 1569 | tweetnacl "~0.14.0" 1570 | 1571 | string-width@^1.0.1: 1572 | version "1.0.2" 1573 | resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" 1574 | dependencies: 1575 | code-point-at "^1.0.0" 1576 | is-fullwidth-code-point "^1.0.0" 1577 | strip-ansi "^3.0.0" 1578 | 1579 | string_decoder@~0.10.x: 1580 | version "0.10.31" 1581 | resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" 1582 | 1583 | stringstream@~0.0.4: 1584 | version "0.0.5" 1585 | resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" 1586 | 1587 | strip-ansi@^3.0.0, strip-ansi@^3.0.1: 1588 | version "3.0.1" 1589 | resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" 1590 | dependencies: 1591 | ansi-regex "^2.0.0" 1592 | 1593 | strip-json-comments@~2.0.1: 1594 | version "2.0.1" 1595 | resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" 1596 | 1597 | supports-color@^2.0.0: 1598 | version "2.0.0" 1599 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" 1600 | 1601 | tar-pack@~3.3.0: 1602 | version "3.3.0" 1603 | resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.3.0.tgz#30931816418f55afc4d21775afdd6720cee45dae" 1604 | dependencies: 1605 | debug "~2.2.0" 1606 | fstream "~1.0.10" 1607 | fstream-ignore "~1.0.5" 1608 | once "~1.3.3" 1609 | readable-stream "~2.1.4" 1610 | rimraf "~2.5.1" 1611 | tar "~2.2.1" 1612 | uid-number "~0.0.6" 1613 | 1614 | tar@~2.2.1: 1615 | version "2.2.1" 1616 | resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" 1617 | dependencies: 1618 | block-stream "*" 1619 | fstream "^1.0.2" 1620 | inherits "2" 1621 | 1622 | to-fast-properties@^1.0.1: 1623 | version "1.0.2" 1624 | resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.2.tgz#f3f5c0c3ba7299a7ef99427e44633257ade43320" 1625 | 1626 | tough-cookie@~2.3.0: 1627 | version "2.3.2" 1628 | resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" 1629 | dependencies: 1630 | punycode "^1.4.1" 1631 | 1632 | trim-right@^1.0.1: 1633 | version "1.0.1" 1634 | resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" 1635 | 1636 | tunnel-agent@~0.4.1: 1637 | version "0.4.3" 1638 | resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb" 1639 | 1640 | tweetnacl@^0.14.3, tweetnacl@~0.14.0: 1641 | version "0.14.5" 1642 | resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" 1643 | 1644 | uid-number@~0.0.6: 1645 | version "0.0.6" 1646 | resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" 1647 | 1648 | user-home@^1.1.1: 1649 | version "1.1.1" 1650 | resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190" 1651 | 1652 | util-deprecate@~1.0.1: 1653 | version "1.0.2" 1654 | resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" 1655 | 1656 | uuid@^3.0.0: 1657 | version "3.0.1" 1658 | resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" 1659 | 1660 | v8flags@^2.0.10: 1661 | version "2.0.11" 1662 | resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.0.11.tgz#bca8f30f0d6d60612cc2c00641e6962d42ae6881" 1663 | dependencies: 1664 | user-home "^1.1.1" 1665 | 1666 | verror@1.3.6: 1667 | version "1.3.6" 1668 | resolved "https://registry.yarnpkg.com/verror/-/verror-1.3.6.tgz#cff5df12946d297d2baaefaa2689e25be01c005c" 1669 | dependencies: 1670 | extsprintf "1.0.2" 1671 | 1672 | wide-align@^1.1.0: 1673 | version "1.1.0" 1674 | resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.0.tgz#40edde802a71fea1f070da3e62dcda2e7add96ad" 1675 | dependencies: 1676 | string-width "^1.0.1" 1677 | 1678 | wrappy@1: 1679 | version "1.0.2" 1680 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" 1681 | 1682 | xtend@^4.0.0: 1683 | version "4.0.1" 1684 | resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" 1685 | -------------------------------------------------------------------------------- /examples/typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "validx-typescript-example", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "tsc --project tsconfig.json --outDir ./.test-out && node ./.test-out/index.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "typescript": "^2.1.6" 14 | }, 15 | "dependencies": { 16 | "moment": "^2.17.1" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | validationContext, 3 | required, 4 | pattern, 5 | IValidatorOptions, 6 | } from '../../../src' 7 | import { action, autorun } from 'mobx' 8 | import { inspect } from 'util' 9 | 10 | interface IObj { 11 | name?: string 12 | email?: string 13 | age?: number 14 | } 15 | 16 | // Does not have to be an observable, 17 | // so to demonstrate I'll use a plain object. 18 | const obj: IObj = {} 19 | 20 | // First parameter is the object to validate, second 21 | // is the validation schema. 22 | const validation = validationContext(obj, { 23 | name: [required({ msg: 'Name is required' })], 24 | email: [ 25 | required('Email is required'), // shorthand message parameter for the required validator. 26 | pattern({ pattern: 'email', msg: 'That is not a valid email' }), 27 | ], 28 | age: [ 29 | required('Age is required'), 30 | pattern({ 31 | pattern: /\d/, // regex pattern for numbers 32 | msg: 'Age must be a number', 33 | }), 34 | // And a custom validator. 35 | (opts: IValidatorOptions) => { 36 | // Validators return either true for success, and false (for the default error message) 37 | // or a string (for a custom error message) 38 | return opts.value >= 13 || 'You must be over 13 years of age to sign up.' 39 | }, 40 | ], 41 | }) 42 | 43 | // Let's set up an autorun that will log whenever 44 | // our validation state changes. 45 | // Keep in mind the first output will say all is well, 46 | // but thats because we didnt start validating yet. 47 | autorun(() => { 48 | console.log('') 49 | console.log('') 50 | console.log('-------- Validation Summary ---------') 51 | console.log('Bad field count: ', Object.keys(validation.errors).length) 52 | Object.keys(validation.errors).map((key) => { 53 | // errors[key] is an observable array. 54 | // using slice to print them nicely in the console. 55 | console.log( 56 | `Errors for ${key}: `, 57 | // Add some color to the console output. :) 58 | inspect(validation.errors[key].slice(), { colors: true }) 59 | ) 60 | }) 61 | console.log( 62 | '-- So is it valid?', 63 | validation.isValid ? 'Yes it is!' : 'Hell naw!' 64 | ) 65 | }) 66 | 67 | // The context needs to be reset every time we validate 68 | // from scratch. See the docs as to why this is useful. 69 | // Wrap it in an action so we batch the resetting and validating. 70 | const validate = action(() => validation.reset().validate()) 71 | 72 | // First round 73 | validation.validate() 74 | 75 | // Let's add our name. 76 | obj.name = 'Jeff' 77 | 78 | // We need to validate again. 79 | validate() 80 | 81 | // Add an email, except it's not really an email.. 82 | obj.email = 'test' 83 | validate() 84 | 85 | // Much better! 86 | obj.email = 'test@test.com' 87 | validate() 88 | 89 | // Alright now the age.. 90 | obj.age = 'twentytwo' as any // trick TS 91 | validate() 92 | 93 | // Oh, it has to be a number. 94 | obj.age = 2 95 | validate() 96 | 97 | // Woops, forgot a digit. 98 | obj.age = 22 99 | validate() 100 | 101 | // And we're good! 102 | -------------------------------------------------------------------------------- /examples/typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "target": "es5", 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "experimentalDecorators": true, 8 | "sourceMap": true, 9 | "baseUrl": "./src", 10 | "lib": ["es6"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/typescript/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | moment@^2.17.1: 6 | version "2.17.1" 7 | resolved "https://registry.yarnpkg.com/moment/-/moment-2.17.1.tgz#fed9506063f36b10f066c8b59a144d7faebe1d82" 8 | 9 | typescript@^2.1.6: 10 | version "2.1.6" 11 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.6.tgz#40c7e6e9e5da7961b7718b55505f9cac9487a607" 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "validx", 3 | "version": "1.0.0-alpha.2", 4 | "description": "Validation library for MobX", 5 | "main": "lib/index.js", 6 | "typings": "lib/index.d.ts", 7 | "engines": {}, 8 | "scripts": { 9 | "build": "rimraf lib && tsc -p tsconfig.build.json", 10 | "check": "tsc -p tsconfig.json --noEmit --pretty", 11 | "lint": "npm run check && tslint --project tsconfig.json --fix \"{src,examples}/**/*.ts\" && prettier --write \"{src,examples}/**/*.{ts,js}\"", 12 | "precommit": "lint-staged && npm test", 13 | "test": "npm run check && jest", 14 | "test:watch": "nodemon -e js,ts --exec npm run test", 15 | "lint:watch": "nodemon -e ts --exec npm run lint", 16 | "cover": "npm run test -- --coverage", 17 | "coveralls": "npm run cover && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", 18 | "publish:pre": "npm run lint && npm run build && npm run cover", 19 | "publish:post": "npm publish && git push --follow-tags", 20 | "release:prerelease": "npm run publish:pre && npm version prerelease && npm run publish:post", 21 | "release:patch": "npm run publish:pre && npm version patch && npm run publish:post", 22 | "release:minor": "npm run publish:pre && npm version minor && npm run publish:post", 23 | "release:major": "npm run publish:pre && npm version major && npm run publish:post" 24 | }, 25 | "prettier": { 26 | "semi": false, 27 | "singleQuote": true 28 | }, 29 | "lint-staged": { 30 | "*.ts": [ 31 | "tslint --project tsconfig.json --fix", 32 | "prettier --write" 33 | ] 34 | }, 35 | "repository": { 36 | "type": "git", 37 | "url": "git+https://github.com/jeffijoe/validx.git" 38 | }, 39 | "files": [ 40 | "lib", 41 | "LICENSE.md", 42 | "README.md" 43 | ], 44 | "directories": { 45 | "lib": "lib" 46 | }, 47 | "keywords": [ 48 | "mobx", 49 | "validation", 50 | "state management", 51 | "react" 52 | ], 53 | "author": "Jeff Hansen ", 54 | "license": "MIT", 55 | "bugs": { 56 | "url": "https://github.com/jeffijoe/validx/issues" 57 | }, 58 | "homepage": "https://github.com/jeffijoe/validx#readme", 59 | "devDependencies": { 60 | "@types/chai": "^4.3.1", 61 | "@types/email-validator": "^1.0.30", 62 | "@types/is-url": "^1.2.30", 63 | "@types/jest": "^28.1.1", 64 | "@types/mocha": "^9.1.1", 65 | "@types/node": "^18.0.0", 66 | "@types/sinon-chai": "^3.2.8", 67 | "chai": "^4.3.6", 68 | "coveralls": "^3.1.1", 69 | "husky": "^8.0.1", 70 | "jest": "^28.1.1", 71 | "lint-staged": "^13.0.1", 72 | "mobx": "^6.6.0", 73 | "mocha": "^10.0.0", 74 | "nodemon": "^2.0.16", 75 | "nyc": "^15.1.0", 76 | "prettier": "^2.7.1", 77 | "rimraf": "^3.0.2", 78 | "sinon": "^14.0.0", 79 | "sinon-chai": "^3.7.0", 80 | "ts-jest": "^28.0.5", 81 | "tslint": "^6.1.3", 82 | "tslint-config-prettier": "^1.18.0", 83 | "tslint-config-standard": "^9.0.0", 84 | "typescript": "^4.7.3" 85 | }, 86 | "dependencies": { 87 | "email-validator": "^2.0.4", 88 | "is-url": "^1.2.4" 89 | }, 90 | "jest": { 91 | "testRegex": "(/__tests__/.*\\.(test|spec))\\.(ts|tsx|js)$", 92 | "testEnvironment": "node", 93 | "coveragePathIgnorePatterns": [ 94 | "/node_modules/", 95 | "__tests__", 96 | "lib" 97 | ], 98 | "moduleFileExtensions": [ 99 | "ts", 100 | "tsx", 101 | "js" 102 | ], 103 | "transform": { 104 | "^.+\\.tsx?$": "ts-jest" 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/__tests__/utils.spec.ts: -------------------------------------------------------------------------------- 1 | import { forEach, every, mapToObject } from '../utils' 2 | 3 | describe('utils', () => { 4 | describe('forEach', () => { 5 | it('calls the iteratee on arrays', () => { 6 | const arr = ['a', 'b', 'c'] 7 | const iteratee = jest.fn() 8 | forEach(arr, iteratee) 9 | expect(iteratee).toHaveBeenCalledTimes(3) 10 | expect(iteratee).toBeCalledWith('a', 0, arr) 11 | expect(iteratee).toBeCalledWith('b', 1, arr) 12 | expect(iteratee).toBeCalledWith('c', 2, arr) 13 | }) 14 | 15 | it('calls the iteratee on objects', () => { 16 | const obj = { a: 1, b: 2, c: 3 } 17 | const iteratee = jest.fn() 18 | forEach(obj, iteratee) 19 | expect(iteratee).toHaveBeenCalledTimes(3) 20 | expect(iteratee).toBeCalledWith(1, 'a', obj) 21 | expect(iteratee).toBeCalledWith(2, 'b', obj) 22 | expect(iteratee).toBeCalledWith(3, 'c', obj) 23 | }) 24 | 25 | it('only iterates own props', () => { 26 | class Test { 27 | test: string | undefined 28 | method() { 29 | /**/ 30 | } 31 | } 32 | 33 | const instance = new Test() 34 | instance.test = 'hello' 35 | const iteratee = jest.fn() 36 | forEach(instance, iteratee) 37 | expect(iteratee).toBeCalledTimes(1) 38 | expect(iteratee).toBeCalledWith('hello', 'test', instance) 39 | }) 40 | }) 41 | 42 | describe('every', function () { 43 | it('returns true if every element satisfies the predicate', () => { 44 | const arr = [1, 1, 1] 45 | expect(every(arr, (x) => x === 1)).toEqual(true) 46 | }) 47 | 48 | it('returns false if some element does not satisfy the predicate', () => { 49 | const arr = [1, 1, 2] 50 | expect(every(arr, (x) => x === 1)).toEqual(false) 51 | }) 52 | 53 | it('stops early if it encounters false', () => { 54 | const arr = [1, 2, 1] 55 | const predicate = jest.fn((x) => x === 1) 56 | expect(every(arr, predicate)).toEqual(false) 57 | expect(predicate).toBeCalledTimes(2) 58 | expect(predicate).toBeCalledWith(1, 0, arr) 59 | expect(predicate).toBeCalledWith(2, 1, arr) 60 | }) 61 | 62 | it('works on objects', () => { 63 | expect(every({ a: 1, b: 2 }, (v) => v === 2)).toEqual(false) 64 | expect(every({ a: 2, b: 2 }, (v) => v === 2)).toEqual(true) 65 | }) 66 | }) 67 | 68 | describe('mapToObject', () => { 69 | it('maps a map to an object', () => { 70 | const map = new Map([ 71 | ['one', 1], 72 | ['two', 2], 73 | ]) 74 | const obj = mapToObject(map) 75 | 76 | expect(obj['one']).toEqual(1) 77 | expect(obj['two']).toEqual(2) 78 | }) 79 | }) 80 | }) 81 | -------------------------------------------------------------------------------- /src/__tests__/validation.spec.ts: -------------------------------------------------------------------------------- 1 | import { 2 | IValidatorOptions, 3 | validationContext, 4 | ValidationContext, 5 | IValidationSchema, 6 | required, 7 | pattern, 8 | } from '../' 9 | import { reaction } from 'mobx' 10 | 11 | describe('ValidationContext', () => { 12 | describe('#validate', () => { 13 | it('runs validations on the input object', () => { 14 | const v = new ValidationContext() 15 | const reactionSpy = jest.fn() 16 | reaction( 17 | () => v.errors, 18 | (e: any) => { 19 | expect(Object.keys(e).length).toEqual(2) 20 | reactionSpy() 21 | } 22 | ) 23 | v.validate( 24 | { 25 | name: null, 26 | lol: 'test', 27 | }, 28 | { 29 | name: [required({ msg: 'yo' })], 30 | lol: [required(), pattern({ pattern: 'email' })], 31 | } 32 | ) 33 | 34 | expect(v.errors['name'].length).toEqual(1) 35 | expect(v.errors['name'][0]).toEqual('yo') 36 | expect(v.errors['lol'].length).toEqual(1) 37 | expect(v.errors['lol'][0]).toMatch(/email/i) 38 | expect(reactionSpy).toHaveBeenCalledTimes(1) 39 | }) 40 | 41 | it('accumulates errors', () => { 42 | const v = new ValidationContext() 43 | v.validate( 44 | { 45 | name: '', 46 | }, 47 | { 48 | name: [required()], 49 | } 50 | ) 51 | v.validate( 52 | { 53 | email: '', 54 | name: '', 55 | }, 56 | { 57 | email: [required(), pattern({ pattern: 'email' })], 58 | name: [required()], 59 | } 60 | ) 61 | 62 | expect(Object.keys(v.errors).length).toEqual(2) 63 | }) 64 | 65 | it('uses default error message when validator returns false', () => { 66 | const v = validationContext() 67 | v.validate( 68 | { 69 | name: 'Joe', 70 | }, 71 | { 72 | name: [ 73 | (v: IValidatorOptions<{ name: string }>) => v.value === 'Jeff', 74 | ], 75 | } 76 | ) 77 | 78 | expect(v.errors['name'][0]).toMatch(/invalid/i) 79 | }) 80 | 81 | it('has no errors when all is well', () => { 82 | const c = new ValidationContext() 83 | c.validate( 84 | { name: 'heh' }, 85 | { 86 | name: [required()], 87 | } 88 | ) 89 | expect(Object.keys(c.errors).length).toEqual(0) 90 | }) 91 | 92 | it('skips falsy values in schema', () => { 93 | const c = new ValidationContext() 94 | c.validate( 95 | { name: '' }, 96 | { 97 | name: [undefined as any, null, false, required()], 98 | } 99 | ) 100 | expect(Object.keys(c.errors).length).toEqual(1) 101 | }) 102 | }) 103 | 104 | describe('#reset', () => { 105 | it('removes all errors', () => { 106 | const c = new ValidationContext() 107 | const reactionSpy = jest.fn() 108 | c.validate( 109 | { name: null }, 110 | { 111 | name: [required()], 112 | } 113 | ) 114 | expect(Object.keys(c.errors).length).toEqual(1) 115 | reaction( 116 | () => c.errors, 117 | (e: any) => { 118 | expect(Object.keys(e).length).toEqual(0) 119 | reactionSpy() 120 | } 121 | ) 122 | c.reset() 123 | expect(Object.keys(c.errors).length).toEqual(0) 124 | expect(reactionSpy).toHaveBeenCalledTimes(1) 125 | }) 126 | }) 127 | 128 | describe('#isValid', () => { 129 | it('reacts based on errors', () => { 130 | const reactionSpy = jest.fn() 131 | const c = new ValidationContext() 132 | reaction(() => c.isValid, reactionSpy) 133 | expect(c.isValid).toEqual(true) 134 | c.validate( 135 | { name: null }, 136 | { 137 | name: [required()], 138 | } 139 | ) 140 | expect(c.isValid).toEqual(false) 141 | c.reset() 142 | expect(c.isValid).toEqual(true) 143 | expect(reactionSpy).toHaveBeenCalledTimes(2) 144 | }) 145 | }) 146 | 147 | describe('#getErrors', () => { 148 | it('returns the errors for the given field', () => { 149 | const c = validationContext() 150 | c.addErrors({ test: ['Hello', 'World'] }) 151 | expect(c.getErrors('test')).toEqual(['Hello', 'World']) 152 | }) 153 | 154 | it('returns an empty array for the given field if there are no errors', () => { 155 | const c = validationContext() 156 | expect(c.getErrors('test')).toEqual([]) 157 | }) 158 | 159 | it('supports bound contexts', () => { 160 | const c = validationContext( 161 | { name: '' }, 162 | { 163 | name: [required()], 164 | } 165 | ) 166 | c.reset().validate() 167 | expect(c.getErrors('name')[0]).toMatch(/required/) 168 | }) 169 | }) 170 | 171 | describe('#getError', () => { 172 | it('returns the first error for the given field', () => { 173 | const c = validationContext() 174 | c.addErrors({ test: ['Hello', 'World'] }) 175 | expect(c.getError('test')).toEqual('Hello') 176 | }) 177 | 178 | it('returns an empty array for the given field if there are no errors', () => { 179 | const c = validationContext() 180 | expect(c.getError('test')).toBeUndefined() 181 | }) 182 | 183 | it('supports bound contexts', () => { 184 | const c = validationContext( 185 | { name: '' }, 186 | { 187 | name: [required('hah'), pattern({ pattern: 'email' })], 188 | } 189 | ) 190 | c.reset().validate() 191 | expect(c.getError('name')).toEqual('hah') 192 | }) 193 | }) 194 | 195 | describe('#clearErrors', function () { 196 | it('clears errors for the specified field', () => { 197 | const c = validationContext() 198 | c.addErrors({ test: ['Hello'] }) 199 | expect(c.getError('test')).toEqual('Hello') 200 | c.clearErrors('test') 201 | expect(c.getError('test')).toBeUndefined() 202 | }) 203 | }) 204 | 205 | describe('validators', () => { 206 | describe('regular function', () => { 207 | it('works', () => { 208 | type ITest = { name: string; age: number } 209 | const schema: IValidationSchema = { 210 | name: [ 211 | (opts) => { 212 | return opts.obj.name === 'Jeff' ? true : 'jeff plz' 213 | }, 214 | ], 215 | } 216 | const c = new ValidationContext().validate( 217 | { 218 | name: 'Jeff', 219 | age: 22, 220 | }, 221 | schema 222 | ) 223 | expect(c.isValid).toEqual(true) 224 | c.validate( 225 | { 226 | name: 'Joe', 227 | age: 24, 228 | }, 229 | schema 230 | ) 231 | expect(c.isValid).toEqual(false) 232 | expect(c.errors['name'][0]).toEqual('jeff plz') 233 | }) 234 | }) 235 | }) 236 | 237 | describe('#addErrors', () => { 238 | it('adds errors to the context', () => { 239 | const c = new ValidationContext() 240 | expect(c.isValid).toEqual(true) 241 | c.addErrors({ 242 | test: ['yeah'], 243 | }) 244 | 245 | expect(c.errors['test'][0]).toEqual('yeah') 246 | expect(c.isValid).toEqual(false) 247 | }) 248 | }) 249 | }) 250 | 251 | describe('validationContext(object)', () => { 252 | describe('when called with no parameter', () => { 253 | it('returns a regular validation context', () => { 254 | const v = validationContext() 255 | v.validate( 256 | { name: '' }, 257 | { 258 | name: [required()], 259 | } 260 | ) 261 | expect(v.errors['name'].length).toEqual(1) 262 | }) 263 | }) 264 | 265 | describe('when called with an object parameter', () => { 266 | it('returns a bound validation context', () => { 267 | const o = { name: '' } 268 | const v = validationContext(o) 269 | v.validate({ 270 | name: [required()], 271 | }) 272 | expect(v.errors['name'].length).toEqual(1) 273 | v.reset() 274 | o.name = 'joe' 275 | v.validate({ 276 | name: [required()], 277 | }) 278 | expect(Object.keys(v.errors).length).toEqual(0) 279 | }) 280 | }) 281 | 282 | describe('when called with an object + schema', () => { 283 | it('returns a bound validation context with a schema', () => { 284 | const o = { name: '' } 285 | const v = validationContext(o, { 286 | name: [required()], 287 | }) 288 | v.validate() 289 | expect(v.errors['name'].length).toEqual(1) 290 | v.reset() 291 | o.name = 'joe' 292 | v.validate() 293 | expect(Object.keys(v.errors).length).toEqual(0) 294 | }) 295 | }) 296 | }) 297 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './validators/requiredValidator' 2 | export * from './validators/patternValidator' 3 | export * from './validators/funcValidator' 4 | export * from './validation' 5 | -------------------------------------------------------------------------------- /src/utils.ts: -------------------------------------------------------------------------------- 1 | export type Iteratee = (value: V, key: K, source: O) => R 2 | 3 | /** 4 | * A specialized version of `forEach` for arrays. 5 | * 6 | * From lodash. 7 | */ 8 | function arrayEach( 9 | array: T[], 10 | iteratee: Iteratee 11 | ): T[] { 12 | let index = -1 13 | const length = array.length 14 | 15 | while (++index < length) { 16 | if (iteratee(array[index], index, array) === false) { 17 | break 18 | } 19 | } 20 | return array 21 | } 22 | 23 | /** 24 | * A specialized version of `forEach` for objects. 25 | */ 26 | function objectEach>( 27 | source: T, 28 | iteratee: Iteratee 29 | ): T { 30 | for (let key in source) { 31 | /* istanbul ignore next */ 32 | if (source.hasOwnProperty(key)) { 33 | if (iteratee(source[key], key, source) === false) { 34 | break 35 | } 36 | } 37 | } 38 | 39 | return source 40 | } 41 | 42 | /** 43 | * Invokes the iteratee for each item in the array or object. 44 | */ 45 | export function forEach( 46 | array: T[], 47 | iteratee: Iteratee 48 | ): T[] 49 | export function forEach( 50 | source: T, 51 | iteratee: Iteratee 52 | ): T 53 | export function forEach( 54 | source: any, 55 | iteratee: Iteratee 56 | ): any { 57 | const func: any = Array.isArray(source) ? arrayEach : objectEach 58 | return func(source, iteratee) 59 | } 60 | 61 | /** 62 | * Determines if every element in the collection statisfies the predicate. 63 | * @type {T[]} 64 | */ 65 | export function every( 66 | array: T[], 67 | predicate: Iteratee 68 | ): boolean 69 | export function every( 70 | source: T, 71 | predicate: Iteratee 72 | ): boolean 73 | export function every( 74 | source: any, 75 | predicate: Iteratee 76 | ): any { 77 | let result = true 78 | forEach(source, (value, key, source) => { 79 | if (!predicate(value, key, source)) { 80 | result = false 81 | return false 82 | } 83 | }) 84 | return result 85 | } 86 | 87 | /** 88 | * Creates an object hash from a map. 89 | * 90 | * @param map 91 | */ 92 | export function mapToObject(map: Map): Record { 93 | const result: Record = {} as any 94 | const entries = Array.from(map.entries()) 95 | for (let index = 0; index < entries.length; index++) { 96 | const [key, value] = entries[index] 97 | result[key] = value 98 | } 99 | 100 | return result 101 | } 102 | -------------------------------------------------------------------------------- /src/validation.ts: -------------------------------------------------------------------------------- 1 | import { 2 | observable, 3 | extendObservable, 4 | action, 5 | computed, 6 | ObservableMap, 7 | toJS, 8 | } from 'mobx' 9 | import { forEach, every, mapToObject } from './utils' 10 | 11 | /** 12 | * A validatable object where all keys are strings. 13 | */ 14 | export type Validatable = Record 15 | 16 | /** 17 | * Options passed to validators. 18 | * 19 | * @export 20 | * @interface IValidatorOptions 21 | * @template T The type of the object being validated. 22 | * @template R The rule type. 23 | */ 24 | export interface IValidatorOptions { 25 | field: string 26 | value: any 27 | obj: T 28 | } 29 | 30 | /** 31 | * Definition of a validator function. 32 | * 33 | * @export 34 | * @interface IValidator 35 | * @template T Type of the object being validated. 36 | * @template R The rule type. 37 | */ 38 | export interface IValidator { 39 | (opts: IValidatorOptions): boolean | string 40 | } 41 | 42 | /** 43 | * The interface all rules must satisfy. 44 | * 45 | * @export 46 | * @interface IRule 47 | * @template T 48 | */ 49 | export interface IRule { 50 | msg?: string 51 | } 52 | 53 | /** 54 | * Maps fields on an object to one or more rules. 55 | * 56 | * @export 57 | * @interface IValidationSchema 58 | * @template T The object type. 59 | */ 60 | export type IValidationSchema = { [P in keyof T]?: Array> } 61 | 62 | /** 63 | * Validation errors are stored as a map of fields to error strings. 64 | * 65 | * @export 66 | * @interface IValidationErrors 67 | */ 68 | export interface IValidationErrors { 69 | [key: string]: Array 70 | } 71 | 72 | /** 73 | * The validation context interface. 74 | * 75 | * @export 76 | * @interface IValidationContext 77 | */ 78 | export interface IValidationContext { 79 | errors: IValidationErrors 80 | isValid: boolean 81 | reset(): this 82 | validate(obj: T, schema: IValidationSchema): this 83 | addErrors(errors: IValidationErrors | { [key: string]: string[] }): this 84 | getErrors(field: string): string[] 85 | getError(field: string): string | undefined 86 | clearErrors(field: string): this 87 | } 88 | 89 | /** 90 | * Validation context with the object already bound to the validate function. 91 | */ 92 | export interface IBoundValidationContext { 93 | errors: IValidationErrors 94 | isValid: boolean 95 | reset(): this 96 | validate(schema: IValidationSchema): this 97 | addErrors(errors: IValidationErrors | { [key: string]: string[] }): this 98 | getErrors(field: keyof T): string[] 99 | getError(field: keyof T): string | undefined 100 | clearErrors(field: string): this 101 | } 102 | 103 | /** 104 | * Validation context with the object already bound to the validate function. 105 | */ 106 | export interface ISchemaBoundValidationContext 107 | extends IBoundValidationContext { 108 | validate(): this 109 | } 110 | 111 | /** 112 | * Implementation of the validation context. 113 | * 114 | * @export 115 | * @class ValidationContext 116 | * @implements {IValidationContext} 117 | */ 118 | export class ValidationContext implements IValidationContext { 119 | /** 120 | * All validation errors are stored here. To clear, call `reset`. 121 | * 122 | * @readonly 123 | * @type {IValidationErrors} 124 | * @memberOf ValidationContext 125 | */ 126 | readonly errors!: IValidationErrors 127 | 128 | /** 129 | * Determines if the validation context is in a valid state (no errors) 130 | * 131 | * @readonly 132 | * @type {boolean} 133 | * @memberOf ValidationContext 134 | */ 135 | readonly isValid!: boolean 136 | 137 | /** 138 | * Internal map of the errors. 139 | * 140 | * @private 141 | * 142 | * @memberOf ValidationContext 143 | */ 144 | private errorsMap!: ObservableMap 145 | 146 | /** 147 | * Initializes a new instance of ValidationContext. 148 | */ 149 | constructor() { 150 | this.reset = action(this.reset) 151 | this.addErrors = action(this.addErrors) 152 | this.clearErrors = action(this.clearErrors) 153 | this.validate = action(this.validate) 154 | extendObservable( 155 | this, 156 | { 157 | errorsMap: observable.map(), 158 | get errors() { 159 | return mapToObject(toJS(this.errorsMap)) 160 | }, 161 | get isValid() { 162 | return every(this.errors, (arr: string[]) => arr.length === 0) 163 | }, 164 | }, 165 | { 166 | errors: computed, 167 | isValid: computed, 168 | } 169 | ) 170 | } 171 | 172 | /** 173 | * Resets the errors. 174 | * 175 | * @returns {IValidationContext} 176 | * 177 | * @memberOf ValidationContext 178 | */ 179 | reset(): this { 180 | this.errorsMap.clear() 181 | return this 182 | } 183 | 184 | /** 185 | * Validates the input object and stores any errors that may have occurred 186 | * in `errors`. 187 | * 188 | * @template T The type of the object being validated. 189 | * @param {T} obj 190 | * @param {IValidationSchema} schema 191 | * @returns {IValidationContext} 192 | * 193 | * @memberOf ValidationContext 194 | */ 195 | validate(obj: T, schema: IValidationSchema): this { 196 | forEach(schema, (validators: Array>, field: string) => { 197 | const errors = this.ensureErrors(field) 198 | const value = (obj as any)[field] 199 | forEach(validators, (validator?: IValidator) => { 200 | if (!validator) { 201 | return 202 | } 203 | 204 | const opts: IValidatorOptions = { 205 | field, 206 | value, 207 | obj, 208 | } 209 | 210 | let msg = 'This field is invalid.' 211 | const result = validator(opts) 212 | if (result === true) { 213 | return 214 | } else if (result !== false) { 215 | msg = result 216 | } 217 | 218 | errors.push(msg) 219 | }) 220 | }) 221 | this.cleanupErrors() 222 | return this 223 | } 224 | 225 | /** 226 | * Adds errors to the context. 227 | */ 228 | addErrors(errors: IValidationErrors | { [key: string]: string[] }) { 229 | forEach(errors, (arr: string[], field: string) => { 230 | this.ensureErrors(field).push(...arr) 231 | }) 232 | return this 233 | } 234 | 235 | /** 236 | * Gets the errors for the given field. 237 | */ 238 | getErrors(field: string) { 239 | const errors = this.errors[field] 240 | if (!errors) { 241 | return [] 242 | } 243 | 244 | return errors.slice() 245 | } 246 | 247 | /** 248 | * Gets the first error for the given field. 249 | * If not found, returns undefined. 250 | */ 251 | getError(field: string) { 252 | return this.getErrors(field)[0] 253 | } 254 | 255 | /** 256 | * Removes errors for a particular field. 257 | */ 258 | clearErrors(field: string) { 259 | this.errorsMap.set(field, []) 260 | return this 261 | } 262 | 263 | /** 264 | * Ensures that an entry in the internal error map 265 | * exists for the specified field. 266 | * 267 | * @private 268 | * @param {string} field 269 | * @returns 270 | * 271 | * @memberOf ValidationContext 272 | */ 273 | private ensureErrors(field: string) { 274 | let errors = this.errorsMap.get(field) 275 | if (!errors) { 276 | errors = observable.array([]) 277 | this.errorsMap.set(field, errors) 278 | } 279 | 280 | return errors 281 | } 282 | 283 | /** 284 | * At the end of a validation run, if a field 285 | * has no errors, it's entry in the error map 286 | * is removed. 287 | * 288 | * @private 289 | * 290 | * @memberOf ValidationContext 291 | */ 292 | private cleanupErrors() { 293 | const entries = Array.from(this.errorsMap.entries()).filter( 294 | ([, value]) => value.length === 0 295 | ) 296 | entries.forEach(([key]) => this.errorsMap.delete(key)) 297 | } 298 | } 299 | 300 | export function validationContext( 301 | objectToValidate: T, 302 | schema: IValidationSchema 303 | ): ISchemaBoundValidationContext 304 | export function validationContext( 305 | objectToValidate: T 306 | ): IBoundValidationContext 307 | export function validationContext(): IValidationContext 308 | export function validationContext( 309 | objectToValidate?: any, 310 | schema?: IValidationSchema 311 | ): 312 | | IValidationContext 313 | | IBoundValidationContext 314 | | ISchemaBoundValidationContext { 315 | const v = new ValidationContext() 316 | if (objectToValidate !== null && objectToValidate !== undefined) { 317 | if (schema) { 318 | v.validate = v.validate.bind(v, objectToValidate, schema) 319 | } else { 320 | v.validate = v.validate.bind(v, objectToValidate) 321 | } 322 | } 323 | return v 324 | } 325 | -------------------------------------------------------------------------------- /src/validators/__tests__/funcValidator.spec.ts: -------------------------------------------------------------------------------- 1 | import 'mocha' 2 | import { ValidationContext, func } from '../..' 3 | 4 | describe('funcValidator', () => { 5 | it('works', () => { 6 | const c = new ValidationContext() 7 | c.validate<{ name: string; title: string }>( 8 | { name: '', title: '' }, 9 | { 10 | name: [func(() => true, 'Haha')], 11 | title: [func(() => false, 'Lol')], 12 | } 13 | ) 14 | expect(c.errors['name']).toBeUndefined() 15 | expect(c.errors['title'][0]).toEqual('Lol') 16 | }) 17 | 18 | it('accepts a config object', () => { 19 | const c = new ValidationContext() 20 | c.validate<{ name: string; title: string }>( 21 | { name: '', title: '' }, 22 | { 23 | name: [func({ fn: () => false, msg: 'Haha' })], 24 | title: [func({ fn: () => false }, 'Lol')], 25 | } 26 | ) 27 | expect(c.errors['name'][0]).toEqual('Haha') 28 | expect(c.errors['title'][0]).toEqual('Lol') 29 | }) 30 | 31 | it('rejects anything else', () => { 32 | expect(() => func(undefined as any)).toThrowError(TypeError) 33 | expect(() => func(null as any)).toThrowError(TypeError) 34 | }) 35 | }) 36 | -------------------------------------------------------------------------------- /src/validators/__tests__/patternValidator.spec.ts: -------------------------------------------------------------------------------- 1 | import 'mocha' 2 | import { ValidationContext, pattern } from '../..' 3 | 4 | describe('patternValidator', () => { 5 | it('supports simple notation', () => { 6 | const c = new ValidationContext() 7 | c.validate( 8 | { email1: '', email2: '', email3: 'test@test.com' }, 9 | { 10 | email1: [pattern('email', 'yo')], 11 | email2: [pattern('email')], 12 | email3: [pattern('email')], 13 | } 14 | ) 15 | expect(c.errors['email1'][0]).toEqual('yo') 16 | expect(c.errors['email2'][0]).toEqual('This is not a valid email') 17 | expect(c.errors['email3']).toBeUndefined() 18 | }) 19 | 20 | it('validates emails', () => { 21 | const c = new ValidationContext() 22 | c.validate( 23 | { email1: '', email2: '', email3: 'test@test.com' }, 24 | { 25 | email1: [pattern({ pattern: 'email', msg: 'yo' })], 26 | email2: [pattern({ pattern: 'email' })], 27 | email3: [pattern({ pattern: 'email' })], 28 | } 29 | ) 30 | expect(c.errors['email1'][0]).toEqual('yo') 31 | expect(c.errors['email2'][0]).toEqual('This is not a valid email') 32 | expect(c.errors['email3']).toBeUndefined() 33 | }) 34 | 35 | it('validates urls', () => { 36 | const c = new ValidationContext() 37 | c.validate( 38 | { url1: '', url2: 'haha', url3: 'https://jeffijoe.com' }, 39 | { 40 | url1: [pattern({ pattern: 'url', msg: 'yo' })], 41 | url2: [pattern({ pattern: 'url' })], 42 | url3: [pattern({ pattern: 'url' })], 43 | } 44 | ) 45 | expect(c.errors['url1'][0]).toEqual('yo') 46 | expect(c.errors['url2'][0]).toEqual('This is not a valid url') 47 | expect(c.errors['url3']).toBeUndefined() 48 | }) 49 | 50 | it('validates regexp', () => { 51 | const c = new ValidationContext() 52 | c.validate( 53 | { p1: 'abcd', p2: '1234', p3: 'hij' }, 54 | { 55 | p1: [pattern({ pattern: /\d/, msg: 'yo' })], 56 | p2: [pattern({ pattern: /[a-z]/ })], 57 | p3: [pattern({ pattern: /[a-z]/ })], 58 | } 59 | ) 60 | expect(c.errors['p1'][0]).toEqual('yo') 61 | expect(c.errors['p2'][0]).toMatch(/invalid/i) 62 | expect(c.errors['p3']).toBeUndefined() 63 | }) 64 | }) 65 | -------------------------------------------------------------------------------- /src/validators/__tests__/requiredValidator.spec.ts: -------------------------------------------------------------------------------- 1 | import 'mocha' 2 | import { ValidationContext, required } from '../..' 3 | 4 | describe('requiredValidator', () => { 5 | it('works', () => { 6 | const c = new ValidationContext() 7 | c.validate<{ name: string; title: string }>( 8 | { name: '', title: '' }, 9 | { 10 | name: [required({ msg: 'yo' })], 11 | title: [required('Title plz')], 12 | } 13 | ) 14 | expect(c.errors['name'][0]).toEqual('yo') 15 | expect(c.errors['title'][0]).toEqual('Title plz') 16 | }) 17 | 18 | it('can be disabled', () => { 19 | const c = new ValidationContext() 20 | c.validate<{ name: string; title: string }>( 21 | { name: '', title: '' }, 22 | { 23 | name: [required({ msg: 'yo', required: false })], 24 | title: [required('Title plz')], 25 | } 26 | ) 27 | expect(c.errors['name']).toBeUndefined() 28 | expect(c.errors['title'][0]).toEqual('Title plz') 29 | }) 30 | }) 31 | -------------------------------------------------------------------------------- /src/validators/funcValidator.ts: -------------------------------------------------------------------------------- 1 | import { IValidator, IRule } from '../validation' 2 | 3 | /** 4 | * Rule options. 5 | */ 6 | export interface IFuncRule extends IRule { 7 | fn: IValidator 8 | } 9 | 10 | const DEFAULT_MESSAGE = 'This field is not valid' 11 | 12 | /** 13 | * Simple way to run a function and return an error message. 14 | * 15 | * @param rule 16 | * @returns {(opts:any)=>boolean|string} 17 | */ 18 | export const func = ( 19 | rule: IFuncRule | IValidator, 20 | msg: string = DEFAULT_MESSAGE 21 | ): IValidator => { 22 | if (!rule) { 23 | throw new TypeError( 24 | 'Expected a function or a configuration object, got ' + rule 25 | ) 26 | } 27 | 28 | return (opts) => { 29 | if (typeof rule === 'function') { 30 | return rule(opts) || msg 31 | } 32 | 33 | return rule.fn(opts) || rule.msg || msg 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/validators/patternValidator.ts: -------------------------------------------------------------------------------- 1 | import { IRule, IValidator } from '../validation' 2 | import * as emailValidator from 'email-validator' 3 | import isUrl = require('is-url') 4 | 5 | export type Pattern = 'email' | 'url' | RegExp 6 | 7 | /** 8 | * Rule specifics. 9 | * 10 | * @export 11 | * @interface IPatternRule 12 | * @extends {IRule} 13 | */ 14 | export interface IPatternRule extends IRule { 15 | pattern: Pattern 16 | } 17 | 18 | const DEFAULT_MESSAGE = 'This field is invalid' 19 | 20 | const PatternMessages = { 21 | email: 'This is not a valid email', 22 | url: 'This is not a valid url', 23 | } 24 | 25 | /** 26 | * The validator function. 27 | */ 28 | export const pattern = ( 29 | rule: IPatternRule | Pattern, 30 | msg?: string 31 | ): IValidator => { 32 | const validator: IValidator = (opts) => { 33 | let valid = false 34 | const pattern = 35 | typeof rule === 'string' || rule instanceof RegExp ? rule : rule.pattern 36 | const message = 37 | typeof rule === 'string' || rule instanceof RegExp ? msg : rule.msg 38 | 39 | if (pattern === 'email') { 40 | valid = emailValidator.validate(opts.value) 41 | } else if (pattern === 'url') { 42 | valid = isUrl(opts.value) 43 | } else { 44 | valid = pattern.test(opts.value) 45 | } 46 | 47 | return ( 48 | valid || 49 | message || 50 | (typeof pattern === 'string' && PatternMessages[pattern]) || 51 | DEFAULT_MESSAGE 52 | ) 53 | } 54 | 55 | return validator 56 | } 57 | -------------------------------------------------------------------------------- /src/validators/requiredValidator.ts: -------------------------------------------------------------------------------- 1 | import { IValidator, IRule } from '../validation' 2 | 3 | /** 4 | * Rule options. 5 | */ 6 | export interface IRequiredRule extends IRule { 7 | required?: boolean 8 | } 9 | 10 | const DEFAULT_MESSAGE = 'This field is required' 11 | 12 | /** 13 | * Validates that the field has a truthy value. 14 | * The only exception is the number 0. 15 | * 16 | * @param rule 17 | * @returns {(opts:any)=>boolean|string} 18 | */ 19 | export const required = (rule?: IRequiredRule | string): IValidator => { 20 | if ( 21 | typeof rule !== 'string' && 22 | rule !== undefined && 23 | rule.required === false 24 | ) { 25 | return () => true 26 | } 27 | 28 | return (opts) => { 29 | return opts.value || opts.value === 0 // 0 is the only allowed falsy value. 30 | ? true 31 | : (typeof rule === 'string' ? rule : rule && rule.msg) || DEFAULT_MESSAGE 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["__tests__", "**/__tests__/*", "node_modules/*", "examples"], 4 | "compilerOptions": { 5 | "forceConsistentCasingInFileNames": false, 6 | "baseUrl": "src" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": ["node_modules", "lib"], 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "outDir": "./lib", 6 | "strict": true, 7 | "strictNullChecks": true, 8 | "experimentalDecorators": true, 9 | "noImplicitAny": true, 10 | "noUnusedLocals": true, 11 | "target": "es6", 12 | "module": "commonjs", 13 | "moduleResolution": "node", 14 | "importHelpers": false, 15 | "sourceMap": true, 16 | "declaration": true, 17 | "skipLibCheck": true, 18 | "forceConsistentCasingInFileNames": true, 19 | "lib": ["es6", "es7"] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint-config-standard", "tslint-config-prettier"], 3 | "rules": { 4 | "no-var-requires": false, 5 | "trailing-comma": [false], 6 | "ordered-imports": false, 7 | "member-access": false, 8 | "only-arrow-functions": false, 9 | "object-literal-sort-keys": [false], 10 | "max-classes-per-file": 0 11 | } 12 | } 13 | --------------------------------------------------------------------------------