├── .gitignore ├── LICENSE ├── README.md ├── index.ts ├── package.json └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | /.vscode 2 | /node_modules 3 | .idea 4 | npm-debug.log.* 5 | *.d.ts 6 | *.js 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | ======= 367 | Mozilla Public License, version 2.0 368 | 369 | 1. Definitions 370 | 371 | 1.1. "Contributor" 372 | 373 | means each individual or legal entity that creates, contributes to the 374 | creation of, or owns Covered Software. 375 | 376 | 1.2. "Contributor Version" 377 | 378 | means the combination of the Contributions of others (if any) used by a 379 | Contributor and that particular Contributor's Contribution. 380 | 381 | 1.3. "Contribution" 382 | 383 | means Covered Software of a particular Contributor. 384 | 385 | 1.4. "Covered Software" 386 | 387 | means Source Code Form to which the initial Contributor has attached the 388 | notice in Exhibit A, the Executable Form of such Source Code Form, and 389 | Modifications of such Source Code Form, in each case including portions 390 | thereof. 391 | 392 | 1.5. "Incompatible With Secondary Licenses" 393 | means 394 | 395 | a. that the initial Contributor has attached the notice described in 396 | Exhibit B to the Covered Software; or 397 | 398 | b. that the Covered Software was made available under the terms of 399 | version 1.1 or earlier of the License, but not also under the terms of 400 | a Secondary License. 401 | 402 | 1.6. "Executable Form" 403 | 404 | means any form of the work other than Source Code Form. 405 | 406 | 1.7. "Larger Work" 407 | 408 | means a work that combines Covered Software with other material, in a 409 | separate file or files, that is not Covered Software. 410 | 411 | 1.8. "License" 412 | 413 | means this document. 414 | 415 | 1.9. "Licensable" 416 | 417 | means having the right to grant, to the maximum extent possible, whether 418 | at the time of the initial grant or subsequently, any and all of the 419 | rights conveyed by this License. 420 | 421 | 1.10. "Modifications" 422 | 423 | means any of the following: 424 | 425 | a. any file in Source Code Form that results from an addition to, 426 | deletion from, or modification of the contents of Covered Software; or 427 | 428 | b. any new file in Source Code Form that contains any Covered Software. 429 | 430 | 1.11. "Patent Claims" of a Contributor 431 | 432 | means any patent claim(s), including without limitation, method, 433 | process, and apparatus claims, in any patent Licensable by such 434 | Contributor that would be infringed, but for the grant of the License, 435 | by the making, using, selling, offering for sale, having made, import, 436 | or transfer of either its Contributions or its Contributor Version. 437 | 438 | 1.12. "Secondary License" 439 | 440 | means either the GNU General Public License, Version 2.0, the GNU Lesser 441 | General Public License, Version 2.1, the GNU Affero General Public 442 | License, Version 3.0, or any later versions of those licenses. 443 | 444 | 1.13. "Source Code Form" 445 | 446 | means the form of the work preferred for making modifications. 447 | 448 | 1.14. "You" (or "Your") 449 | 450 | means an individual or a legal entity exercising rights under this 451 | License. For legal entities, "You" includes any entity that controls, is 452 | controlled by, or is under common control with You. For purposes of this 453 | definition, "control" means (a) the power, direct or indirect, to cause 454 | the direction or management of such entity, whether by contract or 455 | otherwise, or (b) ownership of more than fifty percent (50%) of the 456 | outstanding shares or beneficial ownership of such entity. 457 | 458 | 459 | 2. License Grants and Conditions 460 | 461 | 2.1. Grants 462 | 463 | Each Contributor hereby grants You a world-wide, royalty-free, 464 | non-exclusive license: 465 | 466 | a. under intellectual property rights (other than patent or trademark) 467 | Licensable by such Contributor to use, reproduce, make available, 468 | modify, display, perform, distribute, and otherwise exploit its 469 | Contributions, either on an unmodified basis, with Modifications, or 470 | as part of a Larger Work; and 471 | 472 | b. under Patent Claims of such Contributor to make, use, sell, offer for 473 | sale, have made, import, and otherwise transfer either its 474 | Contributions or its Contributor Version. 475 | 476 | 2.2. Effective Date 477 | 478 | The licenses granted in Section 2.1 with respect to any Contribution 479 | become effective for each Contribution on the date the Contributor first 480 | distributes such Contribution. 481 | 482 | 2.3. Limitations on Grant Scope 483 | 484 | The licenses granted in this Section 2 are the only rights granted under 485 | this License. No additional rights or licenses will be implied from the 486 | distribution or licensing of Covered Software under this License. 487 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 488 | Contributor: 489 | 490 | a. for any code that a Contributor has removed from Covered Software; or 491 | 492 | b. for infringements caused by: (i) Your and any other third party's 493 | modifications of Covered Software, or (ii) the combination of its 494 | Contributions with other software (except as part of its Contributor 495 | Version); or 496 | 497 | c. under Patent Claims infringed by Covered Software in the absence of 498 | its Contributions. 499 | 500 | This License does not grant any rights in the trademarks, service marks, 501 | or logos of any Contributor (except as may be necessary to comply with 502 | the notice requirements in Section 3.4). 503 | 504 | 2.4. Subsequent Licenses 505 | 506 | No Contributor makes additional grants as a result of Your choice to 507 | distribute the Covered Software under a subsequent version of this 508 | License (see Section 10.2) or under the terms of a Secondary License (if 509 | permitted under the terms of Section 3.3). 510 | 511 | 2.5. Representation 512 | 513 | Each Contributor represents that the Contributor believes its 514 | Contributions are its original creation(s) or it has sufficient rights to 515 | grant the rights to its Contributions conveyed by this License. 516 | 517 | 2.6. Fair Use 518 | 519 | This License is not intended to limit any rights You have under 520 | applicable copyright doctrines of fair use, fair dealing, or other 521 | equivalents. 522 | 523 | 2.7. Conditions 524 | 525 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in 526 | Section 2.1. 527 | 528 | 529 | 3. Responsibilities 530 | 531 | 3.1. Distribution of Source Form 532 | 533 | All distribution of Covered Software in Source Code Form, including any 534 | Modifications that You create or to which You contribute, must be under 535 | the terms of this License. You must inform recipients that the Source 536 | Code Form of the Covered Software is governed by the terms of this 537 | License, and how they can obtain a copy of this License. You may not 538 | attempt to alter or restrict the recipients' rights in the Source Code 539 | Form. 540 | 541 | 3.2. Distribution of Executable Form 542 | 543 | If You distribute Covered Software in Executable Form then: 544 | 545 | a. such Covered Software must also be made available in Source Code Form, 546 | as described in Section 3.1, and You must inform recipients of the 547 | Executable Form how they can obtain a copy of such Source Code Form by 548 | reasonable means in a timely manner, at a charge no more than the cost 549 | of distribution to the recipient; and 550 | 551 | b. You may distribute such Executable Form under the terms of this 552 | License, or sublicense it under different terms, provided that the 553 | license for the Executable Form does not attempt to limit or alter the 554 | recipients' rights in the Source Code Form under this License. 555 | 556 | 3.3. Distribution of a Larger Work 557 | 558 | You may create and distribute a Larger Work under terms of Your choice, 559 | provided that You also comply with the requirements of this License for 560 | the Covered Software. If the Larger Work is a combination of Covered 561 | Software with a work governed by one or more Secondary Licenses, and the 562 | Covered Software is not Incompatible With Secondary Licenses, this 563 | License permits You to additionally distribute such Covered Software 564 | under the terms of such Secondary License(s), so that the recipient of 565 | the Larger Work may, at their option, further distribute the Covered 566 | Software under the terms of either this License or such Secondary 567 | License(s). 568 | 569 | 3.4. Notices 570 | 571 | You may not remove or alter the substance of any license notices 572 | (including copyright notices, patent notices, disclaimers of warranty, or 573 | limitations of liability) contained within the Source Code Form of the 574 | Covered Software, except that You may alter any license notices to the 575 | extent required to remedy known factual inaccuracies. 576 | 577 | 3.5. Application of Additional Terms 578 | 579 | You may choose to offer, and to charge a fee for, warranty, support, 580 | indemnity or liability obligations to one or more recipients of Covered 581 | Software. However, You may do so only on Your own behalf, and not on 582 | behalf of any Contributor. You must make it absolutely clear that any 583 | such warranty, support, indemnity, or liability obligation is offered by 584 | You alone, and You hereby agree to indemnify every Contributor for any 585 | liability incurred by such Contributor as a result of warranty, support, 586 | indemnity or liability terms You offer. You may include additional 587 | disclaimers of warranty and limitations of liability specific to any 588 | jurisdiction. 589 | 590 | 4. Inability to Comply Due to Statute or Regulation 591 | 592 | If it is impossible for You to comply with any of the terms of this License 593 | with respect to some or all of the Covered Software due to statute, 594 | judicial order, or regulation then You must: (a) comply with the terms of 595 | this License to the maximum extent possible; and (b) describe the 596 | limitations and the code they affect. Such description must be placed in a 597 | text file included with all distributions of the Covered Software under 598 | this License. Except to the extent prohibited by statute or regulation, 599 | such description must be sufficiently detailed for a recipient of ordinary 600 | skill to be able to understand it. 601 | 602 | 5. Termination 603 | 604 | 5.1. The rights granted under this License will terminate automatically if You 605 | fail to comply with any of its terms. However, if You become compliant, 606 | then the rights granted under this License from a particular Contributor 607 | are reinstated (a) provisionally, unless and until such Contributor 608 | explicitly and finally terminates Your grants, and (b) on an ongoing 609 | basis, if such Contributor fails to notify You of the non-compliance by 610 | some reasonable means prior to 60 days after You have come back into 611 | compliance. Moreover, Your grants from a particular Contributor are 612 | reinstated on an ongoing basis if such Contributor notifies You of the 613 | non-compliance by some reasonable means, this is the first time You have 614 | received notice of non-compliance with this License from such 615 | Contributor, and You become compliant prior to 30 days after Your receipt 616 | of the notice. 617 | 618 | 5.2. If You initiate litigation against any entity by asserting a patent 619 | infringement claim (excluding declaratory judgment actions, 620 | counter-claims, and cross-claims) alleging that a Contributor Version 621 | directly or indirectly infringes any patent, then the rights granted to 622 | You by any and all Contributors for the Covered Software under Section 623 | 2.1 of this License shall terminate. 624 | 625 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user 626 | license agreements (excluding distributors and resellers) which have been 627 | validly granted by You or Your distributors under this License prior to 628 | termination shall survive termination. 629 | 630 | 6. Disclaimer of Warranty 631 | 632 | Covered Software is provided under this License on an "as is" basis, 633 | without warranty of any kind, either expressed, implied, or statutory, 634 | including, without limitation, warranties that the Covered Software is free 635 | of defects, merchantable, fit for a particular purpose or non-infringing. 636 | The entire risk as to the quality and performance of the Covered Software 637 | is with You. Should any Covered Software prove defective in any respect, 638 | You (not any Contributor) assume the cost of any necessary servicing, 639 | repair, or correction. This disclaimer of warranty constitutes an essential 640 | part of this License. No use of any Covered Software is authorized under 641 | this License except under this disclaimer. 642 | 643 | 7. Limitation of Liability 644 | 645 | Under no circumstances and under no legal theory, whether tort (including 646 | negligence), contract, or otherwise, shall any Contributor, or anyone who 647 | distributes Covered Software as permitted above, be liable to You for any 648 | direct, indirect, special, incidental, or consequential damages of any 649 | character including, without limitation, damages for lost profits, loss of 650 | goodwill, work stoppage, computer failure or malfunction, or any and all 651 | other commercial damages or losses, even if such party shall have been 652 | informed of the possibility of such damages. This limitation of liability 653 | shall not apply to liability for death or personal injury resulting from 654 | such party's negligence to the extent applicable law prohibits such 655 | limitation. Some jurisdictions do not allow the exclusion or limitation of 656 | incidental or consequential damages, so this exclusion and limitation may 657 | not apply to You. 658 | 659 | 8. Litigation 660 | 661 | Any litigation relating to this License may be brought only in the courts 662 | of a jurisdiction where the defendant maintains its principal place of 663 | business and such litigation shall be governed by laws of that 664 | jurisdiction, without reference to its conflict-of-law provisions. Nothing 665 | in this Section shall prevent a party's ability to bring cross-claims or 666 | counter-claims. 667 | 668 | 9. Miscellaneous 669 | 670 | This License represents the complete agreement concerning the subject 671 | matter hereof. If any provision of this License is held to be 672 | unenforceable, such provision shall be reformed only to the extent 673 | necessary to make it enforceable. Any law or regulation which provides that 674 | the language of a contract shall be construed against the drafter shall not 675 | be used to construe this License against a Contributor. 676 | 677 | 678 | 10. Versions of the License 679 | 680 | 10.1. New Versions 681 | 682 | Mozilla Foundation is the license steward. Except as provided in Section 683 | 10.3, no one other than the license steward has the right to modify or 684 | publish new versions of this License. Each version will be given a 685 | distinguishing version number. 686 | 687 | 10.2. Effect of New Versions 688 | 689 | You may distribute the Covered Software under the terms of the version 690 | of the License under which You originally received the Covered Software, 691 | or under the terms of any subsequent version published by the license 692 | steward. 693 | 694 | 10.3. Modified Versions 695 | 696 | If you create software not governed by this License, and you want to 697 | create a new license for such software, you may create and use a 698 | modified version of this License if you rename the license and remove 699 | any references to the name of the license steward (except to note that 700 | such modified license differs from this License). 701 | 702 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 703 | Licenses If You choose to distribute Source Code Form that is 704 | Incompatible With Secondary Licenses under the terms of this version of 705 | the License, the notice described in Exhibit B of this License must be 706 | attached. 707 | 708 | Exhibit A - Source Code Form License Notice 709 | 710 | This Source Code Form is subject to the 711 | terms of the Mozilla Public License, v. 712 | 2.0. If a copy of the MPL was not 713 | distributed with this file, You can 714 | obtain one at 715 | http://mozilla.org/MPL/2.0/. 716 | 717 | If it is not possible or desirable to put the notice in a particular file, 718 | then You may include the notice in a location (such as a LICENSE file in a 719 | relevant directory) where a recipient would be likely to look for such a 720 | notice. 721 | 722 | --------------------------------------------------------- 723 | 724 | This Source Code Form is "Incompatible With Secondary Licenses", as 725 | defined by the Mozilla Public License, v. 2.0. 726 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # redux-typed-modules 2 | 3 | Based on the [ducks-modular-redux / Redux modules](https://github.com/erikras/ducks-modular-redux) pattern, this library provides a simple, developer friendly, method for defining strongly typed modules in a pattern that will integrate seamlessly into projects currently following the Redux modules pattern. 4 | 5 | Key features 6 | 7 | - exports interface matching existing Redux module pattern. No changes required outside the module file! 8 | - support for a transform method which is called after every reducer is run. 9 | - support for a method to be called to add extra 'module global' data to actions, useful for adding timing. 10 | - fully typed actions and reducers specific to the individual action! 11 | 12 | Limitations 13 | 14 | - Actions accept up to seven arguments to allow for strong typing, if you need more, I recomment passing all arguments under a single object. 15 | 16 | ## Installation 17 | 18 | ```shell 19 | npm i --save redux-typed-modules 20 | ``` 21 | 22 | ## Usage 23 | 24 | Here is a basic TODO module using `redux-typed-modules`. 25 | 26 | ### src/modules/todos.ts 27 | 28 | ```typescript 29 | import { Module, generateID } from 'redux-typed-modules'; 30 | 31 | export interface TODO { 32 | id: string 33 | added: Date, 34 | task: string, 35 | } 36 | 37 | export interface TODOState { 38 | todos: Map; 39 | } 40 | 41 | // Initialize the module with an initial state 42 | // 43 | // *Optional configuration 44 | // actionExtraData: () => T; -> define a method to be called after an action is run 45 | // whose return value will be merged with the action result before being passed 46 | // to a reducer. Useful for adding global fields to actions, like the time. 47 | // 48 | // postReducer: (state: STATETYPE) => STATETYPE; -> define a method to be called 49 | // after every reducer is run. The result of an individual actions reducer is 50 | // passed in to this method for you to transform / and or perform any additional 51 | // tasks on all actions. 52 | const module = new Module({ 53 | initialState: { 54 | todos: Map() 55 | }, 56 | }); 57 | 58 | // Define the action and reducer to handle adding a new TODO using the createAction method 59 | // 60 | // createAction returns a typed action function which can be dispatched. 61 | // 62 | // *Optional configuration 63 | // type: string; -> define a custom type name for the action. If no type value 64 | // is provided a unique string id is generated for each action. I'd recommend 65 | // defining a type name for better logging. 66 | export const addTodo = module.createAction({ 67 | // The returned method from createAction will call this method when dispatched 68 | // and will share the same types. 69 | action: (todo: string) => { 70 | return { 71 | // generateID is just a basic alphanumeric random string generator used within 72 | // the module class for automatic type name creation, it's exported if you want 73 | // to use it selsewhere for simple string generation 74 | id: generateID(7), 75 | task: todo, 76 | }; 77 | }, 78 | 79 | // Here state is the STATETYPE as defined by initialState 80 | // and action is typed as the return of the above action method 81 | // merged with {type: string} & the return of actionExtraData If 82 | // that method is defined on the constructor options 83 | // 84 | // The return of the reducer can be a partial state, this will be 85 | // merged with the existing state behind the scenes. 86 | // 87 | // This removes any bleedthrough of types from other actions to help 88 | // prevent any confusion or misuse of action properties typical when 89 | // being forced to use a module global action interface. 90 | reducer: (state, action) => { 91 | return { 92 | todos: state.todos.set(a.id, { 93 | id: a.id, 94 | task: a.task 95 | }) 96 | }; 97 | } 98 | }); 99 | 100 | // Define the action and reducer to handle removing a TODO 101 | export const removeTodo = module.createAction({ 102 | action: (id: string) => { 103 | return { 104 | id: id 105 | }; 106 | }, 107 | 108 | reducer: (s, a) => { 109 | return { 110 | todos: s.todos.remove(a.id) 111 | }; 112 | } 113 | }); 114 | 115 | // Export the reducer, compiled from each of the reducers provided 116 | // in the createAction methods 117 | export default module.createReducer(); 118 | 119 | ``` 120 | 121 | ### src/modules/reducer.ts - *defined as you would normally* 122 | 123 | ```typescript 124 | import {combineReducers} from 'redux'; 125 | 126 | import todos, {TODOState} from './todos'; 127 | // import other modules... 128 | 129 | // Define the state as presented after combineReducers merges 130 | // each state 131 | export interface GlobalState { 132 | todos: TODOState, 133 | // add other state types 134 | } 135 | 136 | export default combineReducers({ 137 | todos, 138 | // other module reducers 139 | }); 140 | 141 | ``` 142 | 143 | ### src/index.tsx - *defined as you would normally* 144 | 145 | ```jsx 146 | import * as React from 'react'; 147 | import * as ReactDom from 'react-dom'; 148 | import {Provider} from 'react-redux'; 149 | 150 | import reducer from './modules/reducer'; 151 | import Todos from './components/Todos'; 152 | 153 | const store = createStore(reducer); 154 | ReactDom.render( 155 | 156 | 157 | , 158 | document.getElementById('app') 159 | ); 160 | 161 | ``` 162 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * This Source Code Form is subject to the terms of the Mozilla Public 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 | * 6 | * @Author: JB (jb@codecorsair.com) 7 | * @Date: 2016-12-09 14:42:59 8 | * @Last Modified by: JB (jb@codecorsair.com) 9 | * @Last Modified time: 2017-01-18 12:10:02 10 | */ 11 | 12 | const IDGenCharacters = 'abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ'; 13 | const IDGenCharactersLength = IDGenCharacters.length; 14 | export function generateID(length: number) { 15 | let id = ''; 16 | let counter = length; 17 | while (--counter >= 0) { 18 | id += IDGenCharacters.charAt(Math.floor(Math.random() *IDGenCharactersLength)); 19 | } 20 | return id; 21 | } 22 | 23 | // a global list of module names to ensure unique generated action type names across modules. 24 | const globalModuleIDs: {[id: string]: string} = {}; 25 | 26 | export class Module { 27 | actionDefs: {[id: string]: (state: STATETYPE, action: any) => Partial} = {}; 28 | 29 | initialState: STATETYPE; 30 | actionExtraData: () => ACTIONEXTRADATA; 31 | postReducer: (state: STATETYPE) => STATETYPE; 32 | 33 | reducerCreated: boolean = false; 34 | 35 | moduleID: string; 36 | 37 | constructor(options: { 38 | moduleID?: string, 39 | initialState: STATETYPE, 40 | actionExtraData?: () => ACTIONEXTRADATA, 41 | postReducer?: (state: STATETYPE) => STATETYPE, 42 | }) { 43 | this.initialState = options.initialState; 44 | this.actionExtraData = options.actionExtraData || (() => { return {} as ACTIONEXTRADATA;}); 45 | this.postReducer = options.postReducer || null; 46 | this.moduleID = options.moduleID || null; 47 | 48 | if (this.moduleID && typeof globalModuleIDs[this.moduleID] !== 'undefined') throw new Error(`Module name "${this.moduleID}" is not unique.`); 49 | 50 | // generate a unique id for this module. 51 | if (!this.moduleID) { 52 | this.moduleID = generateID(6); 53 | let retryCount = 10; 54 | while (typeof globalModuleIDs[this.moduleID] !== 'undefined' && --retryCount >= 0) { 55 | this.moduleID = generateID(6); 56 | } 57 | // extremely unlikely to ever happen 58 | if (typeof globalModuleIDs[this.moduleID] !== 'undefined') throw new Error('failed to generate a unique module id'); 59 | } 60 | globalModuleIDs[this.moduleID] = this.moduleID; 61 | } 62 | 63 | // no action params 64 | createAction(options: { 65 | type?: string, 66 | action: () => ACTIONTYPE, 67 | reducer?: (state: Readonly, action: Readonly) => Partial, 68 | }) : () => Readonly; 69 | 70 | // action params 71 | createAction(options: { 72 | type?: string, 73 | action: (a: A) => ACTIONTYPE, 74 | reducer?: (state: Readonly, action: Readonly) => Partial, 75 | }) : (a: A) => Readonly; 76 | 77 | createAction(options: { 78 | type?: string, 79 | action: (a: A, b: B) => ACTIONTYPE, 80 | reducer?: (state: Readonly, action: Readonly) => Partial, 81 | }) : (a: A, b: B) => Readonly; 82 | 83 | createAction(options: { 84 | type?: string, 85 | action: (a: A, b: B, c: C) => ACTIONTYPE, 86 | reducer?: (state: Readonly, action: Readonly) => Partial, 87 | }) : (a: A, b: B, c: C) => Readonly; 88 | 89 | createAction(options: { 90 | type?: string, 91 | action: (a: A, b: B, c: C, d: D) => ACTIONTYPE, 92 | reducer?: (state: Readonly, action: Readonly) => Partial, 93 | }) : (a: A, b: B, c: C, d: D) => Readonly; 94 | 95 | createAction(options: { 96 | type?: string, 97 | action: (a: A, b: B, c: C, d: D, e: E) => ACTIONTYPE, 98 | reducer?: (state: Readonly, action: Readonly) => Partial, 99 | }) : (a: A, b: B, c: C, d: D, e: E) => Readonly; 100 | 101 | createAction(options: { 102 | type?: string, 103 | action: (a: A, b: B, c: C, d: D, e: E, f: F) => ACTIONTYPE, 104 | reducer?: (state: Readonly, action: Readonly) => Partial, 105 | }) : (a: A, b: B, c: C, d: D, e: E, f: F) => Readonly; 106 | 107 | createAction(options: { 108 | type?: string, 109 | action: (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => ACTIONTYPE, 110 | reducer?: (state: Readonly, action: Readonly) => Partial, 111 | }) : (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => Readonly; 112 | 113 | // combined 114 | createAction(options: { 115 | type?: string, 116 | action: (() => ACTIONTYPE) 117 | | ((a: A) => ACTIONTYPE) 118 | | ((a: A, b: B, c: C) => ACTIONTYPE) 119 | | ((a: A, b: B, c: C, d: D) => ACTIONTYPE) 120 | | ((a: A, b: B, c: C, d: D, e: E) => ACTIONTYPE) 121 | | ((a: A, b: B, c: C, d: D, e: E, f: F) => ACTIONTYPE) 122 | | ((a: A, b: B, c: C, d: D, e: E, f: F, g: G) => ACTIONTYPE), 123 | reducer?: (state: Readonly, action: Readonly) => Partial, 124 | }) : (() => Readonly) 125 | | ((a: A) => Readonly) 126 | | ((a: A, b: B) => Readonly) 127 | | ((a: A, b: B, c: C) => Readonly) 128 | | ((a: A, b: B, c: C, d: D) => Readonly) 129 | | ((a: A, b: B, c: C, d: D, e: E) => Readonly) 130 | | ((a: A, b: B, c: C, d: D, e: E, f: F) => Readonly) 131 | | ((a: A, b: B, c: C, d: D, e: E, f: F, g: G) => Readonly) 132 | { 133 | 134 | if (this.reducerCreated) throw new Error("createAction may only be called before createReducer."); 135 | 136 | const {action, reducer} = options; 137 | 138 | let type = options.type; 139 | 140 | if (typeof type === 'undefined') { 141 | // generate a type 142 | type = this.moduleID + '/' + generateID(6); 143 | let retry = 10; 144 | while (typeof this.actionDefs[type] !== 'undefined' && --retry >= 0) { 145 | type = this.moduleID + '/' + generateID(6); 146 | } 147 | } else if (type.indexOf('/') === 0) { 148 | // When the type name starts with a "/", we assume we want to prepend the module name. 149 | type = this.moduleID + type; 150 | } 151 | 152 | if (typeof this.actionDefs[type] !== 'undefined') throw new Error('duplicate type name provided to createAction or type name generation failed to generate a unique type name'); 153 | 154 | this.actionDefs[type] = reducer || function(s, a) { return >{}; }; 155 | 156 | const actionExtraData = this.actionExtraData; 157 | 158 | if (action.length == 0) { 159 | return () => { 160 | const actionResult = (<() => ACTIONTYPE>action)() as any; 161 | if (typeof actionResult === 'function') { 162 | return (dispatch: (action: any) => any, state: STATETYPE) => { 163 | return { 164 | ...(actionResult(dispatch, state) as any), 165 | type: type, 166 | ...(actionExtraData() as any) 167 | } 168 | } 169 | } 170 | return { 171 | ...actionResult, 172 | type: type, 173 | ...(actionExtraData() as any) 174 | }; 175 | }; 176 | } else if (action.length === 1) { 177 | return (a: A) => { 178 | const actionResult = (<(a: A) => ACTIONTYPE>action)(a) as any; 179 | if (typeof actionResult === 'function') { 180 | return (dispatch: (action: any) => any, state: STATETYPE) => { 181 | return { 182 | ...(actionResult(dispatch, state) as any), 183 | type: type, 184 | ...(actionExtraData() as any) 185 | } 186 | } 187 | } 188 | return { 189 | ...actionResult, 190 | type: type, 191 | ...(actionExtraData() as any) 192 | }; 193 | }; 194 | } else if (action.length === 2) { 195 | return (a: A, b: B) => { 196 | const actionResult = (<(a: A, b: B) => ACTIONTYPE>action)(a, b) as any; 197 | if (typeof actionResult === 'function') { 198 | return (dispatch: (action: any) => any, state: STATETYPE) => { 199 | return { 200 | ...(actionResult(dispatch, state) as any), 201 | type: type, 202 | ...(actionExtraData() as any) 203 | } 204 | } 205 | } 206 | return { 207 | ...actionResult, 208 | type: type, 209 | ...(actionExtraData() as any) 210 | }; 211 | }; 212 | } else if (action.length === 3) { 213 | return (a: A, b: B, c: C) => { 214 | const actionResult = (<(a: A, b: B, c: C) => ACTIONTYPE>action)(a, b, c) as any; 215 | if (typeof actionResult === 'function') { 216 | return (dispatch: (action: any) => any, state: STATETYPE) => { 217 | return { 218 | ...(actionResult(dispatch, state) as any), 219 | type: type, 220 | ...(actionExtraData() as any) 221 | } 222 | } 223 | } 224 | return { 225 | ...actionResult, 226 | type: type, 227 | ...(actionExtraData() as any) 228 | }; 229 | }; 230 | } else if (action.length === 4) { 231 | return (a: A, b: B, c: C, d: D) => { 232 | const actionResult = (<(a: A, b: B, c: C, d: D) => ACTIONTYPE>action)(a, b, c, d) as any; 233 | if (typeof actionResult === 'function') { 234 | return (dispatch: (action: any) => any, state: STATETYPE) => { 235 | return { 236 | ...(actionResult(dispatch, state) as any), 237 | type: type, 238 | ...(actionExtraData() as any) 239 | } 240 | } 241 | } 242 | return { 243 | ...actionResult, 244 | type: type, 245 | ...(actionExtraData() as any) 246 | }; 247 | }; 248 | } else if (action.length === 5) { 249 | return (a: A, b: B, c: C, d: D, e: E) => { 250 | const actionResult = (<(a: A, b: B, c: C, d: D, e: E) => ACTIONTYPE>action)(a, b, c, d, e) as any; 251 | if (typeof actionResult === 'function') { 252 | return (dispatch: (action: any) => any, state: STATETYPE) => { 253 | return { 254 | ...(actionResult(dispatch, state) as any), 255 | type: type, 256 | ...(actionExtraData() as any) 257 | } 258 | } 259 | } 260 | return { 261 | ...actionResult, 262 | type: type, 263 | ...(actionExtraData() as any) 264 | }; 265 | }; 266 | } else if (action.length === 6) { 267 | return (a: A, b: B, c: C, d: D, e: E, f: F) => { 268 | const actionResult = (<(a: A, b: B, c: C, d: D, e: E, f: F) => ACTIONTYPE>action)(a, b, c, d, e, f) as any; 269 | if (typeof actionResult === 'function') { 270 | return (dispatch: (action: any) => any, state: STATETYPE) => { 271 | return { 272 | ...(actionResult(dispatch, state) as any), 273 | type: type, 274 | ...(actionExtraData() as any) 275 | } 276 | } 277 | } 278 | return { 279 | ...actionResult, 280 | type: type, 281 | ...(actionExtraData() as any) 282 | }; 283 | }; 284 | } else if (action.length === 7) { 285 | return (a: A, b: B, c: C, d: D, e: E, f: F, g: G) => { 286 | const actionResult = (<(a: A, b: B, c: C, d: D, e: E, f: F, g: G) => ACTIONTYPE>action)(a, b, c, d, e, f, g) as any; 287 | if (typeof actionResult === 'function') { 288 | return (dispatch: (action: any) => any, state: STATETYPE) => { 289 | return { 290 | ...(actionResult(dispatch, state) as any), 291 | type: type, 292 | ...(actionExtraData() as any) 293 | } 294 | } 295 | } 296 | return { 297 | ...actionResult, 298 | type: type, 299 | ...(actionExtraData() as any) 300 | }; 301 | }; 302 | } 303 | } 304 | 305 | createReducer() { 306 | this.reducerCreated = true; 307 | const postReducer = this.postReducer; 308 | if (postReducer === null) { 309 | return (state: STATETYPE = this.initialState, action: {type: string}) => { 310 | let def = this.actionDefs[action.type]; 311 | if (typeof def === 'undefined' || def === null) return state; 312 | return { 313 | ...(state as any), 314 | ...(def(state, action) as any) 315 | }; 316 | }; 317 | } else { 318 | return (state: STATETYPE = this.initialState, action: {type: string}) => { 319 | let def = this.actionDefs[action.type]; 320 | if (typeof def === 'undefined' || def === null) return state; 321 | return postReducer({ 322 | ...(state as any), 323 | ...(def(state, action) as any) 324 | }); 325 | }; 326 | } 327 | } 328 | } 329 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "redux-typed-modules", 3 | "version": "2.2.1", 4 | "description": "A library for defining strongly typed Redux reducers without the boilerplate normally required with TypeScript.", 5 | "main": "index.js", 6 | "typings": "index.d.ts", 7 | "scripts": { 8 | "build": "tsc" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/codecorsair/redux-typed-modules.git" 13 | }, 14 | "keywords": [ 15 | "redux", 16 | "modules", 17 | "typescript", 18 | "ts", 19 | "duck", 20 | "module" 21 | ], 22 | "author": "JB ", 23 | "license": "MPL-2.0", 24 | "files": [ 25 | "package.json", 26 | "LICENSE", 27 | "index.js", 28 | "index.d.ts", 29 | "README.md" 30 | ], 31 | "bugs": { 32 | "url": "https://github.com/codecorsair/redux-typed-modules/issues" 33 | }, 34 | "homepage": "https://github.com/codecorsair/redux-typed-modules#readme", 35 | "devDependencies": { 36 | "typescript": "^2.1.5" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "noImplicitAny": true, 5 | "removeComments": false, 6 | "outDir": ".", 7 | "sourceMap": false, 8 | "declaration": true, 9 | "module": "commonjs", 10 | "alwaysStrict": false, 11 | "noImplicitUseStrict": true 12 | }, 13 | "formatCodeOptions": { 14 | "indentSize": 2, 15 | "tabSize": 2, 16 | "newLineCharacter": "\r\n", 17 | "convertTabsToSpaces": true, 18 | "insertSpaceAfterCommaDelimiter": true, 19 | "insertSpaceAfterSemicolonInForStatements": true, 20 | "insertSpaceBeforeAndAfterBinaryOperators": true, 21 | "insertSpaceAfterKeywordsInControlFlowStatements": true, 22 | "insertSpaceAfterFunctionKeywordForAnonymousFunctions": false, 23 | "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false, 24 | "placeOpenBraceOnNewLineForFunctions": false, 25 | "placeOpenBraceOnNewLineForControlBlocks": false 26 | }, 27 | "compileOnSave": false, 28 | "buildOnSave": false, 29 | "resolution": "typings", 30 | "exclude": [ 31 | "node_modules" 32 | ], 33 | "atom": { 34 | "rewriteTsconfig": false 35 | } 36 | } 37 | --------------------------------------------------------------------------------