diff --git a/.dockerignore b/.dockerignore index 932e9558..0acb2dd1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,11 +11,9 @@ TestFixture.java .idea/ target/* .lein-repl-history -example.rb -/setup -/examples -/test /pull.js /server.js /push.js -/README.md \ No newline at end of file +/README.md +node_modules/* +docker/* \ No newline at end of file diff --git a/.gitignore b/.gitignore index e21d53cd..8ceb1e85 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ example.rb Dockerfile *.o *.hi +\#* diff --git a/LICENSE b/LICENSE index 7d889ea7..cf72b711 100644 --- a/LICENSE +++ b/LICENSE @@ -1,664 +1,21 @@ -Copyright (c) 2014 Codewars - -GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. +The MIT License (MIT) - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -. +Copyright (c) 2014 Codewars +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..b01e766b --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +HOSTNAME=codewars +# func was removed due to issues compiling haskell using the latest base image. +# We need to fix that image before we can ever update that image/codebase again :( +#CONTAINERS=dotnet func jvm node python ruby systems +CONTAINERS=dotnet jvm node python ruby systems alt func erlang + +ALL_CONTAINERS=${CONTAINERS} base + +.PHONY: ${ALL_CONTAINERS} clean docker_rm docker_rmi + +all: ${CONTAINERS} + +base: + cp docker/$@.docker ./Dockerfile + docker build -t $(HOSTNAME)/$@-runner . + +${CONTAINERS}: base + cp docker/$@.docker ./Dockerfile + docker build -t $(HOSTNAME)/$@-runner . + +# Push docker containers to registry +push_to_registry: + docker push $(HOSTNAME)/base-runner + echo $(patsubst %, $(HOSTNAME)/%-runner, $(CONTAINERS)) | xargs -n 1 docker push + +# Remove docker processes that have exited cleanly +docker_rm_exited: + [ ! -n "$(shell docker ps -a | grep Exit | cut -d ' ' -f 1)" ] || echo $(shell docker ps -a | grep Exit | cut -d ' ' -f 1) | xargs -n 1 docker rm -f + +# Kill temporary built images might fail if not exited cleanly +docker_rmi_temporary: + [ ! -n "$(shell docker images --no-trunc | grep none | sed -e 's/\s\s*/\t/g' | cut -f3)" ] || docker images --no-trunc | grep none | sed -e 's/\s\s*/\t/g' | cut -f3 | xargs -n 1 docker rmi -f + +# Kill all of the in-flight and exited docker containers +docker_rm: + docker ps -q | xargs docker stop + [ ! -n "$(shell docker ps -a -q)" ] || echo $(shell docker ps -a -q) | xargs -n 1 docker rm -f + +# Kill all docker images +docker_rmi: docker_rm + [ ! -n "$(shell docker images -q)" ] || docker images -q | xargs -n 1 docker rmi -f + +clean: docker_rm_exited docker_rmi_temporary + for i in $(shell for i in $(HOSTNAME)/base $(patsubst %, $(HOSTNAME)/%-runner, $(CONTAINERS)) ; do docker images | grep $$i | sed -e 's/\s\s*/\t/g' | cut -f1; done) ; do docker rmi -f $$i ; done + +deep-clean: docker_rmi + +pull: + docker pull codewars/ruby-runner + docker pull codewars/node-runner + docker pull codewars/python-runner + docker pull codewars/dotnet-runner + docker pull codewars/jvm-runner + docker pull codewars/systems-runner + docker pull codewars/func-runner diff --git a/README.md b/README.md index 19cb6f8b..d7f6f92d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,75 @@ +# runner -TODO: update documentation +This project is both a command-line utility and server, used by [Codewars](http://www.codewars.com) to execute small sets of code within various languages, using various testing frameworks. + +You can run `node run --help` to view information about which arguments are supported. + +## Purpose + +The purpose of this project is to provide a low level ability to run 'Kata'. It provides a mechanism for executing different configurations of code using various languages and testing frameworks. + +Docker can be utilized in order to sandbox code execution. A server is provided that can accept 'run' requests and execute them within a Docker container. + +## Language Support Status + +Many languages are currently supported in various states of completeness. This list tries to keep track of each. + +**Legend:** `!!!` = Failing Specs, `???` = Status is unknown, `*` = Any + +| Language | solutionOnly | testSuite | Codewars | Strive | Docker Image | Examples | Notes | +|--------------|--------------|----------------|--------------|----------------|----------------|--------------|-------------------------------------------------------------------------| +| Bash | ✓ | | Kumite | | * | | | +| C | ✓ | Failing | ? | | systems-runner | | | +| Clojure | ✓ | clojure.test | clojure.test | clojure.test | func-runner | clojure.test | | +| CoffeeScript | ✓ | cw-2, mocha | cw-2 | cw-2, mocha | node-runner | cw-2 | | +| CPP | ✓ | | | | systems-runner | | | +| C# | ✓ | nunit | nunit | nunit | dotnet-runner | nunit | | +| Elixir | ✓ | | | | erlang-runner | | | +| Erlang | ✓ | | | | erlang-runner | | | +| F# | ✓ | | Kumite Only | | dotnet-runner | | | +| Go | ✓ | | Kumite Only | | alt-runner | | | +| Groovy | ✓ | | Kumite Only | | jvm-runner | | | +| Haskell | ✓ | hspec!!! | hspec | hspec | func-runner | hspec | An older version is running on CW & Strive that is fully functional | +| Java | ✓ | junit | Yes | Yes | jvm-runner | junit | | +| JavaScript | ✓ | cw-2, mocha | cw-2 | cw-2, mocha | node-runner | cw-2 | | +| Julia | ✓!!! | Failing | | | | | | +| Lisp | ✓ | | Kumite Only | | func-runner | | | +| Lua | ✓ | | Kumite Only | | alt-runner | | | +| ObjC | ??? | ??? | | | | | | +| OCAML | ✓ | | Kumite Only | | func-runner | | | +| Perl | ✓ | | Kumite Only | | * | | | +| Php | ✓ | | Kumite Only | | alt-runner | | | +| Python 2 | ✓ | cw-2, unittest | cw-2 | cw-2, unittest | python-runner | cw-2 | | +| Python 3 | ✓ | cw-2, unittest | | cw-2, unittest | python-runner | cw-2 | | +| R | ✓ | | | | alt-runner | | | +| Racket | ✓ | | Kumite Only | | func-runner | | | +| Ruby | ✓ | cw-2, rspec | cw-2 | cw-2, rspec | ruby-runner | cw-2 | | +| Rust | ✓ | | | | | | | +| Scala | ✓ | | Kumite Only | | jvm-runner | | | +| Swift | ??? | ??? | | | | | Current contribution designed for OSX, need to move to OS linux version | +| TypeScript | ✓ | mocha | Kumite Only | | node-runner | | TypeScript utilizes `require` instead of concatenating files | + + +## Setup + +You should have Docker installed, if not do that first. Before you can run any of the code +environments you will need to build the proper Docker image. To get started lets work with the +node image. + +Run `make base node` to build the base and node images. This will take a few minutes. + +Once you image is built, you can create a container to work within it. Doing this means you do not +have to worry about having any of the project dependencies loaded directly on your machine. + +Run the following command: + +``` +docker run -it --rm --entrypoint bash -v $(pwd)/lib:/runner/lib -v $(pwd)/frameworks:/runner/frameworks -v $(pwd)/test:/runner/test codewars/node-runner +``` + +This will create a new container and send you into the instance with your project's lib and test directories mounted +as volumes. Mounting as a volume allows you to change files on your local machine and have those changes available to you +from within the container. + +> We do not mount the entire directory because that would overwrite things such as your node_modules directory. If you need +to update these you should `make node` the image to ensure you are always testing against the correct packages. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..495df6ce --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: '2' +services: + base: + build: + context: . + dockerfile: base.docker + image: codewars/base-runner + + ruby: + build: + context: . + dockerfile: ruby.docker + image: codewars/ruby-runner + + node: + build: + context: . + dockerfile: node.docker + image: codewars/node-runner \ No newline at end of file diff --git a/docker/alt.docker b/docker/alt.docker index 40aa1401..814cf439 100644 --- a/docker/alt.docker +++ b/docker/alt.docker @@ -1,32 +1,9 @@ -# BUILD-USING: docker build -t codewars/runner-julia . -# TEST-USING: docker run --rm -i -t --name=test-runner-julia --entrypoint=/bin/bash codewars/runner-julia -s -# RUN-USING: docker run --rm --name=runner-julia codewars/runner-julia --help - # Pull base image. -FROM codewars/runner-base - -# Install Julia -# Julia is really slow, but v0.3 is okay (see http://stackoverflow.com/a/20566032) -# In the future, don't use nightly builds, use releases -RUN add-apt-repository ppa:staticfloat/julianightlies -RUN add-apt-repository ppa:staticfloat/julia-deps -RUN apt-get update -RUN apt-get -y install julia -# Nightly builds have a noisy OpenBLAS error, workaround -RUN mv /usr/bin/julia /usr/bin/julia-noisy -RUN printf '#!/bin/bash\njulia-noisy "$@" 2> >(grep -v "OpenBLAS : Your OS does not support AVX instructions." 1>&2)' > /usr/bin/julia -RUN chmod a+x /usr/bin/julia - -# Install erlang -RUN echo "deb http://packages.erlang-solutions.com/ubuntu trusty contrib" >> /etc/apt/sources.list -RUN curl http://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | apt-key add - -RUN apt-get update -RUN apt-get -y install erlang-nox erlang-dev +FROM codewars/base-runner # Install PHP RUN apt-get -y install php-pear php5-dev libcurl3-openssl-dev - # Install GoLang WORKDIR /tmp # http://blog.labix.org/2013/06/15/in-flight-deb-packages-of-go @@ -36,12 +13,6 @@ RUN ./godeb install 1.3.1 RUN rm godeb #RUN apt-get install -y golang -# Install Rust 0.11 -# Workaround since the author of this PPA is Scandanavian, with a unicode name, and the tools hate this -RUN add-apt-repository "deb http://ppa.launchpad.net/hansjorg/rust/ubuntu trusty main" -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BD6B6386 -RUN apt-get update -RUN apt-get -y install rust-0.11 # Install Lua RUN apt-get install -y lua5.2 @@ -51,30 +22,13 @@ RUN apt-get install -y luarocks #RUN apt-add-repository ppa:swi-prolog/stable && apt-get update #RUN apt-get install -y swi-prolog -# Install ZMQ -#RUN luarocks install https://raw.github.com/Neopallium/lua-zmq/master/rockspecs/lua-zmq-scm-1.rockspec -RUN pecl install zmq-beta #php -RUN apt-get install -y libzeromq-perl #perl - -# Install Elixir -# Elixir needs a UTF-8 locale -RUN apt-get install -y locales && dpkg-reconfigure locales && locale-gen en_US.UTF-8 -WORKDIR /tmp -RUN git clone https://github.com/elixir-lang/elixir.git -WORKDIR /tmp/elixir -RUN git checkout tags/v1.0.0 -RUN make install -RUN rm -rf /tmp/elixir - - - # Install GNU R RUN apt-get install -y r-base # ADD cli-runner and install node deps -ADD . /codewars +ADD . /runner -WORKDIR /codewars +WORKDIR /runner RUN npm install # Run the test suite to make sure this thing works @@ -83,10 +37,7 @@ USER codewarrior # Set environment variables ENV USER codewarrior ENV HOME /home/codewarrior -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 -RUN mocha -t 5000 test/runners/{go,php,erlang,elixir,julia,rust,go,lua,perl,r}_spec.js +RUN mocha -t 3000 test/runners/{php,go,r,lua}_spec.js #timeout is a fallback in case an error with node #prevents it from exiting properly diff --git a/docker/base.docker b/docker/base.docker index 8bca4a79..2ee5a167 100644 --- a/docker/base.docker +++ b/docker/base.docker @@ -3,7 +3,35 @@ # RUN-USING: docker run --rm --name=runner-base codewars/runner-base --help # Pull base image. -FROM dockerfile/ubuntu +FROM buildpack-deps:trusty + +RUN apt-get update -qq + +# gpg keys listed at https://github.com/nodejs/node +RUN set -ex \ + && for key in \ + 9554F04D7259F04124DE6B476D5A82AC7E37093B \ + 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ + 0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \ + FD3A5288F042B6850C66B31F09FE44734EB7990E \ + 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ + DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ + B9AE9905FFD7803F25714661B63B535A4C206CA9 \ + C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ + ; do \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + done + +ENV NPM_CONFIG_LOGLEVEL info +ENV NODE_VERSION 5.8.0 + +# Install NodeJS +RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \ + && curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \ + && rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt # Set the env variables to non-interactive ENV DEBIAN_FRONTEND noninteractive @@ -21,42 +49,28 @@ CMD ["bash"] # Append any relevant run args as per the help -RUN apt-get update - +ENV NODE_ENV production ENTRYPOINT ["timeout", "15", "node"] -# Install Node.js (needed to run actual runner) -RUN add-apt-repository ppa:chris-lea/node.js -RUN apt-get update -RUN apt-get install -y nodejs -RUN su codewarrior -c "echo '\n# Node.js\nexport PATH=\"/codewars/node_modules/.bin:$PATH\"' >> ~codewarrior/.bash_profile" - # Install Redis RUN apt-get install -y redis-server -# Install MongoDB -RUN apt-get install -y mongodb-server && \ - mkdir -p /data/db && \ - chown codewarrior:codewarrior /data/db - # Install SQLITE RUN apt-get install -y sqlite libsqlite3-dev -# Install ElasticSearch -RUN wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.deb && \ - dpkg -i elasticsearch-1.1.1.deb +# Install MongoDB +RUN apt-get install -y mongodb -# Install RabitMQ -RUN apt-get install -y rabbitmq-server +RUN mkdir /.npm-global +RUN npm config set prefix '/.npm-global' +RUN su codewarrior -c "echo 'export PATH=\"/.npm-global/bin:$PATH\"' >> ~/.profile" +ENV PATH /.npm-global/bin:$PATH -# Install ZMQ -RUN apt-get install -y libzmq3-dev +# Install Node testing frameworks & additional frameworks +RUN npm install -g chai mocha # Install Python Basics -RUN apt-get install -y python-software-properties - -# Install Node testing frameworks & additional frameworks -RUN npm -g install chai mocha +RUN apt-get install -y python-minimal -# Install pkg-config for things that need to compile from source -RUN apt-get install -y pkg-config +# Install Git +RUN apt-get -y install git \ No newline at end of file diff --git a/docker/dotnet.docker b/docker/dotnet.docker index 8582a338..423075ef 100644 --- a/docker/dotnet.docker +++ b/docker/dotnet.docker @@ -3,7 +3,13 @@ # RUN-USING: docker run --rm --name=runner-dotnet codewars/runner-dotnet --help # Pull base image. -FROM codewars/runner-base +FROM codewars/base-runner + +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list +RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list + +RUN apt-get update # Install Mono RUN apt-get install -y mono-complete @@ -11,28 +17,10 @@ RUN apt-get install -y mono-complete # Install F# RUN apt-get install -y fsharp -# Install NuGet -RUN mkdir -p /usr/local/share/mono/ -WORKDIR /usr/local/share/mono/ -RUN mozroots --import --sync -RUN wget 'http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=nuget&DownloadId=835802&FileTime=130438931143730000&Build=20928' -O NuGet.exe - -RUN mono NuGet.exe update -self -RUN mono NuGet.exe install xunit ; \ - mono NuGet.exe install xunit.extensions ; \ - mono NuGet.exe install ; \ - mono NuGet.exe install log4net ; \ - mono NuGet.exe install mongocsharpdriver ; \ - mono NuGet.exe install System.Data.SQLite - -# this is currently breaking the build -#RUN mono NuGet.exe install NUnit ; \ -# mono NuGet.exe install NUnit.Runners ; \ - # ADD cli-runner and install node deps -ADD . /codewars +ADD . /runner -WORKDIR /codewars +WORKDIR /runner RUN npm install # Run the test suite to make sure this thing works @@ -43,6 +31,7 @@ ENV USER codewarrior ENV HOME /home/codewarrior RUN mocha -t 10000 test/runners/{csharp,fsharp}_spec.js +RUN mono -V #timeout is a fallback in case an error with node #prevents it from exiting properly diff --git a/docker/erlang.docker b/docker/erlang.docker new file mode 100644 index 00000000..8da02442 --- /dev/null +++ b/docker/erlang.docker @@ -0,0 +1,55 @@ +# Pull base image. +FROM codewars/base-runner + +WORKDIR /tmp +# Set the locale +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections + +RUN echo "deb http://packages.erlang-solutions.com/ubuntu trusty contrib" >> /etc/apt/sources.list && \ + apt-key adv --fetch-keys http://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc && \ + apt-get -qq update && apt-get install -y \ + esl-erlang \ + git \ + unzip \ + build-essential \ + wget && \ + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Download and Install Specific Version of Elixir +WORKDIR /elixir +RUN wget -q https://github.com/elixir-lang/elixir/releases/download/v1.2.4/Precompiled.zip && \ + unzip Precompiled.zip && \ + rm -f Precompiled.zip && \ + ln -s /elixir/bin/elixirc /usr/local/bin/elixirc && \ + ln -s /elixir/bin/elixir /usr/local/bin/elixir && \ + ln -s /elixir/bin/mix /usr/local/bin/mix && \ + ln -s /elixir/bin/iex /usr/local/bin/iex + +# Install local Elixir hex and rebar +RUN /usr/local/bin/mix local.hex --force && \ + /usr/local/bin/mix local.rebar --force + +WORKDIR / + +# ADD cli-runner and install node deps +ADD . /runner + +WORKDIR /runner +RUN npm install + +# Run the test suite to make sure this thing works + +USER codewarrior +# Set environment variables +ENV USER codewarrior +ENV HOME /home/codewarrior +RUN mocha -t 5000 test/runners/{erlang,elixir}_spec.js + +#timeout is a fallback in case an error with node +#prevents it from exiting properly +ENTRYPOINT ["timeout", "15", "node"] diff --git a/docker/full.docker b/docker/full.docker deleted file mode 100644 index 8459a396..00000000 --- a/docker/full.docker +++ /dev/null @@ -1,232 +0,0 @@ -# BUILD-USING: docker build -t codewars/cli-runner . -# TEST-USING: docker run --rm -i -t --name=test-cli-runner --entrypoint=/bin/bash codewars/cli-runner -s -# RUN-USING: docker run --rm --name=cli-runner codewars/cli-runner --help -# EXAMPLE USAGE: docker run --rm codewars/cli-runner run -l ruby -c "puts 1+1" - -# Pull base image. -FROM dockerfile/ubuntu - -# Set the env variables to non-interactive -ENV DEBIAN_FRONTEND noninteractive -ENV DEBIAN_PRIORITY critical -ENV DEBCONF_NOWARNINGS yes -ENV TERM linux -RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - -# ADD codewarrior user -RUN useradd codewarrior -RUN rm -rf ~codewarrior && cp -a ~root ~codewarrior && chown -R codewarrior:codewarrior ~codewarrior -RUN apt-get install -y python python-dev python-pip python-virtualenv - -# Define mountable directories. - -# Install Node.js -RUN add-apt-repository ppa:chris-lea/node.js -RUN apt-get update -RUN apt-get install -y nodejs -RUN su codewarrior -c "echo '\n# Node.js\nexport PATH=\"/codewars/node_modules/.bin:$PATH\"' >> ~codewarrior/.bash_profile" - -# Define default command. -CMD ["bash"] - -# Append any relevant run args as per the help - -RUN apt-get update - -# Install Mono -RUN apt-get install -y mono-csharp-shell --fix-missing - -# Install F# -RUN apt-get install -y fsharp - -# Install Coffeescript -RUN npm -g install coffee-script - -# Install Node testing frameworks & additional frameworks -RUN npm -g install chai mocha immutable - -# Install Lua -RUN apt-get install -y lua5.2 - -# Install Python 3 - -# Install Additional Python libraries -RUN sudo apt-get install -y python-numpy python-scipy python-pandas - -# Install Java 8 -# RUN apt-get install -y default-jre-headless default-jdk # default is OpenJDK6 -RUN add-apt-repository ppa:webupd8team/java -RUN apt-get update -# http://askubuntu.com/a/190674 -RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \ - echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections -RUN apt-get install -y oracle-java8-installer - -# Install Clojure (well, install Leiningen) -RUN curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > /usr/bin/lein -RUN chmod a+x /usr/bin/lein - -# Install Haskell -RUN apt-get install -y ghc cabal-install -RUN su codewarrior -c "cabal update" -RUN su codewarrior -c "cd ~codewarrior ; cabal install hspec" - -# Install Julia -# Julia is really slow, but v0.3 is okay (see http://stackoverflow.com/a/20566032) -# In the future, don't use nightly builds, use releases -RUN add-apt-repository ppa:staticfloat/julianightlies -RUN add-apt-repository ppa:staticfloat/julia-deps -RUN apt-get update -RUN apt-get -y install julia -# Nightly builds have a noisy OpenBLAS error, workaround -RUN mv /usr/bin/julia /usr/bin/julia-noisy -RUN printf '#!/bin/bash\njulia-noisy "$@" 2> >(grep -v "OpenBLAS : Your OS does not support AVX instructions." 1>&2)' > /usr/bin/julia -RUN chmod a+x /usr/bin/julia - -# Install erlang -RUN echo "deb http://packages.erlang-solutions.com/ubuntu trusty contrib" >> /etc/apt/sources.list -RUN curl http://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | apt-key add - -RUN apt-get update -RUN apt-get -y install erlang-nox erlang-dev - -# Install PHP -RUN apt-get -y install php5-cli - -# Install GoLang -WORKDIR /tmp -# http://blog.labix.org/2013/06/15/in-flight-deb-packages-of-go -# This was cool but then it stopped working... that sucks... ~Matt -RUN curl https://godeb.s3.amazonaws.com/godeb-amd64.tar.gz | tar zxv -RUN ./godeb install 1.3.1 -RUN rm godeb -#RUN apt-get install -y golang - -# Install TypeScript -RUN npm -g install typescript - -#Install ruby -RUN apt-get install -y python-software-properties && \ - apt-add-repository -y ppa:brightbox/ruby-ng && \ - apt-get update && \ - apt-get install -y ruby2.1 ruby2.1-dev && \ - update-alternatives --remove ruby /usr/bin/ruby2.1 && \ - update-alternatives --remove irb /usr/bin/irb2.1 && \ - update-alternatives --remove gem /usr/bin/gem2.1 && \ - update-alternatives \ - --install /usr/bin/ruby ruby /usr/bin/ruby2.1 50 \ - --slave /usr/bin/irb irb /usr/bin/irb2.1 \ - --slave /usr/bin/rake rake /usr/bin/rake2.1 \ - --slave /usr/bin/gem gem /usr/bin/gem2.1 \ - --slave /usr/bin/rdoc rdoc /usr/bin/rdoc2.1 \ - --slave /usr/bin/testrb testrb /usr/bin/testrb2.1 \ - --slave /usr/bin/erb erb /usr/bin/erb2.1 \ - --slave /usr/bin/ri ri /usr/bin/ri2.1 && \ - update-alternatives --config ruby && \ - update-alternatives --display ruby - -## install bundler -RUN gem install rspec --no-ri --no-rdoc -RUN gem install rspec-its --no-ri --no-rdoc - -#RUN gem install minitest --no-ri --no-rdoc - -# Install additional gems -RUN gem install rails --no-ri --no-rdoc - -# Install Racket -RUN apt-get -y install racket - -# Install SBCL (Steel Bank Common Lisp) -RUN apt-get -y install sbcl - -# Install Tiny C Compiler -RUN apt-get -y install tcc - -# Install CLANG 3.4 -RUN add-apt-repository ppa:ubuntu-toolchain-r/ppa -RUN apt-get update -RUN apt-get -y install clang-3.4 lldb-3.4 - -# Install OCAML -RUN apt-get -y install ocaml-nox - -# Install Rust 0.11 -# Workaround since the author of this PPA is Scandanavian, with a unicode name, and the tools hate this -RUN add-apt-repository "deb http://ppa.launchpad.net/hansjorg/rust/ubuntu trusty main" -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BD6B6386 -RUN apt-get update -RUN apt-get -y install rust-0.11 - -# Install SQLITE -RUN apt-get install -y sqlite libsqlite3-dev -RUN gem install sqlite3 --no-ri --no-rdoc -RUN npm -g install sqlite3 - -# Install MongoDB -RUN apt-get install -y mongodb-server && \ - mkdir -p /data/db && \ - chown codewarrior:codewarrior /data/db - -# Install mongo packages for languages -RUN npm -g install mongoose mongodb -RUN pip install pymongo -RUN gem install mongo --no-ri --no-rdoc -RUN gem install mongoid --no-ri --no-rdoc - -# Install Redis -RUN apt-get install -y redis-server - -# Install Redis Language packages -RUN npm -g install redis -RUN gem install redis --no-ri --no-rdoc -RUN pip install redis - -# CUDA 6 -#RUN wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_6.0-37_amd64.deb && \ -# dpkg -i cuda-repo-ubuntu1204_6.0-37_amd64.deb && \ -# rm cuda-repo-ubuntu1204_6.0-37_amd64.deb -#RUN apt-get update -#RUN apt-get install -y cuda-core-6-0 -# Install GPUOcelot -#RUN apt-get -y install subversion -#RUN svn checkout http://gpuocelot.googlecode.com/svn/trunk/ gpuocelot-read-only -#RUN apt-get -y install flex bison scons libboost-all-dev llvm llvm-dev freeglut3-dev libglew-dev -#RUN cd gpuocelot-read-only && \ -# ./build.py --install - -# NASM -RUN apt-get -y install nasm - -# ARM Assembly Emulation -RUN apt-get -y install gcc-4.7-arm-linux-gnueabi libc6-dev-armel-cross qemu-user - -# Install Persistent Database support for Haskell -RUN apt-get -y install libghc-zlib-dev && su codewarrior -c "cabal install esqueleto persistent-sqlite persistent-template" - -# Install Octave -RUN apt-get -y install octave - -# Install pip3 and pymongo for Python3 -RUN apt-get -y install python3-pip && pip3 install pymongo - -# ADD cli-runner and install node deps -ADD . /codewars - -# Build the jvm-runner -WORKDIR /codewars/jvm-runner -RUN [ -e target/jvm-runner-0.1.1-standalone.jar ] || LEIN_ROOT=true lein do clean, test, uberjar - -WORKDIR /codewars -RUN npm install - -# Run the test suite to make sure this thing works - -USER codewarrior -# Set environment variables -ENV USER codewarrior -ENV HOME /home/codewarrior -RUN mocha -t 5000 test/* - -#timeout is a fallback in case an error with node -#prevents it from exiting properly -ENTRYPOINT ["timeout", "15", "node"] diff --git a/docker/func.docker b/docker/func.docker index cc21445f..29a7e416 100644 --- a/docker/func.docker +++ b/docker/func.docker @@ -3,7 +3,7 @@ # RUN-USING: docker run --rm --name=runner-func codewars/runner-func --help # Pull base image. -FROM codewars/runner-base +FROM codewars/base-runner # Install Racket RUN apt-get -y install racket @@ -14,32 +14,40 @@ RUN apt-get -y install sbcl # Install OCAML RUN apt-get -y install ocaml-nox -# Install Haskell -RUN apt-get install -y ghc cabal-install -RUN su codewarrior -c "cabal update" -RUN su codewarrior -c "cd ~codewarrior ; cabal install hspec" - -# Install Persistent Database support for Haskell -RUN apt-get -y install libghc-zlib-dev - -WORKDIR /tmp -RUN su codewarrior -c "cabal install esqueleto persistent-sqlite persistent-template" +# Needed to run add-apt-repository +RUN apt-get -y install software-properties-common -# ZMQ -RUN apt-get install -y pkg-config -RUN su codewarrior -c "cabal install zeromq4-haskell" - -# Support hidding modules/built-ins -RUN apt-get install -y happy -RUN su codewarrior -c "cabal install haskell-src-exts" - -# Lens for haskell -RUN su codewarrior -c "cabal install lens" +# Install Haskell +## ensure locale is set during build +ENV LANG C.UTF-8 + +RUN apt-get -y install libghc-zlib-dev happy + +RUN echo 'deb http://ppa.launchpad.net/hvr/ghc/ubuntu trusty main' > /etc/apt/sources.list.d/ghc.list && \ + echo 'deb http://download.fpcomplete.com/debian/jessie stable main'| tee /etc/apt/sources.list.d/fpco.list && \ + # hvr keys + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F6F88286 && \ + # fpco keys + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C5705533DA4F78D8664B5DC0575159689BEFB442 && \ + apt-get update && \ + apt-get install -y --no-install-recommends cabal-install-1.22 ghc-7.10.3 happy-1.19.5 alex-3.1.4 \ + stack zlib1g-dev libtinfo-dev libsqlite3-0 libsqlite3-dev ca-certificates g++ && \ + rm -rf /var/lib/apt/lists/* + +ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/cabal/1.22/bin:/opt/ghc/7.10.3/bin:/opt/happy/1.19.5/bin:/opt/alex/3.1.4/bin:$PATH + +# Install Haskell Packages +RUN apt-get -y install libghc-zlib-dev pkg-config happy +RUN cabal update +RUN cabal install hspec +RUN cabal install haskell-src-exts lens +RUN cabal install esqueleto persistent-sqlite persistent-template +RUN cabal install split ifelse # ADD cli-runner and install node deps -ADD . /codewars +ADD . /runner -WORKDIR /codewars +WORKDIR /runner RUN npm install # Run the test suite to make sure this thing works @@ -48,7 +56,7 @@ USER codewarrior # Set environment variables ENV USER codewarrior ENV HOME /home/codewarrior -RUN mocha -t 5000 test/runners/{haskell,ocaml,lisp,racket}_spec.js +#RUN mocha -t 5000 test/runners/{haskell,ocaml,lisp,racket}_spec.js #timeout is a fallback in case an error with node #prevents it from exiting properly diff --git a/docker/jvm.docker b/docker/jvm.docker index b6bcaf0d..353d2dcd 100644 --- a/docker/jvm.docker +++ b/docker/jvm.docker @@ -3,7 +3,10 @@ # RUN-USING: docker run --rm --name=runner-jvm codewars/runner-jvm --help # Pull base image. -FROM codewars/runner-base +FROM codewars/base-runner + +# Needed to run add-apt-repository +RUN apt-get -y install software-properties-common # Install Java 8 # RUN apt-get install -y default-jre-headless default-jdk # default is OpenJDK6 @@ -18,51 +21,20 @@ RUN apt-get install -y oracle-java8-installer RUN curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > /usr/bin/lein RUN chmod a+x /usr/bin/lein RUN mkdir ~/.lein -RUN echo '{:user {\ -:dependencies [\ - [org.clojure/clojure "1.6.0"] \ - [cheshire "5.3.1"] \ - [korma "0.3.0"] \ - [com.h2database/h2 "1.3.170"] \ - [org.xerial/sqlite-jdbc "3.7.15-M1"] \ - [com.novemberain/monger "2.0.0"] \ - [com.taoensso/carmine "2.7.0" :exclusions [org.clojure/clojure]] \ - [org.clojure/core.async "0.1.346.0-17112a-alpha"] \ - [org.clojure/test.check "0.5.9"] \ - [prismatic/schema "0.2.6"] \ - [instaparse "1.3.4"] \ - [org.clojure/core.logic "0.8.8"] \ - [org.clojure/core.match "0.2.1"] \ - [prismatic/plumbing "0.3.3"] \ - [slingshot "0.11.0"] \ - [compojure "1.1.9"] \ - [clj-http "1.0.0"] \ - [enlive "1.1.5"] \ - [hiccup "1.0.5"] \ - [junit/junit "4.11"] \ - [org.codehaus.groovy/groovy-all "2.3.6"] \ - [environ "0.5.0"] \ -] \ -:plugins [ \ - [lein-exec "0.3.4"] \ - [lein-environ "0.5.0"] \ -]}}' > ~/.lein/profiles.clj -RUN LEIN_ROOT=true lein exec -e '(prn :ok)' # Install scala RUN apt-get install -y scala RUN curl http://downloads.typesafe.com/scala/2.11.2/scala-2.11.2.deb > /tmp/scala-2.11.2.deb RUN dpkg -i /tmp/scala-2.11.2.deb && rm /tmp/scala-2.11.2.deb - # ADD cli-runner and install node deps -ADD . /codewars +ADD . /runner # Build the jvm-runner -WORKDIR /codewars/jvm-runner +WORKDIR /runner/jvm-runner RUN LEIN_ROOT=true lein do clean, test, uberjar -WORKDIR /codewars +WORKDIR /runner RUN npm install # Run the test suite to make sure this thing works diff --git a/docker/node.docker b/docker/node.docker index 3b6c1dd9..2b3d7752 100644 --- a/docker/node.docker +++ b/docker/node.docker @@ -1,13 +1,36 @@ -# BUILD-USING: docker build -t codewars/runner-node . -# TEST-USING: docker run --rm -i -t --name=test-runner-node --entrypoint=/bin/bash codewars/runner-node -s -# RUN-USING: docker run --rm --name=runner-node codewars/runner-node --help -# EXAMPLE USAGE: docker run --rm codewars/runner-node run -l javascript -c "console.log(1+1)" +# RUN-USING: docker run --rm --name=node codewars/node-runner --help +# EXAMPLE USAGE: docker run --rm codewars/node-runner run -l javascript -c "console.log(1+1)" # Pull base image. -FROM codewars/runner-base +FROM codewars/base-runner -# Install Haxe -RUN apt-get install -y haxe +# Install additional libraries +# HACK: installing globallying and then linking has a less buggy experience. +# NOTE: we dont configure these via package.json in order to prevent having to re-install them on each code change +RUN npm link chai +RUN npm install immutable -gq; npm link immutable +RUN npm install deku -gq; npm link deku +RUN npm install quickcheck -gq; npm link quickcheck +RUN npm install should -gq; npm link should +RUN npm install expect -gq; npm link expect +RUN npm install chai-spies -gq; npm link chai-spies +RUN npm install chai-stats -gq; npm link chai-stats +RUN npm install chai-factories -gq; npm link chai-factories +RUN npm install chai-things -gq; npm link chai-things +RUN npm install chai-fuzzy -gq; npm link chai-fuzzy +RUN npm install chai-interface -gq; npm link chai-interface +RUN npm install chai-change -gq; npm link chai-change +RUN npm install chai-subset -gq; npm link chai-subset +RUN npm install rx -gq; npm link rx +RUN npm install baconjs -gq; npm link baconjs +RUN npm install lodash -gq; npm link lodash +RUN npm install react -gq; npm link react +RUN npm install react-dom -gq; npm link react-dom +RUN npm install mongoose -gq; npm link mongoose +RUN npm install mongodb -gq; npm link mongodb +RUN npm install redis -gq; npm link redis +RUN npm install sqlite3 -gq; npm link sqlite3 +RUN npm install elasticsearch -gq; npm link elasticsearch # Install Coffeescript RUN npm -g install coffee-script @@ -15,28 +38,36 @@ RUN npm -g install coffee-script # Install TypeScript RUN npm -g install typescript -RUN npm -g install chai mocha +# install TypeScript type definitions +RUN npm install -gq typings; npm link typings -RUN npm -g install mongoose mongodb -RUN npm -g install redis -RUN npm -g install sqlite3 -RUN npm -g install elasticsearch -RUN npm -g install zmq -RUN npm -g install immutable +RUN typings install node --ambient +RUN typings install mocha --ambient +RUN typings install mocha-node --ambient +RUN typings install chai --ambient +RUN typings install react --ambient +RUN typings install lodash --ambient +RUN typings install baconjs --ambient +RUN typings install rx --ambient +RUN typings install mongoose --ambient +RUN typings install redis --ambient # ADD cli-runner and install node deps -ADD . /codewars +ADD . /runner -WORKDIR /codewars +WORKDIR /runner RUN npm install +RUN npm install --only=dev +RUN npm dedupe # needed to fix slow babeljs performance +ENV NODE_PATH /usr/lib/node_modules -# Run the test suite to make sure this thing works - -USER codewarrior # Set environment variables +USER codewarrior ENV USER codewarrior ENV HOME /home/codewarrior -RUN mocha -t 5000 test/runners/javascript_spec.js test/runners/coffeescript_spec.js test/runners/typescript_spec.js + +# Run the test suite to make sure this thing works +#RUN mocha -t 5000 test/runners/{javascript,coffeescript,typescript}_spec.js #timeout is a fallback in case an error with node #prevents it from exiting properly diff --git a/docker/python.docker b/docker/python.docker index de9a78f9..6352a37b 100644 --- a/docker/python.docker +++ b/docker/python.docker @@ -1,26 +1,23 @@ -# BUILD-USING: docker build -t codewars/runner-python . -# TEST-USING: docker run --rm -i -t --name=test-runner-python --entrypoint=/bin/bash codewars/runner-python -s -# RUN-USING: docker run --rm --name=runner-python codewars/runner-python --help -# EXAMPLE USAGE: docker run --rm codewars/runner-python run -l python -c "print 1+1 " -# docker run --rm codewars/runner-python run -l python3 -c "print(1+1)" +# EXAMPLE USAGE: docker run --rm codewars/python-runner run -l python -c "print 1+1 " +# docker run --rm codewars/python-runner run -l python3 -c "print(1+1)" # Pull base image. -FROM codewars/runner-base +FROM codewars/base-runner # Install Additional Python libraries -RUN sudo apt-get install -y python-pip python-numpy python-scipy python-pandas +RUN apt-get install -y python-pip python-numpy python-scipy python-pandas # Install Python 3 -RUN sudo apt-get install -y python3-pip python3-numpy python3-scipy python3-pandas +RUN apt-get install -y python3-pip python3-numpy python3-scipy python3-pandas # Install Packages -RUN pip install pymongo redis pyzmq -RUN pip3 install pymongo redis pyzmq +RUN pip install pymongo redis +RUN pip3 install pymongo redis # ADD cli-runner and install node deps -ADD . /codewars +ADD . /runner -WORKDIR /codewars +WORKDIR /runner RUN npm install # Run the test suite to make sure this thing works diff --git a/docker/ruby.docker b/docker/ruby.docker index 6b4fe3ec..4ebc5c62 100644 --- a/docker/ruby.docker +++ b/docker/ruby.docker @@ -4,32 +4,68 @@ # EXAMPLE USAGE: docker run --rm codewars/runner-ruby run -l ruby -c "puts 1+1" # Pull base image. -FROM codewars/runner-base +FROM codewars/base-runner #Install ruby -RUN apt-add-repository -y ppa:brightbox/ruby-ng && \ - apt-get update && \ - apt-get install -y ruby2.1 ruby2.1-dev && \ - update-alternatives --remove ruby /usr/bin/ruby2.1 && \ - update-alternatives --remove irb /usr/bin/irb2.1 && \ - update-alternatives --remove gem /usr/bin/gem2.1 && \ - update-alternatives \ - --install /usr/bin/ruby ruby /usr/bin/ruby2.1 50 \ - --slave /usr/bin/irb irb /usr/bin/irb2.1 \ - --slave /usr/bin/rake rake /usr/bin/rake2.1 \ - --slave /usr/bin/gem gem /usr/bin/gem2.1 \ - --slave /usr/bin/rdoc rdoc /usr/bin/rdoc2.1 \ - --slave /usr/bin/testrb testrb /usr/bin/testrb2.1 \ - --slave /usr/bin/erb erb /usr/bin/erb2.1 \ - --slave /usr/bin/ri ri /usr/bin/ri2.1 && \ - update-alternatives --config ruby && \ - update-alternatives --display ruby - -## install Rspec +# skip installing gem documentation +RUN mkdir -p /usr/local/etc \ + && { \ + echo 'install: --no-document'; \ + echo 'update: --no-document'; \ + } >> /usr/local/etc/gemrc + +ENV RUBY_MAJOR 2.3 +ENV RUBY_VERSION 2.3.0 +ENV RUBY_DOWNLOAD_SHA256 ba5ba60e5f1aa21b4ef8e9bf35b9ddb57286cb546aac4b5a28c71f459467e507 +ENV RUBYGEMS_VERSION 2.6.1 + +# some of ruby's build scripts are written in ruby +# we purge this later to make sure our final image uses what we just built +RUN set -ex \ + && buildDeps=' \ + bison \ + libgdbm-dev \ + ruby \ + ' \ + && apt-get update \ + && apt-get install -y --no-install-recommends $buildDeps \ + && rm -rf /var/lib/apt/lists/* \ + && curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \ + && echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.gz" | sha256sum -c - \ + && mkdir -p /usr/src/ruby \ + && tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \ + && rm ruby.tar.gz \ + && cd /usr/src/ruby \ + && { echo '#define ENABLE_PATH_CHECK 0'; echo; cat file.c; } > file.c.new && mv file.c.new file.c \ + && autoconf \ + && ./configure --disable-install-doc \ + && make -j"$(nproc)" \ + && make install \ + && apt-get purge -y --auto-remove $buildDeps \ + && gem update --system $RUBYGEMS_VERSION \ + && rm -r /usr/src/ruby + +ENV BUNDLER_VERSION 1.11.2 + +RUN gem install bundler --version "$BUNDLER_VERSION" + +# install things globally, for great justice +# and don't create ".bundle" in all our apps +ENV GEM_HOME /usr/local/bundle +ENV BUNDLE_PATH="$GEM_HOME" \ + BUNDLE_BIN="$GEM_HOME/bin" \ + BUNDLE_SILENCE_ROOT_WARNING=1 \ + BUNDLE_APP_CONFIG="$GEM_HOME" +ENV PATH $BUNDLE_BIN:$PATH +RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \ + && chmod 777 "$GEM_HOME" "$BUNDLE_BIN" + +# Ruby Gems RUN gem install rspec --no-ri --no-rdoc RUN gem install rspec-its --no-ri --no-rdoc -#RUN gem install minitest --no-ri --no-rdoc +# needed for nokogiri +RUN apt-get -y install zlib1g-dev # Install additional gems RUN gem install pry --no-ri --no-rdoc @@ -54,15 +90,37 @@ RUN gem install googlecharts --no-ri --no-rdoc RUN gem install ffi-rzmq --no-ri --no-rdoc RUN gem install bunny --no-ri --no-rdoc RUN gem install amqp --no-ri --no-rdoc -RUN gem install functional-ruby --no-ri --no-rdoc RUN gem install concurrent-ruby --no-ri --no-rdoc -#RUN gem install gruff --no-ri --no-rdoc -#RUN gem install chartkick --no-ri --no-rdoc +RUN gem install sciruby --no-ri --no-rdoc +# reduced selection of sciruby-full gems since all needed build dependencies are not installed +RUN gem install ai4r --no-ri --no-rdoc +RUN gem install algorithms --no-ri --no-rdoc +RUN gem install awesome_print --no-ri --no-rdoc +RUN gem install classifier --no-ri --no-rdoc +RUN gem install daru --no-ri --no-rdoc +RUN gem install darwinning --no-ri --no-rdoc +RUN gem install decisiontree --no-ri --no-rdoc +RUN gem install distribution --no-ri --no-rdoc +RUN gem install gga4r --no-ri --no-rdoc +RUN gem install gimuby --no-ri --no-rdoc +RUN gem install hamster --no-ri --no-rdoc +RUN gem install histogram --no-ri --no-rdoc +RUN gem install measurable --no-ri --no-rdoc +RUN gem install mikon --no-ri --no-rdoc +RUN gem install minimization --no-ri --no-rdoc +RUN gem install narray --no-ri --no-rdoc +RUN gem install ruby-fann --no-ri --no-rdoc +RUN gem install statsample --no-ri --no-rdoc +RUN gem install statsample-glm --no-ri --no-rdoc +RUN gem install statsample-timeseries --no-ri --no-rdoc +RUN gem install stuff-classifier --no-ri --no-rdoc +RUN gem install symbolic --no-ri --no-rdoc +RUN gem install unit --no-ri --no-rdoc # ADD cli-runner and install node deps -ADD . /codewars +ADD . /runner -WORKDIR /codewars +WORKDIR /runner RUN npm install # Run the test suite to make sure this thing works diff --git a/docker/systems.docker b/docker/systems.docker index 24809ae0..735c3412 100644 --- a/docker/systems.docker +++ b/docker/systems.docker @@ -4,11 +4,14 @@ # Pull base image. -FROM codewars/runner-base +FROM codewars/base-runner # Install Tiny C Compiler RUN apt-get -y install tcc +# Needed to run add-apt-repository +RUN apt-get -y install software-properties-common + # Install CLANG 3.4 RUN add-apt-repository ppa:ubuntu-toolchain-r/ppa RUN apt-get update @@ -21,9 +24,9 @@ RUN apt-get -y install nasm RUN apt-get -y install gcc-4.7-arm-linux-gnueabi libc6-dev-armel-cross qemu-user # ADD cli-runner and install node deps -ADD . /codewars +ADD . /runner -WORKDIR /codewars +WORKDIR /runner RUN npm install # Run the test suite to make sure this thing works @@ -32,12 +35,7 @@ USER codewarrior # Set environment variables ENV USER codewarrior ENV HOME /home/codewarrior -RUN mocha -t 5000 test/runners/c_spec.js \ - test/runners/cpp_spec.js \ - test/runners/bash_spec.js \ - test/runners/arm_spec.js \ - test/runners/gas_spec.js \ - test/runners/nasm_spec.js +RUN mocha -t 5000 test/runners/{gas,nasm,arm,cpp}_spec.js #timeout is a fallback in case an error with node #prevents it from exiting properly diff --git a/examples/clojure.yml b/examples/clojure.yml new file mode 100644 index 00000000..d25f04f0 --- /dev/null +++ b/examples/clojure.yml @@ -0,0 +1,32 @@ +'clojure.test': + reference: + initial: |- + (ns oldest) + (defn two-oldest-ages + "Returns the two oldest ages" + ;; TODO: Program me + ) + + answer: |- + (ns oldest) + (defn two-oldest-ages + "Returns the two oldest ages" + [ages] + (->> ages + sort + reverse + (take 2) + reverse)) + + fixture: |- + (ns oldest-test + (:require [clojure.test :refer :all] + [oldest :refer [two-oldest-ages]])) + + (deftest basic-test + (let [input1 [1 5 87 45 8 8] + input2 [6 5 83 5 3 18]] + (testing (str "input1: " input1) + (is (= (two-oldest-ages input1) [45 87]))) + (testing (str "input2: " input2) + (is (= (two-oldest-ages input2) [18 83]))))) \ No newline at end of file diff --git a/examples/coffeescript.yml b/examples/coffeescript.yml new file mode 100644 index 00000000..1c91740b --- /dev/null +++ b/examples/coffeescript.yml @@ -0,0 +1,90 @@ +cw-2: + algorithms: + initial: |- + # return the two oldest/oldest ages within the array of ages passed in. + # it should return the two ages as a sorted array, youngest age first + twoOldestAges = (ages) -> + + answer: |- + twoOldestAges = (ages) -> + oldest = 0 + nextOldest = 0; + for age in ages + if age > oldest + nextOldest = oldest + oldest = age + else if age > nextOldest + nextOldest = age + [nextOldest, oldest] + + fixture: |- + Test.describe "twoOldestAges([1,5,87,45,8,8])", -> + results1 = twoOldestAges [1,5,87,45,8,8] + Test.it "Should return something that isn't falsy", -> + Test.expect results1, "Something is wrong, twoOldestAges([1,5,87,45,8,8]) has no results!" + Test.it "Should return [45,87]", -> + Test.assertEquals results1[0], 45, "twoOldestAges([1,5,87,45,8,8]) should return 45 as the second highest result" + Test.assertEquals results1[1], 87, "twoOldestAges([1,5,87,45,8,8]) should return 87 as the second highest result" + + Test.describe "twoOldestAges([6,5,83,5,3,18])", -> + results2 = twoOldestAges [6,5,83,5,3,18] + Test.assertSimilar results2, [18, 83] + + bug fixes: + initial: |- + class Person + constructor: (@name) -> + + #TODO: The greet function is not returning the expected value. + greet: -> "Hello my name is #{name}" + + answer: |- + class Person + constructor: (@name) -> + + greet: -> "Hello my name is #{@name}" + + fixture: |- + jack = new Person "Jack" + jill = new Person "Jill" + + Test.expect jack.name == "Jack", "person.name property does have have a valid value" + + Test.expect jack.greet() == "Hello my name is Jack" + Test.expect jill.greet() == "Hello my name is Jill" + + refactoring: + initial: |- + # TODO: This method needs to be called multiple times for the same person (myName). + # It would be nice if we didnt have to always pass in myName every time we needed to great someone. + + greet = (myName, yourName) -> "Hello #{yourName}, my name is #{myName}" + + answer: |- + class Person + constructor: (@name) -> + + greet: (yourName) -> + "Hello #{yourName}, my name is #{@name}" + + fixture: |- + jack = new Person "Jack" + jill = new Person "Jill" + + Test.expect jack.greet("Jill") == "Hello Jill, my name is Jack" + Test.expect jack.greet("Mary") == "Hello Mary, my name is Jack" + + Test.expect jill.greet("Jack") == "Hello Jack, my name is Jill" + + reference: + initial: |- + websites = [] + + answer: |- + # add the values "codewars" to the websites array + websites = ["codewars"] + + fixture: |- + Test.expect(websites.length > 0, 'The array is still empty') + Test.expect(websites.length == 1, 'The array contains too many values') + Test.expect(websites[0] == 'codewars', 'The array does not contain the correct value "codewars"') diff --git a/examples/csharp.yml b/examples/csharp.yml new file mode 100644 index 00000000..e178284c --- /dev/null +++ b/examples/csharp.yml @@ -0,0 +1,80 @@ +nunit: + algorithms: + initial: |- + namespace Bank { + using System; + public class Account + { + private decimal balance; + public void Deposit(decimal amount) + { + } + + public void Withdraw(decimal amount) + { + } + + public void TransferFunds(Account destination, decimal amount) + { + } + + public decimal Balance { get { return balance; } } + } + } + + answer: |- + namespace Bank { + using System; + public class Account + { + private decimal balance; + public void Deposit(decimal amount) + { + balance += amount; + } + + public void Withdraw(decimal amount) + { + balance -= amount; + } + + public void TransferFunds(Account destination, decimal amount) + { + destination.Deposit(amount); + this.Withdraw(amount); + } + + public decimal Balance { get { return balance; } } + } + } + + fixture: |- + namespace Bank { + using NUnit.Framework; + using System; + [TestFixture] + public class AccountTest + { + [Test] + public void TransferFunds() + { + Account source = new Account(); + source.Deposit(200m); + Account destination = new Account(); + destination.Deposit(150m); + source.TransferFunds(destination, 100m); + Assert.AreEqual(250m, destination.Balance); + Assert.AreEqual(100m, source.Balance); + } + + [Test] + public void CheckFunds() + { + Account source = new Account(); + source.Deposit(200m); + Account destination = new Account(); + destination.Deposit(150m); + Assert.AreEqual(200m, source.Balance); + } + } + } \ No newline at end of file diff --git a/examples/haskell.yml b/examples/haskell.yml new file mode 100644 index 00000000..f1989408 --- /dev/null +++ b/examples/haskell.yml @@ -0,0 +1,48 @@ +hspec: + reference: + initial: |- + module Oldest where + + -- | Return the two oldest/oldest ages within the array of ages passed in. + -- it should return the two ages as a sorted array, youngest age first + twoOldestAges :: [Integer] -> (Integer,Integer) + -- TODO: Write me + + answer: |- + module Oldest where + import Data.List (sort) + + -- | Return the two oldest/oldest ages within the array of ages passed in. + -- it should return the two ages as a sorted array, youngest age first + twoOldestAges :: [Integer] -> (Integer,Integer) + twoOldestAges ages = + let [b,a] = take 2 $ reverse $ sort $ ages + in (a,b) + + fixture: |- + module Oldest.Test where + import Oldest + import Test.Hspec + import Text.Printf + + -- Codewars wraps HSpec: http://hspec.github.io/ + main = hspec $ do + -- hspec lets you test your code in blocks, like RSpec + describe "twoOldestAges" $ do + -- hspec supports nested describe blocks + describe (show input1) $ do + -- Individual tests are specified with 'it' + it (printf "should return %s given %s as input" (show expected1) (show input1)) + $ do + let (a,b) = twoOldestAges input1 + -- You can test multiple things in an individual test if you want + a `shouldBe` fst expected1 + b `shouldBe` snd expected1 + describe (show input2) $ do + it (printf "should return %s given %s as input" (show expected2) (show input2)) + $ do twoOldestAges input2 `shouldBe` expected2 + where + input1 = [1,5,87,45,8,8] + expected1 = (45,87) + input2 = [6,5,83,5,3,18] + expected2 = (18,83) \ No newline at end of file diff --git a/examples/java.yml b/examples/java.yml new file mode 100644 index 00000000..8d21e363 --- /dev/null +++ b/examples/java.yml @@ -0,0 +1,42 @@ +junit: + reference: + initial: |- + public class Person { + String name; + + public Person(String personName) { + // TODO: Program Constructor + } + + public String greet(String yourName) { + // TODO: Write a greeting string + } + } + + answer: |- + public class Person { + String name; + + public Person(String personName) { + name = personName; + } + + public String greet(String yourName) { + return String.format("Konbanwa! My name is %s. It is nice to meet you, %s!", this.name, yourName); + } + } + + fixture: |- + import org.junit.Test; + import static org.junit.Assert.assertEquals; + import org.junit.runners.JUnit4; + + + public class PersonTest { + @Test + public void testGreet() { + Person shoki = new Person("Shoki, the Demon Queller"); + assertEquals("Konbanwa! My name is Shoki, the Demon Queller. It is nice to meet you, Sun Wukong, the Monkey King!", + shoki.greet("Sun Wukong, the Monkey King")); + } + } \ No newline at end of file diff --git a/examples/javascript.yml b/examples/javascript.yml new file mode 100644 index 00000000..44301488 --- /dev/null +++ b/examples/javascript.yml @@ -0,0 +1,102 @@ +cw-2: + algorithms: + initial: |- + // return the two oldest/oldest ages within the array of ages passed in. + // it should return the two ages as a sorted array, youngest age first + function twoOldestAges(ages){ + + } + + answer: |- + function twoOldestAges(ages){ + var oldest = 0, nextOldest; + for(var i = 0;i < ages.length;i++){ + var age = ages[i]; + if (age > oldest){ + nextOldest = oldest; + oldest = age; + } + else if(age > nextOldest){ + nextOldest = age; + } + } + return [nextOldest, oldest]; + } + + fixture: |- + Test.describe("twoOldestAges([1,5,87,45,8,8])", function() { + var results1 = twoOldestAges([1, 5, 87, 45, 8, 8]); + Test.it("Should return something that isn't falsy", function() { + Test.expect(results1, "Something is wrong, twoOldestAges([1,5,87,45,8,8]) has no results!"); + }); + Test.it("Should return [45,87]", function() { + Test.assertEquals(results1[0], 45, "twoOldestAges([1,5,87,45,8,8]) should return 45 as the second highest result"); + Test.assertEquals(results1[1], 87, "twoOldestAges([1,5,87,45,8,8]) should return 87 as the second highest result"); + }); + }); + + Test.describe("twoOldestAges([6,5,83,5,3,18])", function() { + var results2 = twoOldestAges([6, 5, 83, 5, 3, 18]); + Test.assertSimilar(results2, [18, 83]); + }); + + bug fixes: + initial: |- + function Person(name){ + this.name = name + } + + //TODO: The greet function is not returning the expected value. + Person.prototype.greet = function(){ + return "Hello my name is " + name + } + + answer: |- + function Person(name){ + this.name = name + } + + Person.prototype.greet = function(){ + return "Hello my name is " + this.name; + } + + fixture: |- + var jack = new Person("Jack"); + var jill = new Person("Jill"); + + Test.expect(jack.name == "Jack", "person.name does not have a valid value"); + + Test.expect(jack.greet, "greet method does not exist on the Person instance"); + Test.expect(jack.greet() === "Hello my name is Jack"); + Test.expect(jill.greet() === "Hello my name is Jill"); + + refactoring: + initial: |- + // TODO: This method needs to be called multiple times for the same person (myName). + // It would be nice if we didnt have to always pass in myName every time we needed to great someone. + + function greet(myName, yourName){ + return "Hello " + yourName + ", my name is " + myName; + } + + answer: |- + function Person(name){ + this.name = name + } + + Person.prototype.greet = function(yourName){ + return "Hello " + yourName + ", my name is " + this.name + } + + reference: + initial: |- + var websites = []; + + answer: |- + // add the values "codewars" to the websites array + var websites = ['codewars']; + + fixture: |- + Test.expect(websites.length > 0, 'The array is still empty') + Test.expect(websites.length == 1, 'The array contains too many values') + Test.expect(websites[0] == 'codewars', 'The array does not contain the correct value "codewars"') \ No newline at end of file diff --git a/examples/javascript/cw-v2/fixture.js b/examples/javascript/cw-v2/fixture.js deleted file mode 100644 index 6f8be35e..00000000 --- a/examples/javascript/cw-v2/fixture.js +++ /dev/null @@ -1 +0,0 @@ -Test.expect(a == 1); \ No newline at end of file diff --git a/examples/javascript/cw-v2/project.js b/examples/javascript/cw-v2/project.js deleted file mode 100644 index ec1d07a4..00000000 --- a/examples/javascript/cw-v2/project.js +++ /dev/null @@ -1,12 +0,0 @@ -var __fs = require( 'fs' ), __vm = require('vm'); -function __include(path) { - var code = __fs.readFileSync(path, 'utf-8'); - __vm.runInThisContext(code, path); -} -require('../../../frameworks/javascript/cw-js-v2'); - -__include('./solution'); -(function() { - __include('./fixture'); -})(); - diff --git a/examples/javascript/cw-v2/solution.js b/examples/javascript/cw-v2/solution.js deleted file mode 100644 index 8359463d..00000000 --- a/examples/javascript/cw-v2/solution.js +++ /dev/null @@ -1 +0,0 @@ -a = 1; \ No newline at end of file diff --git a/examples/python.yml b/examples/python.yml new file mode 100644 index 00000000..0287ecc2 --- /dev/null +++ b/examples/python.yml @@ -0,0 +1,135 @@ +cw-2: + algorithms: + initial: |- + # return the two oldest/oldest ages within the array of ages passed in. + # it should return the two ages as a sorted array, youngest age first + def two_oldest_ages(ages): + # TODO: complete + + answer: |- + def two_oldest_ages(ages): + oldest = 0 + next_oldest = 0; + for age in ages: + if age > oldest: + next_oldest = oldest + oldest = age + elif age > next_oldest: + next_oldest = age + + return [next_oldest, oldest] + + fixture: |- + # some example data + results1 = two_oldest_ages([1,5,87,45,8,8]) + results2 = two_oldest_ages([6,5,83,5,3,18]) + + # NOTE: You can use Test or test, whichever you prefer. + + # Use "describe" to label your test suite. + Test.describe("two_oldest_ages:") + + # Use "it" to identify the conditions you are testing for + Test.it("should return the second oldest age first") + # using assert_equals will report the invalid values to the user + Test.assert_equals(results1[0], 45) + # using expect will just give a user a generic error message, unless you provide a message + Test.expect(results2[0] == 18, "Number is not the second oldest") + + # its best practice to test for multiple groups of tests, using it calls. + Test.it("should return the oldest age last") + + Test.assert_equals(results1[1], 87) + Test.expect(results2[1] == 83, "Number is not the oldest") + + bug fixes: + initial: |- + def add(a, b): + a + b + + answer: |- + def add(a, b): + return a + b + + fixture: |- + # Use "describe" to define the test suite + test.describe('add method') + + # Use "it" to indicate a condition you are testing for + test.it('should add both arguments and return') + + # "assert_equals" will return information about what values were + # expect if the assertion fails. This can be very useful to other + # users trying to pass the kata. + test.assert_equals(add(1,2), 3) + + # "expect" is a lower level assertion that will allow you to test + # anything. It just needs a boolean result. You should pass a message + # as the second parameter so that if the assertion fails the user + # will be giving some useful information. + test.expect(add(1,1) == 2, "add(1,1) should == 2") + + refactoring: + initial: |- + # refactor this method into a Person class with its own greet method + def greet(you, me): + return "Hello {0}, my name is {1}".format(you, me) + + answer: |- + class Person: + def __init__(self, name): + self.name = name + + def greet(self, name): + return "Hello {0}, my name is {1}".format(name, self.name) + + fixture: |- + # Use "describe" to define the test suite + test.describe('Person') + + jack = Person('Jack') + + # Use "it" to indicate a condition you are testing for + test.it('should have a name') + + # "assert_equals" will return information about what values were + # expect if the assertion fails. This can be very useful to other + # users trying to pass the kata. + test.assert_equals(jack.name, "Jack") + + + test.it("should greet Jill") + + test.assert_equals(jack.greet("Jill"), "Hello Jill, my name is Jack") + + test.it("should greet other people as well") + + # unlike "assert_equals", "expect" is a lower level assertion that + # takes a boolean to determine if it passes. If it fails it will + # output the message that you give it, or a generic one. It is a good + # idea to provide a custom error message to help users pass the kata + test.expect(jack.greet("Jane") == "Hello Jane, my name is Jack", "Jack apparently is only able to greet Jane") + + reference: + initial: |- + # create an array called websites that has "codewars" as its only value + + answer: |- + websites = ['codewars'] + + fixture: |- + # Use test.describe (or Test.describe) to describe your test suite + test.describe("websites") + + # Use "it" calls to describe the specific test case + test.it("should have the value 'codewars' inside of it") + + # assert equals will pass if both items equal each other (using ==). If + # the test fails, assert_equals will output a descriptive message indicating + # what the values were expected to be. + test.assert_equals(['codewars'], websites) + + # you can also use the lower level test.expect. If you use test.expect directly then + # you should provide a custom error message, as the default one will be pretty useless + # to users trying to pass the kata. + test.expect(['codewars'] == websites, 'Array does not have correct value') \ No newline at end of file diff --git a/examples/python3.yml b/examples/python3.yml new file mode 100644 index 00000000..02392cbb --- /dev/null +++ b/examples/python3.yml @@ -0,0 +1,134 @@ +cw-2: + algorithms: + initial: |- + # return the two oldest/oldest ages within the array of ages passed in. + # it should return the two ages as a sorted array, youngest age first + def two_oldest_ages(ages): + # TODO: complete + + answer: |- + def two_oldest_ages(ages): + oldest = 0 + next_oldest = 0; + for age in ages: + if age > oldest: + next_oldest = oldest + oldest = age + elif age > next_oldest: + next_oldest = age + + return [next_oldest, oldest] + + fixture: |- + # some example data + results1 = two_oldest_ages([1,5,87,45,8,8]) + results2 = two_oldest_ages([6,5,83,5,3,18]) + + # NOTE: You can use Test or test, whichever you prefer. + + # Use "describe" to label your test suite. + Test.describe("two_oldest_ages:") + + # Use "it" to identify the conditions you are testing for + Test.it("should return the second oldest age first") + # using assert_equals will report the invalid values to the user + Test.assert_equals(results1[0], 45) + # using expect will just give a user a generic error message, unless you provide a message + Test.expect(results2[0] == 18, "Number is not the second oldest") + + # its best practice to test for multiple groups of tests, using it calls. + Test.it("should return the oldest age last") + + Test.assert_equals(results1[1], 87) + Test.expect(results2[1] == 83, "Number is not the oldest") + + bug fixes: + initial: |- + def add(a, b): + a + b + + answer: |- + def add(a, b): + return a + b + + fixture: |- + # Use "describe" to define the test suite + test.describe('add method') + + # Use "it" to indicate a condition you are testing for + test.it('should add both arguments and return') + + # "assert_equals" will return information about what values were + # expect if the assertion fails. This can be very useful to other + # users trying to pass the kata. + test.assert_equals(add(1,2), 3) + + # "expect" is a lower level assertion that will allow you to test + # anything. It just needs a boolean result. You should pass a message + # as the second parameter so that if the assertion fails the user + # will be giving some useful information. + test.expect(add(1,1) == 2, "add(1,1) should == 2") + + refactoring: + initial: |- + # refactor this method into a Person class with its own greet method + def greet(you, me): + return "Hello {0}, my name is {1}".format(you, me) + + answer: |- + class Person: + def __init__(self, name): + self.name = name + + def greet(self, name): + return "Hello {0}, my name is {1}".format(name, self.name) + + fixture: |- + # Use "describe" to define the test suite + test.describe('Person') + + jack = Person('Jack') + + # Use "it" to indicate a condition you are testing for + test.it('should have a name') + + # "assert_equals" will return information about what values were + # expect if the assertion fails. This can be very useful to other + # users trying to pass the kata. + test.assert_equals(jack.name, "Jack") + + test.it("should greet Jill") + + test.assert_equals(jack.greet("Jill"), "Hello Jill, my name is Jack") + + test.it("should greet other people as well") + + # unlike "assert_equals", "expect" is a lower level assertion that + # takes a boolean to determine if it passes. If it fails it will + # output the message that you give it, or a generic one. It is a good + # idea to provide a custom error message to help users pass the kata + test.expect(jack.greet("Jane") == "Hello Jane, my name is Jack", "Jack apparently is only able to greet Jane") + + reference: + initial: |- + # create an array called websites that has "codewars" as its only value + + answer: |- + websites = ['codewars'] + + fixture: |- + # Use test.describe (or Test.describe) to describe your test suite + test.describe("websites") + + # Use "it" calls to describe the specific test case + test.it("should have the value 'codewars' inside of it") + + # assert equals will pass if both items equal each other (using ==). If + # the test fails, assert_equals will output a descriptive message indicating + # what the values were expected to be. + test.assert_equals(['codewars'], websites) + + # you can also use the lower level test.expect. If you use test.expect directly then + # you should provide a custom error message, as the default one will be pretty useless + # to users trying to pass the kata. + test.expect(['codewars'] == websites, 'Array does not have correct value') \ No newline at end of file diff --git a/examples/ruby.yml b/examples/ruby.yml new file mode 100644 index 00000000..e25c437a --- /dev/null +++ b/examples/ruby.yml @@ -0,0 +1,107 @@ +cw-2: + bug fixes: + initial: |- + class Person + attr_reader :name + def initialize(name) + name = name + end + + def greet + "Hello my name is #{name}" + end + end + answer: |- + class Person + attr_reader :name + def initialize(name) + @name = name + end + + def greet + "Hello my name is #{name}" + end + end + + fixture: |- + jack = Person.new("Jack") + jill = Person.new("Jill") + + Test.expect(jack.name == "Jack", "person.name method does not have a valid value") + + Test.expect(jack.greet == "Hello my name is Jack") + Test.expect(jill.greet == "Hello my name is Jill") + + algorithms: + initial: |- + # return the two oldest/oldest ages within the array of ages passed in. + # it should return the two ages as a sorted array, youngest age first + def two_oldest_ages(ages) + end + + answer: |- + def two_oldest_ages(ages) + oldest = 0 + next_oldest = 0; + ages.each do |age| + if age > oldest + next_oldest = oldest + oldest = age + elsif age > next_oldest + next_oldest = age + end + end + [next_oldest, oldest] + + + fixture: |- + results1 = two_oldest_ages [1,5,87,45,8,8] + results2 = two_oldest_ages [6,5,83,5,3,18] + + Test.expect(results1[0] == 45) + Test.expect(results1[1] == 87) + + Test.expect(results2[0] == 18) + Test.expect(results2[1] == 83) + + refactoring: + initial: |- + # TODO: This method needs to be called multiple times for the same person (myName). + # It would be nice if we didnt have to always pass in myName every time we needed to great someone. + + def greet(myName, yourName) + "Hello #{yourName}, my name is #{myName}" + end + + answer: |- + class Person + def initialize(name) + @name = name + end + + def greet(yourName) + "Hello #{yourName}, my name is #{@name}" + end + end + + fixture: |- + jack = Person.new("Jack") + jill = Person.new("Jill") + + Test.expect(jack.greet("Jill") == "Hello Jill, my name is Jack") + Test.expect(jack.greet("Mary") == "Hello Mary, my name is Jack") + + Test.expect(jill.greet("Jack") == "Hello Jack, my name is Jill") + + reference: + initial: |- + websites = [] + + answer: |- + # add the values "codewars" to the websites array + websites << 'codewars' + + fixture: |- + Test.expect(websites.length > 0, 'The array is still empty') + Test.expect(websites.length == 1, 'The array contains too many values') + Test.expect(websites[0] == 'codewars', 'The array does not contain the correct value "codewars"') \ No newline at end of file diff --git a/examples/ruby/fixture.rb b/examples/ruby/fixture.rb deleted file mode 100644 index b83ac90c..00000000 --- a/examples/ruby/fixture.rb +++ /dev/null @@ -1,7 +0,0 @@ -require './solution' - -describe Example do - it 'should work' do - 1.should == 1 - end -end \ No newline at end of file diff --git a/examples/ruby/solution.rb b/examples/ruby/solution.rb deleted file mode 100644 index 58df36a1..00000000 --- a/examples/ruby/solution.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Example - -end \ No newline at end of file diff --git a/frameworks/c/test.c b/frameworks/c/test.c deleted file mode 100644 index 9915918d..00000000 --- a/frameworks/c/test.c +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include - -#define MAX_CHARS 1024 - -char * format(const char * format_string, ...) { - //! Create a new string, up to MAX_CHARS long - //! Uses vsnprintf to format it, and returns it - //! Users are responsible for freeing outputted string - char * output_string = malloc(MAX_CHARS); - va_list arguments; - va_start(arguments, format_string); - vsnprintf(output_string, MAX_CHARS, format_string, arguments); - va_end(arguments); - return output_string; -} - -char * __CODEWARS__default_string__ -(char * default_string, ...) { - //! Defaults to a particular value - //! when no optional second argument is passed - //! arguments must be terminted with NULL - //! NOTE: this is intended for use in macros only! - va_list arguments; - char * second_argument; - va_start(arguments, default_string); - second_argument = va_arg(arguments, char*); - va_end(arguments); - return second_argument ? second_argument : default_string; -} - -int __CODEWARS__stdout__(const char * first, ...) { - //! Writes several strings to stdout - //! Arguments must be terminated with NULL - //! Returns the number of strings written - char * arg; - int i = 0; - va_list arguments; - fputs(first, stdout); - va_start(arguments, first); - while((arg = va_arg(arguments, char*))) { - fputs(arg, stdout); - ++i; - } - va_end(arguments); - return i; -} - -void __CODEWARS__fail__(const char * message) { - //! Prints an error message and exits with failure status - __CODEWARS__stdout__("", message, "\n", NULL); - exit(EXIT_FAILURE); -} diff --git a/frameworks/c/test.h b/frameworks/c/test.h deleted file mode 100644 index c07a4f13..00000000 --- a/frameworks/c/test.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _CODEWARS_TEST_H_ -#define _CODEWARS_TEST_H_ - -int __CODEWARS__stdout__(const char * first, ...); -char * __CODEWARS__default_string__(char * default_string, ...); -int __CODEWARS__fail__(const char * message); -char * format(const char * format_string, ...); - -#define DESCRIBE(x) \ - __CODEWARS__stdout__("", (x), "<:LF:>\n", 0); - -#define IT(x) \ - __CODEWARS__stdout__("", (x), "<:LF:>\n", 0); - -#define EXPECT(fact, message...) \ - if((fact)) __CODEWARS__stdout__("Test Passed\n",0); \ - else __CODEWARS__fail__(__CODEWARS__default_string__("Value is not what was expected", ##message, 0)); - -#define EXPECT_ERROR(fact, message...) \ - if(!(fact)) __CODEWARS__stdout__("Test Passed\n",0); \ - else __CODEWARS__fail__(__CODEWARS__default_string__("Value is not what was expected", ##message, 0)); - -#define ASSERT_EQUALS(value1, value2, message...) \ - if((value1) == (value2)) __CODEWARS__stdout__("Test Passed\n",0); \ - else __CODEWARS__fail__(__CODEWARS__default_string__("Values are not equal", ##message, 0)); - -#define ASSERT_NOT_EQUALS(value1, value2, message...) \ - if((value1) == (value2)) __CODEWARS__stdout__("Test Passed\n",0); \ - else __CODEWARS__fail__(__CODEWARS__default_string__("Values should not equal", ##message, 0)); - -#endif _CODEWARS_TEST_H_ diff --git a/frameworks/csharp/nunit/agent.conf b/frameworks/csharp/nunit/agent.conf new file mode 100644 index 00000000..b4cf5509 --- /dev/null +++ b/frameworks/csharp/nunit/agent.conf @@ -0,0 +1,4 @@ + + 8080 + . + \ No newline at end of file diff --git a/frameworks/csharp/nunit/agent.log.conf b/frameworks/csharp/nunit/agent.log.conf new file mode 100644 index 00000000..6a9ced8b --- /dev/null +++ b/frameworks/csharp/nunit/agent.log.conf @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/frameworks/csharp/nunit/framework/framework/nunit.framework.dll b/frameworks/csharp/nunit/framework/framework/nunit.framework.dll new file mode 100755 index 00000000..956c32c2 Binary files /dev/null and b/frameworks/csharp/nunit/framework/framework/nunit.framework.dll differ diff --git a/frameworks/csharp/nunit/framework/framework/nunit.framework.xml b/frameworks/csharp/nunit/framework/framework/nunit.framework.xml new file mode 100644 index 00000000..bec89757 --- /dev/null +++ b/frameworks/csharp/nunit/framework/framework/nunit.framework.xml @@ -0,0 +1,9329 @@ + + + + nunit.framework + + + + + Delegate used by tests that execute code and + capture any thrown exception. + + + + The Assert class contains a collection of static methods that + implement the most common assertions used in NUnit. + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + Gets the number of assertions executed so far and + resets the counter to zero. + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + Helper for Assert.AreEqual(double expected, double actual, ...) + allowing code generation to work consistently. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + Arguments to be used in formatting the message + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + + + Throws an with the message and arguments + that are passed in. This is used by the other Assert functions. + + The message to initialize the with. + Arguments to be used in formatting the message + + + Throws an with the message that is + passed in. This is used by the other Assert functions. + + The message to initialize the with. + + + Throws an . + This is used by the other Assert functions. + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + Arguments to be used in formatting the message + + + Throws an with the message that is + passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + + + Throws an . + This causes the test to be reported as ignored. + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + Arguments to be used in formatting the message + + + Throws an with the message that is + passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + + + Throws an . + This causes the test to be reported as Inconclusive. + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + + This method is provided for use by VB developers needing to test + the value of properties with private setters. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + The message that will be displayed on failure + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + The message that will be displayed on failure + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + Verifies that a delegate does not throw an exception + + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate does not throw an exception. + + A TestSnippet delegate + The message that will be displayed on failure + + + Verifies that a delegate does not throw an exception. + + A TestSnippet delegate + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + The message to display in case of failure + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + + + Assert that a string is not null or empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that a string is not null or empty + + The string to be tested + The message to display in case of failure + + + Assert that a string is not null or empty + + The string to be tested + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + + + AssertionHelper is an optional base class for user tests, + allowing the use of shorter names for constraints and + asserts and avoiding conflict with the definition of + , from which it inherits much of its + behavior, in certain mock object frameworks. + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That + + A Constraint to be applied + The actual value to test + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to Assert.That. + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to Assert.That. + + The evaluated condition + The message to display if the condition is false + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically Assert.That. + + The evaluated condition + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + Returns a ListMapper based on a collection. + + The original collection + + + + Provides static methods to express the assumptions + that must be met for a test to give a meaningful + result. If an assumption is not met, the test + should produce an inconclusive result. + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + + + Asserts that a condition is true. If the condition is false the + method throws an . + + The evaluated condition + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + The different targets a test action attribute can be applied to + + + + Default target, which is determined by where the action attribute is attached + + + + Target a individual test case + + + + Target a suite of test cases + + + + Attribute used to apply a category to a test + + + + The name of the category + + + + Construct attribute for a given category based on + a name. The name may not contain the characters ',', + '+', '-' or '!'. However, this is not checked in the + constructor since it would cause an error to arise at + as the test was loaded without giving a clear indication + of where the problem is located. The error is handled + in NUnitFramework.cs by marking the test as not + runnable. + + The name of the category + + + Protected constructor uses the Type name as the name + of the category. + + + + The name of the category + + + + Used to mark a field for use as a datapoint when executing a theory + within the same fixture that requires an argument of the field's Type. + + + + Used to mark an array as containing a set of datapoints to be used + executing a theory within the same fixture that requires an argument + of the Type of the array elements. + + + + Attribute used to provide descriptive text about a + test case or fixture. + + + + Construct the attribute + + Text describing the test + + + Gets the test description + + + + Enumeration indicating how the expected message parameter is to be used + + + Expect an exact match + + Expect a message containing the parameter string + + Match the regular expression provided as a parameter + + Expect a message that starts with the parameter string + + + ExpectedExceptionAttribute + + + + Constructor for a non-specific exception + + + + Constructor for a given type of exception + + The type of the expected exception + + + Constructor for a given exception name + + The full name of the expected exception + + + Gets or sets the expected exception type + + + + Gets or sets the full Type name of the expected exception + + + + Gets or sets the expected message text + + + + Gets or sets the user message displayed in case of failure + + + + Gets or sets the type of match to be performed on the expected message + + + + Gets the name of a method to be used as an exception handler + + + + ExplicitAttribute marks a test or test fixture so that it will + only be run if explicitly executed from the gui or command line + or if it is included by use of a filter. The test will not be + run simply because an enclosing suite is run. + + + + Default constructor + + + + Constructor with a reason + + The reason test is marked explicit + + + The reason test is marked explicit + + + + Attribute used to mark a test that is to be ignored. + Ignored tests result in a warning message when the + tests are run. + + + + Constructs the attribute without giving a reason + for ignoring the test. + + + + Constructs the attribute giving a reason for ignoring the test + + The reason for ignoring the test + + + The reason for ignoring a test + + + + Abstract base for Attributes that are used to include tests + in the test run based on environmental settings. + + + + Constructor with no included items specified, for use + with named property syntax. + + + + Constructor taking one or more included items + + Comma-delimited list of included items + + + Name of the item that is needed in order for + a test to run. Multiple itemss may be given, + separated by a comma. + + + + Name of the item to be excluded. Multiple items + may be given, separated by a comma. + + + + The reason for including or excluding the test + + + + PlatformAttribute is used to mark a test fixture or an + individual method as applying to a particular platform only. + + + + Constructor with no platforms specified, for use + with named property syntax. + + + + Constructor taking one or more platforms + + Comma-deliminted list of platforms + + + CultureAttribute is used to mark a test fixture or an + individual method as applying to a particular Culture only. + + + + Constructor with no cultures specified, for use + with named property syntax. + + + + Constructor taking one or more cultures + + Comma-deliminted list of cultures + + + Marks a test to use a combinatorial join of any argument data + provided. NUnit will create a test case for every combination of + the arguments provided. This can result in a large number of test + cases and so should be used judiciously. This is the default join + type, so the attribute need not be used except as documentation. + + + + Default constructor + + + + Marks a test to use pairwise join of any argument data provided. + NUnit will attempt too excercise every pair of argument values at + least once, using as small a number of test cases as it can. With + only two arguments, this is the same as a combinatorial join. + + + + Default constructor + + + + Marks a test to use a sequential join of any argument data + provided. NUnit will use arguements for each parameter in + sequence, generating test cases up to the largest number + of argument values provided and using null for any arguments + for which it runs out of values. Normally, this should be + used with the same number of arguments for each parameter. + + + + Default constructor + + + + Summary description for MaxTimeAttribute. + + + + Construct a MaxTimeAttribute, given a time in milliseconds. + + The maximum elapsed time in milliseconds + + + PropertyAttribute is used to attach information to a test as a name/value pair.. + + + + Construct a PropertyAttribute with a name and string value + + The name of the property + The property value + + + Construct a PropertyAttribute with a name and int value + + The name of the property + The property value + + + Construct a PropertyAttribute with a name and double value + + The name of the property + The property value + + + Constructor for derived classes that set the + property dictionary directly. + + + + Constructor for use by derived classes that use the + name of the type as the property name. Derived classes + must ensure that the Type of the property value is + a standard type supported by the BCL. Any custom + types will cause a serialization Exception when + in the client. + + + + Gets the property dictionary for this attribute + + + + RandomAttribute is used to supply a set of random values + to a single parameter of a parameterized test. + + + + Construct a set of doubles from 0.0 to 1.0, + specifying only the count. + + + + + Construct a set of doubles from min to max + + + + + + + Construct a set of ints from min to max + + + + + + + Get the collection of values to be used as arguments + + + + RangeAttribute is used to supply a range of values to an + individual parameter of a parameterized test. + + + + Construct a range of ints using default step of 1 + + + + + + Construct a range of ints specifying the step size + + + + + + + Construct a range of longs + + + + + + + Construct a range of doubles + + + + + + + Construct a range of floats + + + + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + Construct a RepeatAttribute + + The number of times to run the test + + + RequiredAddinAttribute may be used to indicate the names of any addins + that must be present in order to run some or all of the tests in an + assembly. If the addin is not loaded, the entire assembly is marked + as NotRunnable. + + + + Initializes a new instance of the class. + + The required addin. + + + Gets the name of required addin. + + The required addin name. + + + Summary description for SetCultureAttribute. + + + + Construct given the name of a culture + + + + + Summary description for SetUICultureAttribute. + + + + Construct given the name of a culture + + + + + SetUpAttribute is used in a TestFixture to identify a method + that is called immediately before each test is run. It is + also used in a SetUpFixture to identify the method that is + called once, before any of the subordinate tests are run. + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + Attribute used to mark a static (shared in VB) property + that returns a list of tests. + + + + Attribute used in a TestFixture to identify a method that is + called immediately after each test is run. It is also used + in a SetUpFixture to identify the method that is called once, + after all subordinate tests have run. In either case, the method + is guaranteed to be called, even if an exception is thrown. + + + + Provide actions to execute before and after tests. + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + [Test(Description = "more detailed description")] + publc void TestDescriptionMethod() + {} + } + + + + Descriptive text for this test + + + + TestCaseAttribute is used to mark parameterized test cases + and provide them with their arguments. + + + + Construct a TestCaseAttribute with a list of arguments. + This constructor is not CLS-Compliant + + + + + Construct a TestCaseAttribute with a single argument + + + + + Construct a TestCaseAttribute with a two arguments + + + + + + Construct a TestCaseAttribute with a three arguments + + + + + + + Gets the list of arguments to a test case + + + + Gets or sets the expected result. Use + ExpectedResult by preference. + + The result. + + + Gets or sets the expected result. + + The result. + + + Gets a flag indicating whether an expected + result has been set. + + + + Gets a list of categories associated with this test; + + + + Gets or sets the category associated with this test. + May be a single category or a comma-separated list. + + + + Gets or sets the expected exception. + + The expected exception. + + + Gets or sets the name the expected exception. + + The expected name of the exception. + + + Gets or sets the expected message of the expected exception + + The expected message of the exception. + + + Gets or sets the type of match to be performed on the expected message + + + + Gets or sets the description. + + The description. + + + Gets or sets the name of the test. + + The name of the test. + + + Gets or sets the ignored status of the test + + + + Gets or sets the ignored status of the test + + + + Gets or sets the explicit status of the test + + + + Gets or sets the reason for not running the test + + + + Gets or sets the reason for not running the test. + Set has the side effect of marking the test as ignored. + + The ignore reason. + + + FactoryAttribute indicates the source to be used to + provide test cases for a test method. + + + + Construct with the name of the data source, which must + be a property, field or method of the test class itself. + + An array of the names of the factories that will provide data + + + Construct with a Type, which must implement IEnumerable + + The Type that will provide data + + + Construct with a Type and name. + that don't support params arrays. + + The Type that will provide data + The name of the method, property or field that will provide data + + + The name of a the method, property or fiend to be used as a source + + + + A Type to be used as a source + + + + Gets or sets the category associated with this test. + May be a single category or a comma-separated list. + + + + [TestFixture] + public class ExampleClass + {} + + + + Default constructor + + + + Construct with a object[] representing a set of arguments. + In .NET 2.0, the arguments may later be separated into + type arguments and constructor arguments. + + + + + Descriptive text for this fixture + + + + Gets and sets the category for this fixture. + May be a comma-separated list of categories. + + + + Gets a list of categories for this fixture + + + + The arguments originally provided to the attribute + + + + Gets or sets a value indicating whether this should be ignored. + + true if ignore; otherwise, false. + + + Gets or sets the ignore reason. May set Ignored as a side effect. + + The ignore reason. + + + Get or set the type arguments. If not set + explicitly, any leading arguments that are + Types are taken as type arguments. + + + + Attribute used to identify a method that is + called before any tests in a fixture are run. + + + + Attribute used to identify a method that is called after + all the tests in a fixture have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + [Test(Description = "more detailed description")] + publc void TestDescriptionMethod() + {} + } + + + + Used on a method, marks the test with a timeout value in milliseconds. + The test will be run in a separate thread and is cancelled if the timeout + is exceeded. Used on a method or assembly, sets the default timeout + for all contained test methods. + + + + Construct a TimeoutAttribute given a time in milliseconds + + The timeout value in milliseconds + + + Marks a test that must run in the STA, causing it + to run in a separate thread if necessary. + On methods, you may also use STAThreadAttribute + to serve the same purpose. + + + + Construct a RequiresSTAAttribute + + + + Marks a test that must run in the MTA, causing it + to run in a separate thread if necessary. + On methods, you may also use MTAThreadAttribute + to serve the same purpose. + + + + Construct a RequiresMTAAttribute + + + + Marks a test that must run on a separate thread. + + + + Construct a RequiresThreadAttribute + + + + Construct a RequiresThreadAttribute, specifying the apartment + + + + Abstract base class for attributes that apply to parameters + and supply data for the parameter. + + + + Gets the data to be provided to the specified parameter + + + + ValuesAttribute is used to provide literal arguments for + an individual parameter of a test. + + + + The collection of data to be returned. Must + be set by any derived attribute classes. + We use an object[] so that the individual + elements may have their type changed in GetData + if necessary. + + + + Construct with one argument + + + + + Construct with two arguments + + + + + + Construct with three arguments + + + + + + + Construct with an array of arguments + + + + + Get the collection of values to be used as arguments + + + + ValueSourceAttribute indicates the source to be used to + provide data for one parameter of a test method. + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + The name of the data source to be used + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of the method, property or field that will provide data + + + The name of a the method, property or fiend to be used as a source + + + + A Type to be used as a source + + + + A set of Assert methods operationg on one or more collections + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + The message that will be displayed on failure + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + Arguments to be used in formatting the message + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + + + AttributeExistsConstraint tests for the presence of a + specified attribute on a Type. + + + + Constructs an AttributeExistsConstraint for a specific attribute Type + + + + + Tests whether the object provides the expected attribute. + + A Type, MethodInfo, or other ICustomAttributeProvider + True if the expected attribute is present, otherwise false + + + Writes the description of the constraint to the specified writer + + + + AttributeConstraint tests that a specified attribute is present + on a Type or other provider and that the value of the attribute + satisfies some other constraint. + + + + Constructs an AttributeConstraint for a specified attriute + Type and base constraint. + + + + + + Determines whether the Type or other provider has the + expected attribute and if its value matches the + additional constraint specified. + + + + Writes a description of the attribute to the specified writer. + + + + Writes the actual value supplied to the specified writer. + + + + Returns a string representation of the constraint. + + + + BasicConstraint is the abstract base for constraints that + perform a simple comparison to a constant value. + + + + Initializes a new instance of the class. + + The expected. + The description. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + NullConstraint tests that the actual value is null + + + + Initializes a new instance of the class. + + + + TrueConstraint tests that the actual value is true + + + + Initializes a new instance of the class. + + + + FalseConstraint tests that the actual value is false + + + + Initializes a new instance of the class. + + + + NaNConstraint tests that the actual value is a double or float NaN + + + + Test that the actual value is an NaN + + + + + + Write the constraint description to a specified writer + + + + + BinaryConstraint is the abstract base of all constraints + that combine two other constraints in some fashion. + + + + The first constraint being combined + + + + The second constraint being combined + + + + Construct a BinaryConstraint from two other constraints + + The first constraint + The second constraint + + + AndConstraint succeeds only if both members succeed. + + + + Create an AndConstraint from two other constraints + + The first constraint + The second constraint + + + Apply both member constraints to an actual value, succeeding + succeeding only if both of them succeed. + + The actual value + True if the constraints both succeeded + + + Write a description for this contraint to a MessageWriter + + The MessageWriter to receive the description + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + OrConstraint succeeds if either member succeeds + + + + Create an OrConstraint from two other constraints + + The first constraint + The second constraint + + + Apply the member constraints to an actual value, succeeding + succeeding as soon as one of them succeeds. + + The actual value + True if either constraint succeeded + + + Write a description for this contraint to a MessageWriter + + The MessageWriter to receive the description + + + CollectionConstraint is the abstract base class for + constraints that operate on collections. + + + + Construct an empty CollectionConstraint + + + + Construct a CollectionConstraint + + + + + Determines whether the specified enumerable is empty. + + The enumerable. + + true if the specified enumerable is empty; otherwise, false. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Protected method to be implemented by derived classes + + + + + + CollectionItemsEqualConstraint is the abstract base class for all + collection constraints that apply some notion of item equality + as a part of their operation. + + + + Construct an empty CollectionConstraint + + + + Construct a CollectionConstraint + + + + + Flag the constraint to ignore case and return self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Compares two collection members for equality + + + + Return a new CollectionTally for use in making tests + + The collection to be included in the tally + + + EmptyCollectionConstraint tests whether a collection is empty. + + + + Check that the collection is empty + + + + + + Write the constraint description to a MessageWriter + + + + + UniqueItemsConstraint tests whether all the items in a + collection are unique. + + + + Check that all items are unique. + + + + + + Write a description of this constraint to a MessageWriter + + + + + CollectionContainsConstraint is used to test whether a collection + contains an expected object as a member. + + + + Construct a CollectionContainsConstraint + + + + + Test whether the expected item is contained in the collection + + + + + + Write a descripton of the constraint to a MessageWriter + + + + + CollectionEquivalentCOnstraint is used to determine whether two + collections are equivalent. + + + + Construct a CollectionEquivalentConstraint + + + + + Test whether two collections are equivalent + + + + + + Write a description of this constraint to a MessageWriter + + + + + CollectionSubsetConstraint is used to determine whether + one collection is a subset of another + + + + Construct a CollectionSubsetConstraint + + The collection that the actual value is expected to be a subset of + + + Test whether the actual collection is a subset of + the expected collection provided. + + + + + + Write a description of this constraint to a MessageWriter + + + + + CollectionOrderedConstraint is used to test whether a collection is ordered. + + + + Construct a CollectionOrderedConstraint + + + + If used performs a reverse comparison + + + + Modifies the constraint to use an IComparer and returns self. + + + + Modifies the constraint to use an IComparer<T> and returns self. + + + + Modifies the constraint to use a Comparison<T> and returns self. + + + + Modifies the constraint to test ordering by the value of + a specified property and returns self. + + + + Test whether the collection is ordered + + + + + + Write a description of the constraint to a MessageWriter + + + + + Returns the string representation of the constraint. + + + + + CollectionTally counts (tallies) the number of + occurences of each object in one or more enumerations. + + + + Construct a CollectionTally object from a comparer and a collection + + + + The number of objects remaining in the tally + + + + Try to remove an object from the tally + + The object to remove + True if successful, false if the object was not found + + + Try to remove a set of objects from the tally + + The objects to remove + True if successful, false if any object was not found + + + ComparisonAdapter class centralizes all comparisons of + values in NUnit, adapting to the use of any provided + IComparer, IComparer<T> or Comparison<T> + + + + Gets the default ComparisonAdapter, which wraps an + NUnitComparer object. + + + + Returns a ComparisonAdapter that wraps an IComparer + + + + Returns a ComparisonAdapter that wraps an IComparer<T> + + + + Returns a ComparisonAdapter that wraps a Comparison<T> + + + + Compares two objects + + + + Construct a default ComparisonAdapter + + + + Construct a ComparisonAdapter for an IComparer + + + + Compares two objects + + + + + + + ComparisonAdapter<T> extends ComparisonAdapter and + allows use of an IComparer<T> or Comparison<T> + to actually perform the comparison. + + + + Construct a ComparisonAdapter for an IComparer<T> + + + + Compare a Type T to an object + + + + Construct a ComparisonAdapter for a Comparison<T> + + + + Compare a Type T to an object + + + + Abstract base class for constraints that compare values to + determine if one is greater than, equal to or less than + the other. This class supplies the Using modifiers. + + + + ComparisonAdapter to be used in making the comparison + + + + Initializes a new instance of the class. + + + + Initializes a new instance of the class. + + + + Modifies the constraint to use an IComparer and returns self + + + + Modifies the constraint to use an IComparer<T> and returns self + + + + Modifies the constraint to use a Comparison<T> and returns self + + + + Delegate used to delay evaluation of the actual value + to be used in evaluating a constraint + + + + The Constraint class is the base of all built-in constraints + within NUnit. It provides the operator overloads used to combine + constraints. + + + + Class used to detect any derived constraints + that fail to set the actual value in their + Matches override. + + + + Static UnsetObject used to detect derived constraints + failing to set the actual value. + + + + The actual value being tested against a constraint + + + + The display name of this Constraint for use by ToString() + + + + Argument fields used by ToString(); + + + + The builder holding this constraint + + + + Construct a constraint with no arguments + + + + Construct a constraint with one argument + + + + Construct a constraint with two arguments + + + + Sets the ConstraintBuilder holding this constraint + + + + The display name of this Constraint for use by ToString(). + The default value is the name of the constraint with + trailing "Constraint" removed. Derived classes may set + this to another name in their constructors. + + + + Write the failure message to the MessageWriter provided + as an argument. The default implementation simply passes + the constraint and the actual value to the writer, which + then displays the constraint description and the value. + Constraints that need to provide additional details, + such as where the error occured can override this. + + The MessageWriter on which to display the message + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Test whether the constraint is satisfied by an + ActualValueDelegate that returns the value to be tested. + The default implementation simply evaluates the delegate + but derived classes may override it to provide for delayed + processing. + + An ActualValueDelegate + True for success, false for failure + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Default override of ToString returns the constraint DisplayName + followed by any arguments within angle brackets. + + + + + Returns the string representation of this constraint + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + Returns a ConstraintExpression by appending Or + to the current constraint. + + + + Returns a DelayedConstraint with the specified delay time. + + The delay in milliseconds. + + + + Returns a DelayedConstraint with the specified delay time + and polling interval. + + The delay in milliseconds. + The interval at which to test the constraint. + + + + ConstraintBuilder maintains the stacks that are used in + processing a ConstraintExpression. An OperatorStack + is used to hold operators that are waiting for their + operands to be reognized. a ConstraintStack holds + input constraints as well as the results of each + operator applied. + + + + OperatorStack is a type-safe stack for holding ConstraintOperators + + + + Initializes a new instance of the class. + + The builder. + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + Gets the topmost operator without modifying the stack. + + The top. + + + Pushes the specified operator onto the stack. + + The op. + + + Pops the topmost operator from the stack. + + + + + ConstraintStack is a type-safe stack for holding Constraints + + + + Initializes a new instance of the class. + + The builder. + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + Gets the topmost constraint without modifying the stack. + + The topmost constraint + + + Pushes the specified constraint. As a side effect, + the constraint's builder field is set to the + ConstraintBuilder owning this stack. + + The constraint. + + + Pops this topmost constrait from the stack. + As a side effect, the constraint's builder + field is set to null. + + + + + Initializes a new instance of the class. + + + + Gets a value indicating whether this instance is resolvable. + + + true if this instance is resolvable; otherwise, false. + + + + Appends the specified operator to the expression by first + reducing the operator stack and then pushing the new + operator on the stack. + + The operator to push. + + + Appends the specified constraint to the expresson by pushing + it on the constraint stack. + + The constraint to push. + + + Sets the top operator right context. + + The right context. + + + Reduces the operator stack until the topmost item + precedence is greater than or equal to the target precedence. + + The target precedence. + + + Resolves this instance, returning a Constraint. If the builder + is not currently in a resolvable state, an exception is thrown. + + The resolved constraint + + + ConstraintExpression represents a compound constraint in the + process of being constructed from a series of syntactic elements. + Individual elements are appended to the expression as they are + reognized. Once an actual Constraint is appended, the expression + returns a resolvable Constraint. + + + + Initializes a new instance of the class. + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + With is currently a NOP - reserved for future use. + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + Returns a constraint that tests for null + + + + Returns a constraint that tests for True + + + + Returns a constraint that tests for False + + + + Returns a constraint that tests for a positive value + + + + Returns a constraint that tests for a negative value + + + + Returns a constraint that tests for NaN + + + + Returns a constraint that tests for empty + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + Returns a constraint that tests two items for equality + + + + Returns a constraint that tests that two references are the same object + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + Returns a constraint that tests whether a collection is ordered + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + ConstraintExpressionBase is the abstract base class for the + ConstraintExpression class, which represents a + compound constraint in the process of being constructed + from a series of syntactic elements. + NOTE: ConstraintExpressionBase is separate because the + ConstraintExpression class was generated in earlier + versions of NUnit. The two classes may be combined + in a future version. + + + + The ConstraintBuilder holding the elements recognized so far + + + + Initializes a new instance of the class. + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + Returns a string representation of the expression as it + currently stands. This should only be used for testing, + since it has the side-effect of resolving the expression. + + + + + Appends an operator to the expression and returns the + resulting expression itself. + + + + Appends a self-resolving operator to the expression and + returns a new ResolvableConstraintExpression. + + + + Appends a constraint to the expression and returns that + constraint, which is associated with the current state + of the expression being built. + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + Returns a constraint that tests for null + + + + Returns a constraint that tests for True + + + + Returns a constraint that tests for False + + + + Returns a constraint that tests for a positive value + + + + Returns a constraint that tests for a negative value + + + + Returns a constraint that tests for NaN + + + + Returns a constraint that tests for empty + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + Returns a constraint that tests two items for equality + + + + Returns a constraint that tests that two references are the same object + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + Returns a constraint that tests whether a collection is ordered + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + The ConstraintOperator class is used internally by a + ConstraintBuilder to represent an operator that + modifies or combines constraints. + Constraint operators use left and right precedence + values to determine whether the top operator on the + stack should be reduced before pushing a new operator. + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + The precedence value used when the operator + is on the top of the stack. + + + + The syntax element preceding this operator + + + + The syntax element folowing this operator + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + The precedence value used when the operator + is on the top of the stack. + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + PrefixOperator takes a single constraint and modifies + it's action in some way. + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Returns the constraint created by applying this + prefix to another constraint. + + + + + + Negates the test of the constraint it wraps. + + + + Constructs a new NotOperator + + + + Returns a NotConstraint applied to its argument. + + + + Abstract base for operators that indicate how to + apply a constraint to items in a collection. + + + + Constructs a CollectionOperator + + + + Represents a constraint that succeeds if all the + members of a collection match a base constraint. + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + they all succeed. + + + + Represents a constraint that succeeds if any of the + members of a collection match a base constraint. + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + any of them succeed. + + + + Represents a constraint that succeeds if none of the + members of a collection match a base constraint. + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + Represents a constraint that succeeds if the specified + count of members of a collection match a base constraint. + + + + Construct an ExactCountOperator for a specified count + + The expected count + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + Represents a constraint that simply wraps the + constraint provided as an argument, without any + further functionality, but which modifes the + order of evaluation because of its precedence. + + + + Constructor for the WithOperator + + + + Returns a constraint that wraps its argument + + + + Abstract base class for operators that are able to reduce to a + constraint whether or not another syntactic element follows. + + + + Operator used to test for the presence of a named Property + on an object and optionally apply further tests to the + value of that property. + + + + Gets the name of the property to which the operator applies + + + + Constructs a PropOperator for a particular named property + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Operator that tests for the presence of a particular attribute + on a type and optionally applies further tests to the attribute. + + + + Construct an AttributeOperator for a particular Type + + The Type of attribute tested + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + Operator that tests that an exception is thrown and + optionally applies further tests to the exception. + + + + Construct a ThrowsOperator + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + Abstract base class for all binary operators + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Gets the left precedence of the operator + + + + Gets the right precedence of the operator + + + + Abstract method that produces a constraint by applying + the operator to its left and right constraint arguments. + + + + Operator that requires both it's arguments to succeed + + + + Construct an AndOperator + + + + Apply the operator to produce an AndConstraint + + + + Operator that requires at least one of it's arguments to succeed + + + + Construct an OrOperator + + + + Apply the operator to produce an OrConstraint + + + + ContainsConstraint tests a whether a string contains a substring + or a collection contains an object. It postpones the decision of + which test to use until the type of the actual argument is known. + This allows testing whether a string is contained in a collection + or as a substring of another string using the same syntax. + + + + Initializes a new instance of the class. + + The expected. + + + Flag the constraint to ignore case and return self. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Applies a delay to the match so that a match can be evaluated in the future. + + + + Creates a new DelayedConstraint + + The inner constraint two decorate + The time interval after which the match is performed + If the value of is less than 0 + + + Creates a new DelayedConstraint + + The inner constraint two decorate + The time interval after which the match is performed + The time interval used for polling + If the value of is less than 0 + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + Test whether the constraint is satisfied by a delegate + + The delegate whose value is to be tested + True for if the base constraint fails, false if it succeeds + + + Test whether the constraint is satisfied by a given reference. + Overridden to wait for the specified delay period before + calling the base constraint with the dereferenced value. + + A reference to the value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a MessageWriter. + + The writer on which the actual value is displayed + + + Returns the string representation of the constraint. + + + + EmptyDirectoryConstraint is used to test that a directory is empty + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + EmptyConstraint tests a whether a string or collection is empty, + postponing the decision about which test is applied until the + type of the actual argument is known. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + EqualConstraint is able to compare an actual value with the + expected value provided in its constructor. Two objects are + considered equal if both are null, or if both have the same + value. NUnit has special semantics for some object types. + + + + If true, strings in error messages will be clipped + + + + NUnitEqualityComparer used to test equality. + + + + Initializes a new instance of the class. + + The expected value. + + + Flag the constraint to ignore case and return self. + + + + Flag the constraint to suppress string clipping + and return self. + + + + Flag the constraint to compare arrays as collections + and return self. + + + + Flag the constraint to use a tolerance when determining equality. + + Tolerance value to be used + Self. + + + Switches the .Within() modifier to interpret its tolerance as + a distance in representable values (see remarks). + + Self. + + Ulp stands for "unit in the last place" and describes the minimum + amount a given value can change. For any integers, an ulp is 1 whole + digit. For floating point values, the accuracy of which is better + for smaller numbers and worse for larger numbers, an ulp depends + on the size of the number. Using ulps for comparison of floating + point results instead of fixed tolerances is safer because it will + automatically compensate for the added inaccuracy of larger numbers. + + + + Switches the .Within() modifier to interpret its tolerance as + a percentage that the actual values is allowed to deviate from + the expected value. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in days. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in hours. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in minutes. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in seconds. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in milliseconds. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in clock ticks. + + Self + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write a failure message. Overridden to provide custom + failure messages for EqualConstraint. + + The MessageWriter to write to + + + Write description of this constraint + + The MessageWriter to write to + + + Display the failure information for two collections that did not match. + + The MessageWriter on which to display + The expected collection. + The actual collection + The depth of this failure in a set of nested collections + + + Displays a single line showing the types and sizes of the expected + and actual enumerations, collections or arrays. If both are identical, + the value is only shown once. + + The MessageWriter on which to display + The expected collection or array + The actual collection or array + The indentation level for the message line + + + Displays a single line showing the point in the expected and actual + arrays at which the comparison failed. If the arrays have different + structures or dimensions, both values are shown. + + The MessageWriter on which to display + The expected array + The actual array + Index of the failure point in the underlying collections + The indentation level for the message line + + + Display the failure information for two IEnumerables that did not match. + + The MessageWriter on which to display + The expected enumeration. + The actual enumeration + The depth of this failure in a set of nested collections + + + EqualityAdapter class handles all equality comparisons + that use an IEqualityComparer, IEqualityComparer<T> + or a ComparisonAdapter. + + + + Compares two objects, returning true if they are equal + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + Returns an EqualityAdapter that wraps an IComparer. + + + + EqualityAdapter that wraps an IComparer. + + + + Returns an EqualityAdapter that wraps an IEqualityComparer. + + + + Returns true if the two objects can be compared by this adapter. + Generic adapter requires objects of the specified type. + + + + Returns an EqualityAdapter that wraps an IEqualityComparer<T>. + + + + Returns an EqualityAdapter that wraps an IComparer<T>. + + + + EqualityAdapter that wraps an IComparer. + + + + Returns an EqualityAdapter that wraps a Comparison<T>. + + + Helper routines for working with floating point numbers + + + The floating point comparison code is based on this excellent article: + http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + + + "ULP" means Unit in the Last Place and in the context of this library refers to + the distance between two adjacent floating point numbers. IEEE floating point + numbers can only represent a finite subset of natural numbers, with greater + accuracy for smaller numbers and lower accuracy for very large numbers. + + + If a comparison is allowed "2 ulps" of deviation, that means the values are + allowed to deviate by up to 2 adjacent floating point values, which might be + as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. + + + + Union of a floating point variable and an integer + + The union's value as a floating point variable + + The union's value as an integer + + The union's value as an unsigned integer + + Union of a double precision floating point variable and a long + + The union's value as a double precision floating point variable + + The union's value as a long + + The union's value as an unsigned long + + Compares two floating point values for equality + First floating point value to be compared + Second floating point value t be compared + + Maximum number of representable floating point values that are allowed to + be between the left and the right floating point values + + True if both numbers are equal or close to being equal + + + Floating point values can only represent a finite subset of natural numbers. + For example, the values 2.00000000 and 2.00000024 can be stored in a float, + but nothing inbetween them. + + + This comparison will count how many possible floating point values are between + the left and the right number. If the number of possible values between both + numbers is less than or equal to maxUlps, then the numbers are considered as + being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + Compares two double precision floating point values for equality + First double precision floating point value to be compared + Second double precision floating point value t be compared + + Maximum number of representable double precision floating point values that are + allowed to be between the left and the right double precision floating point values + + True if both numbers are equal or close to being equal + + + Double precision floating point values can only represent a limited series of + natural numbers. For example, the values 2.0000000000000000 and 2.0000000000000004 + can be stored in a double, but nothing inbetween them. + + + This comparison will count how many possible double precision floating point + values are between the left and the right number. If the number of possible + values between both numbers is less than or equal to maxUlps, then the numbers + are considered as being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + Reinterprets the memory contents of a floating point value as an integer value + + + Floating point value whose memory contents to reinterpret + + + The memory contents of the floating point value interpreted as an integer + + + + Reinterprets the memory contents of a double precision floating point + value as an integer value + + + Double precision floating point value whose memory contents to reinterpret + + + The memory contents of the double precision floating point value + interpreted as an integer + + + + Reinterprets the memory contents of an integer as a floating point value + + Integer value whose memory contents to reinterpret + + The memory contents of the integer value interpreted as a floating point value + + + + Reinterprets the memory contents of an integer value as a double precision + floating point value + + Integer whose memory contents to reinterpret + + The memory contents of the integer interpreted as a double precision + floating point value + + + + Tests whether a value is greater than the value supplied to its constructor + + + + The value against which a comparison is to be made + + + + Initializes a new instance of the class. + + The expected value. + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Tests whether a value is greater than or equal to the value supplied to its constructor + + + + The value against which a comparison is to be made + + + + Initializes a new instance of the class. + + The expected value. + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + The IConstraintExpression interface is implemented by all + complete and resolvable constraints and expressions. + + + + Return the top-level constraint for this expression + + + + + Tests whether a value is less than the value supplied to its constructor + + + + The value against which a comparison is to be made + + + + Initializes a new instance of the class. + + The expected value. + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Tests whether a value is less than or equal to the value supplied to its constructor + + + + The value against which a comparison is to be made + + + + Initializes a new instance of the class. + + The expected value. + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + MessageWriter is the abstract base for classes that write + constraint descriptions and messages in some form. The + class has separate methods for writing various components + of a message, allowing implementations to tailor the + presentation as needed. + + + + Construct a MessageWriter given a culture + + + + Abstract method to get the max line length + + + + Method to write single line message with optional args, usually + written to precede the general failure message. + + The message to be written + Any arguments used in formatting the message + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The constraint that failed + + + Display Expected and Actual lines for given values. This + method may be called by constraints that need more control over + the display of actual and expected values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + Display Expected and Actual lines for given values, including + a tolerance value on the Expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + Display the expected and actual string values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in locating the point where the strings differ + If true, the strings should be clipped to fit the line + + + Writes the text for a connector. + + The connector. + + + Writes the text for a predicate. + + The predicate. + + + Writes the text for an expected value. + + The expected value. + + + Writes the text for a modifier + + The modifier. + + + Writes the text for an actual value. + + The actual value. + + + Writes the text for a generalized value. + + The value. + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + Static methods used in creating messages + + + + Static string used when strings are clipped + + + + Returns the representation of a type as used in NUnitLite. + This is the same as Type.ToString() except for arrays, + which are displayed with their declared sizes. + + + + + + Converts any control characters in a string + to their escaped representation. + + The string to be converted + The converted string + + + Return the a string representation for a set of indices into an array + + Array of indices for which a string is needed + + + Get an array of indices representing the point in a enumerable, + collection or array corresponding to a single int index into the + collection. + + The collection to which the indices apply + Index in the collection + Array of indices + + + Clip a string to a given length, starting at a particular offset, returning the clipped + string with ellipses representing the removed parts + + The string to be clipped + The maximum permitted length of the result string + The point at which to start clipping + The clipped string + + + Clip the expected and actual strings in a coordinated fashion, + so that they may be displayed together. + + + + + + + + Shows the position two strings start to differ. Comparison + starts at the start index. + + The expected string + The actual string + The index in the strings at which comparison should start + Boolean indicating whether case should be ignored + -1 if no mismatch found, or the index where mismatch found + + + The Numerics class contains common operations on numeric values. + + + + Checks the type of the object, returning true if + the object is a numeric type. + + The object to check + true if the object is a numeric type + + + Checks the type of the object, returning true if + the object is a floating point numeric type. + + The object to check + true if the object is a floating point numeric type + + + Checks the type of the object, returning true if + the object is a fixed point numeric type. + + The object to check + true if the object is a fixed point numeric type + + + Test two numeric values for equality, performing the usual numeric + conversions and using a provided or default tolerance. If the tolerance + provided is Empty, this method may set it to a default tolerance. + + The expected value + The actual value + A reference to the tolerance in effect + True if the values are equal + + + Compare two numeric values, performing the usual numeric conversions. + + The expected value + The actual value + The relationship of the values to each other + + + NUnitComparer encapsulates NUnit's default behavior + in comparing two objects. + + + + Returns the default NUnitComparer. + + + + Compares two objects + + + + + + + Generic version of NUnitComparer + + + + + Compare two objects of the same type + + + + NUnitEqualityComparer encapsulates NUnit's handling of + equality tests between objects. + + + + If true, all string comparisons will ignore case + + + + If true, arrays will be treated as collections, allowing + those of different dimensions to be compared + + + + Comparison objects used in comparisons for some constraints. + + + + Returns the default NUnitEqualityComparer + + + + Gets and sets a flag indicating whether case should + be ignored in determining equality. + + + + Gets and sets a flag indicating that arrays should be + compared as collections, without regard to their shape. + + + + Gets and sets an external comparer to be used to + test for equality. It is applied to members of + collections, in place of NUnit's own logic. + + + + Gets the list of failure points for the last Match performed. + + + + Compares two objects for equality within a tolerance. + + + + Helper method to compare two arrays + + + + Method to compare two DirectoryInfo objects + + first directory to compare + second directory to compare + true if equivalent, false if not + + + FailurePoint class represents one point of failure + in an equality test. + + + + The location of the failure + + + + The expected value + + + + The actual value + + + + Indicates whether the expected value is valid + + + + Indicates whether the actual value is valid + + + + PathConstraint serves as the abstract base of constraints + that operate on paths and provides several helper methods. + + + + The expected path used in the constraint + + + + The actual path being tested + + + + Flag indicating whether a caseInsensitive comparison should be made + + + + Construct a PathConstraint for a give expected path + + The expected path + + + Modifies the current instance to be case-insensitve + and returns it. + + + + Modifies the current instance to be case-sensitve + and returns it. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Returns true if the expected path and actual path match + + + + Returns the string representation of this constraint + + + + Canonicalize the provided path + + + The path in standardized form + + + Test whether two paths are the same + + The first path + The second path + Indicates whether case should be ignored + + + + Test whether one path is under another path + + The first path - supposed to be the parent path + The second path - supposed to be the child path + Indicates whether case should be ignored + + + + Test whether one path is the same as or under another path + + The first path - supposed to be the parent path + The second path - supposed to be the child path + + + + Summary description for SamePathConstraint. + + + + Initializes a new instance of the class. + + The expected path + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + SubPathConstraint tests that the actual path is under the expected path + + + + Initializes a new instance of the class. + + The expected path + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + SamePathOrUnderConstraint tests that one path is under another + + + + Initializes a new instance of the class. + + The expected path + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Predicate constraint wraps a Predicate in a constraint, + returning success if the predicate is true. + + + + Construct a PredicateConstraint from a predicate + + + + Determines whether the predicate succeeds when applied + to the actual value. + + + + Writes the description to a MessageWriter + + + + Abstract base class used for prefixes + + + + The base constraint + + + + Construct given a base constraint + + + + + NotConstraint negates the effect of some other constraint + + + + Initializes a new instance of the class. + + The base constraint to be negated. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a MessageWriter. + + The writer on which the actual value is displayed + + + AllItemsConstraint applies another constraint to each + item in a collection, succeeding if they all succeed. + + + + Construct an AllItemsConstraint on top of an existing constraint + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + Write a description of this constraint to a MessageWriter + + + + + SomeItemsConstraint applies another constraint to each + item in a collection, succeeding if any of them succeeds. + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + Apply the item constraint to each item in the collection, + succeeding if any item succeeds. + + + + + + Write a description of this constraint to a MessageWriter + + + + + NoItemConstraint applies another constraint to each + item in a collection, failing if any of them succeeds. + + + + Construct a NoItemConstraint on top of an existing constraint + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + Write a description of this constraint to a MessageWriter + + + + + ExactCoutConstraint applies another constraint to each + item in a collection, succeeding only if a specified + number of items succeed. + + + + Construct an ExactCountConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + succeeding only if the expected number of items pass. + + + + + + Write a description of this constraint to a MessageWriter + + + + + PropertyExistsConstraint tests that a named property + exists on the object provided through Match. + Originally, PropertyConstraint provided this feature + in addition to making optional tests on the vaue + of the property. The two constraints are now separate. + + + + Initializes a new instance of the class. + + The name of the property. + + + Test whether the property exists for a given object + + The object to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. + + The writer on which the actual value is displayed + + + Returns the string representation of the constraint. + + + + + PropertyConstraint extracts a named property and uses + its value as the actual value for a chained constraint. + + + + Initializes a new instance of the class. + + The name. + The constraint to apply to the property. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Returns the string representation of the constraint. + + + + + RangeConstraint tests whethe two values are within a + specified range. + + + + Initializes a new instance of the class. + + From. + To. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + ResolvableConstraintExpression is used to represent a compound + constraint being constructed at a point where the last operator + may either terminate the expression or may have additional + qualifying constraints added to it. + It is used, for example, for a Property element or for + an Exception element, either of which may be optionally + followed by constraints that apply to the property or + exception. + + + + Create a new instance of ResolvableConstraintExpression + + + + Create a new instance of ResolvableConstraintExpression, + passing in a pre-populated ConstraintBuilder. + + + + Appends an And Operator to the expression + + + + Appends an Or operator to the expression. + + + + Resolve the current expression to a Constraint + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + ReusableConstraint wraps a resolved constraint so that it + may be saved and reused as needed. + + + + Construct a ReusableConstraint + + The constraint or expression to be reused + + + Conversion operator from a normal constraint to a ReusableConstraint. + + The original constraint to be wrapped as a ReusableConstraint + + + + Returns the string representation of the constraint. + + A string representing the constraint + + + Resolves the ReusableConstraint by returning the constraint + that it originally wrapped. + + A resolved constraint + + + SameAsConstraint tests whether an object is identical to + the object passed to its constructor + + + + Initializes a new instance of the class. + + The expected object. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Returns the string representation + + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Returns the string representation of this constraint + + + + StringConstraint is the abstract base for constraints + that operate on strings. It supports the IgnoreCase + modifier for string operations. + + + + The expected value + + + + Indicates whether tests should be case-insensitive + + + + Constructs a StringConstraint given an expected value + + The expected value + + + Modify the constraint to ignore case in matching. + + + + EmptyStringConstraint tests whether a string is empty. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + NullEmptyStringConstraint tests whether a string is either null or empty. + + + + Constructs a new NullOrEmptyStringConstraint + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + SubstringConstraint can test whether a string contains + the expected substring. + + + + Initializes a new instance of the class. + + The expected. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + StartsWithConstraint can test whether a string starts + with an expected substring. + + + + Initializes a new instance of the class. + + The expected string + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + EndsWithConstraint can test whether a string ends + with an expected substring. + + + + Initializes a new instance of the class. + + The expected string + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + RegexConstraint can test whether a string matches + the pattern provided. + + + + Initializes a new instance of the class. + + The pattern. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + ThrowsConstraint is used to test the exception thrown by + a delegate by applying a constraint to it. + + + + Initializes a new instance of the class, + using a constraint to be applied to the exception. + + A constraint to apply to the caught exception. + + + Get the actual exception thrown - used by Assert.Throws. + + + + Executes the code of the delegate and captures any exception. + If a non-null base constraint was provided, it applies that + constraint to the exception. + + A delegate representing the code to be tested + True if an exception is thrown and the constraint succeeds, otherwise false + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Returns the string representation of this constraint + + + + ThrowsNothingConstraint tests that a delegate does not + throw an exception. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True if no exception is thrown, otherwise false + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Modes in which the tolerance value for a comparison can + be interpreted. + + + + The tolerance was created with a value, without specifying + how the value would be used. This is used to prevent setting + the mode more than once and is generally changed to Linear + upon execution of the test. + + + + The tolerance is used as a numeric range within which + two compared values are considered to be equal. + + + + Interprets the tolerance as the percentage by which + the two compared values my deviate from each other. + + + + Compares two values based in their distance in + representable numbers. + + + + The Tolerance class generalizes the notion of a tolerance + within which an equality test succeeds. Normally, it is + used with numeric types, but it can be used with any + type that supports taking a difference between two + objects and comparing that difference to a value. + + + + Returns an empty Tolerance object, equivalent to + specifying no tolerance. In most cases, it results + in an exact match but for floats and doubles a + default tolerance may be used. + + + + Returns a zero Tolerance object, equivalent to + specifying an exact match. + + + + Constructs a linear tolerance of a specdified amount + + + + Constructs a tolerance given an amount and ToleranceMode + + + + Gets the ToleranceMode for the current Tolerance + + + + Tests that the current Tolerance is linear with a + numeric value, throwing an exception if it is not. + + + + Gets the value of the current Tolerance instance. + + + + Returns a new tolerance, using the current amount as a percentage. + + + + Returns a new tolerance, using the current amount in Ulps. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of days. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of hours. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of minutes. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of seconds. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of milliseconds. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of clock ticks. + + + + Returns true if the current tolerance is empty. + + + + TypeConstraint is the abstract base for constraints + that take a Type as their expected value. + + + + The expected Type used by the constraint + + + + Construct a TypeConstraint for a given Type + + + + + Write the actual value for a failing constraint test to a + MessageWriter. TypeConstraints override this method to write + the name of the type. + + The writer on which the actual value is displayed + + + ExactTypeConstraint is used to test that an object + is of the exact type provided in the constructor + + + + Construct an ExactTypeConstraint for a given Type + + The expected Type. + + + Test that an object is of the exact type specified + + The actual value. + True if the tested object is of the exact type provided, otherwise false. + + + Write the description of this constraint to a MessageWriter + + The MessageWriter to use + + + ExceptionTypeConstraint is a special version of ExactTypeConstraint + used to provided detailed info about the exception thrown in + an error message. + + + + Constructs an ExceptionTypeConstraint + + + + Write the actual value for a failing constraint test to a + MessageWriter. Overriden to write additional information + in the case of an Exception. + + The MessageWriter to use + + + InstanceOfTypeConstraint is used to test that an object + is of the same type provided or derived from it. + + + + Construct an InstanceOfTypeConstraint for the type provided + + The expected Type + + + Test whether an object is of the specified type or a derived type + + The object to be tested + True if the object is of the provided type or derives from it, otherwise false. + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + AssignableFromConstraint is used to test that an object + can be assigned from a given Type. + + + + Construct an AssignableFromConstraint for the type provided + + + + + Test whether an object can be assigned from the specified type + + The object to be tested + True if the object can be assigned a value of the expected Type, otherwise false. + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + AssignableToConstraint is used to test that an object + can be assigned to a given Type. + + + + Construct an AssignableToConstraint for the type provided + + + + + Test whether an object can be assigned to the specified type + + The object to be tested + True if the object can be assigned a value of the expected Type, otherwise false. + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + Static helper class used in the constraint-based syntax + + + + Creates a new SubstringConstraint + + The value of the substring + A SubstringConstraint + + + Creates a new CollectionContainsConstraint. + + The item that should be found. + A new CollectionContainsConstraint + + + Summary description for DirectoryAssert + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are not equal + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are equal + Arguments to be used in formatting the message + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are equal + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + Thrown when an assertion failed. + + + The error message that explains + the reason for the exception + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + Serialization Constructor + + + + Thrown when an assertion failed. + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + Serialization Constructor + + + + Thrown when a test executes inconclusively. + + + The error message that explains + the reason for the exception + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + Serialization Constructor + + + + Thrown when an assertion failed. + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + Serialization Constructor + + + + Summary description for FileAssert. + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if objects are not equal + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if objects are not equal + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if objects are not equal + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the two Stream are the same. + Arguments to be used in formatting the message + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the Streams are the same. + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if objects are not equal + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if objects are not equal + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + GlobalSettings is a place for setting default values used + by the framework in performing asserts. + + + + Default tolerance for floating point equality + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + + + Compares two objects for equality within a tolerance + + The first object to compare + The second object to compare + The tolerance to use in the comparison + + + + + + + + Compares two objects of a given Type for equality within a tolerance + + The first object to compare + The second object to compare + The tolerance to use in the comparison + + + + When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. + + + + Executed before each test is run + + Provides details about the test that is going to be run. + + + Executed after each test is run + + Provides details about the test that has just been run. + + + Provides the target for the action attribute + + The target for the action attribute + + + Interface implemented by a user fixture in order to + validate any expected exceptions. It is only called + for test methods marked with the ExpectedException + attribute. + + + + Method to handle an expected exception + + The exception to be handled + + + Provides details about a test + + + + Creates an instance of TestDetails + + The fixture that the test is a member of, if available. + The method that implements the test, if available. + The full name of the test. + A string representing the type of test, e.g. "Test Case". + Indicates if the test represents a suite of tests. + + + The fixture that the test is a member of, if available. + + + + The method that implements the test, if available. + + + + The full name of the test. + + + + A string representing the type of test, e.g. "Test Case". + + + + Indicates if the test represents a suite of tests. + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + Returns a constraint that tests for null + + + + Returns a constraint that tests for True + + + + Returns a constraint that tests for False + + + + Returns a constraint that tests for a positive value + + + + Returns a constraint that tests for a negative value + + + + Returns a constraint that tests for NaN + + + + Returns a constraint that tests for empty + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + Returns a constraint that tests two items for equality + + + + Returns a constraint that tests that two references are the same object + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + Returns a constraint that tests whether a collection is ordered + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + NOTE: This interface is used in both the framework + and the core, even though that results in two different + types. However, sharing the source code guarantees that + the various implementations will be compatible and that + the core is able to reflect successfully over the + framework implementations of ITestCaseData. + + + + Gets the argument list to be provided to the test + + + + Gets the expected result + + + + Indicates whether a result has been specified. + This is necessary because the result may be + null, so it's value cannot be checked. + + + + Gets the expected exception Type + + + + Gets the FullName of the expected exception + + + + Gets the name to be used for the test + + + + Gets the description of the test + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + Gets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + Gets the ignore reason. + + The ignore reason. + + + The Iz class is a synonym for Is intended for use in VB, + which regards Is as a keyword. + + + + The List class is a helper class with properties and methods + that supply a number of constraints used with lists and collections. + + + + List.Map returns a ListMapper, which can be used to map + the original collection to another collection. + + + + + + ListMapper is used to transform a collection used as an actual argument + producing another collection to be used in the assertion. + + + + Construct a ListMapper based on a collection + + The collection to be transformed + + + Produces a collection containing all the values of a property + + The collection of property values + + + + Randomizer returns a set of random values in a repeatable + way, to allow re-running of tests if necessary. + + + + Get a random seed for use in creating a randomizer. + + + + Get a randomizer for a particular member, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + Get a randomizer for a particular parameter, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + Construct a randomizer using a random seed + + + + Construct a randomizer using a specified seed + + + + Return an array of random doubles between 0.0 and 1.0. + + + + + + Return an array of random doubles with values in a specified range. + + + + Return an array of random ints with values in a specified range. + + + + The SpecialValue enum is used to represent TestCase arguments + that cannot be used as arguments to an Attribute. + + + + Null represents a null value, which cannot be used as an + argument to an attriute under .NET 1.x + + + + Basic Asserts on strings. + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + Asserts that a string is not found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that two strings are Notequal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + + + The TestCaseData class represents a set of arguments + and other parameter info to be used for a parameterized + test case. It provides a number of instance modifiers + for use in initializing the test case. + Note: Instance modifiers are getters that return + the same instance after modifying it's state. + + + + The argument list to be provided to the test + + + + The expected result to be returned + + + + Set to true if this has an expected result + + + + The expected exception Type + + + + The FullName of the expected exception + + + + The name to be used for the test + + + + The description of the test + + + + A dictionary of properties, used to add information + to tests without requiring the class to change. + + + + If true, indicates that the test case is to be ignored + + + + If true, indicates that the test case is marked explicit + + + + The reason for ignoring a test case + + + + Initializes a new instance of the class. + + The arguments. + + + Initializes a new instance of the class. + + The argument. + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + Gets the argument list to be provided to the test + + + + Gets the expected result + + + + Returns true if the result has been set + + + + Gets the expected exception Type + + + + Gets the FullName of the expected exception + + + + Gets the name to be used for the test + + + + Gets the description of the test + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + Gets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + Gets the ignore reason. + + The ignore reason. + + + Gets a list of categories associated with this test. + + + + Gets the property dictionary for this test + + + + Sets the expected result for the test + + The expected result + A modified TestCaseData + + + Sets the expected exception type for the test + + Type of the expected exception. + The modified TestCaseData instance + + + Sets the expected exception type for the test + + FullName of the expected exception. + The modified TestCaseData instance + + + Sets the name of the test case + + The modified TestCaseData instance + + + Sets the description for the test case + being constructed. + + The description. + The modified TestCaseData instance. + + + Applies a category to the test + + + + + + Applies a named property to the test + + + + + + + Applies a named property to the test + + + + + + + Applies a named property to the test + + + + + + + Ignores this TestCase. + + + + + Ignores this TestCase, specifying the reason. + + The reason. + + + + Marks this TestCase as Explicit + + + + + Marks this TestCase as Explicit, specifying the reason. + + The reason. + + + + Provide the context information of the current test + + + + Constructs a TestContext using the provided context dictionary + + A context dictionary + + + Get the current test context. This is created + as needed. The user may save the context for + use within a test, but it should not be used + outside the test for which it is created. + + + + Gets a TestAdapter representing the currently executing test in this context. + + + + Gets a ResultAdapter representing the current result for the test + executing in this context. + + + + Gets the directory containing the current test assembly. + + + + Gets the directory to be used for outputing files created + by this test run. + + + + TestAdapter adapts a Test for consumption by + the user test code. + + + + Constructs a TestAdapter for this context + + The context dictionary + + + The name of the test. + + + + The FullName of the test + + + + The properties of the test. + + + + ResultAdapter adapts a TestResult for consumption by + the user test code. + + + + Construct a ResultAdapter for a context + + The context holding the result + + + The TestState of current test. This maps to the ResultState + used in nunit.core and is subject to change in the future. + + + + The TestStatus of current test. This enum will be used + in future versions of NUnit and so is to be preferred + to the TestState value. + + + + The ResultState enum indicates the result of running a test + + + + The result is inconclusive + + + + The test was not runnable. + + + + The test has been skipped. + + + + The test has been ignored. + + + + The test succeeded + + + + The test failed + + + + The test encountered an unexpected exception + + + + The test was cancelled by the user + + + + The TestStatus enum indicates the result of running a test + + + + The test was inconclusive + + + + The test has skipped + + + + The test succeeded + + + + The test failed + + + + Helper class with static methods used to supply constraints + that operate on strings. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + TextMessageWriter writes constraint descriptions and messages + in displayable form as a text stream. It tailors the display + of individual message components to form the standard message + format of NUnit assertion failure messages. + + + + Prefix used for the expected value line of a message + + + + Prefix used for the actual value line of a message + + + + Length of a message prefix + + + + Construct a TextMessageWriter + + + + Construct a TextMessageWriter, specifying a user message + and optional formatting arguments. + + + + + + Gets or sets the maximum line length for this writer + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The constraint that failed + + + Display Expected and Actual lines for given values. This + method may be called by constraints that need more control over + the display of actual and expected values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + Display Expected and Actual lines for given values, including + a tolerance value on the expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + Display the expected and actual string values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in string comparisons + If true, clip the strings to fit the max line length + + + Writes the text for a connector. + + The connector. + + + Writes the text for a predicate. + + The predicate. + + + Write the text for a modifier. + + The modifier. + + + Writes the text for an expected value. + + The expected value. + + + Writes the text for an actual value. + + The actual value. + + + Writes the text for a generalized value. + + The value. + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + Write the generic 'Expected' line for a constraint + + The constraint that failed + + + Write the generic 'Expected' line for a given value + + The expected value + + + Write the generic 'Expected' line for a given value + and tolerance. + + The expected value + The tolerance within which the test was made + + + Write the generic 'Actual' line for a constraint + + The constraint for which the actual value is to be written + + + Write the generic 'Actual' line for a given value + + The actual value causing a failure + + + Helper class with properties and methods that supply + constraints that operate on exceptions. + + + + Creates a constraint specifying an expected exception + + + + Creates a constraint specifying an exception with a given InnerException + + + + Creates a constraint specifying an expected TargetInvocationException + + + + Creates a constraint specifying an expected TargetInvocationException + + + + Creates a constraint specifying an expected TargetInvocationException + + + + Creates a constraint specifying that no exception is thrown + + + + Creates a constraint specifying the exact type of exception expected + + + + Creates a constraint specifying the exact type of exception expected + + + + Creates a constraint specifying the type of exception expected + + + + Creates a constraint specifying the type of exception expected + + + diff --git a/frameworks/csharp/nunit/framework/nunit.framework.dll b/frameworks/csharp/nunit/framework/nunit.framework.dll new file mode 100755 index 00000000..956c32c2 Binary files /dev/null and b/frameworks/csharp/nunit/framework/nunit.framework.dll differ diff --git a/frameworks/csharp/nunit/framework/nunit.framework.xml b/frameworks/csharp/nunit/framework/nunit.framework.xml new file mode 100644 index 00000000..bec89757 --- /dev/null +++ b/frameworks/csharp/nunit/framework/nunit.framework.xml @@ -0,0 +1,9329 @@ + + + + nunit.framework + + + + + Delegate used by tests that execute code and + capture any thrown exception. + + + + The Assert class contains a collection of static methods that + implement the most common assertions used in NUnit. + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + Gets the number of assertions executed so far and + resets the counter to zero. + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + Helper for Assert.AreEqual(double expected, double actual, ...) + allowing code generation to work consistently. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + Arguments to be used in formatting the message + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + + + Throws an with the message and arguments + that are passed in. This is used by the other Assert functions. + + The message to initialize the with. + Arguments to be used in formatting the message + + + Throws an with the message that is + passed in. This is used by the other Assert functions. + + The message to initialize the with. + + + Throws an . + This is used by the other Assert functions. + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + Arguments to be used in formatting the message + + + Throws an with the message that is + passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + + + Throws an . + This causes the test to be reported as ignored. + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + Arguments to be used in formatting the message + + + Throws an with the message that is + passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + + + Throws an . + This causes the test to be reported as Inconclusive. + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + + This method is provided for use by VB developers needing to test + the value of properties with private setters. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + The message that will be displayed on failure + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestSnippet delegate + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + The message that will be displayed on failure + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestSnippet delegate + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + The message that will be displayed on failure + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestSnippet delegate + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + Verifies that a delegate does not throw an exception + + A TestSnippet delegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Verifies that a delegate does not throw an exception. + + A TestSnippet delegate + The message that will be displayed on failure + + + Verifies that a delegate does not throw an exception. + + A TestSnippet delegate + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + The message to display in case of failure + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + + + Assert that a string is not null or empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + Assert that a string is not null or empty + + The string to be tested + The message to display in case of failure + + + Assert that a string is not null or empty + + The string to be tested + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + Verifies that two values are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + + + AssertionHelper is an optional base class for user tests, + allowing the use of shorter names for constraints and + asserts and avoiding conflict with the definition of + , from which it inherits much of its + behavior, in certain mock object frameworks. + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That + + A Constraint to be applied + The actual value to test + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to Assert.That. + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to Assert.That. + + The evaluated condition + The message to display if the condition is false + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically Assert.That. + + The evaluated condition + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + Returns a ListMapper based on a collection. + + The original collection + + + + Provides static methods to express the assumptions + that must be met for a test to give a meaningful + result. If an assumption is not met, the test + should produce an inconclusive result. + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + + + Asserts that a condition is true. If the condition is false the + method throws an . + + The evaluated condition + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + The different targets a test action attribute can be applied to + + + + Default target, which is determined by where the action attribute is attached + + + + Target a individual test case + + + + Target a suite of test cases + + + + Attribute used to apply a category to a test + + + + The name of the category + + + + Construct attribute for a given category based on + a name. The name may not contain the characters ',', + '+', '-' or '!'. However, this is not checked in the + constructor since it would cause an error to arise at + as the test was loaded without giving a clear indication + of where the problem is located. The error is handled + in NUnitFramework.cs by marking the test as not + runnable. + + The name of the category + + + Protected constructor uses the Type name as the name + of the category. + + + + The name of the category + + + + Used to mark a field for use as a datapoint when executing a theory + within the same fixture that requires an argument of the field's Type. + + + + Used to mark an array as containing a set of datapoints to be used + executing a theory within the same fixture that requires an argument + of the Type of the array elements. + + + + Attribute used to provide descriptive text about a + test case or fixture. + + + + Construct the attribute + + Text describing the test + + + Gets the test description + + + + Enumeration indicating how the expected message parameter is to be used + + + Expect an exact match + + Expect a message containing the parameter string + + Match the regular expression provided as a parameter + + Expect a message that starts with the parameter string + + + ExpectedExceptionAttribute + + + + Constructor for a non-specific exception + + + + Constructor for a given type of exception + + The type of the expected exception + + + Constructor for a given exception name + + The full name of the expected exception + + + Gets or sets the expected exception type + + + + Gets or sets the full Type name of the expected exception + + + + Gets or sets the expected message text + + + + Gets or sets the user message displayed in case of failure + + + + Gets or sets the type of match to be performed on the expected message + + + + Gets the name of a method to be used as an exception handler + + + + ExplicitAttribute marks a test or test fixture so that it will + only be run if explicitly executed from the gui or command line + or if it is included by use of a filter. The test will not be + run simply because an enclosing suite is run. + + + + Default constructor + + + + Constructor with a reason + + The reason test is marked explicit + + + The reason test is marked explicit + + + + Attribute used to mark a test that is to be ignored. + Ignored tests result in a warning message when the + tests are run. + + + + Constructs the attribute without giving a reason + for ignoring the test. + + + + Constructs the attribute giving a reason for ignoring the test + + The reason for ignoring the test + + + The reason for ignoring a test + + + + Abstract base for Attributes that are used to include tests + in the test run based on environmental settings. + + + + Constructor with no included items specified, for use + with named property syntax. + + + + Constructor taking one or more included items + + Comma-delimited list of included items + + + Name of the item that is needed in order for + a test to run. Multiple itemss may be given, + separated by a comma. + + + + Name of the item to be excluded. Multiple items + may be given, separated by a comma. + + + + The reason for including or excluding the test + + + + PlatformAttribute is used to mark a test fixture or an + individual method as applying to a particular platform only. + + + + Constructor with no platforms specified, for use + with named property syntax. + + + + Constructor taking one or more platforms + + Comma-deliminted list of platforms + + + CultureAttribute is used to mark a test fixture or an + individual method as applying to a particular Culture only. + + + + Constructor with no cultures specified, for use + with named property syntax. + + + + Constructor taking one or more cultures + + Comma-deliminted list of cultures + + + Marks a test to use a combinatorial join of any argument data + provided. NUnit will create a test case for every combination of + the arguments provided. This can result in a large number of test + cases and so should be used judiciously. This is the default join + type, so the attribute need not be used except as documentation. + + + + Default constructor + + + + Marks a test to use pairwise join of any argument data provided. + NUnit will attempt too excercise every pair of argument values at + least once, using as small a number of test cases as it can. With + only two arguments, this is the same as a combinatorial join. + + + + Default constructor + + + + Marks a test to use a sequential join of any argument data + provided. NUnit will use arguements for each parameter in + sequence, generating test cases up to the largest number + of argument values provided and using null for any arguments + for which it runs out of values. Normally, this should be + used with the same number of arguments for each parameter. + + + + Default constructor + + + + Summary description for MaxTimeAttribute. + + + + Construct a MaxTimeAttribute, given a time in milliseconds. + + The maximum elapsed time in milliseconds + + + PropertyAttribute is used to attach information to a test as a name/value pair.. + + + + Construct a PropertyAttribute with a name and string value + + The name of the property + The property value + + + Construct a PropertyAttribute with a name and int value + + The name of the property + The property value + + + Construct a PropertyAttribute with a name and double value + + The name of the property + The property value + + + Constructor for derived classes that set the + property dictionary directly. + + + + Constructor for use by derived classes that use the + name of the type as the property name. Derived classes + must ensure that the Type of the property value is + a standard type supported by the BCL. Any custom + types will cause a serialization Exception when + in the client. + + + + Gets the property dictionary for this attribute + + + + RandomAttribute is used to supply a set of random values + to a single parameter of a parameterized test. + + + + Construct a set of doubles from 0.0 to 1.0, + specifying only the count. + + + + + Construct a set of doubles from min to max + + + + + + + Construct a set of ints from min to max + + + + + + + Get the collection of values to be used as arguments + + + + RangeAttribute is used to supply a range of values to an + individual parameter of a parameterized test. + + + + Construct a range of ints using default step of 1 + + + + + + Construct a range of ints specifying the step size + + + + + + + Construct a range of longs + + + + + + + Construct a range of doubles + + + + + + + Construct a range of floats + + + + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + Construct a RepeatAttribute + + The number of times to run the test + + + RequiredAddinAttribute may be used to indicate the names of any addins + that must be present in order to run some or all of the tests in an + assembly. If the addin is not loaded, the entire assembly is marked + as NotRunnable. + + + + Initializes a new instance of the class. + + The required addin. + + + Gets the name of required addin. + + The required addin name. + + + Summary description for SetCultureAttribute. + + + + Construct given the name of a culture + + + + + Summary description for SetUICultureAttribute. + + + + Construct given the name of a culture + + + + + SetUpAttribute is used in a TestFixture to identify a method + that is called immediately before each test is run. It is + also used in a SetUpFixture to identify the method that is + called once, before any of the subordinate tests are run. + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + Attribute used to mark a static (shared in VB) property + that returns a list of tests. + + + + Attribute used in a TestFixture to identify a method that is + called immediately after each test is run. It is also used + in a SetUpFixture to identify the method that is called once, + after all subordinate tests have run. In either case, the method + is guaranteed to be called, even if an exception is thrown. + + + + Provide actions to execute before and after tests. + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + [Test(Description = "more detailed description")] + publc void TestDescriptionMethod() + {} + } + + + + Descriptive text for this test + + + + TestCaseAttribute is used to mark parameterized test cases + and provide them with their arguments. + + + + Construct a TestCaseAttribute with a list of arguments. + This constructor is not CLS-Compliant + + + + + Construct a TestCaseAttribute with a single argument + + + + + Construct a TestCaseAttribute with a two arguments + + + + + + Construct a TestCaseAttribute with a three arguments + + + + + + + Gets the list of arguments to a test case + + + + Gets or sets the expected result. Use + ExpectedResult by preference. + + The result. + + + Gets or sets the expected result. + + The result. + + + Gets a flag indicating whether an expected + result has been set. + + + + Gets a list of categories associated with this test; + + + + Gets or sets the category associated with this test. + May be a single category or a comma-separated list. + + + + Gets or sets the expected exception. + + The expected exception. + + + Gets or sets the name the expected exception. + + The expected name of the exception. + + + Gets or sets the expected message of the expected exception + + The expected message of the exception. + + + Gets or sets the type of match to be performed on the expected message + + + + Gets or sets the description. + + The description. + + + Gets or sets the name of the test. + + The name of the test. + + + Gets or sets the ignored status of the test + + + + Gets or sets the ignored status of the test + + + + Gets or sets the explicit status of the test + + + + Gets or sets the reason for not running the test + + + + Gets or sets the reason for not running the test. + Set has the side effect of marking the test as ignored. + + The ignore reason. + + + FactoryAttribute indicates the source to be used to + provide test cases for a test method. + + + + Construct with the name of the data source, which must + be a property, field or method of the test class itself. + + An array of the names of the factories that will provide data + + + Construct with a Type, which must implement IEnumerable + + The Type that will provide data + + + Construct with a Type and name. + that don't support params arrays. + + The Type that will provide data + The name of the method, property or field that will provide data + + + The name of a the method, property or fiend to be used as a source + + + + A Type to be used as a source + + + + Gets or sets the category associated with this test. + May be a single category or a comma-separated list. + + + + [TestFixture] + public class ExampleClass + {} + + + + Default constructor + + + + Construct with a object[] representing a set of arguments. + In .NET 2.0, the arguments may later be separated into + type arguments and constructor arguments. + + + + + Descriptive text for this fixture + + + + Gets and sets the category for this fixture. + May be a comma-separated list of categories. + + + + Gets a list of categories for this fixture + + + + The arguments originally provided to the attribute + + + + Gets or sets a value indicating whether this should be ignored. + + true if ignore; otherwise, false. + + + Gets or sets the ignore reason. May set Ignored as a side effect. + + The ignore reason. + + + Get or set the type arguments. If not set + explicitly, any leading arguments that are + Types are taken as type arguments. + + + + Attribute used to identify a method that is + called before any tests in a fixture are run. + + + + Attribute used to identify a method that is called after + all the tests in a fixture have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + [Test(Description = "more detailed description")] + publc void TestDescriptionMethod() + {} + } + + + + Used on a method, marks the test with a timeout value in milliseconds. + The test will be run in a separate thread and is cancelled if the timeout + is exceeded. Used on a method or assembly, sets the default timeout + for all contained test methods. + + + + Construct a TimeoutAttribute given a time in milliseconds + + The timeout value in milliseconds + + + Marks a test that must run in the STA, causing it + to run in a separate thread if necessary. + On methods, you may also use STAThreadAttribute + to serve the same purpose. + + + + Construct a RequiresSTAAttribute + + + + Marks a test that must run in the MTA, causing it + to run in a separate thread if necessary. + On methods, you may also use MTAThreadAttribute + to serve the same purpose. + + + + Construct a RequiresMTAAttribute + + + + Marks a test that must run on a separate thread. + + + + Construct a RequiresThreadAttribute + + + + Construct a RequiresThreadAttribute, specifying the apartment + + + + Abstract base class for attributes that apply to parameters + and supply data for the parameter. + + + + Gets the data to be provided to the specified parameter + + + + ValuesAttribute is used to provide literal arguments for + an individual parameter of a test. + + + + The collection of data to be returned. Must + be set by any derived attribute classes. + We use an object[] so that the individual + elements may have their type changed in GetData + if necessary. + + + + Construct with one argument + + + + + Construct with two arguments + + + + + + Construct with three arguments + + + + + + + Construct with an array of arguments + + + + + Get the collection of values to be used as arguments + + + + ValueSourceAttribute indicates the source to be used to + provide data for one parameter of a test method. + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + The name of the data source to be used + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of the method, property or field that will provide data + + + The name of a the method, property or fiend to be used as a source + + + + A Type to be used as a source + + + + A set of Assert methods operationg on one or more collections + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + The message that will be displayed on failure + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + Arguments to be used in formatting the message + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + + + AttributeExistsConstraint tests for the presence of a + specified attribute on a Type. + + + + Constructs an AttributeExistsConstraint for a specific attribute Type + + + + + Tests whether the object provides the expected attribute. + + A Type, MethodInfo, or other ICustomAttributeProvider + True if the expected attribute is present, otherwise false + + + Writes the description of the constraint to the specified writer + + + + AttributeConstraint tests that a specified attribute is present + on a Type or other provider and that the value of the attribute + satisfies some other constraint. + + + + Constructs an AttributeConstraint for a specified attriute + Type and base constraint. + + + + + + Determines whether the Type or other provider has the + expected attribute and if its value matches the + additional constraint specified. + + + + Writes a description of the attribute to the specified writer. + + + + Writes the actual value supplied to the specified writer. + + + + Returns a string representation of the constraint. + + + + BasicConstraint is the abstract base for constraints that + perform a simple comparison to a constant value. + + + + Initializes a new instance of the class. + + The expected. + The description. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + NullConstraint tests that the actual value is null + + + + Initializes a new instance of the class. + + + + TrueConstraint tests that the actual value is true + + + + Initializes a new instance of the class. + + + + FalseConstraint tests that the actual value is false + + + + Initializes a new instance of the class. + + + + NaNConstraint tests that the actual value is a double or float NaN + + + + Test that the actual value is an NaN + + + + + + Write the constraint description to a specified writer + + + + + BinaryConstraint is the abstract base of all constraints + that combine two other constraints in some fashion. + + + + The first constraint being combined + + + + The second constraint being combined + + + + Construct a BinaryConstraint from two other constraints + + The first constraint + The second constraint + + + AndConstraint succeeds only if both members succeed. + + + + Create an AndConstraint from two other constraints + + The first constraint + The second constraint + + + Apply both member constraints to an actual value, succeeding + succeeding only if both of them succeed. + + The actual value + True if the constraints both succeeded + + + Write a description for this contraint to a MessageWriter + + The MessageWriter to receive the description + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + OrConstraint succeeds if either member succeeds + + + + Create an OrConstraint from two other constraints + + The first constraint + The second constraint + + + Apply the member constraints to an actual value, succeeding + succeeding as soon as one of them succeeds. + + The actual value + True if either constraint succeeded + + + Write a description for this contraint to a MessageWriter + + The MessageWriter to receive the description + + + CollectionConstraint is the abstract base class for + constraints that operate on collections. + + + + Construct an empty CollectionConstraint + + + + Construct a CollectionConstraint + + + + + Determines whether the specified enumerable is empty. + + The enumerable. + + true if the specified enumerable is empty; otherwise, false. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Protected method to be implemented by derived classes + + + + + + CollectionItemsEqualConstraint is the abstract base class for all + collection constraints that apply some notion of item equality + as a part of their operation. + + + + Construct an empty CollectionConstraint + + + + Construct a CollectionConstraint + + + + + Flag the constraint to ignore case and return self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Compares two collection members for equality + + + + Return a new CollectionTally for use in making tests + + The collection to be included in the tally + + + EmptyCollectionConstraint tests whether a collection is empty. + + + + Check that the collection is empty + + + + + + Write the constraint description to a MessageWriter + + + + + UniqueItemsConstraint tests whether all the items in a + collection are unique. + + + + Check that all items are unique. + + + + + + Write a description of this constraint to a MessageWriter + + + + + CollectionContainsConstraint is used to test whether a collection + contains an expected object as a member. + + + + Construct a CollectionContainsConstraint + + + + + Test whether the expected item is contained in the collection + + + + + + Write a descripton of the constraint to a MessageWriter + + + + + CollectionEquivalentCOnstraint is used to determine whether two + collections are equivalent. + + + + Construct a CollectionEquivalentConstraint + + + + + Test whether two collections are equivalent + + + + + + Write a description of this constraint to a MessageWriter + + + + + CollectionSubsetConstraint is used to determine whether + one collection is a subset of another + + + + Construct a CollectionSubsetConstraint + + The collection that the actual value is expected to be a subset of + + + Test whether the actual collection is a subset of + the expected collection provided. + + + + + + Write a description of this constraint to a MessageWriter + + + + + CollectionOrderedConstraint is used to test whether a collection is ordered. + + + + Construct a CollectionOrderedConstraint + + + + If used performs a reverse comparison + + + + Modifies the constraint to use an IComparer and returns self. + + + + Modifies the constraint to use an IComparer<T> and returns self. + + + + Modifies the constraint to use a Comparison<T> and returns self. + + + + Modifies the constraint to test ordering by the value of + a specified property and returns self. + + + + Test whether the collection is ordered + + + + + + Write a description of the constraint to a MessageWriter + + + + + Returns the string representation of the constraint. + + + + + CollectionTally counts (tallies) the number of + occurences of each object in one or more enumerations. + + + + Construct a CollectionTally object from a comparer and a collection + + + + The number of objects remaining in the tally + + + + Try to remove an object from the tally + + The object to remove + True if successful, false if the object was not found + + + Try to remove a set of objects from the tally + + The objects to remove + True if successful, false if any object was not found + + + ComparisonAdapter class centralizes all comparisons of + values in NUnit, adapting to the use of any provided + IComparer, IComparer<T> or Comparison<T> + + + + Gets the default ComparisonAdapter, which wraps an + NUnitComparer object. + + + + Returns a ComparisonAdapter that wraps an IComparer + + + + Returns a ComparisonAdapter that wraps an IComparer<T> + + + + Returns a ComparisonAdapter that wraps a Comparison<T> + + + + Compares two objects + + + + Construct a default ComparisonAdapter + + + + Construct a ComparisonAdapter for an IComparer + + + + Compares two objects + + + + + + + ComparisonAdapter<T> extends ComparisonAdapter and + allows use of an IComparer<T> or Comparison<T> + to actually perform the comparison. + + + + Construct a ComparisonAdapter for an IComparer<T> + + + + Compare a Type T to an object + + + + Construct a ComparisonAdapter for a Comparison<T> + + + + Compare a Type T to an object + + + + Abstract base class for constraints that compare values to + determine if one is greater than, equal to or less than + the other. This class supplies the Using modifiers. + + + + ComparisonAdapter to be used in making the comparison + + + + Initializes a new instance of the class. + + + + Initializes a new instance of the class. + + + + Modifies the constraint to use an IComparer and returns self + + + + Modifies the constraint to use an IComparer<T> and returns self + + + + Modifies the constraint to use a Comparison<T> and returns self + + + + Delegate used to delay evaluation of the actual value + to be used in evaluating a constraint + + + + The Constraint class is the base of all built-in constraints + within NUnit. It provides the operator overloads used to combine + constraints. + + + + Class used to detect any derived constraints + that fail to set the actual value in their + Matches override. + + + + Static UnsetObject used to detect derived constraints + failing to set the actual value. + + + + The actual value being tested against a constraint + + + + The display name of this Constraint for use by ToString() + + + + Argument fields used by ToString(); + + + + The builder holding this constraint + + + + Construct a constraint with no arguments + + + + Construct a constraint with one argument + + + + Construct a constraint with two arguments + + + + Sets the ConstraintBuilder holding this constraint + + + + The display name of this Constraint for use by ToString(). + The default value is the name of the constraint with + trailing "Constraint" removed. Derived classes may set + this to another name in their constructors. + + + + Write the failure message to the MessageWriter provided + as an argument. The default implementation simply passes + the constraint and the actual value to the writer, which + then displays the constraint description and the value. + Constraints that need to provide additional details, + such as where the error occured can override this. + + The MessageWriter on which to display the message + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Test whether the constraint is satisfied by an + ActualValueDelegate that returns the value to be tested. + The default implementation simply evaluates the delegate + but derived classes may override it to provide for delayed + processing. + + An ActualValueDelegate + True for success, false for failure + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Default override of ToString returns the constraint DisplayName + followed by any arguments within angle brackets. + + + + + Returns the string representation of this constraint + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + Returns a ConstraintExpression by appending Or + to the current constraint. + + + + Returns a DelayedConstraint with the specified delay time. + + The delay in milliseconds. + + + + Returns a DelayedConstraint with the specified delay time + and polling interval. + + The delay in milliseconds. + The interval at which to test the constraint. + + + + ConstraintBuilder maintains the stacks that are used in + processing a ConstraintExpression. An OperatorStack + is used to hold operators that are waiting for their + operands to be reognized. a ConstraintStack holds + input constraints as well as the results of each + operator applied. + + + + OperatorStack is a type-safe stack for holding ConstraintOperators + + + + Initializes a new instance of the class. + + The builder. + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + Gets the topmost operator without modifying the stack. + + The top. + + + Pushes the specified operator onto the stack. + + The op. + + + Pops the topmost operator from the stack. + + + + + ConstraintStack is a type-safe stack for holding Constraints + + + + Initializes a new instance of the class. + + The builder. + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + Gets the topmost constraint without modifying the stack. + + The topmost constraint + + + Pushes the specified constraint. As a side effect, + the constraint's builder field is set to the + ConstraintBuilder owning this stack. + + The constraint. + + + Pops this topmost constrait from the stack. + As a side effect, the constraint's builder + field is set to null. + + + + + Initializes a new instance of the class. + + + + Gets a value indicating whether this instance is resolvable. + + + true if this instance is resolvable; otherwise, false. + + + + Appends the specified operator to the expression by first + reducing the operator stack and then pushing the new + operator on the stack. + + The operator to push. + + + Appends the specified constraint to the expresson by pushing + it on the constraint stack. + + The constraint to push. + + + Sets the top operator right context. + + The right context. + + + Reduces the operator stack until the topmost item + precedence is greater than or equal to the target precedence. + + The target precedence. + + + Resolves this instance, returning a Constraint. If the builder + is not currently in a resolvable state, an exception is thrown. + + The resolved constraint + + + ConstraintExpression represents a compound constraint in the + process of being constructed from a series of syntactic elements. + Individual elements are appended to the expression as they are + reognized. Once an actual Constraint is appended, the expression + returns a resolvable Constraint. + + + + Initializes a new instance of the class. + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + With is currently a NOP - reserved for future use. + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + Returns a constraint that tests for null + + + + Returns a constraint that tests for True + + + + Returns a constraint that tests for False + + + + Returns a constraint that tests for a positive value + + + + Returns a constraint that tests for a negative value + + + + Returns a constraint that tests for NaN + + + + Returns a constraint that tests for empty + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + Returns a constraint that tests two items for equality + + + + Returns a constraint that tests that two references are the same object + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + Returns a constraint that tests whether a collection is ordered + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + ConstraintExpressionBase is the abstract base class for the + ConstraintExpression class, which represents a + compound constraint in the process of being constructed + from a series of syntactic elements. + NOTE: ConstraintExpressionBase is separate because the + ConstraintExpression class was generated in earlier + versions of NUnit. The two classes may be combined + in a future version. + + + + The ConstraintBuilder holding the elements recognized so far + + + + Initializes a new instance of the class. + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + Returns a string representation of the expression as it + currently stands. This should only be used for testing, + since it has the side-effect of resolving the expression. + + + + + Appends an operator to the expression and returns the + resulting expression itself. + + + + Appends a self-resolving operator to the expression and + returns a new ResolvableConstraintExpression. + + + + Appends a constraint to the expression and returns that + constraint, which is associated with the current state + of the expression being built. + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + Returns a constraint that tests for null + + + + Returns a constraint that tests for True + + + + Returns a constraint that tests for False + + + + Returns a constraint that tests for a positive value + + + + Returns a constraint that tests for a negative value + + + + Returns a constraint that tests for NaN + + + + Returns a constraint that tests for empty + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + Returns a constraint that tests two items for equality + + + + Returns a constraint that tests that two references are the same object + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + Returns a constraint that tests whether a collection is ordered + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + The ConstraintOperator class is used internally by a + ConstraintBuilder to represent an operator that + modifies or combines constraints. + Constraint operators use left and right precedence + values to determine whether the top operator on the + stack should be reduced before pushing a new operator. + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + The precedence value used when the operator + is on the top of the stack. + + + + The syntax element preceding this operator + + + + The syntax element folowing this operator + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + The precedence value used when the operator + is on the top of the stack. + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + PrefixOperator takes a single constraint and modifies + it's action in some way. + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Returns the constraint created by applying this + prefix to another constraint. + + + + + + Negates the test of the constraint it wraps. + + + + Constructs a new NotOperator + + + + Returns a NotConstraint applied to its argument. + + + + Abstract base for operators that indicate how to + apply a constraint to items in a collection. + + + + Constructs a CollectionOperator + + + + Represents a constraint that succeeds if all the + members of a collection match a base constraint. + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + they all succeed. + + + + Represents a constraint that succeeds if any of the + members of a collection match a base constraint. + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + any of them succeed. + + + + Represents a constraint that succeeds if none of the + members of a collection match a base constraint. + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + Represents a constraint that succeeds if the specified + count of members of a collection match a base constraint. + + + + Construct an ExactCountOperator for a specified count + + The expected count + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + Represents a constraint that simply wraps the + constraint provided as an argument, without any + further functionality, but which modifes the + order of evaluation because of its precedence. + + + + Constructor for the WithOperator + + + + Returns a constraint that wraps its argument + + + + Abstract base class for operators that are able to reduce to a + constraint whether or not another syntactic element follows. + + + + Operator used to test for the presence of a named Property + on an object and optionally apply further tests to the + value of that property. + + + + Gets the name of the property to which the operator applies + + + + Constructs a PropOperator for a particular named property + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Operator that tests for the presence of a particular attribute + on a type and optionally applies further tests to the attribute. + + + + Construct an AttributeOperator for a particular Type + + The Type of attribute tested + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + Operator that tests that an exception is thrown and + optionally applies further tests to the exception. + + + + Construct a ThrowsOperator + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + Abstract base class for all binary operators + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Gets the left precedence of the operator + + + + Gets the right precedence of the operator + + + + Abstract method that produces a constraint by applying + the operator to its left and right constraint arguments. + + + + Operator that requires both it's arguments to succeed + + + + Construct an AndOperator + + + + Apply the operator to produce an AndConstraint + + + + Operator that requires at least one of it's arguments to succeed + + + + Construct an OrOperator + + + + Apply the operator to produce an OrConstraint + + + + ContainsConstraint tests a whether a string contains a substring + or a collection contains an object. It postpones the decision of + which test to use until the type of the actual argument is known. + This allows testing whether a string is contained in a collection + or as a substring of another string using the same syntax. + + + + Initializes a new instance of the class. + + The expected. + + + Flag the constraint to ignore case and return self. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Applies a delay to the match so that a match can be evaluated in the future. + + + + Creates a new DelayedConstraint + + The inner constraint two decorate + The time interval after which the match is performed + If the value of is less than 0 + + + Creates a new DelayedConstraint + + The inner constraint two decorate + The time interval after which the match is performed + The time interval used for polling + If the value of is less than 0 + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + Test whether the constraint is satisfied by a delegate + + The delegate whose value is to be tested + True for if the base constraint fails, false if it succeeds + + + Test whether the constraint is satisfied by a given reference. + Overridden to wait for the specified delay period before + calling the base constraint with the dereferenced value. + + A reference to the value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a MessageWriter. + + The writer on which the actual value is displayed + + + Returns the string representation of the constraint. + + + + EmptyDirectoryConstraint is used to test that a directory is empty + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + EmptyConstraint tests a whether a string or collection is empty, + postponing the decision about which test is applied until the + type of the actual argument is known. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + EqualConstraint is able to compare an actual value with the + expected value provided in its constructor. Two objects are + considered equal if both are null, or if both have the same + value. NUnit has special semantics for some object types. + + + + If true, strings in error messages will be clipped + + + + NUnitEqualityComparer used to test equality. + + + + Initializes a new instance of the class. + + The expected value. + + + Flag the constraint to ignore case and return self. + + + + Flag the constraint to suppress string clipping + and return self. + + + + Flag the constraint to compare arrays as collections + and return self. + + + + Flag the constraint to use a tolerance when determining equality. + + Tolerance value to be used + Self. + + + Switches the .Within() modifier to interpret its tolerance as + a distance in representable values (see remarks). + + Self. + + Ulp stands for "unit in the last place" and describes the minimum + amount a given value can change. For any integers, an ulp is 1 whole + digit. For floating point values, the accuracy of which is better + for smaller numbers and worse for larger numbers, an ulp depends + on the size of the number. Using ulps for comparison of floating + point results instead of fixed tolerances is safer because it will + automatically compensate for the added inaccuracy of larger numbers. + + + + Switches the .Within() modifier to interpret its tolerance as + a percentage that the actual values is allowed to deviate from + the expected value. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in days. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in hours. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in minutes. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in seconds. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in milliseconds. + + Self + + + Causes the tolerance to be interpreted as a TimeSpan in clock ticks. + + Self + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write a failure message. Overridden to provide custom + failure messages for EqualConstraint. + + The MessageWriter to write to + + + Write description of this constraint + + The MessageWriter to write to + + + Display the failure information for two collections that did not match. + + The MessageWriter on which to display + The expected collection. + The actual collection + The depth of this failure in a set of nested collections + + + Displays a single line showing the types and sizes of the expected + and actual enumerations, collections or arrays. If both are identical, + the value is only shown once. + + The MessageWriter on which to display + The expected collection or array + The actual collection or array + The indentation level for the message line + + + Displays a single line showing the point in the expected and actual + arrays at which the comparison failed. If the arrays have different + structures or dimensions, both values are shown. + + The MessageWriter on which to display + The expected array + The actual array + Index of the failure point in the underlying collections + The indentation level for the message line + + + Display the failure information for two IEnumerables that did not match. + + The MessageWriter on which to display + The expected enumeration. + The actual enumeration + The depth of this failure in a set of nested collections + + + EqualityAdapter class handles all equality comparisons + that use an IEqualityComparer, IEqualityComparer<T> + or a ComparisonAdapter. + + + + Compares two objects, returning true if they are equal + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + Returns an EqualityAdapter that wraps an IComparer. + + + + EqualityAdapter that wraps an IComparer. + + + + Returns an EqualityAdapter that wraps an IEqualityComparer. + + + + Returns true if the two objects can be compared by this adapter. + Generic adapter requires objects of the specified type. + + + + Returns an EqualityAdapter that wraps an IEqualityComparer<T>. + + + + Returns an EqualityAdapter that wraps an IComparer<T>. + + + + EqualityAdapter that wraps an IComparer. + + + + Returns an EqualityAdapter that wraps a Comparison<T>. + + + Helper routines for working with floating point numbers + + + The floating point comparison code is based on this excellent article: + http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + + + "ULP" means Unit in the Last Place and in the context of this library refers to + the distance between two adjacent floating point numbers. IEEE floating point + numbers can only represent a finite subset of natural numbers, with greater + accuracy for smaller numbers and lower accuracy for very large numbers. + + + If a comparison is allowed "2 ulps" of deviation, that means the values are + allowed to deviate by up to 2 adjacent floating point values, which might be + as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. + + + + Union of a floating point variable and an integer + + The union's value as a floating point variable + + The union's value as an integer + + The union's value as an unsigned integer + + Union of a double precision floating point variable and a long + + The union's value as a double precision floating point variable + + The union's value as a long + + The union's value as an unsigned long + + Compares two floating point values for equality + First floating point value to be compared + Second floating point value t be compared + + Maximum number of representable floating point values that are allowed to + be between the left and the right floating point values + + True if both numbers are equal or close to being equal + + + Floating point values can only represent a finite subset of natural numbers. + For example, the values 2.00000000 and 2.00000024 can be stored in a float, + but nothing inbetween them. + + + This comparison will count how many possible floating point values are between + the left and the right number. If the number of possible values between both + numbers is less than or equal to maxUlps, then the numbers are considered as + being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + Compares two double precision floating point values for equality + First double precision floating point value to be compared + Second double precision floating point value t be compared + + Maximum number of representable double precision floating point values that are + allowed to be between the left and the right double precision floating point values + + True if both numbers are equal or close to being equal + + + Double precision floating point values can only represent a limited series of + natural numbers. For example, the values 2.0000000000000000 and 2.0000000000000004 + can be stored in a double, but nothing inbetween them. + + + This comparison will count how many possible double precision floating point + values are between the left and the right number. If the number of possible + values between both numbers is less than or equal to maxUlps, then the numbers + are considered as being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + Reinterprets the memory contents of a floating point value as an integer value + + + Floating point value whose memory contents to reinterpret + + + The memory contents of the floating point value interpreted as an integer + + + + Reinterprets the memory contents of a double precision floating point + value as an integer value + + + Double precision floating point value whose memory contents to reinterpret + + + The memory contents of the double precision floating point value + interpreted as an integer + + + + Reinterprets the memory contents of an integer as a floating point value + + Integer value whose memory contents to reinterpret + + The memory contents of the integer value interpreted as a floating point value + + + + Reinterprets the memory contents of an integer value as a double precision + floating point value + + Integer whose memory contents to reinterpret + + The memory contents of the integer interpreted as a double precision + floating point value + + + + Tests whether a value is greater than the value supplied to its constructor + + + + The value against which a comparison is to be made + + + + Initializes a new instance of the class. + + The expected value. + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Tests whether a value is greater than or equal to the value supplied to its constructor + + + + The value against which a comparison is to be made + + + + Initializes a new instance of the class. + + The expected value. + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + The IConstraintExpression interface is implemented by all + complete and resolvable constraints and expressions. + + + + Return the top-level constraint for this expression + + + + + Tests whether a value is less than the value supplied to its constructor + + + + The value against which a comparison is to be made + + + + Initializes a new instance of the class. + + The expected value. + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Tests whether a value is less than or equal to the value supplied to its constructor + + + + The value against which a comparison is to be made + + + + Initializes a new instance of the class. + + The expected value. + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + MessageWriter is the abstract base for classes that write + constraint descriptions and messages in some form. The + class has separate methods for writing various components + of a message, allowing implementations to tailor the + presentation as needed. + + + + Construct a MessageWriter given a culture + + + + Abstract method to get the max line length + + + + Method to write single line message with optional args, usually + written to precede the general failure message. + + The message to be written + Any arguments used in formatting the message + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The constraint that failed + + + Display Expected and Actual lines for given values. This + method may be called by constraints that need more control over + the display of actual and expected values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + Display Expected and Actual lines for given values, including + a tolerance value on the Expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + Display the expected and actual string values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in locating the point where the strings differ + If true, the strings should be clipped to fit the line + + + Writes the text for a connector. + + The connector. + + + Writes the text for a predicate. + + The predicate. + + + Writes the text for an expected value. + + The expected value. + + + Writes the text for a modifier + + The modifier. + + + Writes the text for an actual value. + + The actual value. + + + Writes the text for a generalized value. + + The value. + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + Static methods used in creating messages + + + + Static string used when strings are clipped + + + + Returns the representation of a type as used in NUnitLite. + This is the same as Type.ToString() except for arrays, + which are displayed with their declared sizes. + + + + + + Converts any control characters in a string + to their escaped representation. + + The string to be converted + The converted string + + + Return the a string representation for a set of indices into an array + + Array of indices for which a string is needed + + + Get an array of indices representing the point in a enumerable, + collection or array corresponding to a single int index into the + collection. + + The collection to which the indices apply + Index in the collection + Array of indices + + + Clip a string to a given length, starting at a particular offset, returning the clipped + string with ellipses representing the removed parts + + The string to be clipped + The maximum permitted length of the result string + The point at which to start clipping + The clipped string + + + Clip the expected and actual strings in a coordinated fashion, + so that they may be displayed together. + + + + + + + + Shows the position two strings start to differ. Comparison + starts at the start index. + + The expected string + The actual string + The index in the strings at which comparison should start + Boolean indicating whether case should be ignored + -1 if no mismatch found, or the index where mismatch found + + + The Numerics class contains common operations on numeric values. + + + + Checks the type of the object, returning true if + the object is a numeric type. + + The object to check + true if the object is a numeric type + + + Checks the type of the object, returning true if + the object is a floating point numeric type. + + The object to check + true if the object is a floating point numeric type + + + Checks the type of the object, returning true if + the object is a fixed point numeric type. + + The object to check + true if the object is a fixed point numeric type + + + Test two numeric values for equality, performing the usual numeric + conversions and using a provided or default tolerance. If the tolerance + provided is Empty, this method may set it to a default tolerance. + + The expected value + The actual value + A reference to the tolerance in effect + True if the values are equal + + + Compare two numeric values, performing the usual numeric conversions. + + The expected value + The actual value + The relationship of the values to each other + + + NUnitComparer encapsulates NUnit's default behavior + in comparing two objects. + + + + Returns the default NUnitComparer. + + + + Compares two objects + + + + + + + Generic version of NUnitComparer + + + + + Compare two objects of the same type + + + + NUnitEqualityComparer encapsulates NUnit's handling of + equality tests between objects. + + + + If true, all string comparisons will ignore case + + + + If true, arrays will be treated as collections, allowing + those of different dimensions to be compared + + + + Comparison objects used in comparisons for some constraints. + + + + Returns the default NUnitEqualityComparer + + + + Gets and sets a flag indicating whether case should + be ignored in determining equality. + + + + Gets and sets a flag indicating that arrays should be + compared as collections, without regard to their shape. + + + + Gets and sets an external comparer to be used to + test for equality. It is applied to members of + collections, in place of NUnit's own logic. + + + + Gets the list of failure points for the last Match performed. + + + + Compares two objects for equality within a tolerance. + + + + Helper method to compare two arrays + + + + Method to compare two DirectoryInfo objects + + first directory to compare + second directory to compare + true if equivalent, false if not + + + FailurePoint class represents one point of failure + in an equality test. + + + + The location of the failure + + + + The expected value + + + + The actual value + + + + Indicates whether the expected value is valid + + + + Indicates whether the actual value is valid + + + + PathConstraint serves as the abstract base of constraints + that operate on paths and provides several helper methods. + + + + The expected path used in the constraint + + + + The actual path being tested + + + + Flag indicating whether a caseInsensitive comparison should be made + + + + Construct a PathConstraint for a give expected path + + The expected path + + + Modifies the current instance to be case-insensitve + and returns it. + + + + Modifies the current instance to be case-sensitve + and returns it. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Returns true if the expected path and actual path match + + + + Returns the string representation of this constraint + + + + Canonicalize the provided path + + + The path in standardized form + + + Test whether two paths are the same + + The first path + The second path + Indicates whether case should be ignored + + + + Test whether one path is under another path + + The first path - supposed to be the parent path + The second path - supposed to be the child path + Indicates whether case should be ignored + + + + Test whether one path is the same as or under another path + + The first path - supposed to be the parent path + The second path - supposed to be the child path + + + + Summary description for SamePathConstraint. + + + + Initializes a new instance of the class. + + The expected path + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + SubPathConstraint tests that the actual path is under the expected path + + + + Initializes a new instance of the class. + + The expected path + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + SamePathOrUnderConstraint tests that one path is under another + + + + Initializes a new instance of the class. + + The expected path + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Predicate constraint wraps a Predicate in a constraint, + returning success if the predicate is true. + + + + Construct a PredicateConstraint from a predicate + + + + Determines whether the predicate succeeds when applied + to the actual value. + + + + Writes the description to a MessageWriter + + + + Abstract base class used for prefixes + + + + The base constraint + + + + Construct given a base constraint + + + + + NotConstraint negates the effect of some other constraint + + + + Initializes a new instance of the class. + + The base constraint to be negated. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a MessageWriter. + + The writer on which the actual value is displayed + + + AllItemsConstraint applies another constraint to each + item in a collection, succeeding if they all succeed. + + + + Construct an AllItemsConstraint on top of an existing constraint + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + Write a description of this constraint to a MessageWriter + + + + + SomeItemsConstraint applies another constraint to each + item in a collection, succeeding if any of them succeeds. + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + Apply the item constraint to each item in the collection, + succeeding if any item succeeds. + + + + + + Write a description of this constraint to a MessageWriter + + + + + NoItemConstraint applies another constraint to each + item in a collection, failing if any of them succeeds. + + + + Construct a NoItemConstraint on top of an existing constraint + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + Write a description of this constraint to a MessageWriter + + + + + ExactCoutConstraint applies another constraint to each + item in a collection, succeeding only if a specified + number of items succeed. + + + + Construct an ExactCountConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + succeeding only if the expected number of items pass. + + + + + + Write a description of this constraint to a MessageWriter + + + + + PropertyExistsConstraint tests that a named property + exists on the object provided through Match. + Originally, PropertyConstraint provided this feature + in addition to making optional tests on the vaue + of the property. The two constraints are now separate. + + + + Initializes a new instance of the class. + + The name of the property. + + + Test whether the property exists for a given object + + The object to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. + + The writer on which the actual value is displayed + + + Returns the string representation of the constraint. + + + + + PropertyConstraint extracts a named property and uses + its value as the actual value for a chained constraint. + + + + Initializes a new instance of the class. + + The name. + The constraint to apply to the property. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Returns the string representation of the constraint. + + + + + RangeConstraint tests whethe two values are within a + specified range. + + + + Initializes a new instance of the class. + + From. + To. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + ResolvableConstraintExpression is used to represent a compound + constraint being constructed at a point where the last operator + may either terminate the expression or may have additional + qualifying constraints added to it. + It is used, for example, for a Property element or for + an Exception element, either of which may be optionally + followed by constraints that apply to the property or + exception. + + + + Create a new instance of ResolvableConstraintExpression + + + + Create a new instance of ResolvableConstraintExpression, + passing in a pre-populated ConstraintBuilder. + + + + Appends an And Operator to the expression + + + + Appends an Or operator to the expression. + + + + Resolve the current expression to a Constraint + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + ReusableConstraint wraps a resolved constraint so that it + may be saved and reused as needed. + + + + Construct a ReusableConstraint + + The constraint or expression to be reused + + + Conversion operator from a normal constraint to a ReusableConstraint. + + The original constraint to be wrapped as a ReusableConstraint + + + + Returns the string representation of the constraint. + + A string representing the constraint + + + Resolves the ReusableConstraint by returning the constraint + that it originally wrapped. + + A resolved constraint + + + SameAsConstraint tests whether an object is identical to + the object passed to its constructor + + + + Initializes a new instance of the class. + + The expected object. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Returns the string representation + + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Returns the string representation of this constraint + + + + StringConstraint is the abstract base for constraints + that operate on strings. It supports the IgnoreCase + modifier for string operations. + + + + The expected value + + + + Indicates whether tests should be case-insensitive + + + + Constructs a StringConstraint given an expected value + + The expected value + + + Modify the constraint to ignore case in matching. + + + + EmptyStringConstraint tests whether a string is empty. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + NullEmptyStringConstraint tests whether a string is either null or empty. + + + + Constructs a new NullOrEmptyStringConstraint + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + SubstringConstraint can test whether a string contains + the expected substring. + + + + Initializes a new instance of the class. + + The expected. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + StartsWithConstraint can test whether a string starts + with an expected substring. + + + + Initializes a new instance of the class. + + The expected string + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + EndsWithConstraint can test whether a string ends + with an expected substring. + + + + Initializes a new instance of the class. + + The expected string + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + RegexConstraint can test whether a string matches + the pattern provided. + + + + Initializes a new instance of the class. + + The pattern. + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + ThrowsConstraint is used to test the exception thrown by + a delegate by applying a constraint to it. + + + + Initializes a new instance of the class, + using a constraint to be applied to the exception. + + A constraint to apply to the caught exception. + + + Get the actual exception thrown - used by Assert.Throws. + + + + Executes the code of the delegate and captures any exception. + If a non-null base constraint was provided, it applies that + constraint to the exception. + + A delegate representing the code to be tested + True if an exception is thrown and the constraint succeeds, otherwise false + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Returns the string representation of this constraint + + + + ThrowsNothingConstraint tests that a delegate does not + throw an exception. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True if no exception is thrown, otherwise false + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + Modes in which the tolerance value for a comparison can + be interpreted. + + + + The tolerance was created with a value, without specifying + how the value would be used. This is used to prevent setting + the mode more than once and is generally changed to Linear + upon execution of the test. + + + + The tolerance is used as a numeric range within which + two compared values are considered to be equal. + + + + Interprets the tolerance as the percentage by which + the two compared values my deviate from each other. + + + + Compares two values based in their distance in + representable numbers. + + + + The Tolerance class generalizes the notion of a tolerance + within which an equality test succeeds. Normally, it is + used with numeric types, but it can be used with any + type that supports taking a difference between two + objects and comparing that difference to a value. + + + + Returns an empty Tolerance object, equivalent to + specifying no tolerance. In most cases, it results + in an exact match but for floats and doubles a + default tolerance may be used. + + + + Returns a zero Tolerance object, equivalent to + specifying an exact match. + + + + Constructs a linear tolerance of a specdified amount + + + + Constructs a tolerance given an amount and ToleranceMode + + + + Gets the ToleranceMode for the current Tolerance + + + + Tests that the current Tolerance is linear with a + numeric value, throwing an exception if it is not. + + + + Gets the value of the current Tolerance instance. + + + + Returns a new tolerance, using the current amount as a percentage. + + + + Returns a new tolerance, using the current amount in Ulps. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of days. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of hours. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of minutes. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of seconds. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of milliseconds. + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of clock ticks. + + + + Returns true if the current tolerance is empty. + + + + TypeConstraint is the abstract base for constraints + that take a Type as their expected value. + + + + The expected Type used by the constraint + + + + Construct a TypeConstraint for a given Type + + + + + Write the actual value for a failing constraint test to a + MessageWriter. TypeConstraints override this method to write + the name of the type. + + The writer on which the actual value is displayed + + + ExactTypeConstraint is used to test that an object + is of the exact type provided in the constructor + + + + Construct an ExactTypeConstraint for a given Type + + The expected Type. + + + Test that an object is of the exact type specified + + The actual value. + True if the tested object is of the exact type provided, otherwise false. + + + Write the description of this constraint to a MessageWriter + + The MessageWriter to use + + + ExceptionTypeConstraint is a special version of ExactTypeConstraint + used to provided detailed info about the exception thrown in + an error message. + + + + Constructs an ExceptionTypeConstraint + + + + Write the actual value for a failing constraint test to a + MessageWriter. Overriden to write additional information + in the case of an Exception. + + The MessageWriter to use + + + InstanceOfTypeConstraint is used to test that an object + is of the same type provided or derived from it. + + + + Construct an InstanceOfTypeConstraint for the type provided + + The expected Type + + + Test whether an object is of the specified type or a derived type + + The object to be tested + True if the object is of the provided type or derives from it, otherwise false. + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + AssignableFromConstraint is used to test that an object + can be assigned from a given Type. + + + + Construct an AssignableFromConstraint for the type provided + + + + + Test whether an object can be assigned from the specified type + + The object to be tested + True if the object can be assigned a value of the expected Type, otherwise false. + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + AssignableToConstraint is used to test that an object + can be assigned to a given Type. + + + + Construct an AssignableToConstraint for the type provided + + + + + Test whether an object can be assigned to the specified type + + The object to be tested + True if the object can be assigned a value of the expected Type, otherwise false. + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + Static helper class used in the constraint-based syntax + + + + Creates a new SubstringConstraint + + The value of the substring + A SubstringConstraint + + + Creates a new CollectionContainsConstraint. + + The item that should be found. + A new CollectionContainsConstraint + + + Summary description for DirectoryAssert + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are not equal + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are equal + Arguments to be used in formatting the message + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are equal + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + Thrown when an assertion failed. + + + The error message that explains + the reason for the exception + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + Serialization Constructor + + + + Thrown when an assertion failed. + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + Serialization Constructor + + + + Thrown when a test executes inconclusively. + + + The error message that explains + the reason for the exception + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + Serialization Constructor + + + + Thrown when an assertion failed. + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + Serialization Constructor + + + + Summary description for FileAssert. + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if objects are not equal + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if objects are not equal + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if objects are not equal + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the two Stream are the same. + Arguments to be used in formatting the message + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the Streams are the same. + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if objects are not equal + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if objects are not equal + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + GlobalSettings is a place for setting default values used + by the framework in performing asserts. + + + + Default tolerance for floating point equality + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + + + Compares two objects for equality within a tolerance + + The first object to compare + The second object to compare + The tolerance to use in the comparison + + + + + + + + Compares two objects of a given Type for equality within a tolerance + + The first object to compare + The second object to compare + The tolerance to use in the comparison + + + + When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. + + + + Executed before each test is run + + Provides details about the test that is going to be run. + + + Executed after each test is run + + Provides details about the test that has just been run. + + + Provides the target for the action attribute + + The target for the action attribute + + + Interface implemented by a user fixture in order to + validate any expected exceptions. It is only called + for test methods marked with the ExpectedException + attribute. + + + + Method to handle an expected exception + + The exception to be handled + + + Provides details about a test + + + + Creates an instance of TestDetails + + The fixture that the test is a member of, if available. + The method that implements the test, if available. + The full name of the test. + A string representing the type of test, e.g. "Test Case". + Indicates if the test represents a suite of tests. + + + The fixture that the test is a member of, if available. + + + + The method that implements the test, if available. + + + + The full name of the test. + + + + A string representing the type of test, e.g. "Test Case". + + + + Indicates if the test represents a suite of tests. + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + Returns a constraint that tests for null + + + + Returns a constraint that tests for True + + + + Returns a constraint that tests for False + + + + Returns a constraint that tests for a positive value + + + + Returns a constraint that tests for a negative value + + + + Returns a constraint that tests for NaN + + + + Returns a constraint that tests for empty + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + Returns a constraint that tests two items for equality + + + + Returns a constraint that tests that two references are the same object + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + Returns a constraint that tests whether a collection is ordered + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + NOTE: This interface is used in both the framework + and the core, even though that results in two different + types. However, sharing the source code guarantees that + the various implementations will be compatible and that + the core is able to reflect successfully over the + framework implementations of ITestCaseData. + + + + Gets the argument list to be provided to the test + + + + Gets the expected result + + + + Indicates whether a result has been specified. + This is necessary because the result may be + null, so it's value cannot be checked. + + + + Gets the expected exception Type + + + + Gets the FullName of the expected exception + + + + Gets the name to be used for the test + + + + Gets the description of the test + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + Gets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + Gets the ignore reason. + + The ignore reason. + + + The Iz class is a synonym for Is intended for use in VB, + which regards Is as a keyword. + + + + The List class is a helper class with properties and methods + that supply a number of constraints used with lists and collections. + + + + List.Map returns a ListMapper, which can be used to map + the original collection to another collection. + + + + + + ListMapper is used to transform a collection used as an actual argument + producing another collection to be used in the assertion. + + + + Construct a ListMapper based on a collection + + The collection to be transformed + + + Produces a collection containing all the values of a property + + The collection of property values + + + + Randomizer returns a set of random values in a repeatable + way, to allow re-running of tests if necessary. + + + + Get a random seed for use in creating a randomizer. + + + + Get a randomizer for a particular member, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + Get a randomizer for a particular parameter, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + Construct a randomizer using a random seed + + + + Construct a randomizer using a specified seed + + + + Return an array of random doubles between 0.0 and 1.0. + + + + + + Return an array of random doubles with values in a specified range. + + + + Return an array of random ints with values in a specified range. + + + + The SpecialValue enum is used to represent TestCase arguments + that cannot be used as arguments to an Attribute. + + + + Null represents a null value, which cannot be used as an + argument to an attriute under .NET 1.x + + + + Basic Asserts on strings. + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + Asserts that a string is not found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that two strings are Notequal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + + + The TestCaseData class represents a set of arguments + and other parameter info to be used for a parameterized + test case. It provides a number of instance modifiers + for use in initializing the test case. + Note: Instance modifiers are getters that return + the same instance after modifying it's state. + + + + The argument list to be provided to the test + + + + The expected result to be returned + + + + Set to true if this has an expected result + + + + The expected exception Type + + + + The FullName of the expected exception + + + + The name to be used for the test + + + + The description of the test + + + + A dictionary of properties, used to add information + to tests without requiring the class to change. + + + + If true, indicates that the test case is to be ignored + + + + If true, indicates that the test case is marked explicit + + + + The reason for ignoring a test case + + + + Initializes a new instance of the class. + + The arguments. + + + Initializes a new instance of the class. + + The argument. + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + Gets the argument list to be provided to the test + + + + Gets the expected result + + + + Returns true if the result has been set + + + + Gets the expected exception Type + + + + Gets the FullName of the expected exception + + + + Gets the name to be used for the test + + + + Gets the description of the test + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + Gets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + Gets the ignore reason. + + The ignore reason. + + + Gets a list of categories associated with this test. + + + + Gets the property dictionary for this test + + + + Sets the expected result for the test + + The expected result + A modified TestCaseData + + + Sets the expected exception type for the test + + Type of the expected exception. + The modified TestCaseData instance + + + Sets the expected exception type for the test + + FullName of the expected exception. + The modified TestCaseData instance + + + Sets the name of the test case + + The modified TestCaseData instance + + + Sets the description for the test case + being constructed. + + The description. + The modified TestCaseData instance. + + + Applies a category to the test + + + + + + Applies a named property to the test + + + + + + + Applies a named property to the test + + + + + + + Applies a named property to the test + + + + + + + Ignores this TestCase. + + + + + Ignores this TestCase, specifying the reason. + + The reason. + + + + Marks this TestCase as Explicit + + + + + Marks this TestCase as Explicit, specifying the reason. + + The reason. + + + + Provide the context information of the current test + + + + Constructs a TestContext using the provided context dictionary + + A context dictionary + + + Get the current test context. This is created + as needed. The user may save the context for + use within a test, but it should not be used + outside the test for which it is created. + + + + Gets a TestAdapter representing the currently executing test in this context. + + + + Gets a ResultAdapter representing the current result for the test + executing in this context. + + + + Gets the directory containing the current test assembly. + + + + Gets the directory to be used for outputing files created + by this test run. + + + + TestAdapter adapts a Test for consumption by + the user test code. + + + + Constructs a TestAdapter for this context + + The context dictionary + + + The name of the test. + + + + The FullName of the test + + + + The properties of the test. + + + + ResultAdapter adapts a TestResult for consumption by + the user test code. + + + + Construct a ResultAdapter for a context + + The context holding the result + + + The TestState of current test. This maps to the ResultState + used in nunit.core and is subject to change in the future. + + + + The TestStatus of current test. This enum will be used + in future versions of NUnit and so is to be preferred + to the TestState value. + + + + The ResultState enum indicates the result of running a test + + + + The result is inconclusive + + + + The test was not runnable. + + + + The test has been skipped. + + + + The test has been ignored. + + + + The test succeeded + + + + The test failed + + + + The test encountered an unexpected exception + + + + The test was cancelled by the user + + + + The TestStatus enum indicates the result of running a test + + + + The test was inconclusive + + + + The test has skipped + + + + The test succeeded + + + + The test failed + + + + Helper class with static methods used to supply constraints + that operate on strings. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + TextMessageWriter writes constraint descriptions and messages + in displayable form as a text stream. It tailors the display + of individual message components to form the standard message + format of NUnit assertion failure messages. + + + + Prefix used for the expected value line of a message + + + + Prefix used for the actual value line of a message + + + + Length of a message prefix + + + + Construct a TextMessageWriter + + + + Construct a TextMessageWriter, specifying a user message + and optional formatting arguments. + + + + + + Gets or sets the maximum line length for this writer + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The constraint that failed + + + Display Expected and Actual lines for given values. This + method may be called by constraints that need more control over + the display of actual and expected values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + Display Expected and Actual lines for given values, including + a tolerance value on the expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + Display the expected and actual string values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in string comparisons + If true, clip the strings to fit the max line length + + + Writes the text for a connector. + + The connector. + + + Writes the text for a predicate. + + The predicate. + + + Write the text for a modifier. + + The modifier. + + + Writes the text for an expected value. + + The expected value. + + + Writes the text for an actual value. + + The actual value. + + + Writes the text for a generalized value. + + The value. + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + Write the generic 'Expected' line for a constraint + + The constraint that failed + + + Write the generic 'Expected' line for a given value + + The expected value + + + Write the generic 'Expected' line for a given value + and tolerance. + + The expected value + The tolerance within which the test was made + + + Write the generic 'Actual' line for a constraint + + The constraint for which the actual value is to be written + + + Write the generic 'Actual' line for a given value + + The actual value causing a failure + + + Helper class with properties and methods that supply + constraints that operate on exceptions. + + + + Creates a constraint specifying an expected exception + + + + Creates a constraint specifying an exception with a given InnerException + + + + Creates a constraint specifying an expected TargetInvocationException + + + + Creates a constraint specifying an expected TargetInvocationException + + + + Creates a constraint specifying an expected TargetInvocationException + + + + Creates a constraint specifying that no exception is thrown + + + + Creates a constraint specifying the exact type of exception expected + + + + Creates a constraint specifying the exact type of exception expected + + + + Creates a constraint specifying the type of exception expected + + + + Creates a constraint specifying the type of exception expected + + + diff --git a/frameworks/csharp/nunit/framework/nunit.mocks.dll b/frameworks/csharp/nunit/framework/nunit.mocks.dll new file mode 100755 index 00000000..3da00859 Binary files /dev/null and b/frameworks/csharp/nunit/framework/nunit.mocks.dll differ diff --git a/frameworks/csharp/nunit/launcher.log.conf b/frameworks/csharp/nunit/launcher.log.conf new file mode 100644 index 00000000..6a9ced8b --- /dev/null +++ b/frameworks/csharp/nunit/launcher.log.conf @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Circles/Failure.jpg b/frameworks/csharp/nunit/lib/Images/Tree/Circles/Failure.jpg new file mode 100644 index 00000000..c245548b Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Circles/Failure.jpg differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Circles/Ignored.jpg b/frameworks/csharp/nunit/lib/Images/Tree/Circles/Ignored.jpg new file mode 100644 index 00000000..0549b705 Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Circles/Ignored.jpg differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Circles/Inconclusive.jpg b/frameworks/csharp/nunit/lib/Images/Tree/Circles/Inconclusive.jpg new file mode 100644 index 00000000..8d36153c Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Circles/Inconclusive.jpg differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Circles/Skipped.jpg b/frameworks/csharp/nunit/lib/Images/Tree/Circles/Skipped.jpg new file mode 100644 index 00000000..3d84255c Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Circles/Skipped.jpg differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Circles/Success.jpg b/frameworks/csharp/nunit/lib/Images/Tree/Circles/Success.jpg new file mode 100644 index 00000000..15ec1b7f Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Circles/Success.jpg differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Classic/Failure.jpg b/frameworks/csharp/nunit/lib/Images/Tree/Classic/Failure.jpg new file mode 100644 index 00000000..658905fd Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Classic/Failure.jpg differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Classic/Ignored.jpg b/frameworks/csharp/nunit/lib/Images/Tree/Classic/Ignored.jpg new file mode 100644 index 00000000..95b7fdbd Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Classic/Ignored.jpg differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Classic/Inconclusive.jpg b/frameworks/csharp/nunit/lib/Images/Tree/Classic/Inconclusive.jpg new file mode 100644 index 00000000..32a0ff72 Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Classic/Inconclusive.jpg differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Classic/Skipped.jpg b/frameworks/csharp/nunit/lib/Images/Tree/Classic/Skipped.jpg new file mode 100644 index 00000000..3d84255c Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Classic/Skipped.jpg differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Classic/Success.jpg b/frameworks/csharp/nunit/lib/Images/Tree/Classic/Success.jpg new file mode 100644 index 00000000..3d8e7609 Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Classic/Success.jpg differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Default/Failure.png b/frameworks/csharp/nunit/lib/Images/Tree/Default/Failure.png new file mode 100644 index 00000000..2e400b27 Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Default/Failure.png differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Default/Ignored.png b/frameworks/csharp/nunit/lib/Images/Tree/Default/Ignored.png new file mode 100644 index 00000000..05715cbb Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Default/Ignored.png differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Default/Inconclusive.png b/frameworks/csharp/nunit/lib/Images/Tree/Default/Inconclusive.png new file mode 100644 index 00000000..4807b7ce Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Default/Inconclusive.png differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Default/Skipped.png b/frameworks/csharp/nunit/lib/Images/Tree/Default/Skipped.png new file mode 100644 index 00000000..7c9fc64e Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Default/Skipped.png differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Default/Success.png b/frameworks/csharp/nunit/lib/Images/Tree/Default/Success.png new file mode 100644 index 00000000..2a301508 Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Default/Success.png differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Failure.png b/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Failure.png new file mode 100644 index 00000000..ba03e848 Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Failure.png differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Ignored.png b/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Ignored.png new file mode 100644 index 00000000..9271d6e7 Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Ignored.png differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Inconclusive.png b/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Inconclusive.png new file mode 100644 index 00000000..76219b5c Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Inconclusive.png differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Skipped.png b/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Skipped.png new file mode 100644 index 00000000..7c9fc64e Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Skipped.png differ diff --git a/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Success.png b/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Success.png new file mode 100644 index 00000000..346fe8f9 Binary files /dev/null and b/frameworks/csharp/nunit/lib/Images/Tree/Visual Studio/Success.png differ diff --git a/frameworks/csharp/nunit/lib/nunit-console-runner.dll b/frameworks/csharp/nunit/lib/nunit-console-runner.dll new file mode 100755 index 00000000..0b58cbeb Binary files /dev/null and b/frameworks/csharp/nunit/lib/nunit-console-runner.dll differ diff --git a/frameworks/csharp/nunit/lib/nunit-gui-runner.dll b/frameworks/csharp/nunit/lib/nunit-gui-runner.dll new file mode 100755 index 00000000..34a134a6 Binary files /dev/null and b/frameworks/csharp/nunit/lib/nunit-gui-runner.dll differ diff --git a/frameworks/csharp/nunit/lib/nunit.core.dll b/frameworks/csharp/nunit/lib/nunit.core.dll new file mode 100755 index 00000000..e0280a0a Binary files /dev/null and b/frameworks/csharp/nunit/lib/nunit.core.dll differ diff --git a/frameworks/csharp/nunit/lib/nunit.core.interfaces.dll b/frameworks/csharp/nunit/lib/nunit.core.interfaces.dll new file mode 100755 index 00000000..6fb27f79 Binary files /dev/null and b/frameworks/csharp/nunit/lib/nunit.core.interfaces.dll differ diff --git a/frameworks/csharp/nunit/lib/nunit.core.interfaces.xml b/frameworks/csharp/nunit/lib/nunit.core.interfaces.xml new file mode 100644 index 00000000..f560461d --- /dev/null +++ b/frameworks/csharp/nunit/lib/nunit.core.interfaces.xml @@ -0,0 +1,2571 @@ + + + + nunit.core.interfaces + + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + NOTE: This interface is used in both the framework + and the core, even though that results in two different + types. However, sharing the source code guarantees that + the various implementations will be compatible and that + the core is able to reflect successfully over the + framework implementations of ITestCaseData. + + + + Gets the argument list to be provided to the test + + + + Gets the expected result + + + + Indicates whether a result has been specified. + This is necessary because the result may be + null, so it's value cannot be checked. + + + + Gets the expected exception Type + + + + Gets the FullName of the expected exception + + + + Gets the name to be used for the test + + + + Gets the description of the test + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + Gets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + Gets the ignore reason. + + The ignore reason. + + + The EventListener interface is used within the NUnit core to receive + notifications of significant events while a test is being run. These + events are propogated to any client, which may choose to convert them + to .NET events or to use them directly. + + + + Called when a test run is starting + + The name of the test being started + The number of test cases under this test + + + Called when a run finishes normally + + The result of the test + + + Called when a run is terminated due to an exception + + Exception that was thrown + + + Called when a test case is starting + + The name of the test case + + + Called when a test case has finished + + The result of the test + + + Called when a suite is starting + + The name of the suite + + + Called when a suite has finished + + The result of the suite + + + Called when an unhandled exception is detected during + the execution of a test run. + + The exception thta was detected + + + Called when the test direts output to the console. + + A console message + + + The Addin class holds information about an addin. + + + + Construct an Addin for a type. + + The type to be used + + + The name of the Addin + + + + Brief description of what the Addin does + + + + The type or types of extension provided, using + one or more members of the ExtensionType enumeration. + + + + The AssemblyQualifiedName of the type that implements + the addin. + + + + The status of the addin + + + + Any message that clarifies the status of the Addin, + such as an error message or an explanation of why + the addin is disabled. + + + + Return true if two Addins have teh same type name + + The other addin to be compared + + + Return a hash code for this addin + + + + The AddinStatus enum indicates the load status of an addin. + + + + Not known - default + + + + The addin is enabled but not loaded + + + + The addin is disabled + + + + The addin was loaded successfully + + + + An error was encountered loading the addin + + + + The ExtensionType enumeration is used to indicate the + kinds of extensions provided by an Addin. The addin + is only installed by hosts supporting one of its + extension types. + + + + A Core extension is installed by the CoreExtensions + host in each test domain. + + + + A Client extension is installed by all clients + + + + A Gui extension is installed by the gui client + + + + Add-ins are used to extend NUnti. All add-ins must + implement the IAddin interface. + + + + When called, the add-in installs itself into + the host, if possible. Because NUnit uses separate + hosts for the client and test domain environments, + an add-in may be invited to istall itself more than + once. The add-in is responsible for checking which + extension points are supported by the host that is + passed to it and taking the appropriate action. + + The host in which to install the add-in + True if the add-in was installed, otehrwise false + + + The IAddinRegistry interface allows registering addins + and retrieving information about them. It is also used + to record the load status of an addin. + + + + Gets a list of all addins as Addin objects + + + + Registers an addin + + The addin to be registered + + + Returns true if an addin of a given name is registered + + The name of the addin + True if an addin of that name is registered, otherwise false + + + Sets the load status of an addin + + The name of the addin + The status to be set + An optional message explaining the status + + + The IDataPointProvider interface is used by extensions + that provide data for a single test parameter. + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + Return an IEnumerable providing data for use with the + supplied parameter. + + A ParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + The IDataPointProvider2 interface extends IDataPointProvider + by making the test fixture for which the test is being built + available for use. + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + The test suite for which the test is being built + True if any data is available, otherwise false. + + + Return an IEnumerable providing data for use with the + supplied parameter. + + A ParameterInfo representing one + argument to a parameterized test + The test suite for which the test is being built + An IEnumerable providing the required data + + + The IExtensionHost interface is implemented by each + of NUnit's Extension hosts. Currently, there is + only one host, which resides in the test domain. + + + + Get a list of the ExtensionPoints provided by this host. + + + + Get an interface to the framework registry + + + + Return an extension point by name, if present + + The name of the extension point + The extension point, if found, otherwise null + + + Gets the ExtensionTypes supported by this host + + An enum indicating the ExtensionTypes supported + + + Represents a single point of extension for NUnit. Some extension + points may accept only a single extension, while others may + accept more than one at the same time. + + + + Get the name of this extension point + + + + Get the host that provides this extension point + + + + Install an extension at this extension point. If the + extension object does not meet the requirements for + this extension point, an exception is thrown. + + The extension to install + + + Removes an extension from this extension point. If the + extension object is not present, the method returns + without error. + + + + + Represents a single point of extension for NUnit. Some extension + points may accept only a single extension, while others may + accept more than one at the same time. This interface enhances + IExtensionPoint by allowing specification of a priority + order for applying addins. + + + + Install an extension at this extension point specifying + an integer priority value for the extension.If the + extension object does not meet the requirements for + this extension point, or if the extension point does + not support the requested priority level, an exception + is thrown. + + The extension to install + The priority level for this extension + + + The IFrameworkRegistry allows extensions to register new + frameworks or emulations of other frameworks. + + + + Register a framework + + The name of the framework + The name of the assembly that the tests reference + + + The ISuiteBuilder interface is exposed by a class that knows how to + build a suite from one or more Types. + + + + Examine the type and determine if it is suitable for + this builder to use in building a TestSuite. + Note that returning false will cause the type to be ignored + in loading the tests. If it is desired to load the suite + but label it as non-runnable, ignored, etc., then this + method must return true. + + The type of the fixture to be used + True if the type can be used to build a TestSuite + + + Build a TestSuite from type provided. + + The type of the fixture to be used + A TestSuite + + + The ITestCaseBuilder interface is exposed by a class that knows how to + build a test case from certain methods. + + + + Examine the method and determine if it is suitable for + this builder to use in building a TestCase. + Note that returning false will cause the method to be ignored + in loading the tests. If it is desired to load the method + but label it as non-runnable, ignored, etc., then this + method must return true. + + The test method to examine + True is the builder can use this method + + + Build a TestCase from the provided MethodInfo. + + The method to be used as a test case + A TestCase or null + + + ITestCaseBuilder2 extends ITestCaseBuilder with methods + that include the suite for which the test case is being + built. Test case builders not needing the suite can + continue to implement ITestCaseBuilder. + + + + Examine the method and determine if it is suitable for + this builder to use in building a TestCase to be + included in the suite being populated. + Note that returning false will cause the method to be ignored + in loading the tests. If it is desired to load the method + but label it as non-runnable, ignored, etc., then this + method must return true. + + The test method to examine + The suite being populated + True is the builder can use this method + + + Build a TestCase from the provided MethodInfo for + inclusion in the suite being constructed. + + The method to be used as a test case + The test suite being populated, or null + A TestCase or null + + + The ITestCaseProvider interface is used by extensions + that provide data for parameterized tests, along with + certain flags and other indicators used in the test. + + + + Determine whether any test cases are available for a parameterized method. + + A MethodInfo representing a parameterized test + True if any cases are available, otherwise false. + + + Return an IEnumerable providing test cases for use in + running a paramterized test. + + + + + + ITestCaseProvider2 extends ITestCaseProvider with methods + that include the suite for which the test case is being + built. TestCaseProviders not needing the suite can + continue to implement ITestCaseBuilder. + + + + Determine whether any test cases are available for a parameterized method. + + A MethodInfo representing a parameterized test + The suite for which the test case is being built + True if any cases are available, otherwise false. + + + Return an IEnumerable providing test cases for use in + running a paramterized test. + + + The suite for which the test case is being built + + + + DecoratorPriority wraps constants that may be used + to represent the relative priority of TestDecorators. + Decorators with a lower priority are applied first + so that higher priority decorators wrap them. + NOTE: This feature is subject to change. + + + + The default priority, equivalent to Normal + + + + Priority for Decorators that must apply first + + + + Normal Decorator priority + + + + Priority for Decorators that must apply last + + + + The ITestDecorator interface is exposed by a class that knows how to + enhance the functionality of a test case or suite by decorating it. + + + + Examine the a Test and either return it as is, modify it + or return a different TestCase. + + The Test to be decorated + The MethodInfo used to construct the test + The resulting Test + + + NUnitAddinAttribute is used to mark all add-ins. The marked class + must implement the IAddin interface. + + + + The name of this addin + + + + A description for the addin + + + + The type of extension provided + + + + Default Constructor + + + + ParameterSet encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + A dictionary of properties, used to add information + to tests without requiring the class to change. + + + + The RunState for this set of parameters. + + + + Holds any exception thrown by the parameter provider + + + + The arguments to be used in running the test, + which must match the method signature. + + + + The original arguments supplied by the user, + used for display purposes. + + + + The Type of any exception that is expected. + + + + The FullName of any exception that is expected + + + + The Message of any exception that is expected + + + + Gets or sets the type of match to be performed on the expected message + + + + The expected result of the test, which + must match the method return type. + + + + Returns true if an expected result has been + specified for this parameter set. + + + + A description to be applied to this test case + + + + A name to be used for this test case in lieu + of the standard generated name containing + the argument list. + + + + Gets or sets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + Gets or sets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + Gets or sets the ignore reason. + + The ignore reason. + + + Gets a list of categories associated with this test. + + + + Gets the property dictionary for this test + + + + Construct a non-runnable ParameterSet, specifying + the provider excetpion that made it invalid. + + + + Construct an empty parameter set, which + defaults to being Runnable. + + + + Constructs a ParameterSet from another object, accessing properties + by reflection. The object must expose at least an Arguments property + in order for the test to be runnable. + + + + + Summary description for TestFramework. + + + + The name of the framework + + + + The file name of the assembly that defines the framwork + + + + Constructs a TestFramwork object given its name and assembly name. + + + + + + Combines multiple filters so that a test must pass all + of them in order to pass this filter. + + + + Constructs an empty AndFilter + + + + Constructs an AndFilter from an array of filters + + + + + Adds a filter to the list of filters + + The filter to be added + + + Return an array of the composing filters + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters pass, otherwise false + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters match, otherwise false + + + Return string representation of the filter. + + + + CategoryFilter is able to select or exclude tests + based on their categories. + + + + Construct an empty CategoryFilter + + + + Construct a CategoryFilter using a single category name + + A category name + + + Construct a CategoryFilter using an array of category names + + An array of category names + + + Add a category name to the filter + + A category name + + + Check whether the filter matches a test + + The test to be matched + + + + Return the string representation of a category filter + + + + + Gets the list of categories from this filter + + + + Summary description for NameFilter. + + + + Construct an empty NameFilter + + + + Construct a NameFilter for a single TestName + + + + + Add a TestName to a NameFilter + + + + + Check if a test matches the filter + + The test to match + True if it matches, false if not + + + NotFilter negates the operation of another filter + + + + Construct a not filter on another filter. The topLevel + argument is used to trigger special handling when tests + are being excluded. + + The filter to be negated + + + Construct a not filter on another filter. The topLevel + argument is used to trigger special handling when tests + are being excluded. + + The filter to be negated + Indicates whether this is a top level NotFilter + + + Indicates whether this is a top-level NotFilter, + requiring special handling of Explicit + + + + Gets the base filter + + + + Check whether the filter matches a test + + The test to be matched + True if it matches, otherwise false + + + Determine whether any descendant of the test matches the filter criteria. + + The test to be matched + True if at least one descendant matches the filter criteria + + + Return string representation of the filter + + + + Combines multiple filters so that a test must pass one + of them in order to pass this filter. + + + + Constructs an empty OrFilter + + + + Constructs an AndFilter from an array of filters + + + + + Adds a filter to the list of filters + + The filter to be added + + + Return an array of the composing filters + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters pass, otherwise false + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters match, otherwise false + + + Return the string representation of an or filter + + + + + SimpleName filter selects tests based on their name + + + + Construct an empty SimpleNameFilter + + + + Construct a SimpleNameFilter for a single name + + The name the filter will recognize. + + + Construct a SimpleNameFilter for an array of names + + The names the filter will recognize. + + + Add a name to a SimpleNameFilter + + The name to be added. + + + Add an array of names to a SimpleNameFilter + + The name to be added. + + + Check whether the filter matches a test + + The test to be matched + True if it matches, otherwise false + + + The IAgency interface is implemented by a TestAgency in + order to allow TestAgents to register with it. + + + + Registers an agent with an agency + + + + + The IService interface is implemented by all Services. + + + + Initialize the Service + + + + Do any cleanup needed before terminating the service + + + + Common interface supported by all representations + of a test. Only includes informational fields. + The Run method is specifically excluded to allow + for data-only representations of a test. + + + + Gets the completely specified name of the test + encapsulated in a TestName object. + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + Gets a string representing the type of test, e.g.: "Test Case" + + + + Indicates whether the test can be run using + the RunState enum. + + + + Reason for not running the test, if applicable + + + + Count of the test cases ( 1 if this is a test case ) + + + + Categories available for this test + + + + Return the description field. + + + + Return additional properties of the test + + + + True if this is a suite + + + + Gets the parent test of this test + + + + For a test suite, the child tests or suites + Null if this is not a test suite + + + + Count the test cases that pass a filter. The + result should match those that would execute + when passing the same filter to Run. + + The filter to apply + The count of test cases + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + Indicates whether this is the EmptyFilter + + + + Determine if a particular test passes the filter criteria. Pass + may examine the parents and/or descendants of a test, depending + on the semantics of the particular filter + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + Determine whether the test itself matches the filter criteria, + without examining either parents or descendants. + + The test to which the filter is applied + True if the filter matches the any parent of the test + + + OSPlatform represents a particular operating system platform + + + + Platform ID for Unix as defined by Microsoft .NET 2.0 and greater + + + + Platform ID for Unix as defined by Mono + + + + Get the OSPlatform under which we are currently running + + + + Product Type Enumeration used for Windows + + + + Product type is unknown or unspecified + + + + Product type is Workstation + + + + Product type is Domain Controller + + + + Product type is Server + + + + Construct from a platform ID and version + + + + Construct from a platform ID, version and product type + + + + Get the platform ID of this instance + + + + Get the Version of this instance + + + + Get the Product Type of this instance + + + + Return true if this is a windows platform + + + + Return true if this is a Unix or Linux platform + + + + Return true if the platform is Win32S + + + + Return true if the platform is Win32Windows + + + + Return true if the platform is Win32NT + + + + Return true if the platform is Windows CE + + + + Return true if the platform is Xbox + + + + Return true if the platform is MacOSX + + + + Return true if the platform is Windows 95 + + + + Return true if the platform is Windows 98 + + + + Return true if the platform is Windows ME + + + + Return true if the platform is NT 3 + + + + Return true if the platform is NT 4 + + + + Return true if the platform is NT 5 + + + + Return true if the platform is Windows 2000 + + + + Return true if the platform is Windows XP + + + + Return true if the platform is Windows 2003 Server + + + + Return true if the platform is NT 6 + + + + Return true if the platform is Vista + + + + Return true if the platform is Windows 2008 Server (original or R2) + + + + Return true if the platform is Windows 2008 Server (original) + + + + Return true if the platform is Windows 2008 Server R2 + + + + Return true if the platform is Windows 2012 Server + + + + Return true if the platform is Windows 7 + + + + Return true if the platform is Windows 8 + + + + The PropertyNames struct lists common property names, which are + accessed by reflection in the NUnit core. This provides a modicum + of type safety as opposed to using the strings directly. + + + Exception Type expected from a test + + Exception Type expected from a test (pre-2.5) + + FullName of the Exception Type expected from a test + + FullName of the Exception Type expected from a test (pre-2.5) + + ExpectedException Message + + ExpectedException MatchType + + Expected return result from test + + Indicates whether there is an expected return result + + Description of the test + + Alternate test name + + Arguments for the test + + Indicates test case is ignored + + Indicates test case is explicit + + The reason a test case is ignored + + Properties of the test + + Categories of the test + + Name of a category + + Reason for not running a test + + Flag indicating excluded test should be marked as Ignored + + Name of an addin that must be present to run a test + + + The ResultState enum indicates the result of running a test + + + + The result is inconclusive + + + + The test was not runnable. + + + + The test has been skipped. + + + + The test has been ignored. + + + + The test succeeded + + + + The test failed + + + + The test encountered an unexpected exception + + + + The test was cancelled by the user + + + + The FailureSite enum indicates the stage of a test + in which an error or failure occured. + + + + Failure in the test itself + + + + Failure in the SetUp method + + + + Failure in the TearDown method + + + + Failure of a parent test + + + + Failure of a child test + + + + The RunState enum indicates whether a test + can be executed. When used on a TestResult + it may also indicate whether the test has + been executed. See individual values for + restrictions on use. + + + + The test is not runnable. + + + + The test is runnable. This value would + normally not appear on a TestResult, since + it would change to Executed. + + + + The test can only be run explicitly. Would + normally not appear on a TestResult, since + it would change to Executed or Skipped. + + + + The test has been skipped. This value may + appear on a Test when certain attributes + are used to skip the test. + + + + The test has been ignored. May appear on + a Test, when the IgnoreAttribute is used. + Appears on a TestResult in that case or + if the test is dynamically ignored. + + + + Enumeration identifying a common language + runtime implementation. + + + Any supported runtime framework + + Microsoft .NET Framework + + Microsoft .NET Compact Framework + + Microsoft Shared Source CLI + + Mono + + + RuntimeFramework represents a particular version + of a common language runtime implementation. + + + + DefaultVersion is an empty Version, used to indicate that + NUnit should select the CLR version to use for the test. + + + + Construct from a runtime type and version + + The runtime type of the framework + The version of the framework + + + Static method to return a RuntimeFramework object + for the framework that is currently in use. + + + + Gets an array of all available frameworks + + + + Returns true if the current RuntimeFramework is available. + In the current implementation, only Mono and Microsoft .NET + are supported. + + True if it's available, false if not + + + The type of this runtime framework + + + + The framework version for this runtime framework + + + + The CLR version for this runtime framework + + + + Return true if any CLR version may be used in + matching this RuntimeFramework object. + + + + Returns the Display name for this framework + + + + Parses a string representing a RuntimeFramework. + The string may be just a RuntimeType name or just + a Version or a hyphentated RuntimeType-Version or + a Version prefixed by 'v'. + + + + + + Returns the best available framework that matches a target framework. + If the target framework has a build number specified, then an exact + match is needed. Otherwise, the matching framework with the highest + build number is used. + + + + + + Overridden to return the short name of the framework + + + + + Returns true if this framework's supports executing under the + requested target framework. The target is supported if + 1. The runtime types are the same or either one is RuntimeType.Any + 2. All specified (non-negative) components of the CLR version are equal. + 3. The major and minor components of the current framework version are + greater than or equal to the corresponding target components. + The last provision allows tests requiring .NET 2.0 to run under the + 3.0 and 3.5 platforms and those requiring .NET 4.0 to run under 4.5. + + The RuntimeFramework to be matched. + True on match, otherwise false + + + Test Class. + + + + TestName that identifies this test + + + + Indicates whether the test should be executed + + + + Test suite containing this test, or null + + + + A dictionary of properties, used to add information + to tests without requiring the class to change. + + + + Return true if the test requires a thread + + + + Get the desired apartment state for running the test + + + + Get the current apartment state of the test + + + + Gets a boolean value indicating whether this + test should run on it's own thread. + + + + Constructs a test given its name + + The name of the test + + + Constructs a test given the path through the + test hierarchy to its parent and a name. + + The parent tests full name + The name of the test + + + Constructs a test given a TestName object + + The TestName for this test + + + Sets the runner id of a test and optionally its children + + The runner id to be used + True if all children should get the same id + + + Gets the TestName of the test + + + + Gets a string representing the kind of test + that this object represents, for use in display. + + + + Whether or not the test should be run + + + + Reason for not running the test, if applicable + + + + Gets a count of test cases represented by + or contained under this test. + + + + Gets a list of categories associated with this test. + + + + Gets a description associated with this test. + + + + Gets the property dictionary for this test + + + + Indicates whether this test is a suite + + + + Gets the parent test of this test + + + + Gets the parent as a Test object. + Used by the core to set the parent. + + + + Gets this test's child tests + + + + Gets the Type of the fixture used in running this test + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + Gets or sets a fixture object for running this test + + + + Gets a count of test cases that would be run using + the specified filter. + + + + + + Runs the test under a particular filter, sending + notifications to a listener. + + An event listener to receive notifications + A filter used in running the test + + + + Compares this test to another test for sorting purposes + + The other test + Value of -1, 0 or +1 depending on whether the current test is less than, equal to or greater than the other test + + + Abstract base for all types of TestAgents. + A TestAgent provides services of locating, + loading and running tests in a particular + context such as an AppDomain or Process. + + + + Reference to the TestAgency that controls this agent + + + + This agent's assigned id + + + + Constructs a TestAgent + + + + + Consructor used by TestAgency when creating + an agent. + + + + + + The TestAgency with which this agent is asssociated, + or null if the agent is not tied to an agency. + + + + A Guid that uniquely identifies this agent. + + + + Starts the agent, performing any required initialization + + + + + Stops the agent, releasing any resources + + + + Creates a runner using a given runner id + + + + Dispose is overridden to stop the agent + + + + Overridden to cause object to live indefinitely + + + + TestAssemblyInfo holds information about a loaded test assembly + + + + Constructs a TestAssemblyInfo + + The name of the assembly + The version of the runtime for which the assembly was built + The runtime framework under which the assembly is loaded + A list of test framework useds by the assembly + + + Gets the name of the assembly + + + + Gets the runtime version for which the assembly was built + + + + Gets the runtime framework under which the assembly is loaded + + + + Gets the runtime version under which the assembly is loaded + + + + The Id of the process in which the assembly is loaded + + + + The friendly name of the AppDomain in which the assembly is loaded + + + + The Application Base of the AppDomain in which the assembly is loaded + + + + The PrivateBinPath of the AppDomain in which the assembly is loaded + + + + The ConfigurationFile of the AppDomain in which the assembly is loaded + + + + The name of the main module of the process in which the assembly is loaded + + + + Gets a list of testframeworks referenced by the assembly + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + Unique Empty filter. + + + + Indicates whether this is the EmptyFilter + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + Determine whether the test itself matches the filter criteria, without + examining either parents or descendants. + + The test to which the filter is applied + True if the filter matches the any parent of the test + + + Determine whether any ancestor of the test mateches the filter criteria + + The test to which the filter is applied + True if the filter matches the an ancestor of the test + + + Determine whether any descendant of the test matches the filter criteria. + + The test to be matched + True if at least one descendant matches the filter criteria + + + Nested class provides an empty filter - one that always + returns true when called, unless the test is marked explicit. + + + + TestID encapsulates a unique identifier for tests. As + currently implemented, this is an integer and is unique + within the AppDomain. TestID is one component of a + TestName. We use this object, rather than a raw int, + for two reasons: (1) to hide the implementation so + it may be changed later if necessary and (2) so that the + id may be null in a "weak" TestName. + + + + The int key that distinguishes this test from all others created + by the same runner. + + + + Static value to seed ids. It's started at 1000 so any + uninitialized ids will stand out. + + + + Construct a new TestID + + + + Construct a TestID with a given value. + Used in parsing test names and in order + to construct an artificial test node for + aggregating multiple test runners. + + + + + Parse a TestID from it's string representation + + + + + + Override of Equals method to allow comparison of TestIDs + + + + + + Override of GetHashCode for TestIDs + + + + + Override ToString() to display the int id + + + + + Operator == override + + + + + + + Operator != override + + + + + + + Clone this TestID + + An identical TestID + + + TestInfo holds common info about a test. It represents only + a single test or a suite and contains no references to other + tests. Since it is informational only, it can easily be passed + around using .Net remoting. + TestInfo is used directly in all EventListener events and in + TestResults. It contains an ID, which can be used by a + runner to locate the actual test. + TestInfo also serves as the base class for TestNode, which + adds hierarchical information and is used in client code to + maintain a visible image of the structure of the tests. + + + + TestName that identifies this test + + + + Reason for not running the test + + + + Number of test cases in this test or suite + + + + True if this is a suite + + + + The test description + + + + A list of all the categories assigned to a test + + + + A dictionary of properties, used to add information + to tests without requiring the class to change. + + + + Construct from an ITest + + Test from which a TestNode is to be constructed + + + Construct as a parent to multiple tests. + + The name to use for the new test + An array of child tests + + + Construct given a test name + + The TestName for the new test + + + Gets the completely specified name of the test + encapsulated in a TestName object. + + + + The name of the class containing this test, or null + + + + The name of the method implementing this test, or null + + + + Gets a string representing the kind of test this + object represents for display purposes. + + + + The test description + + + + Gets the RunState for this test + + + + The reason for ignoring a test + + + + Count of test cases in this test. + + + + Gets the parent test of this test + + + + Gets a list of the categories applied to this test + + + + Gets a list of any child tests + + + + True if this is a suite, false if a test case + + + + Gets the Properties dictionary for this test + + + + Counts the test cases that would be run if this + test were executed using the provided filter. + + The filter to apply + A count of test cases + + + TestName encapsulates all info needed to identify and + locate a test that has been loaded by a runner. It consists + of a three components: the simple name of the test, an int + id that is unique to a given tree of tests and an int + runner id that identifies the particular runner that + holds the test instance. + + + + ID that uniquely identifies the test + + + + The simple name of the test, without qualification + + + + The fully qualified name of the test + + + + Gets or sets the TestID that uniquely identifies this test + + + + Gets the ID for the runner that created the test from + the TestID, or returns -1 if the TestID is null. + + + + Gets or sets the simple name of the test + + + + Gets or sets the full (qualified) name of the test + + + + Get the string representation of this test name, incorporating all + the components of the name. + + + + Parse a string representation of a TestName, + returning a TestName. + + The string to parse + A TestName + + + Compares two TestNames for equality + + the other TestID + True if the two TestIDs are equal + + + Calculates a hashcode for this TestID + + The hash code. + + + Override ToString() to display the UniqueName + + + + + Override the == operator + + + + + + + Override the != operator + + + + + + + Returns a duplicate of this TestName + + + + + TestNode represents a single test or suite in the test hierarchy. + TestNode holds common info needed about a test and represents a + single node - either a test or a suite - in the hierarchy of tests. + TestNode extends TestInfo, which holds all the information with + the exception of the list of child classes. When constructed from + a Test, TestNodes are always fully populated with child TestNodes. + Like TestInfo, TestNode is purely a data class, and is not able + to execute tests. + + + + For a test suite, the child tests or suites + Null if this is not a test suite + + + + Construct from an ITest + + Test from which a TestNode is to be constructed + + + Construct a TestNode given a TestName and an + array of child tests. + + The TestName of the new test + An array of tests to be added as children of the new test + + + Gets the parent test of the current test + + + + Array of child tests, null if this is a test case. + + + + The TestOutput class holds a unit of output from + a test to either stdOut or stdErr + + + + Construct with text and an ouput destination type + + Text to be output + Destination of output + + + Return string representation of the object for debugging + + + + + Get the text + + + + Get the output type + + + + Enum representing the output destination + It uses combinable flags so that a given + output control can accept multiple types + of output. Normally, each individual + output uses a single flag value. + + + + Send output to stdOut + + + + Send output to stdErr + + + + Send output to Trace + + + + Send output to Log + + + + Represents the manner in which test assemblies are + distributed across processes. + + + + Use the default setting, depending on the runner + and the nature of the tests to be loaded. + + + + Run tests directly in the NUnit process + + + + Run tests in a single separate process + + + + Run tests in a separate process per assembly + + + + Represents the manner in which test assemblies use + AppDomains to provide isolation + + + + Use the default setting, depending on the runner + and the nature of the tests to be loaded. + + + + Don't create a test domain - run in the primary AppDomain + + + + Run tests in a single separate test domain + + + + Run tests in a separate domain per assembly + + + + TestPackage holds information about a set of tests to + be loaded by a TestRunner. It may represent a single + assembly or a set of assemblies. It supports selection + of a single test fixture for loading. + + + + Construct a package, specifying the name of the package. + If the package name is an assembly file type (dll or exe) + then the resulting package represents a single assembly. + Otherwise it is a container for multiple assemblies. + + The name of the package + + + Construct a package, specifying the name to be used + and a list of assemblies. + + The package name, used to name the top-level test node + The list of assemblies comprising the package + + + Gets the name of the package + + + + Gets the full name of the package, which is usually + the path to the NUnit project used to create the it + + + + The BasePath to be used in loading the assemblies + + + + The configuration file to be used + + + + Addditional directories to be probed when loading assemblies + + + + Indicates whether the probing path should be generated + automatically based on the list of assemblies. + + + + Assemblies to be loaded. At least one must be specified. + + + + Return true if the package represents a single assembly. + No root node is displayed in that case. + + + + Fully qualified name of test to be loaded. If not + specified, all the tests in the assemblies are loaded. + + + + Gets the dictionary of settings for this TestPackage + + + + Return the value of a setting or a default. + + The name of the setting + The default value + + + + Return the value of a string setting or a default. + + The name of the setting + The default value + + + + Return the value of a bool setting or a default. + + The name of the setting + The default value + + + + Return the value of an int setting or a default. + + The name of the setting + The default value + + + + Return the value of a enum setting or a default. + + The name of the setting + The default value + + + + The TestResult class represents + the result of a test and is used to + communicate results across AppDomains. + + + + Indicates the result of the test + + + + Indicates the location of a failure + + + + The elapsed time for executing this test + + + + The test that this result pertains to + + + + The stacktrace at the point of failure + + + + Message giving the reason for failure + + + + List of child results + + + + Number of asserts executed by this test + + + + Construct a test result given a TestInfo + + The test to be used + + + Construct a TestResult given an ITest + + + + + Construct a TestResult given a TestName + + A TestName + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + Gets the stage of the test in which a failure + or error occured. + + + + Indicates whether the test executed + + + + Gets the name of the test result + + + + Gets the full name of the test result + + + + Gets the test associated with this result + + + + Indicates whether the test ran successfully + + + + Indicates whether the test failed + + + + Indicates whether the test had an error (as opposed to a failure) + + + + Gets a description associated with the test + + + + Gets the elapsed time for running the test + + + + Gets the message associated with a test + failure or with not running the test + + + + Gets any stacktrace associated with an + error or failure. + + + + Gets or sets the count of asserts executed + when running the test. + + + + Return true if this result has any child results + + + + Gets a list of the child results of this TestResult + + + + Mark the test as succeeding + + + + Mark the test as succeeding and set a message + + + + Mark the test as ignored. + + The reason the test was not run + + + Mark the test as ignored. + + The ignore exception that was thrown + + + Mark the test as ignored. + + The reason the test was not run + Stack trace giving the location of the command + + + Mark the test as skipped. + + The reason the test was not run + + + Mark the test a not runnable with a reason + + The reason the test is invalid + + + Mark the test as not runnable due to a builder exception + + The exception thrown by the builder or an addin + + + Set the result of the test + + The ResultState to use in the result + The reason the test was not run + Stack trace giving the location of the command + The location of the failure, if any + + + Set the result of the test + + The ResultState to use in the result + The reason the test was not run + Stack trace giving the location of the command + + + Set the result of the test. + + The ResultState to use in the result + The exception that caused this result + The site at which an error or failure occured + + + Mark the test as a failure due to an + assertion having failed. + + Message to display + Stack trace giving the location of the failure + + + Mark the test as a failure due to an + assertion having failed. + + Message to display + Stack trace giving the location of the failure + The site of the failure + + + Marks the result as an error due to an exception thrown + by the test. + + The exception that was caught + + + Marks the result as an error due to an exception thrown + from the indicated FailureSite. + + The exception that was caught + The site from which it was thrown + + + Add a child result + + The child result to be added + + + The TestRunner Interface allows client code, such as the NUnit console and + gui runners, to load and run tests. This is the lowest level interface generally + supported for running tests and is implemented by the RemoteTestRunner class in + the NUnit core as well as by other classes running on the client side. + The Load method is used to load a suite of tests from one or more + assemblies, returning a tree of TestNodes to the caller. + The CountTestCases family of methods returns the number of test cases in the + loaded suite, either in its entirety or by using a filter to count a subset of tests. + The Run family of methods performs a test run synchronously, returning a TestResult + or TestResult[] to the caller. If provided, an EventListener interface will be + notified of significant events in the running of the tests. A filter may be used + to run a subset of the tests. + BeginRun and EndRun provide a simplified form of the asynchronous invocation + pattern used in many places within the .NET framework. Because the current + implementation allows only one run to be in process at a time, an IAsyncResult + is not used at this time. + Methods to cancel a run and to wait for a run to complete are also provided. The + result of the last run may be obtained by querying the TestResult property. + + + + TestRunners are identified by an ID. So long as there + is only one test runner or a single chain of test runners, + the default id of 0 may be used. However, any client that + creates multiple runners must ensure that each one has a + unique ID in order to locate and run specific tests. + + + + Running indicates whether a test is in progress. To retrieve the + results from an asynchronous test run, wait till Running is false. + + + + Returns information about loaded assemblies + + + + The loaded test, converted to a tree of TestNodes so they can be + serialized and marshalled to a remote client. + + + + Result of the last test run. + + + + Load the assemblies in a test package + + The test package to be loaded + True if the tests were loaded successfully, otherwise false + + + Unload all tests previously loaded + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. Arguments control whether + trace and log output are passed back to the caller. + + Interface to receive EventListener notifications. + The filter to apply when running the tests + If true, trace output is returned as a TestOutput event + The threshold for log output to be returned as a TestOutput event + + + Start a run of selected tests. The tests are run aynchronously and the + listener interface is notified as it progresses. Arguments control whether + trace and log output are passed back to the caller. + + Interface to receive EventListener notifications. + The filter to apply when running the tests + If true, trace output is returned as a TestOutput event + The threshold for log output to be returned as a TestOutput event + + + Wait for an asynchronous run to complete and return the result. + + A TestResult for the entire run + + + Cancel the test run that is in progress. For a synchronous run, + a client wanting to call this must create a separate run thread. + + + + Wait for the test run in progress to complete. For a synchronous run, + a client wanting to call this must create a separate run thread. In + particular, a gui client calling this method is likely to hang, since + events will not be able to invoke methods on the gui thread. + + + + Enumeration expressing the level of log messages to be + captured by NUnit and sent to the runner. These happen + to match the standard levels used by log4net, but will + be translated for any other loggers we support. + + + No logging + + Severe error beyond which continuation is not possible + + Error that may allow continuation + + A warning message + + An informational message + + Messages used for debugging + + All of the preceding plus more detailled messages if supported + + diff --git a/frameworks/csharp/nunit/lib/nunit.util.dll b/frameworks/csharp/nunit/lib/nunit.util.dll new file mode 100755 index 00000000..cd862ff0 Binary files /dev/null and b/frameworks/csharp/nunit/lib/nunit.util.dll differ diff --git a/frameworks/csharp/nunit/log4net.dll b/frameworks/csharp/nunit/log4net.dll new file mode 100644 index 00000000..20a2e1c4 Binary files /dev/null and b/frameworks/csharp/nunit/log4net.dll differ diff --git a/frameworks/csharp/nunit/nunit-agent.exe b/frameworks/csharp/nunit/nunit-agent.exe new file mode 100755 index 00000000..aaf9d9bc Binary files /dev/null and b/frameworks/csharp/nunit/nunit-agent.exe differ diff --git a/frameworks/csharp/nunit/nunit-agent.exe.config b/frameworks/csharp/nunit/nunit-agent.exe.config new file mode 100644 index 00000000..43adb3b8 --- /dev/null +++ b/frameworks/csharp/nunit/nunit-agent.exe.config @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/csharp/nunit/nunit-console.exe b/frameworks/csharp/nunit/nunit-console.exe new file mode 100755 index 00000000..4b8accad Binary files /dev/null and b/frameworks/csharp/nunit/nunit-console.exe differ diff --git a/frameworks/csharp/nunit/nunit-console.exe.config b/frameworks/csharp/nunit/nunit-console.exe.config new file mode 100644 index 00000000..c8b31ebe --- /dev/null +++ b/frameworks/csharp/nunit/nunit-console.exe.config @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + diff --git a/frameworks/csharp/nunit/nunit-editor.exe b/frameworks/csharp/nunit/nunit-editor.exe new file mode 100755 index 00000000..d00d9f78 Binary files /dev/null and b/frameworks/csharp/nunit/nunit-editor.exe differ diff --git a/frameworks/csharp/nunit/nunit-editor.exe.mdb b/frameworks/csharp/nunit/nunit-editor.exe.mdb new file mode 100644 index 00000000..cd781109 Binary files /dev/null and b/frameworks/csharp/nunit/nunit-editor.exe.mdb differ diff --git a/frameworks/csharp/nunit/nunit.core.dll b/frameworks/csharp/nunit/nunit.core.dll new file mode 100755 index 00000000..e0280a0a Binary files /dev/null and b/frameworks/csharp/nunit/nunit.core.dll differ diff --git a/frameworks/csharp/nunit/nunit.core.interfaces.dll b/frameworks/csharp/nunit/nunit.core.interfaces.dll new file mode 100755 index 00000000..6fb27f79 Binary files /dev/null and b/frameworks/csharp/nunit/nunit.core.interfaces.dll differ diff --git a/frameworks/csharp/nunit/nunit.core.interfaces.xml b/frameworks/csharp/nunit/nunit.core.interfaces.xml new file mode 100644 index 00000000..0956b78b --- /dev/null +++ b/frameworks/csharp/nunit/nunit.core.interfaces.xml @@ -0,0 +1,3150 @@ + + + + nunit.core.interfaces + + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + NOTE: This interface is used in both the framework + and the core, even though that results in two different + types. However, sharing the source code guarantees that + the various implementations will be compatible and that + the core is able to reflect successfully over the + framework implementations of ITestCaseData. + + + + + Gets the argument list to be provided to the test + + + + + Gets the expected result + + + + + Indicates whether a result has been specified. + This is necessary because the result may be + null, so it's value cannot be checked. + + + + + Gets the expected exception Type + + + + + Gets the FullName of the expected exception + + + + + Gets the name to be used for the test + + + + + Gets the description of the test + + + + + Gets a value indicating whether this is ignored. + + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + Gets the ignore reason. + + The ignore reason. + + + + The EventListener interface is used within the NUnit core to receive + notifications of significant events while a test is being run. These + events are propogated to any client, which may choose to convert them + to .NET events or to use them directly. + + + + + Called when a test run is starting + + The name of the test being started + The number of test cases under this test + + + + Called when a run finishes normally + + The result of the test + + + + Called when a run is terminated due to an exception + + Exception that was thrown + + + + Called when a test case is starting + + The name of the test case + + + + Called when a test case has finished + + The result of the test + + + + Called when a suite is starting + + The name of the suite + + + + Called when a suite has finished + + The result of the suite + + + + Called when an unhandled exception is detected during + the execution of a test run. + + The exception thta was detected + + + + Called when the test direts output to the console. + + A console message + + + + The Addin class holds information about an addin. + + + + + Construct an Addin for a type. + + The type to be used + + + + The name of the Addin + + + + + Brief description of what the Addin does + + + + + The type or types of extension provided, using + one or more members of the ExtensionType enumeration. + + + + + The AssemblyQualifiedName of the type that implements + the addin. + + + + + The status of the addin + + + + + Any message that clarifies the status of the Addin, + such as an error message or an explanation of why + the addin is disabled. + + + + + Return true if two Addins have teh same type name + + The other addin to be compared + + + + Return a hash code for this addin + + + + + The AddinStatus enum indicates the load status of an addin. + + + + + Not known - default + + + + + The addin is enabled but not loaded + + + + + The addin is disabled + + + + + The addin was loaded successfully + + + + + An error was encountered loading the addin + + + + + The ExtensionType enumeration is used to indicate the + kinds of extensions provided by an Addin. The addin + is only installed by hosts supporting one of its + extension types. + + + + + A Core extension is installed by the CoreExtensions + host in each test domain. + + + + + A Client extension is installed by all clients + + + + + A Gui extension is installed by the gui client + + + + + Add-ins are used to extend NUnti. All add-ins must + implement the IAddin interface. + + + + + When called, the add-in installs itself into + the host, if possible. Because NUnit uses separate + hosts for the client and test domain environments, + an add-in may be invited to istall itself more than + once. The add-in is responsible for checking which + extension points are supported by the host that is + passed to it and taking the appropriate action. + + The host in which to install the add-in + True if the add-in was installed, otehrwise false + + + + The IAddinRegistry interface allows registering addins + and retrieving information about them. It is also used + to record the load status of an addin. + + + + + Gets a list of all addins as Addin objects + + + + + Registers an addin + + The addin to be registered + + + + Returns true if an addin of a given name is registered + + The name of the addin + True if an addin of that name is registered, otherwise false + + + + Sets the load status of an addin + + The name of the addin + The status to be set + An optional message explaining the status + + + + The IDataPointProvider interface is used by extensions + that provide data for a single test parameter. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + A ParameterInfo representing one + argument to a parameterized test + An IEnumerable providing the required data + + + + The IDataPointProvider2 interface extends IDataPointProvider + by making the test fixture for which the test is being built + available for use. + + + + + Determine whether any data is available for a parameter. + + A ParameterInfo representing one + argument to a parameterized test + The test suite for which the test is being built + True if any data is available, otherwise false. + + + + Return an IEnumerable providing data for use with the + supplied parameter. + + A ParameterInfo representing one + argument to a parameterized test + The test suite for which the test is being built + An IEnumerable providing the required data + + + + The IExtensionHost interface is implemented by each + of NUnit's Extension hosts. Currently, there is + only one host, which resides in the test domain. + + + + + Get a list of the ExtensionPoints provided by this host. + + + + + Get an interface to the framework registry + + + + + Return an extension point by name, if present + + The name of the extension point + The extension point, if found, otherwise null + + + + Gets the ExtensionTypes supported by this host + + An enum indicating the ExtensionTypes supported + + + + Represents a single point of extension for NUnit. Some extension + points may accept only a single extension, while others may + accept more than one at the same time. + + + + + Get the name of this extension point + + + + + Get the host that provides this extension point + + + + + Install an extension at this extension point. If the + extension object does not meet the requirements for + this extension point, an exception is thrown. + + The extension to install + + + + Removes an extension from this extension point. If the + extension object is not present, the method returns + without error. + + + + + + + Represents a single point of extension for NUnit. Some extension + points may accept only a single extension, while others may + accept more than one at the same time. This interface enhances + IExtensionPoint by allowing specification of a priority + order for applying addins. + + + + + Install an extension at this extension point specifying + an integer priority value for the extension.If the + extension object does not meet the requirements for + this extension point, or if the extension point does + not support the requested priority level, an exception + is thrown. + + The extension to install + The priority level for this extension + + + + The IFrameworkRegistry allows extensions to register new + frameworks or emulations of other frameworks. + + + + + Register a framework + + The name of the framework + The name of the assembly that the tests reference + + + + The ISuiteBuilder interface is exposed by a class that knows how to + build a suite from one or more Types. + + + + + Examine the type and determine if it is suitable for + this builder to use in building a TestSuite. + Note that returning false will cause the type to be ignored + in loading the tests. If it is desired to load the suite + but label it as non-runnable, ignored, etc., then this + method must return true. + + The type of the fixture to be used + True if the type can be used to build a TestSuite + + + + Build a TestSuite from type provided. + + The type of the fixture to be used + A TestSuite + + + + The ITestCaseBuilder interface is exposed by a class that knows how to + build a test case from certain methods. + + + + + Examine the method and determine if it is suitable for + this builder to use in building a TestCase. + Note that returning false will cause the method to be ignored + in loading the tests. If it is desired to load the method + but label it as non-runnable, ignored, etc., then this + method must return true. + + The test method to examine + True is the builder can use this method + + + + Build a TestCase from the provided MethodInfo. + + The method to be used as a test case + A TestCase or null + + + + ITestCaseBuilder2 extends ITestCaseBuilder with methods + that include the suite for which the test case is being + built. Test case builders not needing the suite can + continue to implement ITestCaseBuilder. + + + + + Examine the method and determine if it is suitable for + this builder to use in building a TestCase to be + included in the suite being populated. + Note that returning false will cause the method to be ignored + in loading the tests. If it is desired to load the method + but label it as non-runnable, ignored, etc., then this + method must return true. + + The test method to examine + The suite being populated + True is the builder can use this method + + + + Build a TestCase from the provided MethodInfo for + inclusion in the suite being constructed. + + The method to be used as a test case + The test suite being populated, or null + A TestCase or null + + + + The ITestCaseProvider interface is used by extensions + that provide data for parameterized tests, along with + certain flags and other indicators used in the test. + + + + + Determine whether any test cases are available for a parameterized method. + + A MethodInfo representing a parameterized test + True if any cases are available, otherwise false. + + + + Return an IEnumerable providing test cases for use in + running a paramterized test. + + + + + + + + + ITestCaseProvider2 extends ITestCaseProvider with methods + that include the suite for which the test case is being + built. TestCaseProviders not needing the suite can + continue to implement ITestCaseBuilder. + + + + + Determine whether any test cases are available for a parameterized method. + + A MethodInfo representing a parameterized test + The suite for which the test case is being built + True if any cases are available, otherwise false. + + + + Return an IEnumerable providing test cases for use in + running a paramterized test. + + + + The suite for which the test case is being built + + + + + + DecoratorPriority wraps constants that may be used + to represent the relative priority of TestDecorators. + Decorators with a lower priority are applied first + so that higher priority decorators wrap them. + NOTE: This feature is subject to change. + + + + + The default priority, equivalent to Normal + + + + + Priority for Decorators that must apply first + + + + + Normal Decorator priority + + + + + Priority for Decorators that must apply last + + + + + The ITestDecorator interface is exposed by a class that knows how to + enhance the functionality of a test case or suite by decorating it. + + + + + Examine the a Test and either return it as is, modify it + or return a different TestCase. + + The Test to be decorated + The MethodInfo used to construct the test + The resulting Test + + + + NUnitAddinAttribute is used to mark all add-ins. The marked class + must implement the IAddin interface. + + + + + The name of this addin + + + + + A description for the addin + + + + + The type of extension provided + + + + + Default Constructor + + + + + ParameterSet encapsulates method arguments and + other selected parameters needed for constructing + a parameterized test case. + + + + + A dictionary of properties, used to add information + to tests without requiring the class to change. + + + + + The RunState for this set of parameters. + + + + + Holds any exception thrown by the parameter provider + + + + + The arguments to be used in running the test, + which must match the method signature. + + + + + The original arguments supplied by the user, + used for display purposes. + + + + + The Type of any exception that is expected. + + + + + The FullName of any exception that is expected + + + + + The Message of any exception that is expected + + + + + Gets or sets the type of match to be performed on the expected message + + + + + The expected result of the test, which + must match the method return type. + + + + + Returns true if an expected result has been + specified for this parameter set. + + + + + A description to be applied to this test case + + + + + A name to be used for this test case in lieu + of the standard generated name containing + the argument list. + + + + + Gets or sets a value indicating whether this is ignored. + + + true if ignored; otherwise, false. + + + + Gets or sets a value indicating whether this is explicit. + + + true if explicit; otherwise, false. + + + + Gets or sets the ignore reason. + + The ignore reason. + + + + Gets a list of categories associated with this test. + + + + + Gets the property dictionary for this test + + + + + Construct a non-runnable ParameterSet, specifying + the provider excetpion that made it invalid. + + + + + Construct an empty parameter set, which + defaults to being Runnable. + + + + + Constructs a ParameterSet from another object, accessing properties + by reflection. The object must expose at least an Arguments property + in order for the test to be runnable. + + + + + + + Summary description for TestFramework. + + + + + The name of the framework + + + + + The file name of the assembly that defines the framwork + + + + + Constructs a TestFramwork object given its name and assembly name. + + + + + + + + + Combines multiple filters so that a test must pass all + of them in order to pass this filter. + + + + + Constructs an empty AndFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + + Adds a filter to the list of filters + + The filter to be added + + + + Return an array of the composing filters + + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters pass, otherwise false + + + + Checks whether the AndFilter is matched by a test + + The test to be matched + True if all the component filters match, otherwise false + + + + Return string representation of the filter. + + + + + CategoryFilter is able to select or exclude tests + based on their categories. + + + + + Construct an empty CategoryFilter + + + + + Construct a CategoryFilter using a single category name + + A category name + + + + Construct a CategoryFilter using an array of category names + + An array of category names + + + + Add a category name to the filter + + A category name + + + + Check whether the filter matches a test + + The test to be matched + + + + + + Return the string representation of a category filter + + + + + + + Gets the list of categories from this filter + + + + + Summary description for NameFilter. + + + + + Construct an empty NameFilter + + + + + Construct a NameFilter for a single TestName + + + + + + + Add a TestName to a NameFilter + + + + + + + Check if a test matches the filter + + The test to match + True if it matches, false if not + + + + NotFilter negates the operation of another filter + + + + + Construct a not filter on another filter. The topLevel + argument is used to trigger special handling when tests + are being excluded. + + The filter to be negated + + + + Construct a not filter on another filter. The topLevel + argument is used to trigger special handling when tests + are being excluded. + + The filter to be negated + Indicates whether this is a top level NotFilter + + + + Indicates whether this is a top-level NotFilter, + requiring special handling of Explicit + + + + + Gets the base filter + + + + + Check whether the filter matches a test + + The test to be matched + True if it matches, otherwise false + + + + Determine whether any descendant of the test matches the filter criteria. + + The test to be matched + True if at least one descendant matches the filter criteria + + + + Return string representation of the filter + + + + + Combines multiple filters so that a test must pass one + of them in order to pass this filter. + + + + + Constructs an empty OrFilter + + + + + Constructs an AndFilter from an array of filters + + + + + + + Adds a filter to the list of filters + + The filter to be added + + + + Return an array of the composing filters + + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters pass, otherwise false + + + + Checks whether the OrFilter is matched by a test + + The test to be matched + True if any of the component filters match, otherwise false + + + + Return the string representation of an or filter + + + + + + + SimpleName filter selects tests based on their name + + + + + Construct an empty SimpleNameFilter + + + + + Construct a SimpleNameFilter for a single name + + The name the filter will recognize. + + + + Construct a SimpleNameFilter for an array of names + + The names the filter will recognize. + + + + Add a name to a SimpleNameFilter + + The name to be added. + + + + Add an array of names to a SimpleNameFilter + + The name to be added. + + + + Check whether the filter matches a test + + The test to be matched + True if it matches, otherwise false + + + + The IAgency interface is implemented by a TestAgency in + order to allow TestAgents to register with it. + + + + + Registers an agent with an agency + + + + + + + The IService interface is implemented by all Services. + + + + + Initialize the Service + + + + + Do any cleanup needed before terminating the service + + + + + Common interface supported by all representations + of a test. Only includes informational fields. + The Run method is specifically excluded to allow + for data-only representations of a test. + + + + + Gets the completely specified name of the test + encapsulated in a TestName object. + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets a string representing the type of test, e.g.: "Test Case" + + + + + Indicates whether the test can be run using + the RunState enum. + + + + + Reason for not running the test, if applicable + + + + + Count of the test cases ( 1 if this is a test case ) + + + + + Categories available for this test + + + + + Return the description field. + + + + + Return additional properties of the test + + + + + True if this is a suite + + + + + Gets the parent test of this test + + + + + For a test suite, the child tests or suites + Null if this is not a test suite + + + + + Count the test cases that pass a filter. The + result should match those that would execute + when passing the same filter to Run. + + The filter to apply + The count of test cases + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Indicates whether this is the EmptyFilter + + + + + Determine if a particular test passes the filter criteria. Pass + may examine the parents and/or descendants of a test, depending + on the semantics of the particular filter + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine whether the test itself matches the filter criteria, + without examining either parents or descendants. + + The test to which the filter is applied + True if the filter matches the any parent of the test + + + + OSPlatform represents a particular operating system platform + + + + + Platform ID for Unix as defined by Microsoft .NET 2.0 and greater + + + + + Platform ID for Unix as defined by Mono + + + + + Get the OSPlatform under which we are currently running + + + + + Product Type Enumeration used for Windows + + + + + Product type is unknown or unspecified + + + + + Product type is Workstation + + + + + Product type is Domain Controller + + + + + Product type is Server + + + + + Construct from a platform ID and version + + + + + Construct from a platform ID, version and product type + + + + + Get the platform ID of this instance + + + + + Get the Version of this instance + + + + + Get the Product Type of this instance + + + + + Return true if this is a windows platform + + + + + Return true if this is a Unix or Linux platform + + + + + Return true if the platform is Win32S + + + + + Return true if the platform is Win32Windows + + + + + Return true if the platform is Win32NT + + + + + Return true if the platform is Windows CE + + + + + Return true if the platform is Xbox + + + + + Return true if the platform is MacOSX + + + + + Return true if the platform is Windows 95 + + + + + Return true if the platform is Windows 98 + + + + + Return true if the platform is Windows ME + + + + + Return true if the platform is NT 3 + + + + + Return true if the platform is NT 4 + + + + + Return true if the platform is NT 5 + + + + + Return true if the platform is Windows 2000 + + + + + Return true if the platform is Windows XP + + + + + Return true if the platform is Windows 2003 Server + + + + + Return true if the platform is NT 6 + + + + + Return true if the platform is Vista + + + + + Return true if the platform is Windows 2008 Server (original or R2) + + + + + Return true if the platform is Windows 2008 Server (original) + + + + + Return true if the platform is Windows 2008 Server R2 + + + + + Return true if the platform is Windows 2012 Server + + + + + Return true if the platform is Windows 7 + + + + + Return true if the platform is Windows 8 + + + + + The PropertyNames struct lists common property names, which are + accessed by reflection in the NUnit core. This provides a modicum + of type safety as opposed to using the strings directly. + + + + Exception Type expected from a test + + + Exception Type expected from a test (pre-2.5) + + + FullName of the Exception Type expected from a test + + + FullName of the Exception Type expected from a test (pre-2.5) + + + ExpectedException Message + + + ExpectedException MatchType + + + Expected return result from test + + + Indicates whether there is an expected return result + + + Description of the test + + + Alternate test name + + + Arguments for the test + + + Indicates test case is ignored + + + Indicates test case is explicit + + + The reason a test case is ignored + + + Properties of the test + + + Categories of the test + + + Name of a category + + + Reason for not running a test + + + Flag indicating excluded test should be marked as Ignored + + + Name of an addin that must be present to run a test + + + + The ResultState enum indicates the result of running a test + + + + + The result is inconclusive + + + + + The test was not runnable. + + + + + The test has been skipped. + + + + + The test has been ignored. + + + + + The test succeeded + + + + + The test failed + + + + + The test encountered an unexpected exception + + + + + The test was cancelled by the user + + + + + The FailureSite enum indicates the stage of a test + in which an error or failure occured. + + + + + Failure in the test itself + + + + + Failure in the SetUp method + + + + + Failure in the TearDown method + + + + + Failure of a parent test + + + + + Failure of a child test + + + + + The RunState enum indicates whether a test + can be executed. When used on a TestResult + it may also indicate whether the test has + been executed. See individual values for + restrictions on use. + + + + + The test is not runnable. + + + + + The test is runnable. This value would + normally not appear on a TestResult, since + it would change to Executed. + + + + + The test can only be run explicitly. Would + normally not appear on a TestResult, since + it would change to Executed or Skipped. + + + + + The test has been skipped. This value may + appear on a Test when certain attributes + are used to skip the test. + + + + + The test has been ignored. May appear on + a Test, when the IgnoreAttribute is used. + Appears on a TestResult in that case or + if the test is dynamically ignored. + + + + + Enumeration identifying a common language + runtime implementation. + + + + Any supported runtime framework + + + Microsoft .NET Framework + + + Microsoft .NET Compact Framework + + + Microsoft Shared Source CLI + + + Mono + + + + RuntimeFramework represents a particular version + of a common language runtime implementation. + + + + + DefaultVersion is an empty Version, used to indicate that + NUnit should select the CLR version to use for the test. + + + + + Construct from a runtime type and version + + The runtime type of the framework + The version of the framework + + + + Static method to return a RuntimeFramework object + for the framework that is currently in use. + + + + + Gets an array of all available frameworks + + + + + Returns true if the current RuntimeFramework is available. + In the current implementation, only Mono and Microsoft .NET + are supported. + + True if it's available, false if not + + + + The type of this runtime framework + + + + + The framework version for this runtime framework + + + + + The CLR version for this runtime framework + + + + + Return true if any CLR version may be used in + matching this RuntimeFramework object. + + + + + Returns the Display name for this framework + + + + + Parses a string representing a RuntimeFramework. + The string may be just a RuntimeType name or just + a Version or a hyphentated RuntimeType-Version or + a Version prefixed by 'v'. + + + + + + + + + Returns the best available framework that matches a target framework. + If the target framework has a build number specified, then an exact + match is needed. Otherwise, the matching framework with the highest + build number is used. + + + + + + + + + Overridden to return the short name of the framework + + + + + + + Returns true if this framework's supports executing under the + requested target framework. The target is supported if + 1. The runtime types are the same or either one is RuntimeType.Any + 2. All specified (non-negative) components of the CLR version are equal. + 3. The major and minor components of the current framework version are + greater than or equal to the corresponding target components. + The last provision allows tests requiring .NET 2.0 to run under the + 3.0 and 3.5 platforms and those requiring .NET 4.0 to run under 4.5. + + The RuntimeFramework to be matched. + True on match, otherwise false + + + + Test Class. + + + + + TestName that identifies this test + + + + + Indicates whether the test should be executed + + + + + Test suite containing this test, or null + + + + + A dictionary of properties, used to add information + to tests without requiring the class to change. + + + + + Return true if the test requires a thread + + + + + Get the desired apartment state for running the test + + + + + Get the current apartment state of the test + + + + + Gets a boolean value indicating whether this + test should run on it's own thread. + + + + + Constructs a test given its name + + The name of the test + + + + Constructs a test given the path through the + test hierarchy to its parent and a name. + + The parent tests full name + The name of the test + + + + Constructs a test given a TestName object + + The TestName for this test + + + + Sets the runner id of a test and optionally its children + + The runner id to be used + True if all children should get the same id + + + + Gets the TestName of the test + + + + + Gets a string representing the kind of test + that this object represents, for use in display. + + + + + Whether or not the test should be run + + + + + Reason for not running the test, if applicable + + + + + Gets a count of test cases represented by + or contained under this test. + + + + + Gets a list of categories associated with this test. + + + + + Gets a description associated with this test. + + + + + Gets the property dictionary for this test + + + + + Indicates whether this test is a suite + + + + + Gets the parent test of this test + + + + + Gets the parent as a Test object. + Used by the core to set the parent. + + + + + Gets this test's child tests + + + + + Gets the Type of the fixture used in running this test + + + + + Gets the name of the class containing this test. Returns + null if the test is not associated with a class. + + + + + Gets the name of the method implementing this test. + Returns null if the test is not implemented as a method. + + + + + Gets or sets a fixture object for running this test + + + + + Gets a count of test cases that would be run using + the specified filter. + + + + + + + + + Runs the test under a particular filter, sending + notifications to a listener. + + An event listener to receive notifications + A filter used in running the test + + + + + + Compares this test to another test for sorting purposes + + The other test + Value of -1, 0 or +1 depending on whether the current test is less than, equal to or greater than the other test + + + + Abstract base for all types of TestAgents. + A TestAgent provides services of locating, + loading and running tests in a particular + context such as an AppDomain or Process. + + + + + Reference to the TestAgency that controls this agent + + + + + This agent's assigned id + + + + + Constructs a TestAgent + + + + + + + Consructor used by TestAgency when creating + an agent. + + + + + + + + + The TestAgency with which this agent is asssociated, + or null if the agent is not tied to an agency. + + + + + A Guid that uniquely identifies this agent. + + + + + Starts the agent, performing any required initialization + + + + + + + Stops the agent, releasing any resources + + + + + Creates a runner using a given runner id + + + + + Dispose is overridden to stop the agent + + + + + Overridden to cause object to live indefinitely + + + + + TestAssemblyInfo holds information about a loaded test assembly + + + + + Constructs a TestAssemblyInfo + + The name of the assembly + The version of the runtime for which the assembly was built + The runtime framework under which the assembly is loaded + A list of test framework useds by the assembly + + + + Gets the name of the assembly + + + + + Gets the runtime version for which the assembly was built + + + + + Gets the runtime framework under which the assembly is loaded + + + + + Gets the runtime version under which the assembly is loaded + + + + + The Id of the process in which the assembly is loaded + + + + + The friendly name of the AppDomain in which the assembly is loaded + + + + + The Application Base of the AppDomain in which the assembly is loaded + + + + + The PrivateBinPath of the AppDomain in which the assembly is loaded + + + + + The ConfigurationFile of the AppDomain in which the assembly is loaded + + + + + The name of the main module of the process in which the assembly is loaded + + + + + Gets a list of testframeworks referenced by the assembly + + + + + Interface to be implemented by filters applied to tests. + The filter applies when running the test, after it has been + loaded, since this is the only time an ITest exists. + + + + + Unique Empty filter. + + + + + Indicates whether this is the EmptyFilter + + + + + Determine if a particular test passes the filter criteria. The default + implementation checks the test itself, its parents and any descendants. + Derived classes may override this method or any of the Match methods + to change the behavior of the filter. + + The test to which the filter is applied + True if the test passes the filter, otherwise false + + + + Determine whether the test itself matches the filter criteria, without + examining either parents or descendants. + + The test to which the filter is applied + True if the filter matches the any parent of the test + + + + Determine whether any ancestor of the test mateches the filter criteria + + The test to which the filter is applied + True if the filter matches the an ancestor of the test + + + + Determine whether any descendant of the test matches the filter criteria. + + The test to be matched + True if at least one descendant matches the filter criteria + + + + Nested class provides an empty filter - one that always + returns true when called, unless the test is marked explicit. + + + + + TestID encapsulates a unique identifier for tests. As + currently implemented, this is an integer and is unique + within the AppDomain. TestID is one component of a + TestName. We use this object, rather than a raw int, + for two reasons: (1) to hide the implementation so + it may be changed later if necessary and (2) so that the + id may be null in a "weak" TestName. + + + + + The int key that distinguishes this test from all others created + by the same runner. + + + + + Static value to seed ids. It's started at 1000 so any + uninitialized ids will stand out. + + + + + Construct a new TestID + + + + + Construct a TestID with a given value. + Used in parsing test names and in order + to construct an artificial test node for + aggregating multiple test runners. + + + + + + + Parse a TestID from it's string representation + + + + + + + + + Override of Equals method to allow comparison of TestIDs + + + + + + + + + Override of GetHashCode for TestIDs + + + + + + + Override ToString() to display the int id + + + + + + + Operator == override + + + + + + + + + + + Operator != override + + + + + + + + + + + Clone this TestID + + An identical TestID + + + + TestInfo holds common info about a test. It represents only + a single test or a suite and contains no references to other + tests. Since it is informational only, it can easily be passed + around using .Net remoting. + TestInfo is used directly in all EventListener events and in + TestResults. It contains an ID, which can be used by a + runner to locate the actual test. + TestInfo also serves as the base class for TestNode, which + adds hierarchical information and is used in client code to + maintain a visible image of the structure of the tests. + + + + + TestName that identifies this test + + + + + Reason for not running the test + + + + + Number of test cases in this test or suite + + + + + True if this is a suite + + + + + The test description + + + + + A list of all the categories assigned to a test + + + + + A dictionary of properties, used to add information + to tests without requiring the class to change. + + + + + Construct from an ITest + + Test from which a TestNode is to be constructed + + + + Construct as a parent to multiple tests. + + The name to use for the new test + An array of child tests + + + + Construct given a test name + + The TestName for the new test + + + + Gets the completely specified name of the test + encapsulated in a TestName object. + + + + + The name of the class containing this test, or null + + + + + The name of the method implementing this test, or null + + + + + Gets a string representing the kind of test this + object represents for display purposes. + + + + + The test description + + + + + Gets the RunState for this test + + + + + The reason for ignoring a test + + + + + Count of test cases in this test. + + + + + Gets the parent test of this test + + + + + Gets a list of the categories applied to this test + + + + + Gets a list of any child tests + + + + + True if this is a suite, false if a test case + + + + + Gets the Properties dictionary for this test + + + + + Counts the test cases that would be run if this + test were executed using the provided filter. + + The filter to apply + A count of test cases + + + + TestName encapsulates all info needed to identify and + locate a test that has been loaded by a runner. It consists + of a three components: the simple name of the test, an int + id that is unique to a given tree of tests and an int + runner id that identifies the particular runner that + holds the test instance. + + + + + ID that uniquely identifies the test + + + + + The simple name of the test, without qualification + + + + + The fully qualified name of the test + + + + + Gets or sets the TestID that uniquely identifies this test + + + + + Gets the ID for the runner that created the test from + the TestID, or returns -1 if the TestID is null. + + + + + Gets or sets the simple name of the test + + + + + Gets or sets the full (qualified) name of the test + + + + + Get the string representation of this test name, incorporating all + the components of the name. + + + + + Parse a string representation of a TestName, + returning a TestName. + + The string to parse + A TestName + + + + Compares two TestNames for equality + + the other TestID + True if the two TestIDs are equal + + + + Calculates a hashcode for this TestID + + The hash code. + + + + Override ToString() to display the UniqueName + + + + + + + Override the == operator + + + + + + + + + + + Override the != operator + + + + + + + + + + + Returns a duplicate of this TestName + + + + + + + TestNode represents a single test or suite in the test hierarchy. + TestNode holds common info needed about a test and represents a + single node - either a test or a suite - in the hierarchy of tests. + TestNode extends TestInfo, which holds all the information with + the exception of the list of child classes. When constructed from + a Test, TestNodes are always fully populated with child TestNodes. + Like TestInfo, TestNode is purely a data class, and is not able + to execute tests. + + + + + For a test suite, the child tests or suites + Null if this is not a test suite + + + + + Construct from an ITest + + Test from which a TestNode is to be constructed + + + + Construct a TestNode given a TestName and an + array of child tests. + + The TestName of the new test + An array of tests to be added as children of the new test + + + + Gets the parent test of the current test + + + + + Array of child tests, null if this is a test case. + + + + + The TestOutput class holds a unit of output from + a test to either stdOut or stdErr + + + + + Construct with text and an ouput destination type + + Text to be output + Destination of output + + + + Return string representation of the object for debugging + + + + + + + Get the text + + + + + Get the output type + + + + + Enum representing the output destination + It uses combinable flags so that a given + output control can accept multiple types + of output. Normally, each individual + output uses a single flag value. + + + + + Send output to stdOut + + + + + Send output to stdErr + + + + + Send output to Trace + + + + + Send output to Log + + + + + Represents the manner in which test assemblies are + distributed across processes. + + + + + Use the default setting, depending on the runner + and the nature of the tests to be loaded. + + + + + Run tests directly in the NUnit process + + + + + Run tests in a single separate process + + + + + Run tests in a separate process per assembly + + + + + Represents the manner in which test assemblies use + AppDomains to provide isolation + + + + + Use the default setting, depending on the runner + and the nature of the tests to be loaded. + + + + + Don't create a test domain - run in the primary AppDomain + + + + + Run tests in a single separate test domain + + + + + Run tests in a separate domain per assembly + + + + + TestPackage holds information about a set of tests to + be loaded by a TestRunner. It may represent a single + assembly or a set of assemblies. It supports selection + of a single test fixture for loading. + + + + + Construct a package, specifying the name of the package. + If the package name is an assembly file type (dll or exe) + then the resulting package represents a single assembly. + Otherwise it is a container for multiple assemblies. + + The name of the package + + + + Construct a package, specifying the name to be used + and a list of assemblies. + + The package name, used to name the top-level test node + The list of assemblies comprising the package + + + + Gets the name of the package + + + + + Gets the full name of the package, which is usually + the path to the NUnit project used to create the it + + + + + The BasePath to be used in loading the assemblies + + + + + The configuration file to be used + + + + + Addditional directories to be probed when loading assemblies + + + + + Indicates whether the probing path should be generated + automatically based on the list of assemblies. + + + + + Assemblies to be loaded. At least one must be specified. + + + + + Return true if the package represents a single assembly. + No root node is displayed in that case. + + + + + Fully qualified name of test to be loaded. If not + specified, all the tests in the assemblies are loaded. + + + + + Gets the dictionary of settings for this TestPackage + + + + + Return the value of a setting or a default. + + The name of the setting + The default value + + + + + + Return the value of a string setting or a default. + + The name of the setting + The default value + + + + + + Return the value of a bool setting or a default. + + The name of the setting + The default value + + + + + + Return the value of an int setting or a default. + + The name of the setting + The default value + + + + + + Return the value of a enum setting or a default. + + The name of the setting + The default value + + + + + + The TestResult class represents + the result of a test and is used to + communicate results across AppDomains. + + + + + Indicates the result of the test + + + + + Indicates the location of a failure + + + + + The elapsed time for executing this test + + + + + The test that this result pertains to + + + + + The stacktrace at the point of failure + + + + + Message giving the reason for failure + + + + + List of child results + + + + + Number of asserts executed by this test + + + + + Construct a test result given a TestInfo + + The test to be used + + + + Construct a TestResult given an ITest + + + + + + + Construct a TestResult given a TestName + + A TestName + + + + Gets the ResultState of the test result, which + indicates the success or failure of the test. + + + + + Gets the stage of the test in which a failure + or error occured. + + + + + Indicates whether the test executed + + + + + Gets the name of the test result + + + + + Gets the full name of the test result + + + + + Gets the test associated with this result + + + + + Indicates whether the test ran successfully + + + + + Indicates whether the test failed + + + + + Indicates whether the test had an error (as opposed to a failure) + + + + + Gets a description associated with the test + + + + + Gets the elapsed time for running the test + + + + + Gets the message associated with a test + failure or with not running the test + + + + + Gets any stacktrace associated with an + error or failure. + + + + + Gets or sets the count of asserts executed + when running the test. + + + + + Return true if this result has any child results + + + + + Gets a list of the child results of this TestResult + + + + + Mark the test as succeeding + + + + + Mark the test as succeeding and set a message + + + + + Mark the test as ignored. + + The reason the test was not run + + + + Mark the test as ignored. + + The ignore exception that was thrown + + + + Mark the test as ignored. + + The reason the test was not run + Stack trace giving the location of the command + + + + Mark the test as skipped. + + The reason the test was not run + + + + Mark the test a not runnable with a reason + + The reason the test is invalid + + + + Mark the test as not runnable due to a builder exception + + The exception thrown by the builder or an addin + + + + Set the result of the test + + The ResultState to use in the result + The reason the test was not run + Stack trace giving the location of the command + The location of the failure, if any + + + + Set the result of the test + + The ResultState to use in the result + The reason the test was not run + Stack trace giving the location of the command + + + + Set the result of the test. + + The ResultState to use in the result + The exception that caused this result + The site at which an error or failure occured + + + + Mark the test as a failure due to an + assertion having failed. + + Message to display + Stack trace giving the location of the failure + + + + Mark the test as a failure due to an + assertion having failed. + + Message to display + Stack trace giving the location of the failure + The site of the failure + + + + Marks the result as an error due to an exception thrown + by the test. + + The exception that was caught + + + + Marks the result as an error due to an exception thrown + from the indicated FailureSite. + + The exception that was caught + The site from which it was thrown + + + + Add a child result + + The child result to be added + + + + The TestRunner Interface allows client code, such as the NUnit console and + gui runners, to load and run tests. This is the lowest level interface generally + supported for running tests and is implemented by the RemoteTestRunner class in + the NUnit core as well as by other classes running on the client side. + The Load method is used to load a suite of tests from one or more + assemblies, returning a tree of TestNodes to the caller. + The CountTestCases family of methods returns the number of test cases in the + loaded suite, either in its entirety or by using a filter to count a subset of tests. + The Run family of methods performs a test run synchronously, returning a TestResult + or TestResult[] to the caller. If provided, an EventListener interface will be + notified of significant events in the running of the tests. A filter may be used + to run a subset of the tests. + BeginRun and EndRun provide a simplified form of the asynchronous invocation + pattern used in many places within the .NET framework. Because the current + implementation allows only one run to be in process at a time, an IAsyncResult + is not used at this time. + Methods to cancel a run and to wait for a run to complete are also provided. The + result of the last run may be obtained by querying the TestResult property. + + + + + TestRunners are identified by an ID. So long as there + is only one test runner or a single chain of test runners, + the default id of 0 may be used. However, any client that + creates multiple runners must ensure that each one has a + unique ID in order to locate and run specific tests. + + + + + Running indicates whether a test is in progress. To retrieve the + results from an asynchronous test run, wait till Running is false. + + + + + Returns information about loaded assemblies + + + + + The loaded test, converted to a tree of TestNodes so they can be + serialized and marshalled to a remote client. + + + + + Result of the last test run. + + + + + Load the assemblies in a test package + + The test package to be loaded + True if the tests were loaded successfully, otherwise false + + + + Unload all tests previously loaded + + + + + Count Test Cases using a filter + + The filter to apply + The number of test cases found + + + + Run selected tests and return a test result. The test is run synchronously, + and the listener interface is notified as it progresses. Arguments control whether + trace and log output are passed back to the caller. + + Interface to receive EventListener notifications. + The filter to apply when running the tests + If true, trace output is returned as a TestOutput event + The threshold for log output to be returned as a TestOutput event + + + + Start a run of selected tests. The tests are run aynchronously and the + listener interface is notified as it progresses. Arguments control whether + trace and log output are passed back to the caller. + + Interface to receive EventListener notifications. + The filter to apply when running the tests + If true, trace output is returned as a TestOutput event + The threshold for log output to be returned as a TestOutput event + + + + Wait for an asynchronous run to complete and return the result. + + A TestResult for the entire run + + + + Cancel the test run that is in progress. For a synchronous run, + a client wanting to call this must create a separate run thread. + + + + + Wait for the test run in progress to complete. For a synchronous run, + a client wanting to call this must create a separate run thread. In + particular, a gui client calling this method is likely to hang, since + events will not be able to invoke methods on the gui thread. + + + + + Enumeration expressing the level of log messages to be + captured by NUnit and sent to the runner. These happen + to match the standard levels used by log4net, but will + be translated for any other loggers we support. + + + + No logging + + + Severe error beyond which continuation is not possible + + + Error that may allow continuation + + + A warning message + + + An informational message + + + Messages used for debugging + + + All of the preceding plus more detailled messages if supported + + + diff --git a/frameworks/csharp/nunit/nunit.framework.dll b/frameworks/csharp/nunit/nunit.framework.dll new file mode 100755 index 00000000..956c32c2 Binary files /dev/null and b/frameworks/csharp/nunit/nunit.framework.dll differ diff --git a/frameworks/csharp/nunit/nunit.util.dll b/frameworks/csharp/nunit/nunit.util.dll new file mode 100755 index 00000000..cd862ff0 Binary files /dev/null and b/frameworks/csharp/nunit/nunit.util.dll differ diff --git a/frameworks/csharp/nunit/pnunit-agent.exe b/frameworks/csharp/nunit/pnunit-agent.exe new file mode 100755 index 00000000..d27864d0 Binary files /dev/null and b/frameworks/csharp/nunit/pnunit-agent.exe differ diff --git a/frameworks/csharp/nunit/pnunit-agent.exe.config b/frameworks/csharp/nunit/pnunit-agent.exe.config new file mode 100644 index 00000000..2da8776d --- /dev/null +++ b/frameworks/csharp/nunit/pnunit-agent.exe.config @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/csharp/nunit/pnunit-launcher.exe b/frameworks/csharp/nunit/pnunit-launcher.exe new file mode 100755 index 00000000..5ab38513 Binary files /dev/null and b/frameworks/csharp/nunit/pnunit-launcher.exe differ diff --git a/frameworks/csharp/nunit/pnunit-launcher.exe.config b/frameworks/csharp/nunit/pnunit-launcher.exe.config new file mode 100644 index 00000000..2da8776d --- /dev/null +++ b/frameworks/csharp/nunit/pnunit-launcher.exe.config @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/csharp/nunit/pnunit.framework.dll b/frameworks/csharp/nunit/pnunit.framework.dll new file mode 100755 index 00000000..faff8f89 Binary files /dev/null and b/frameworks/csharp/nunit/pnunit.framework.dll differ diff --git a/frameworks/csharp/nunit/pnunit.tests.dll b/frameworks/csharp/nunit/pnunit.tests.dll new file mode 100755 index 00000000..49b7ff8f Binary files /dev/null and b/frameworks/csharp/nunit/pnunit.tests.dll differ diff --git a/frameworks/csharp/nunit/runpnunit.bat b/frameworks/csharp/nunit/runpnunit.bat new file mode 100644 index 00000000..f41cb5a6 --- /dev/null +++ b/frameworks/csharp/nunit/runpnunit.bat @@ -0,0 +1,3 @@ +start pnunit-agent 8080 . +start pnunit-agent 8081 . +pnunit-launcher test.conf diff --git a/frameworks/csharp/nunit/test.conf b/frameworks/csharp/nunit/test.conf new file mode 100644 index 00000000..63cc7bd4 --- /dev/null +++ b/frameworks/csharp/nunit/test.conf @@ -0,0 +1,82 @@ + + + + + + + + + + + Testing + + + Testing + pnunit.tests.dll + TestLibraries.Testing.EqualTo19 + $agent_host:8080 + + + + + + + Parallel_Tests + + + ParallelTest_A_Test + pnunit.tests.dll + TestLibraries.ParallelExample.ParallelTest_A + $agent_host:8080 + + + 2 + + + + ParallelTest_B_Test + pnunit.tests.dll + TestLibraries.ParallelExample.ParallelTest_B + $agent_host:8080 + + 1 + + + + + + + + + Parallel_Barriers + + + Parallel_Barriers_TestA + pnunit.tests.dll + TestLibraries.ParallelExampleWithBarriers.ParallelTestWithBarriersA + $agent_host:8080 + + + + START_BARRIER + WAIT_BARRIER + + + + Parallel_Barriers_TestB + pnunit.tests.dll + TestLibraries.ParallelExampleWithBarriers.ParallelTestWithBarriersB + $agent_host:8081 + + + + START_BARRIER + WAIT_BARRIER + + + + + + + + \ No newline at end of file diff --git a/frameworks/haskell/Test/CodeWars/BlackList.hs b/frameworks/haskell/Test/CodeWars/BlackList.hs index b51b09b1..e1bd88fc 100644 --- a/frameworks/haskell/Test/CodeWars/BlackList.hs +++ b/frameworks/haskell/Test/CodeWars/BlackList.hs @@ -95,7 +95,7 @@ unName (Symbol name) = name -- | Check that an ImportSpec matches a symbol importSpecMatchesSymbol :: ImportSpec -> String -> Bool -(IVar x) `importSpecMatchesSymbol` y = (unName x) == y +(IVar _ x) `importSpecMatchesSymbol` y = (unName x) == y (IAbs x) `importSpecMatchesSymbol` y = (unName x) == y (IThingAll x) `importSpecMatchesSymbol` y = (unName x) == y (IThingWith x cnames) `importSpecMatchesSymbol` y = diff --git a/frameworks/haskell/Test/CodeWars/Formatters.hs b/frameworks/haskell/Test/CodeWars/Formatters.hs index d4347572..d01909a0 100644 --- a/frameworks/haskell/Test/CodeWars/Formatters.hs +++ b/frameworks/haskell/Test/CodeWars/Formatters.hs @@ -22,10 +22,10 @@ codewars :: Formatter codewars = do specdoc { headerFormatter = return () -, exampleGroupStarted = \n _ name -> do +, exampleGroupStarted = \nesting name -> do -- separate groups with an empty line - unless (n == 0) newParagraph - writeLine $ join ["", name] + -- TODO: Handel nesting + writeLine $ join $ ["", name] , exampleGroupDone = Test.Hspec.Formatters.writeLine "" @@ -45,7 +45,7 @@ specdoc { writeLine $ printf "%1.4f seconds" time } where formatFailure :: FailureRecord -> FormatM () - formatFailure (FailureRecord _ reason) = + formatFailure (FailureRecord {failureRecordMessage = reason}) = unless (null err) $ writeLine err where err = either diff --git a/frameworks/haskell/Test/CodeWars/Runner.hs b/frameworks/haskell/Test/CodeWars/Runner.hs index a7101bd6..8594d99d 100644 --- a/frameworks/haskell/Test/CodeWars/Runner.hs +++ b/frameworks/haskell/Test/CodeWars/Runner.hs @@ -6,7 +6,7 @@ import Test.CodeWars.Formatters (codewars) import qualified System.Exit import Control.Monad (unless) import "hspec" Test.Hspec (Spec) -import "hspec" Test.Hspec.Runner ( hspecWith +import "hspec" Test.Hspec.Runner ( hspecWithResult , defaultConfig , Config ( configFormatter @@ -15,10 +15,10 @@ import "hspec" Test.Hspec.Runner ( hspecWith hspec :: Spec -> IO () hspec spec = withArgs [] $ do - r <- hspecWith config spec + r <- hspecWithResult config spec unless (summaryFailures r == 0) System.Exit.exitFailure where config = - defaultConfig { configFormatter = codewars + defaultConfig { configFormatter = Just codewars , configFastFail = True} diff --git a/frameworks/haskell/Test/Hspec.hs b/frameworks/haskell/Test/Hspec.hs index 2a2d109b..37dc09e0 100644 --- a/frameworks/haskell/Test/Hspec.hs +++ b/frameworks/haskell/Test/Hspec.hs @@ -9,6 +9,14 @@ module Test.Hspec ( , Spec , describe , it + , context + , example + , pending + , pendingWith + , before + , after + , around + , parallel -- QuickCheck , property diff --git a/frameworks/javascript/cw-2.js b/frameworks/javascript/cw-2.js index f562379a..cbb1fb63 100644 --- a/frameworks/javascript/cw-2.js +++ b/frameworks/javascript/cw-2.js @@ -9,6 +9,7 @@ try } var util = require('util'); + var deepEquals = require('lodash').isEqual; var fnToString = Function.toString; Function.prototype.toString = function () @@ -303,34 +304,50 @@ try { this.assertNotEquals(this.inspect(actual), this.inspect(expected), msg, options) }, - assertEquals: function (actual, expected, msg, options) - { - if (actual !== expected) - { + assertEquals: function (actual, expected, msg, options) { + if (actual !== expected) { msg = _message('Expected: ' + Test.inspect(expected) + ', instead got: ' + Test.inspect(actual), msg); Test.expect(false, msg, options); } - else - { + else { options = options || {}; options.successMsg = options.successMsg || 'Value == ' + Test.inspect(expected); Test.expect(true, null, options); } }, - assertNotEquals: function (a, b, msg, options) - { - if (a === b) - { + assertNotEquals: function (a, b, msg, options) { + if (a === b) { msg = _message('Not Expected: ' + Test.inspect(a), msg); Test.expect(false, msg, options); } - else - { + else { options = options || {}; options.successMsg = options.successMsg || 'Value != ' + Test.inspect(b); Test.expect(true, null, options); } }, + assertDeepEquals: function (actual, expected, msg, options) { + if (deepEquals(actual, expected)) { + options = options || {}; + options.successMsg = options.successMsg || 'Value deep equals ' + Test.inspect(expected); + Test.expect(true, null, options); + } + else { + msg = _message('Expected: ' + Test.inspect(expected) + ', instead got: ' + Test.inspect(actual), msg); + Test.expect(false, msg, options); + } + }, + assertNotDeepEquals: function (actual, expected, msg, options) { + if (!deepEquals(actual, expected)) { + options = options || {}; + options.successMsg = options.successMsg || 'Value not deep equals ' + Test.inspect(expected); + Test.expect(true, null, options); + } + else { + msg = _message('Value should not deep equal ' + Test.inspect(actual), msg); + Test.expect(false, msg, options); + } + }, expectNoError: function (msg, fn) { if (!fn) @@ -402,6 +419,14 @@ try { return array[~~(array.length * Math.random())] }, + escapeHtml: function (html) { + return String(html) + .replace(/&/g, '&') + .replace(/"/g, '"') + .replace(/'/g, ''') + .replace(//g, '>'); + }, Error: function (message) { this.name = "TestError"; diff --git a/frameworks/osx/format_failure.sh b/frameworks/osx/format_failure.sh new file mode 100755 index 00000000..5725da93 --- /dev/null +++ b/frameworks/osx/format_failure.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +sed -n "/^\/tmp\/xcode\/[^\/]*\/${1}\//,\$p" | +sed -e "s/^.*\/${1}\/[^\.]*\.swift$//" \ + -e "s/^.*\/${1}\/[^\.]*\.m$//" \ + -e "s/^.*\/${1}\/\([^\.]*\.swift\)/\1/" \ + -e "s/^.*\/${1}\/\([^\.]*\.m\)/\1/" \ + -e "/^\*\* BUILD FAILED \*\*/,\$d" | +grep -v ${1} | +grep -v 'cd /tmp/xcode' diff --git a/frameworks/osx/format_output.sh b/frameworks/osx/format_output.sh new file mode 100755 index 00000000..ec5e18db --- /dev/null +++ b/frameworks/osx/format_output.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +sed -e "1,/^Test Suite '${1}.xctest' started at/d" \ + -e "s/\(^Test Suite '[^']*' started at .*\)$/\1/" \ + -e "s/\(^Test Case '[^']*' started.\)$/\1/" \ + -e "s/\(^Test Case '[^']*' failed [^(]*\)(\([^)]*\))\.$/\1\2/" \ + -e "s/\(^Test Case '[^']*' passed [^(]*\)(\([^)]*\))\.$/\1\2/" \ + -e $'s//\\\n/g' \ + -e "s/${1//-/_}\.//g" \ + -e "s/^.*\/${1}\/\([^\.]*\.swift\)/\1/" \ + -e "s/^.*\/${1}\/\([^\.]*\.m\)/\1/" \ + -e "/^Test Suite '${1}.xctest' failed/,\$d" \ + -e "/^Test Suite '${1}.xctest' passed/,\$d" | +perl -pe "s/(Test Suite '[^']*' [pf]a[is][ls]ed.*)\n/\1<:LF:>/" diff --git a/frameworks/osx/objc.sb b/frameworks/osx/objc.sb new file mode 100644 index 00000000..2d33e0ae --- /dev/null +++ b/frameworks/osx/objc.sb @@ -0,0 +1,24 @@ +;; A sandbox file for `sandbox-exec` +;; +;; Unofficial Manual: http://reverse.put.as/wp-content/uploads/2011/09/Apple-Sandbox-Guide-v1.0.pdf +;; Examples: /usr/share/sandbox/*.sb +;; + +(version 1) + +; Doesn't work, maybe someday... +(debug all) + +; Deny everything by default +(deny default) + +(allow file-read-data file-read-metadata + ; System dynamic libraries + (regex #"^/usr/lib/.*\.dylib$") + ; Read access to frameworks + (subpath "/System/Library/Frameworks") + (subpath "/System/Library/PrivateFrameworks") +) + +; Allow us to execute compiled executables +(allow process-exec (regex #"/tmp/objc/[0-9a-z\-]+/main")) diff --git a/frameworks/osx/ready_template.sh b/frameworks/osx/ready_template.sh new file mode 100755 index 00000000..72be01d2 --- /dev/null +++ b/frameworks/osx/ready_template.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -euo pipefail + +mkdir -p /tmp/xcode +DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd ) +NEW_TEMPDIR=$(mktemp -d /tmp/xcode/XXXXXXXXXXXXXXXXXXXXXXX) + +# Set up the XCode project +UUID=X$(uuidgen) +mkdir -p ${NEW_TEMPDIR}/runner.xcodeproj/xcuserdata/${USER}.xcuserdatad/xcschemes +sed -e "s/runner-test/${UUID}/g" ${DIR}/runner_template/runner.xcodeproj/xcuserdata/template.xcuserdatad/xcschemes/runner-test.xcscheme > ${NEW_TEMPDIR}/runner.xcodeproj/xcuserdata/${USER}.xcuserdatad/xcschemes/${UUID}.xcscheme +sed -e "s/runner-test/${UUID}/g" ${DIR}/runner_template/runner.xcodeproj/project.pbxproj > ${NEW_TEMPDIR}/runner.xcodeproj/project.pbxproj +cp -a ${DIR}/runner_template/runner-test/ ${NEW_TEMPDIR}/${UUID}/ + +# Build the xcode project a head of time +( cd ${NEW_TEMPDIR} ; + xcodebuild clean build -project runner.xcodeproj/ -scheme ${UUID} -destination 'platform=OS X,arch=x86_64') > /dev/null 2>&1 + +echo ${NEW_TEMPDIR} diff --git a/frameworks/osx/run_template.sh b/frameworks/osx/run_template.sh new file mode 100755 index 00000000..b748ac45 --- /dev/null +++ b/frameworks/osx/run_template.sh @@ -0,0 +1,78 @@ +#!/bin/bash +set -euo pipefail + +mkdir -p /tmp/xcode +DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd ) + +if [ ! -z ${RUNNER_TMPDIR+x} ] ; then + if [ ! -r "$RUNNER_TMPDIR" -o ! -d "$RUNNER_TMPDIR" ] ; then + echo "$RUNNER_TMPDIR is not a readable directory!" + false + fi +else + RUNNER_TMPDIR=$(${DIR}/ready_template.sh) +fi + +#trap 'rm -rf $RUNNER_TMPDIR' EXIT +CODEDIR=$(ls -d $RUNNER_TMPDIR/X*/) +TMPPBXPROJ=$(mktemp /tmp/project.pbxproj.XXXXXXXXXXXXXX) +trap 'rm -f $TMPPBXPROJ' EXIT +mv $CODE $CODEDIR/$(basename $CODE) +mv $FIXTURE $CODEDIR/$(basename $FIXTURE) +[ ! -z ${SETUP+x} ] && cp $SETUP $CODEDIR/$(basename $SETUP) + +case $language in + objc) + mv $CODE_HEADER $CODEDIR/$(basename $CODE_HEADER) + if [ ! -z ${SETUP+x} ]; then + mv $SETUP_HEADER $CODEDIR/$(basename $SETUP_HEADER) + sed -e "s/code.m/$(basename $CODE)/g" \ + -e "s/code.h/$(basename $CODE_HEADER)/g" \ + -e "s/setup.m/$(basename $SETUP)/g" \ + -e "s/setup.h/$(basename $SETUP_HEADER)/g" \ + -e "s/test.m/$(basename $FIXTURE)/g" \ + $RUNNER_TMPDIR/runner.xcodeproj/project.pbxproj > $TMPPBXPROJ + else + sed -e "s/code.m/$(basename $CODE)/g" \ + -e "s/code.h/$(basename $CODE_HEADER)/g" \ + -e "s/test.m/$(basename $FIXTURE)/g" \ + $RUNNER_TMPDIR/runner.xcodeproj/project.pbxproj > $TMPPBXPROJ + + fi + ;; + swift) + if [ ! -z ${SETUP+x} ]; then + sed -e "s/code.swift/$(basename $CODE)/g" \ + -e "s/setup.swift/$(basename $SETUP)/g" \ + -e "s/test.swift/$(basename $FIXTURE)/g" \ + $RUNNER_TMPDIR/runner.xcodeproj/project.pbxproj > $TMPPBXPROJ + else + sed -e "s/code.swift/$(basename $CODE)/g" \ + -e "s/test.swift/$(basename $FIXTURE)/g" \ + $RUNNER_TMPDIR/runner.xcodeproj/project.pbxproj > $TMPPBXPROJ + fi + ;; + + *) + echo "Language \"$language\" not supported!" + false + ;; +esac + +OUTPUT=$(mktemp /tmp/output.XXXXXXXXXXXXXX) +trap 'rm -f $OUTPUT' EXIT +mv $TMPPBXPROJ $RUNNER_TMPDIR/runner.xcodeproj/project.pbxproj + +EXIT_CODE=0 +if (cd $RUNNER_TMPDIR ; + xcodebuild build -project runner.xcodeproj/ -scheme $(basename $CODEDIR) -destination 'platform=OS X,arch=x86_64' && \ + sandbox-exec -f ${DIR}/xcode.sb /usr/bin/xcodebuild test -project runner.xcodeproj/ \ + -scheme $(basename $CODEDIR) \ + -destination 'platform=OS X,arch=x86_64') &> $OUTPUT || \ + EXIT_CODE=1 && \ + grep "Test Suite '$(basename $CODEDIR).xctest'" $OUTPUT &> /dev/null; then + ${DIR}/format_output.sh $(basename $CODEDIR) < $OUTPUT +else + ${DIR}/format_failure.sh $(basename $CODEDIR) < $OUTPUT +fi +exit ${EXIT_CODE} diff --git a/frameworks/osx/runner_template/runner-test/Info.plist b/frameworks/osx/runner_template/runner-test/Info.plist new file mode 100644 index 00000000..899d535f --- /dev/null +++ b/frameworks/osx/runner_template/runner-test/Info.plist @@ -0,0 +1,3 @@ + + + diff --git a/frameworks/osx/runner_template/runner-test/code.h b/frameworks/osx/runner_template/runner-test/code.h new file mode 100644 index 00000000..e69de29b diff --git a/frameworks/osx/runner_template/runner-test/code.m b/frameworks/osx/runner_template/runner-test/code.m new file mode 100644 index 00000000..e69de29b diff --git a/frameworks/osx/runner_template/runner-test/code.swift b/frameworks/osx/runner_template/runner-test/code.swift new file mode 100644 index 00000000..e69de29b diff --git a/frameworks/osx/runner_template/runner-test/setup.h b/frameworks/osx/runner_template/runner-test/setup.h new file mode 100644 index 00000000..e69de29b diff --git a/frameworks/osx/runner_template/runner-test/setup.m b/frameworks/osx/runner_template/runner-test/setup.m new file mode 100644 index 00000000..e69de29b diff --git a/frameworks/osx/runner_template/runner-test/setup.swift b/frameworks/osx/runner_template/runner-test/setup.swift new file mode 100644 index 00000000..e69de29b diff --git a/frameworks/osx/runner_template/runner-test/test.m b/frameworks/osx/runner_template/runner-test/test.m new file mode 100644 index 00000000..e69de29b diff --git a/frameworks/osx/runner_template/runner-test/test.swift b/frameworks/osx/runner_template/runner-test/test.swift new file mode 100644 index 00000000..e69de29b diff --git a/frameworks/osx/runner_template/runner.xcodeproj/.gitignore b/frameworks/osx/runner_template/runner.xcodeproj/.gitignore new file mode 100644 index 00000000..413a0d61 --- /dev/null +++ b/frameworks/osx/runner_template/runner.xcodeproj/.gitignore @@ -0,0 +1 @@ +project.xcworkspace/ diff --git a/frameworks/osx/runner_template/runner.xcodeproj/project.pbxproj b/frameworks/osx/runner_template/runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..ad9c30d3 --- /dev/null +++ b/frameworks/osx/runner_template/runner.xcodeproj/project.pbxproj @@ -0,0 +1,294 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 34123B421A38FBEB00E26285 /* test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34123B411A38FBEB00E26285 /* test.swift */; }; + 34A5CBAE1A45140D005AC3FC /* setup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A5CBAD1A45140D005AC3FC /* setup.swift */; }; + 34A5CBB01A4517FA005AC3FC /* code.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A5CBAF1A4517FA005AC3FC /* code.swift */; }; + 34A5CBB31A45193A005AC3FC /* code.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A5CBB21A45193A005AC3FC /* code.m */; }; + 34A5CBB61A451AF8005AC3FC /* setup.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A5CBB51A451AF8005AC3FC /* setup.m */; }; + 34A5CBBB1A451BF6005AC3FC /* test.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A5CBBA1A451BF6005AC3FC /* test.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 34123B3D1A38FBEB00E26285 /* runner-test.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "runner-test.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 34123B401A38FBEB00E26285 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 34123B411A38FBEB00E26285 /* test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = test.swift; sourceTree = ""; }; + 34A5CBAD1A45140D005AC3FC /* setup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = setup.swift; sourceTree = ""; }; + 34A5CBAF1A4517FA005AC3FC /* code.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = code.swift; sourceTree = ""; }; + 34A5CBB21A45193A005AC3FC /* code.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = code.m; sourceTree = ""; }; + 34A5CBB41A451A92005AC3FC /* code.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = code.h; sourceTree = ""; }; + 34A5CBB51A451AF8005AC3FC /* setup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = setup.m; sourceTree = ""; }; + 34A5CBB71A451B20005AC3FC /* setup.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = setup.h; sourceTree = ""; }; + 34A5CBBA1A451BF6005AC3FC /* test.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = test.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 34123B3A1A38FBEB00E26285 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 34123B261A38FA6E00E26285 = { + isa = PBXGroup; + children = ( + 34123B3E1A38FBEB00E26285 /* runner-test */, + 34123B301A38FA6E00E26285 /* Products */, + ); + sourceTree = ""; + }; + 34123B301A38FA6E00E26285 /* Products */ = { + isa = PBXGroup; + children = ( + 34123B3D1A38FBEB00E26285 /* runner-test.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 34123B3E1A38FBEB00E26285 /* runner-test */ = { + isa = PBXGroup; + children = ( + 34123B411A38FBEB00E26285 /* test.swift */, + 34123B3F1A38FBEB00E26285 /* Supporting Files */, + 34A5CBAD1A45140D005AC3FC /* setup.swift */, + 34A5CBAF1A4517FA005AC3FC /* code.swift */, + 34A5CBB21A45193A005AC3FC /* code.m */, + 34A5CBB41A451A92005AC3FC /* code.h */, + 34A5CBB51A451AF8005AC3FC /* setup.m */, + 34A5CBB71A451B20005AC3FC /* setup.h */, + 34A5CBBA1A451BF6005AC3FC /* test.m */, + ); + path = "runner-test"; + sourceTree = ""; + }; + 34123B3F1A38FBEB00E26285 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 34123B401A38FBEB00E26285 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 34123B3C1A38FBEB00E26285 /* runner-test */ = { + isa = PBXNativeTarget; + buildConfigurationList = 34123B431A38FBEB00E26285 /* Build configuration list for PBXNativeTarget "runner-test" */; + buildPhases = ( + 34123B391A38FBEB00E26285 /* Sources */, + 34123B3A1A38FBEB00E26285 /* Frameworks */, + 34123B3B1A38FBEB00E26285 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "runner-test"; + productName = "runner-test"; + productReference = 34123B3D1A38FBEB00E26285 /* runner-test.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 34123B271A38FA6E00E26285 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0610; + ORGANIZATIONNAME = Entrefuse; + TargetAttributes = { + 34123B3C1A38FBEB00E26285 = { + CreatedOnToolsVersion = 6.1.1; + }; + }; + }; + buildConfigurationList = 34123B2A1A38FA6E00E26285 /* Build configuration list for PBXProject "runner" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 34123B261A38FA6E00E26285; + productRefGroup = 34123B301A38FA6E00E26285 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 34123B3C1A38FBEB00E26285 /* runner-test */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 34123B3B1A38FBEB00E26285 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 34123B391A38FBEB00E26285 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 34A5CBB31A45193A005AC3FC /* code.m in Sources */, + 34A5CBB01A4517FA005AC3FC /* code.swift in Sources */, + 34A5CBB61A451AF8005AC3FC /* setup.m in Sources */, + 34123B421A38FBEB00E26285 /* test.swift in Sources */, + 34A5CBAE1A45140D005AC3FC /* setup.swift in Sources */, + 34A5CBBB1A451BF6005AC3FC /* test.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 34123B341A38FA6E00E26285 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 34123B351A38FA6E00E26285 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 34123B441A38FBEB00E26285 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "runner-test/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 34123B451A38FBEB00E26285 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + INFOPLIST_FILE = "runner-test/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 34123B2A1A38FA6E00E26285 /* Build configuration list for PBXProject "runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 34123B341A38FA6E00E26285 /* Debug */, + 34123B351A38FA6E00E26285 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 34123B431A38FBEB00E26285 /* Build configuration list for PBXNativeTarget "runner-test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 34123B441A38FBEB00E26285 /* Debug */, + 34123B451A38FBEB00E26285 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 34123B271A38FA6E00E26285 /* Project object */; +} diff --git a/frameworks/osx/runner_template/runner.xcodeproj/xcuserdata/template.xcuserdatad/xcschemes/runner-test.xcscheme b/frameworks/osx/runner_template/runner.xcodeproj/xcuserdata/template.xcuserdatad/xcschemes/runner-test.xcscheme new file mode 100644 index 00000000..da58e4bb --- /dev/null +++ b/frameworks/osx/runner_template/runner.xcodeproj/xcuserdata/template.xcuserdatad/xcschemes/runner-test.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frameworks/osx/swift.sb b/frameworks/osx/swift.sb new file mode 100644 index 00000000..cfbf23fa --- /dev/null +++ b/frameworks/osx/swift.sb @@ -0,0 +1,26 @@ +;; A sandbox file for `sandbox-exec` +;; +;; Unofficial Manual: http://reverse.put.as/wp-content/uploads/2011/09/Apple-Sandbox-Guide-v1.0.pdf +;; Examples: /usr/share/sandbox/*.sb +;; + +(version 1) + +; Doesn't work, maybe someday... +(debug all) + +; Deny everything by default +(deny default) + +(allow file-read-data file-read-metadata + ; System dynamic libraries + (regex #"^/usr/lib/.*\.dylib$") + ; Swift libraries + (regex #"^/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/.*\.dylib$") + ; Read access to frameworks + (subpath "/System/Library/Frameworks") + (subpath "/System/Library/PrivateFrameworks") +) + +; Allow us to execute compiled executables +(allow process-exec (regex #"/tmp/swift/[0-9a-z\-]+/main")) diff --git a/frameworks/osx/xcode.sb b/frameworks/osx/xcode.sb new file mode 100644 index 00000000..5d36df9e --- /dev/null +++ b/frameworks/osx/xcode.sb @@ -0,0 +1,73 @@ +;; -*- mode: Lisp; fill-column: 80; comment-column: 0; -*- +;; A sandbox file for `sandbox-exec` +;; +;; Unofficial Manual: http://reverse.put.as/wp-content/uploads/2011/09/Apple-Sandbox-Guide-v1.0.pdf +;; Examples: /usr/share/sandbox/*.sb +;; + +(version 1) + +;; Doesn't work, maybe someday... +(debug all) + +;; Deny everything by default +(deny default) + +(allow sysctl-read) +(allow process-exec + (subpath "/Applications/Xcode.app/Contents") + (literal "/bin/sh")) +(allow process-fork) + +(allow file-read-data file-read-metadata) + +(allow file-write* + ; XCTest's lock file + (regex #"^/private/tmp/XCTest-[a-zA-Z0-9]+$") + + ; User files stored by XCode + (regex #"^/Users/[^/]+/Library/Developer/Xcode/DerivedData/runner-[a-z]+/Logs/Build/[A-Z0-9\-]+\.xcactivitylog$") + (regex #"^/Users/[^/]+/Library/Developer/Xcode/DerivedData/runner-[a-z]+/Logs/Build/Cache.db$") + (regex #"^/Users/[^/]+/Library/Developer/Xcode/DerivedData/runner-[a-z]+/Logs/Test/[A-Z0-9\-]+\.xcactivitylog$") + (regex #"^/Users/[^/]+/Library/Developer/Xcode/DerivedData/runner-[a-z]+/Logs/Test/[A-Z0-9\-]+_TestSummaries\.plist$") + (regex #"^/Users/[^/]+/Library/Developer/Xcode/DerivedData/runner-[a-z]+/TestResults/[0-9 \-\.]+\.xctestresults$") + (regex #"^/Users/[^/]+/Library/Developer/Xcode/DerivedData/runner-[a-z]+/TestResults/[0-9 \-\.]+\.xctestresults/results.plist$") + + ; Private temp files + (regex #"^/private/var/folders/[^/]+/[^/]+/C/mds/mdsDirectory\.db_?$") + (regex #"^/private/var/folders/[^/]+/[^/]+/C/mds/mdsObject\.db_?$") + (regex #"^/private/var/folders/[^/]+/[^/]+/T/TemporaryItems/\(A\ Document\ Being\ Saved\ By\ xcodebuild\ [0-9]+\)/$") + (regex #"^/private/var/folders/[^/]+/[^/]+/T/TemporaryItems/\(A\ Document\ Being\ Saved\ By\ xcodebuild\ [0-9]+\)/Cache\.db$") + (regex #"^/private/var/folders/[^/]+/[^/]+/T/TemporaryItems/\(A\ Document\ Being\ Saved\ By\ xcodebuild\ [0-9]+\)/results\.plist$") + (regex #"^/private/var/folders/[^/]+/[^/]+/T/TemporaryItems/\(A\ Document\ Being\ Saved\ By\ xcodebuild\ [0-9]+\)$") + (regex #"^/private/var/folders/[^/]+/[^/]+/T/TemporaryItems/\(A\ Document\ Being\ Saved\ By\ xcodebuild\ [0-9]+\)/[A-Z0-9\-]+_TestSummaries\.plist$") + (regex #"^/private/var/folders/[^/]+/[^/]+/T/com\.apple\.dt\.XCTest-status/Session-[A-Z 0-9:\-_]+\.log$")) + +(allow file-ioctl file-write-data + (literal "/dev/ptmx") + (regex #"^/dev/ttys[0-9]+$")) + +(allow file-write-xattr file-read-xattr + (regex #"^/Users/[^/]+/Library/Developer/Xcode/DerivedData/ModuleCache$") + (regex #"^/Users/[^/]+/Library/Developer/Xcode/DerivedData/runner-[^/]+$") + (regex #"^/Users/[^/]+/Library/Developer/Xcode/DerivedData/runner-[^/]+/Build/.*$")) + +(allow file-write-data + (regex #"^/Users/[^/]+/Library/Developer/Xcode/DerivedData/runner-[^/]+/Build/Intermediates/runner.build/Debug/[^/]+\.build/dgph$") + (regex #"^/private/var/folders/[^/]+/[^/]+/C/mds/mds\.lock$")) + + +(allow process-exec + (literal "/usr/bin/xcodebuild") + (subpath "/Applications/Xcode.app")) + +(allow network-bind network-outbound (regex #"^/private/tmp/XCTest-.*$")) +(allow network-inbound network-outbound (local tcp4 "localhost:*")) + +(allow mach-priv-task-port) +(allow mach-lookup + (global-name "com.apple.FSEvents") + (global-name "com.apple.backupd.sandbox.xpc") + (global-name "com.apple.metadata.mds") + (global-name "com.apple.system.opendirectoryd.libinfo") + (global-name "com.apple.system.opendirectoryd.membership")) diff --git a/frameworks/python3 b/frameworks/python3 deleted file mode 120000 index fd42b688..00000000 --- a/frameworks/python3 +++ /dev/null @@ -1 +0,0 @@ -python/ \ No newline at end of file diff --git a/frameworks/python3/cw-2.py b/frameworks/python3/cw-2.py new file mode 100644 index 00000000..3a69f7b8 --- /dev/null +++ b/frameworks/python3/cw-2.py @@ -0,0 +1,56 @@ +from __future__ import print_function + +class AssertException(Exception): + pass + + +def format_message(message): + return message.replace("\n", "<:LF:>") + + +def expect(passed=None, message=None, allow_raise=False): + if passed: + print("Test Passed") + else: + message = message or "Value is not what was expected" + print("{0}".format(message)) + if allow_raise: + raise AssertException(message) + + +def assert_equals(actual, expected, message=None, allow_raise=True): + equals_msg = "{0} should equal {1}".format(repr(actual), repr(expected)) + if message is None: + message = equals_msg + else: + message += ": " + equals_msg + + expect(actual == expected, message, allow_raise) + + +def assert_not_equals(actual, expected, message=None, allow_raise=True): + equals_msg = \ + "{0} should not equal {1}".format(repr(actual), repr(expected)) + if message is None: + message = equals_msg + else: + message += ": " + equals_msg + + expect(actual != expected, message, allow_raise) + + +def expect_error(message, function): + passed = False + try: + function() + except: + passed = True + expect(passed, message) + + +def describe(message): + print("{0}".format(format_message(message))) + + +def it(message): + print("{0}".format(format_message(message))) diff --git a/frameworks/python3/unittestwrapper.py b/frameworks/python3/unittestwrapper.py new file mode 100644 index 00000000..1f1ec1a7 --- /dev/null +++ b/frameworks/python3/unittestwrapper.py @@ -0,0 +1,18 @@ +from __future__ import print_function +import unittest + +def formatMessage(message): + return "{0}".format(message).replace("\n", "<:LF:>") + +class CwTestResult(unittest.TestResult): + def addSuccess(self, test): + print("Test Passed") + super(CwTestResult, self).addSuccess(test) + + def addFailure(self, test, err): + print("" + formatMessage(err[1])) + super(CwTestResult, self).addFailure(test, err) + + def addError(self, test, err): + print("Unhandled Exception: " + formatMessage(err[1])) + super(CwTestResult, self).addError(test, err) diff --git a/frameworks/ruby/cwrspecformatter.rb b/frameworks/ruby/cwrspecformatter.rb new file mode 100644 index 00000000..b1e8e7fb --- /dev/null +++ b/frameworks/ruby/cwrspecformatter.rb @@ -0,0 +1,70 @@ +class CwRSpecFormatter + LF_TOKEN = "<:LF:>" + + def initialize(output) + @output = output + end + + def format_message(s) + s.gsub("\n", LF_TOKEN) + end + + def format_exception(notification) + format_message(notification.exception.message.split("\\n/tmp").first) + end + + def format_backtrace(notification) + case SpecFormatter.backtrace_format + when :simple + trace = notification.formatted_backtrace + .map {|chunk| chunk.split('`').last.split("'").first } + + if trace.any? + "#{LF_TOKEN}Simplified backtrace: #{trace.join(' -> ')}" + else + '' + end + + when :detailed + LF_TOKEN + notification.formatted_backtrace.join(LF_TOKEN) + end + end + + RSpec::Core::Formatters.register self, :example_group_started, :example_group_finished, :example_started, :example_passed, :example_failed, :message + def example_group_started(notification) + @output.puts "#{format_message(notification.group.description)}" + end + + def example_group_finished(notification) + @output.puts "" + end + + def example_started(notification) + @output.puts "#{format_message(notification.example.description)}" + end + def example_passed(notification) + @output.puts "Test Passed"# + format_message(notification.example.description) + end + def example_failed(notification) + if notification.exception.is_a? RSpec::Expectations::ExpectationNotMetError + @output.puts "#{format_exception(notification)}" + else + @output.puts "#{format_exception(notification)}#{format_backtrace(notification)}" + end + end + def message(notification) + @output.puts format_message(notification.message) + end +end + +# public version +class SpecFormatter + def self.backtrace_format + @backtrace_format ||= :simple + end + + def self.backtrace_format=(value) + @backtrace_format = value + end +end + diff --git a/jvm-runner/Dockerfile b/jvm-runner/Dockerfile deleted file mode 100644 index e53a54d0..00000000 --- a/jvm-runner/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -# BUILD-USING: docker build -t codewars/jvm-runner . -# EXAMPLE USAGE: docker run -i -a stdin -a stdout -a stderr --rm codewars/jvm-runner <<< '{"language": "clojure", "solution": "(println 42)"}' - -# Pull base image. -FROM dockerfile/ubuntu - -# Install Java 8 -# RUN apt-get install -y default-jre-headless default-jdk # default is OpenJDK6 -RUN add-apt-repository ppa:webupd8team/java -RUN apt-get update -# http://askubuntu.com/a/190674 -RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \ - echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections -RUN apt-get install -y oracle-java8-installer - -# Install Leiningen -RUN curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > /usr/bin/lein -RUN chmod a+x /usr/bin/lein -RUN LEIN_ROOT=true lein --version - -# ADD codewarrior user -RUN useradd -s /usr/sbin/nologin -m -d /home/codewarrior -p codewarrior codewarrior - -# ADD cli-runner and install node deps -ADD . /codewars-jvm -WORKDIR /codewars-jvm -RUN [ -e target/jvm-runner-0.1.1-standalone.jar ] || LEIN_ROOT=true lein do clean, test, uberjar - -# Set the user and workdir -WORKDIR /tmp -USER codewarrior - -# Run the uberjar -ENV TIMEOUT 2000 -ENV USER codewarrior -ENV HOME /home/codewarrior -ENTRYPOINT ["java", "-jar", "/codewars-jvm/target/jvm-runner-0.1.1-standalone.jar"] diff --git a/jvm-runner/project.clj b/jvm-runner/project.clj index 3c7a62d9..7dd0b830 100644 --- a/jvm-runner/project.clj +++ b/jvm-runner/project.clj @@ -2,34 +2,16 @@ :description "JVM Runner for codewars" :url "http://www.codewars.com/" :javac-target "1.8" - :dependencies [[org.clojure/clojure "1.6.0"] - [cheshire "5.3.1"] ; JSON - [korma "0.3.0"] ; ORM - [com.h2database/h2 "1.3.170"] ; In Memory Database - [org.xerial/sqlite-jdbc "3.7.15-M1"] ; SQLite - [com.novemberain/monger "2.0.0"] ; Monger - [com.taoensso/carmine "2.7.0" :exclusions [org.clojure/clojure]] ; Carmine - [org.clojure/core.async "0.1.346.0-17112a-alpha"] ; Go-Routines - [org.clojure/test.check "0.5.9"] ; Generative Testing - [prismatic/schema "0.2.6"] ; Schema Verification - [instaparse "1.3.4"] ; BNF Parsers - [org.clojure/core.logic "0.8.8"] ; Logic Programming - [org.clojure/core.match "0.2.1"] ; Pattern Matching - [prismatic/plumbing "0.3.3"] ; Random Awesomeness - [slingshot "0.11.0"] ; Advanced Exceptions - [compojure "1.1.9"] ; Routing WebServer - [clj-http "1.0.0"] ; HTTP Client - [enlive "1.1.5"] ; HTML templating - [hiccup "1.0.5"] ; Clojure HTML DSL - [junit/junit "4.11"] ; JUnit - [org.codehaus.groovy/groovy-all "2.3.6"] ; Groovy - [environ "0.5.0"] ; Environment Variables - ] + :dependencies + [[org.clojure/clojure "1.6.0"] + [cheshire "5.3.1"] ; JSON + [junit/junit "4.11"] ; JUnit + [org.codehaus.groovy/groovy-all "2.3.6"] ; Groovy + [environ "0.5.0"] ; Environment Variables + ] :plugins [[lein-environ "0.5.0"]] - :source-paths ["src/clojure"] + :source-paths ["src/clojure"] :java-source-paths ["src/java"] - :env {:timeout "2000"} - :profiles {:uberjar {:aot :all - :omit-source true - :javac-options ["-g:none"]}} + :env {:timeout "10000" + :zmq-socket "ipc:///tmp/codewars"} :main codewars.core) diff --git a/jvm-runner/schema.json b/jvm-runner/schema.json deleted file mode 100644 index 2b366491..00000000 --- a/jvm-runner/schema.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "title": "CodeWars Runner Schema", - "type": "object", - "properties": { - "language": { - "description": "The language the kata was written in", - "type": "string" - }, - "solution": { - "description": "The codewars kata solution code", - "type": "string" - }, - "fixture": { - "description": "The test suite for the solution code", - "type": "string" - }, - "setup": { - "description": "Additional setup code", - "type": "string" - } - }, - "required": ["language", "solution"] -} diff --git a/jvm-runner/src/clojure/codewars/clojure/test.clj b/jvm-runner/src/clojure/codewars/clojure/test.clj index 91a02010..fd56f3bd 100644 --- a/jvm-runner/src/clojure/codewars/clojure/test.clj +++ b/jvm-runner/src/clojure/codewars/clojure/test.clj @@ -9,8 +9,7 @@ `(-> (with-out-str ~@body) (clojure.string/replace "\n" "<:LF:>") - (println) - clojure.test/with-test-out)) + (println))) (defn- print-context [] (when (seq *testing-contexts*) diff --git a/jvm-runner/src/clojure/codewars/core.clj b/jvm-runner/src/clojure/codewars/core.clj index ded24971..cea63627 100644 --- a/jvm-runner/src/clojure/codewars/core.clj +++ b/jvm-runner/src/clojure/codewars/core.clj @@ -3,13 +3,17 @@ [codewars.runners :refer [run]] [codewars.kill-switch :refer [with-timeout]] [environ.core :refer [env]] + [codewars.warm-up :refer [warm-up]] [codewars.runners.groovy] [codewars.runners.clojure] [codewars.runners.java]) (:gen-class)) -(defn- flush-out [val] - (flush) +(defn- flush-out [& [val]] + (. *out* (flush)) + (. *err* (flush)) + (.flush (System/out)) + (.flush (System/err)) val) (defn- fail [e] @@ -19,13 +23,19 @@ (-> (str sw) (clojure.string/replace "\n" "<:LF:>") println)) + (flush-out) (System/exit 1)) +(def timeout ((fnil #(Integer/parseInt %) "5000") (env :timeout))) + (defn -main "Listens to *in* for a JSON message, parses it and calls the appropriate runner" - [& _] - (let [ms ((fnil #(Integer/parseInt %) "5000") (env :timeout)) - input (json/parse-stream *in* true)] + [& args] + (when (not (empty? args)) + (warm-up) + (apply println args) + (flush)) + (let [input (json/parse-stream *in* true)] (try - (flush-out (with-timeout ms (run input))) + (flush-out (with-timeout timeout (run input))) (catch Exception e (fail e))))) diff --git a/jvm-runner/src/clojure/codewars/runners.clj b/jvm-runner/src/clojure/codewars/runners.clj index 4913a562..4ed67756 100644 --- a/jvm-runner/src/clojure/codewars/runners.clj +++ b/jvm-runner/src/clojure/codewars/runners.clj @@ -1,8 +1,8 @@ (ns codewars.runners) -(defmulti solution-only :language) +(defmulti code-only :language) (defmulti full-project :language) -(defmethod solution-only :default +(defmethod code-only :default [{:keys [:language]}] (throw (IllegalArgumentException. (format "Language %s is not implemented" @@ -15,8 +15,8 @@ (pr-str language))))) (defn run - "Run solution code or a test-fixture." + "Run code or a test-fixture." [opts] (if (nil? (:fixture opts)) - (solution-only opts) + (code-only opts) (full-project opts))) diff --git a/jvm-runner/src/clojure/codewars/runners/clojure.clj b/jvm-runner/src/clojure/codewars/runners/clojure.clj index 2abec38d..ab95331b 100644 --- a/jvm-runner/src/clojure/codewars/runners/clojure.clj +++ b/jvm-runner/src/clojure/codewars/runners/clojure.clj @@ -1,35 +1,22 @@ (ns codewars.runners.clojure - (:require [codewars.runners :refer [solution-only full-project]] - [codewars.util :as util] - [codewars.clojure.test] - [clojure.java.io :as io]) - (:import [codewars.java TempDir]) - (:refer-clojure :exclude (add-classpath))) + (:require + [codewars.runners :refer [code-only full-project]] + [codewars.clojure.test])) -(defn- add-classpath - "Add a url path to the system class loader" - [new-classpath] - (let [field (aget (.getDeclaredFields java.net.URLClassLoader) 0)] - (.setAccessible field true) - (let [ucp (.get field (ClassLoader/getSystemClassLoader))] - (.addURL ucp (io/as-url new-classpath))))) +(defn name-space + [code] + (if-let [result (re-find #"^\(ns\s+([A-Z|a-z](?:[a-z|A-Z|0-9|-]|\.[A-Z|a-z])*)\W" code)] + (-> result second symbol) + (throw (java.text.ParseException. (str "Failed to parse clojure namespace in code:\n\n" code "\n\n") 0)))) -(defmethod solution-only "clojure" - [{:keys [:setup :solution]}] - (let [dir (TempDir/create "clojure") - solution-file (io/file dir "solution.clj")] - (when (not (empty? setup)) (util/write-code! "clojure" dir setup)) - (spit solution-file solution) - (add-classpath dir) - (load-file (str solution-file)))) +(defmethod code-only "clojure" + [{:keys [:setup :code]}] + (when (not (empty? setup)) (load-string setup)) + (load-string code)) (defmethod full-project "clojure" - [{:keys [:setup :solution :fixture]}] - (let [dir (TempDir/create "clojure") - {fixture-ns :class-name} - (util/write-code! "clojure" dir fixture)] - (when (not (empty? setup)) (util/write-code! "clojure" dir setup)) - (util/write-code! "clojure" dir solution) - (add-classpath dir) - (require fixture-ns) - (codewars.clojure.test/run-tests fixture-ns))) + [{:keys [:setup :code :fixture]}] + (when (not (empty? setup)) (load-string setup)) + (load-string code) + (load-string fixture) + (codewars.clojure.test/run-tests (name-space fixture))) diff --git a/jvm-runner/src/clojure/codewars/runners/groovy.clj b/jvm-runner/src/clojure/codewars/runners/groovy.clj index 68d085f4..e3d68796 100644 --- a/jvm-runner/src/clojure/codewars/runners/groovy.clj +++ b/jvm-runner/src/clojure/codewars/runners/groovy.clj @@ -1,8 +1,10 @@ (ns codewars.runners.groovy - (:require [codewars.runners :refer [solution-only]]) + (:require [codewars.runners :refer [code-only]]) (:import [groovy.lang GroovyShell])) -(defmethod solution-only "groovy" - [{:keys [:setup :solution]}] - (when (not (nil? setup)) (throw (Exception. "Setup code is not supported"))) - (.evaluate (GroovyShell.) solution)) +(defmethod code-only "groovy" + [{:keys [:setup :code]}] + (let [shell (GroovyShell.)] + ;; TODO: Test setup code + (when (not (nil? setup)) (.evaluate shell setup)) + (.evaluate shell code))) diff --git a/jvm-runner/src/clojure/codewars/runners/java.clj b/jvm-runner/src/clojure/codewars/runners/java.clj index 9543e7f9..ee37769e 100644 --- a/jvm-runner/src/clojure/codewars/runners/java.clj +++ b/jvm-runner/src/clojure/codewars/runners/java.clj @@ -1,36 +1,98 @@ (ns codewars.runners.java - (:require [codewars.runners :refer [solution-only full-project]] - [codewars.clojure.test] - [clojure.java.io :as io] - [codewars.util :refer [write-code!]]) - (:import [codewars.java TempDir] - [java.net URLClassLoader] - [javax.tools ToolProvider] - [java.io ByteArrayOutputStream] - [org.junit.runner JUnitCore] - [codewars.java CwRunListener])) + (:require [codewars.runners :refer [code-only full-project]] + [codewars.clojure.test]) + (:import + [javax.tools ToolProvider SimpleJavaFileObject SimpleJavaFileObject ForwardingJavaFileManager] + [java.net URI] + [java.io PrintWriter ByteArrayOutputStream] + [org.junit.runner JUnitCore] + [codewars.java CwRunListener])) -(defn- compile! - "Compile files using the java compiler" - [& files] - (let [out-stream (ByteArrayOutputStream.) - err-stream (ByteArrayOutputStream.) - compilation-result - (. (ToolProvider/getSystemJavaCompiler) - run nil out-stream err-stream - (into-array (map str files)))] - (-> out-stream str print) - (if (zero? compilation-result) - 0 - (throw (RuntimeException. (str err-stream)))))) +(defn class-name + "Determine the class name of some java code (include package)" + [code] + (let [package-name (second (re-find #"\bpackage\s+([A-Z|a-z](?:[a-z|A-Z|0-9|_]|\.[A-Z|a-z])*)\W" code)) + class-name (second (re-find #"\bclass\s+([A-Z][a-z|A-Z|0-9|_]*)\W" code))] + (cond + (nil? class-name) (throw (java.text.ParseException. + (str "Failed to parse java class in code:\n\n" code "\n\n") 0)) + (nil? package-name) class-name + :else (str package-name "." class-name)))) -(defn- load-class - "Load a java class in a specified directory" - [dir class-name] - (let [class-loader - (URLClassLoader/newInstance - (into-array [(io/as-url dir)]))] - (Class/forName (name class-name) true class-loader))) +(def ^:private source-kind javax.tools.JavaFileObject$Kind/SOURCE) +(def ^:private class-kind javax.tools.JavaFileObject$Kind/CLASS) + +(defn- class-uri [class-name kind] + (URI. (str "string:///" + (.replace class-name "." "/") + (.extension kind)))) + +(defn- source-code-file + "In-memory file for storing source code" + [code] + (proxy + [SimpleJavaFileObject] + [(class-uri (class-name code) source-kind) + source-kind] + (getCharContent [_] code))) + +(defn- byte-code-file + "In-memory file for storing byte-code for class" + [class-name kind] + (let [out (ByteArrayOutputStream.)] + (proxy + [SimpleJavaFileObject] + [(class-uri class-name kind) kind] + (getBytes [] (.toByteArray out)) + (openOutputStream [] out)))) + +(defn- byte-code-manager + "File-manager for in-memory class byte-codes" + [standard-manager] + (let [class-codes (atom {}) + class-loader + ;; TODO: Use a lighter ClassLoader than this + (proxy [clojure.lang.DynamicClassLoader] [] + (findClass [class-name] + (if-let [byte-data (get @class-codes [class-name class-kind])] + ;; TODO: Such hacks... :( + (let [byte-code (.toByteArray (.openOutputStream byte-data))] + (proxy-super defineClass class-name byte-code nil)) + (throw + (java.lang.ClassNotFoundException. + (str "Could not find " + [class-name class-kind] + " among possibilities: " + (keys @class-codes)))))))] + (proxy + [ForwardingJavaFileManager] + [standard-manager] + (getClassLoader [_] class-loader) + (getJavaFileForOutput [_ class-name kind _] + (get (swap! class-codes assoc [class-name kind] (byte-code-file class-name kind)) + [class-name kind]))))) + +(def ^:private compiler (ToolProvider/getSystemJavaCompiler)) + +(def ^:private file-manager (byte-code-manager (.getStandardFileManager compiler nil nil nil))) + +(defn compile-and-load + [class-name & codes] + (let [files (map source-code-file codes)] + (with-open [err-stream (ByteArrayOutputStream.)] + (if(-> compiler (.getTask (PrintWriter. err-stream) file-manager nil nil nil files) .call) + (-> file-manager (.getClassLoader nil) (.loadClass class-name)) + (throw (RuntimeException. (str err-stream))))))) + +(defmethod code-only "java" + [{:keys [:setup :code]}] + (let [code-class-name (class-name code)] + (-> (if (nil? setup) + (compile-and-load code-class-name code) + (compile-and-load code-class-name code setup)) + (.getDeclaredMethod "main" (into-array [(Class/forName "[Ljava.lang.String;")])) + (doto (.setAccessible true)) + (.invoke nil (into-array [(into-array String [])]))))) (defn- run-junit-tests "Run a JUnit test using the Codewars Formatter for a given fixture-class" @@ -40,33 +102,10 @@ (codewars.clojure.test/time (.run runner (into-array [fixture-class]))))) -(defn- file-names - "Filter a sequence of files writen by write-code! and output their names" - [& files] - (for [{:keys [:file-name]} files - :when (not (nil? file-name))] - file-name)) - -(defmethod solution-only "java" - [{:keys [:setup :solution]}] - (let [dir (TempDir/create "java") - setup (when (not (empty? setup)) (write-code! "java" dir setup)) - solution (write-code! "java" dir solution) - files (file-names setup solution)] - (apply compile! files) - (-> solution - :class-name - (->> (load-class dir)) - (.getDeclaredMethod "main" (into-array [(Class/forName "[Ljava.lang.String;")])) - (doto (.setAccessible true)) - (.invoke nil (into-array [(into-array String [])]))))) - (defmethod full-project "java" - [{:keys [:fixture :setup :solution]}] - (let [dir (TempDir/create "java") - fixture (write-code! "java" dir fixture) - setup (when (not (empty? setup)) (write-code! "java" dir setup)) - solution (write-code! "java" dir solution) - files (file-names fixture setup solution)] - (apply compile! files) - (->> fixture :class-name (load-class dir) run-junit-tests))) + [{:keys [:fixture :setup :code]}] + (let [fixture-class-name (class-name fixture)] + (run-junit-tests + (if (nil? setup) + (compile-and-load fixture-class-name code fixture) + (compile-and-load fixture-class-name code fixture setup))))) diff --git a/jvm-runner/src/clojure/codewars/util.clj b/jvm-runner/src/clojure/codewars/util.clj deleted file mode 100644 index ba5db10c..00000000 --- a/jvm-runner/src/clojure/codewars/util.clj +++ /dev/null @@ -1,53 +0,0 @@ -(ns codewars.util - (:require [clojure.java.io :as io])) - -(def ^:private - language-data - {"clojure" {:pattern #"^\(ns\s+([A-Z|a-z](?:[a-z|A-Z|0-9|-]|\.[A-Z|a-z])*)\W" - :extension "clj"} - - "java" {:pattern #"\bclass\s+([A-Z][a-z|A-Z|0-9|_]*)\W" - :extension "java"} - - "groovy" {:pattern #"^package\s+([a-z](?:[a-z|A-Z|0-9|-]|\.[a-z])*)\W" - :extension "groovy"}}) - -(defn class-name - "Infer the appropriate class or namespace name from code given a language" - [language code] - (let [{:keys [:pattern]} (get language-data language)] - ;; TODO: Filter comments - (if-let [name (->> code (re-find pattern) second symbol)] - name - (throw - (IllegalArgumentException. - (format "Could not infer class or namespace name for language %s from code:\n%s\n" (pr-str language) code)))))) - -(defn class-name-to-file-name - "Create a file name for a class or namespace name given a language" - [language class-name] - (let [{:keys [:extension]} (get language-data language)] - (-> class-name - name - (clojure.string/replace "-" "_") - ;; TODO: not platform independent... - (clojure.string/replace "." "/") - (str "." extension) - io/file))) - -(defn write-code! - "Write code to an appropriate file in a specified directory given a language" - [language dir code] - (let [class-name (class-name language code) - base-name (class-name-to-file-name language class-name) - file-name (io/file dir base-name)] - (if (.exists file-name) - (throw - (UnsupportedOperationException. - (format "Could not write to file %s, because that file already exists. Perhaps it already contains the setup or test fixture code?\ncode:\n%s" (pr-str base-name) code))) - ;; else - (do - (-> file-name .getParentFile .mkdirs) - (spit file-name code) - {:file-name file-name - :class-name class-name})))) diff --git a/jvm-runner/test/codewars/test/utils.clj b/jvm-runner/src/clojure/codewars/utils.clj similarity index 67% rename from jvm-runner/test/codewars/test/utils.clj rename to jvm-runner/src/clojure/codewars/utils.clj index 7f1b4d7b..8f86aa59 100644 --- a/jvm-runner/test/codewars/test/utils.clj +++ b/jvm-runner/src/clojure/codewars/utils.clj @@ -1,4 +1,4 @@ -(ns codewars.test.utils +(ns codewars.utils "A small collection of utilities for testing" (:import [java.io PrintStream ByteArrayOutputStream StringWriter])) @@ -20,6 +20,18 @@ ~@body (str s#)))) +(defmacro with-all-out-str + "A version of clojure.core/with-out-str suitable for wrapping java's System.out" + [& body] + `(let [original-out# (PrintStream. System/out) + byte-out# (ByteArrayOutputStream.) + s# (StringWriter.)] + (binding [*out* s#] + (-> byte-out# (PrintStream.) System/setOut) + ~@body + (System/setOut original-out#) + (str byte-out# s#)))) + (defmacro with-err-str "A version of clojure.core/with-out-str for *err*" [& body] diff --git a/jvm-runner/src/clojure/codewars/warm_up.clj b/jvm-runner/src/clojure/codewars/warm_up.clj new file mode 100644 index 00000000..7b06184a --- /dev/null +++ b/jvm-runner/src/clojure/codewars/warm_up.clj @@ -0,0 +1,64 @@ +(ns codewars.warm-up + (:require [codewars.runners :refer [run]] + [codewars.runners.java] + [codewars.runners.clojure] + [codewars.utils :refer :all] + [clojure.string :refer [split join capitalize]])) + +(def replacements + {\0 \G, \1 \H, \2 \I, \3 \J, \4 \K, \5 \L, \6 \M, \7 \N, + \8 \O, \9 \P, \a \A, \b \B, \c \C, \d \D, \e \E, \f \F + \- \-}) + +(defn- random-name-space [] + (let [ [class-name & package-path] + (-> (java.util.UUID/randomUUID) + str + vec + (->> (map replacements) + (apply str)) + (split #"-") + (->> (map capitalize)))] + {:class-name class-name + :package (join "." package-path)})) + +(defn clojure-code-warm-up + [] + (run {:language "clojure" + :code ":warm-up-payload"})) + +(defn java-code-warm-up + [] + (let [{:keys [:class-name :package]} (random-name-space)] + (run {:language "java" + :code (format "package %s ; class %s { static int main(String [] args) {return 7;} }" package class-name)}))) + +(defn clojure-test-warm-up + [] + (let [setup-namespace (join "." (vals (random-name-space))) + code-namespace (join "." (vals (random-name-space))) + fixture-namespace (join "." (vals (random-name-space)))] + (with-all-out-str + (run {:language "clojure" + :setup (format "(ns %s) (def x :test-payload)" setup-namespace) + :code (format "(ns %s (:require [%s :as setup])) (def y setup/x)" code-namespace setup-namespace) + :fixture (format "(ns %s (:require [%s :as code] [clojure.test :refer :all])) (deftest test-payload-test (prn :in-test-payload-test) (testing \"foooo\" (is (= :test-payload code/y))))" fixture-namespace code-namespace)})))) +(defn java-test-warm-up + [] + (let [setup (random-name-space) + code (random-name-space) + fixture (random-name-space)] + (with-all-out-str + (run + {:language "java" + :setup (format "package %s ; public class %s { public static String payload() {return \"test payload\";}}" (:package setup) (:class-name setup)) + :code (format "package %1$s ; public class %2$s { public %2$s(){} public String payloadForwarder(){return %3$s.%4$s.payload();}}" (:package code) (:class-name code) (:package setup) (:class-name setup)), + :fixture (format "package %1$s ; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runners.JUnit4; public class %2$s { public %2$s (){} @Test public void codeAndSetupAndFixture(){ %3$s.%4$s s = new %3$s.%4$s(); assertEquals(\"Verifying test payload\", \"test payload\", s.payloadForwarder()); System.out.println(\"test success\");}}" + (:package fixture) (:class-name fixture) + (:package code) (:class-name code))})))) + +(defn warm-up [] + (clojure-code-warm-up) + (clojure-test-warm-up) + (java-code-warm-up) + (java-test-warm-up)) diff --git a/jvm-runner/src/java/codewars/java/CwRunListener.java b/jvm-runner/src/java/codewars/java/CwRunListener.java index 7db252aa..e3e1c779 100644 --- a/jvm-runner/src/java/codewars/java/CwRunListener.java +++ b/jvm-runner/src/java/codewars/java/CwRunListener.java @@ -10,7 +10,11 @@ public class CwRunListener extends RunListener public void testFailure(Failure failure) { failed = true; - System.out.println(String.format("%s<:LF:>", formatMessage(failure.getMessage()))); + String msg = failure.getMessage(); + if (msg == null) { + msg = "Unknown Test Failure"; + } + System.out.println(String.format("%s<:LF:>", formatMessage(msg))); } public void testStarted(Description description) { @@ -23,9 +27,14 @@ public void testFinished(Description description) { System.out.println("Test Passed<:LF:>"); } + System.out.println(""); } private static String formatMessage(String s) { + if(s == null){ + s = ""; + } + return s.replaceAll("\n", "<:LF:>"); } } diff --git a/jvm-runner/src/java/codewars/java/TempDir.java b/jvm-runner/src/java/codewars/java/TempDir.java deleted file mode 100644 index 8abb482b..00000000 --- a/jvm-runner/src/java/codewars/java/TempDir.java +++ /dev/null @@ -1,71 +0,0 @@ -package codewars.java; - -import java.io.File; -import java.io.IOException; -import java.nio.file.*; -import java.nio.file.attribute.BasicFileAttributes; -import java.nio.file.attribute.FileAttribute; -import java.nio.file.attribute.PosixFilePermission; -import java.nio.file.attribute.PosixFilePermissions; -import java.util.Set; - -import static java.nio.file.Files.createTempDirectory; - -public class TempDir { - - private static void delete(Path path) throws IOException { - if (!Files.exists(path)) return; - - Files.walkFileTree(path, new SimpleFileVisitor() { - @Override - public FileVisitResult postVisitDirectory(Path dir, IOException exc) - throws IOException { - Files.deleteIfExists(dir); - return super.postVisitDirectory(dir, exc); - } - - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) - throws IOException { - Files.deleteIfExists(file); - return super.visitFile(file, attrs); - } - }); - } - - private static FileAttribute> posixPermissions(String permissions) { - Set perms = PosixFilePermissions.fromString(permissions); - return PosixFilePermissions.asFileAttribute(perms); - } - - private static void deleteOnShutdown(final Path path) { - Runtime.getRuntime().addShutdownHook(new Thread() { - @Override - public void run() { - try { - delete(path); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - }); - } - - public static File create(String dir, String prefix, String permissions) throws IOException { - final Path tempDirPath = createTempDirectory(Paths.get(dir), prefix, posixPermissions(permissions)); - deleteOnShutdown(tempDirPath); - return tempDirPath.toFile(); - } - - public static File create(String prefix, String permissions) throws IOException { - final Path tempDirPath = createTempDirectory(prefix, posixPermissions(permissions)); - deleteOnShutdown(tempDirPath); - return tempDirPath.toFile(); - } - - // TODO: If permissions are not specified, use umask to get system defaults somehow - public static File create(String prefix) throws IOException { - return create(prefix, "rwx------"); - } - -} diff --git a/jvm-runner/test/codewars/runners/clojure_test.clj b/jvm-runner/test/codewars/runners/clojure_test.clj index aa8fd746..8ed727e8 100644 --- a/jvm-runner/test/codewars/runners/clojure_test.clj +++ b/jvm-runner/test/codewars/runners/clojure_test.clj @@ -1,27 +1,27 @@ (ns codewars.runners.clojure-test (:require [clojure.test :refer :all] [codewars.core :refer [-main] :as core] - [codewars.test.utils :refer [with-out-str-not-thread-safe]] + [codewars.utils :refer [with-out-str-not-thread-safe]] [cheshire.core :as json] [codewars.clojure.test]) (:import [java.util.concurrent TimeoutException])) (deftest basic-clojure - (testing "-main can handle a very basic clojure solution and fixture" + (testing "-main can handle a very basic clojure code and fixture" (with-in-str (json/generate-string {:language "clojure" - :solution "(ns foo)" + :code "(ns foo)" :fixture "(ns bar)"}) (is (= {:type :summary, :fail 0, :error 0, :pass 0, :test 0} (-main)))))) (deftest clojure-simple - (testing "-main can handle a simple clojure solution and fixture" + (testing "-main can handle a simple clojure code and fixture" (with-in-str (json/generate-string {:language "clojure" - :solution "(ns foo1) + :code "(ns foo1) (defn wizard [] :ok)" :fixture "(ns bar1 (:require [foo1] @@ -35,7 +35,7 @@ (with-in-str (json/generate-string {:language "clojure" - :solution "(ns dio) + :code "(ns dio) (defn holy-diver [] :ride-the-tiger)" :fixture "(ns race.for.the.morning (:require [dio] @@ -47,32 +47,32 @@ [codewars.clojure.test/fail (constantly nil)] (-main))))))) -(deftest clojure-solution-only - (testing "-main will just run solution code if a fixture is not present" +(deftest clojure-code-only + (testing "-main will just run code code if a fixture is not present" (with-in-str (json/generate-string {:language "clojure" - :solution "(print \"Oh no, here it comes again\")"}) + :code "(print \"Oh no, here it comes again\")"}) (is (= "Oh no, here it comes again" (with-out-str-not-thread-safe (-main))))))) -(deftest clojure-solution-and-setup - (testing "-main will just run solution code and read correctly from setup code" +(deftest clojure-code-and-setup + (testing "-main will just run code code and read correctly from setup code" (with-in-str (json/generate-string {:language "clojure" :setup "(ns heaven.and.hell) (defn first-track [] (print \"So it's on and on and on, oh it's on and on and on\"))" - :solution "(require 'heaven.and.hell) (heaven.and.hell/first-track)"}) + :code "(require 'heaven.and.hell) (heaven.and.hell/first-track)"}) (is (= "So it's on and on and on, oh it's on and on and on" (with-out-str-not-thread-safe (-main))))))) -(deftest clojure-solution-fixture-and-setup - (testing "-main can handle a solution, fixture, and setup code in clojure" +(deftest clojure-code-fixture-and-setup + (testing "-main can handle a code, fixture, and setup code in clojure" (with-in-str (json/generate-string {:language "clojure" :setup "(ns fear.of.the.dark) (defn lyric [] \"I have a constant fear that someone's always near'\")" - :solution "(ns maiden-greatest-hits (:require [fear.of.the.dark :refer [lyric]])) (defn fear-of-the-dark [] (lyric))" + :code "(ns maiden-greatest-hits (:require [fear.of.the.dark :refer [lyric]])) (defn fear-of-the-dark [] (lyric))" :fixture "(ns maiden-test (:require [maiden-greatest-hits] [fear.of.the.dark :refer [lyric]] @@ -82,11 +82,12 @@ (-main)))))) (deftest clojure-timeout - (testing "-main will timeout if a kata solution takes too long" + (testing "-main will timeout if a kata code takes too long" (with-in-str (json/generate-string {:language "clojure" - :solution "(println \"...Sleeping deeply...\") + :code "(println \"...Sleeping deeply...\") (Thread/sleep 50000)"}) - (with-redefs [core/fail #(throw %)] + (with-redefs [core/timeout 10 + core/fail #(throw %)] (is (thrown? TimeoutException (-main))))))) diff --git a/jvm-runner/test/codewars/runners/groovy_test.clj b/jvm-runner/test/codewars/runners/groovy_test.clj index 8c48512c..aad487fd 100644 --- a/jvm-runner/test/codewars/runners/groovy_test.clj +++ b/jvm-runner/test/codewars/runners/groovy_test.clj @@ -2,20 +2,20 @@ (:require [clojure.test :refer :all] [cheshire.core :as json] [codewars.core :refer [-main] :as core] - [codewars.test.utils :refer [with-java-out-str]])) + [codewars.utils :refer [with-java-out-str]])) -(deftest groovy-solution-only - (testing "-main can handle a groovy solution with no fixture" +(deftest groovy-code-only + (testing "-main can handle a groovy code with no fixture" (with-in-str (json/generate-string {:language "groovy" - :solution "1 + 1"}) + :code "1 + 1"}) (is (= 2 (-main)))))) (deftest groovy-java-out - (testing "-main can handle a groovy solution with no setup code but no fixture" + (testing "-main can handle a groovy code with no setup code but no fixture" (with-in-str (json/generate-string {:language "groovy" - :solution "print 'Hello Groovy!'"}) + :code "print 'Hello Groovy!'"}) (is (= "Hello Groovy!" (with-java-out-str (-main))))))) diff --git a/jvm-runner/test/codewars/runners/java_test.clj b/jvm-runner/test/codewars/runners/java_test.clj index cd679881..54962939 100644 --- a/jvm-runner/test/codewars/runners/java_test.clj +++ b/jvm-runner/test/codewars/runners/java_test.clj @@ -1,45 +1,50 @@ (ns codewars.runners.java-test (:require [clojure.test :refer :all] [codewars.core :refer [-main] :as core] - [codewars.test.utils :refer :all] + [codewars.utils :refer :all] [cheshire.core :as json])) - (deftest java-basic - (testing "-main can handle a very basic java solution and fixture" + (testing "-main can handle a very basic java code and fixture" (with-in-str (json/generate-string {:language "java" - :solution "class Foo {}" + :code "class Foo {}" :fixture "class Bar {}"}) (is (= org.junit.runner.Result (class (-main))))))) -(deftest java-solution-only - (testing "-main can handle a java solution without a fixture" +(deftest java-code-only + (testing "-main can handle a java code without a fixture" (with-in-str (json/generate-string {:language "java" - :solution "class FooFighters { static int main(String [] args) {return 1;} }"}) - (is (= 1 (-main)))))) + :code "class FooFighters { static int main(String [] args) {return 1;} }"}) + (is (= 1 (-main)))) + (with-in-str + (json/generate-string + {:language "java" + :code "package bar.baz ; class FooFighters { static int main(String [] args) {return 7;} }"}) + (is (= 7 (-main)))))) -(deftest java-solution-print - (testing "-main can handle a java solution that prints to standard out" + +(deftest java-code-print + (testing "-main can handle a java code that prints to standard out" (with-in-str (json/generate-string {:language "java" - :solution "public class Hello {public static void main(String[] args) {System.out.print(\"Hellooo!\");}}"}) + :code "public class Hello {public static void main(String[] args) {System.out.print(\"Hellooo!\");}}"}) (is (= "Hellooo!" (with-java-out-str (-main))))))) (deftest java-setup-code - (testing "-main can handle a java solution and setup code" + (testing "-main can handle a java code and setup code" (with-in-str (json/generate-string {:language "java" :setup "import java.lang.String; public class Beatles {public static String sayHello() { return \"Hello, hello!\";}}" - :solution "class HelloAgain { + :code "class HelloAgain { static void main(String[] args) { System.out.print(Beatles.sayHello());}}"}) (is (= "Hello, hello!" (with-java-out-str (-main))))))) @@ -49,8 +54,8 @@ (with-in-str (json/generate-string {:language "java" - :solution "public class Solution { - public Solution(){} + :code "public class Code { + public Code(){} public int testthing(){return 3;}}", :fixture "import static org.junit.Assert.assertEquals; import org.junit.Test; @@ -58,7 +63,7 @@ public class TestFixture { public TestFixture(){} @Test public void myTestFunction(){ - Solution s = new Solution(); + Code s = new Code(); assertEquals(\"wow\", 3, s.testthing()); System.out.println(\"test out\");}}"}) (let [test-out-string (with-java-out-str (-main))] @@ -71,7 +76,7 @@ (with-in-str (json/generate-string {:language "java" - :solution "public class Foo { + :code "public class Foo { public Foo(){} public int testthing(){return 3;} public static void main(String[] args){System.out.println(\"42\");}}" @@ -96,7 +101,7 @@ (with-in-str (json/generate-string {:language "java" - :solution "public class Solution { + :code "public class Code { public static void main(String[] args){ notdefinedgonnafail(\"42\");}}"}) (let [error-message @@ -104,16 +109,16 @@ (is (.contains error-message "error: cannot find symbol")) (is (.contains error-message "notdefinedgonnafail(\"42\");")) (is (.contains error-message "symbol: method notdefinedgonnafail(String)")) - (is (.contains error-message "location: class Solution")) + (is (.contains error-message "location: class Code")) (is (.contains error-message "1 error")))))) (deftest java-nine-yards - (testing "-main can setup, solution, and test fixture code for java" + (testing "-main can setup, code, and test fixture code for java" (with-in-str (json/generate-string {:language "java" :setup "public class Setupp { public static int three() {return 3;}}" - :solution "public class Sollution { + :code "public class Sollution { public Sollution(){} public int testthingy(){return Setupp.three();}}", :fixture "import static org.junit.Assert.assertEquals; @@ -121,21 +126,22 @@ import org.junit.runners.JUnit4; public class NineYards { public NineYards(){} - @Test public void solutionAndSetupAndFixture(){ + @Test public void codeAndSetupAndFixture(){ Sollution s = new Sollution(); assertEquals(\"wow\", 3, s.testthingy()); System.out.println(\"test out\");}}"}) (let [test-out-string (with-java-out-str (-main))] - (is (.contains test-out-string "solutionAndSetupAndFixture(NineYards)<:LF:>")) + (is (.contains test-out-string "codeAndSetupAndFixture(NineYards)<:LF:>")) (is (.contains test-out-string "test out")) (is (.contains test-out-string "Test Passed<:LF:>")))))) + (deftest codewars-kumite-test (testing "Can handle a simple static export" (with-in-str (json/generate-string {:language "java" - :solution "public class Java { + :code "public class Java { public static int multiply(int x, int y) { return x * y; } }" :fixture "import org.junit.*; diff --git a/jvm-runner/test/codewars/warm_up_test.clj b/jvm-runner/test/codewars/warm_up_test.clj new file mode 100644 index 00000000..1195be2e --- /dev/null +++ b/jvm-runner/test/codewars/warm_up_test.clj @@ -0,0 +1,17 @@ +(ns codewars.warm-up-test + (:require [clojure.test :refer :all] + [codewars.warm-up :refer :all])) + +(deftest warm-up-test + (testing "java-code-warm-up should return 7 every time" + (is (= 7 (java-code-warm-up)))) + (testing "clojure-code-warm-up should return :warm-up-payload every time" + (is (= :warm-up-payload (clojure-code-warm-up)))) + (testing "clojure-test-warm-up should pass" + (let [result (clojure-test-warm-up)] + (is (.contains result "PASSED")) + (is (.contains result ":in-test-payload-test")))) + (testing "java-test-warm-up should pass" + (let [result (java-test-warm-up)] + (is (.contains result "PASSED") + (.contains result "codeAndSetupAndFixture"))))) diff --git a/lib/config.js b/lib/config.js new file mode 100644 index 00000000..a4b211bf --- /dev/null +++ b/lib/config.js @@ -0,0 +1,94 @@ +var uniqueId = ('_' + Math.random()).replace(/[^_\d]/g, ''); + +module.exports = { + version: '1.0.5', + testFramework: { + defaults: { + javascript: 'cw-2', + coffeescript: 'cw-2', + ruby: 'cw-2', + python: 'cw-2' + } + }, + timeouts: { + default: 6000, + clojure: 10000, + java: 10000 + }, + moduleRegExs: { + haskell: /module\s+([A-Z]([a-z|A-Z|0-9]|\.[A-Z])*)\W/, + julia: /module\s+([a-z|A-Z][a-z|A-Z|0-9]*)\W/, + erlang: /-module\(([a-z|A-Z][a-z|A-Z|0-9|_]*)\)/, + scala: /(?:object|class)\s+([A-Z][a-z|A-Z|0-9|_]*)/, + swift: /\n*\/\/\s*([a-z|A-Z|0-9|_|-]+)\.swift\s*\n/, + objc: /\n*\/\/\s*([a-z|A-Z|0-9|_|-]+)\.m\s*\n/, + objcHeader: /\n*\/\/\s*([a-z|A-Z|0-9|_|-]+)\.h\s*\n/ + }, + fileExtensions: { + haskell: 'hs', + julia: 'jl', + erlang: 'erl', + scala: 'scala', + swift: 'swift', + objc: 'm', + objcHeader: 'h' + }, + snippets: { + javascript: { + requireCw2: "require('./frameworks/javascript/cw-2')\n", + start: "Test.handleError(function(){\n", + inlineTestFixture: { + start: "\n(function() { var Test = global.Test, describe = global.describe, it = global.it, before = global.before, after = global.after;", + end: '\n})();' + }, + closure: { + start: "\n(function() { \n", + end: '\n})();' + }, + end: "});" + }, + python: { + addPythonFramework: [ + "try: from imp import reload", + "except: pass", + "reload(__import__('sys')).path.append('./frameworks/python')" + ].join('\n'), + requireCw2: "test = Test = reload(__import__('cw-2'))", + requireUnittest: "unittest = reload(__import__('unittest'))", + runUnittest: [ + "unittest", + ".TestLoader()", + ".loadTestsFromTestCase(Test)", + ".run(reload(__import__('unittestwrapper')).CwTestResult())" + ].join('') + }, + php: { + bootstrap: [ + "require_once('frameworks/php/vendor/autoload.php');" + ].join('\n'), + beforeUserScript : [ + "$" + uniqueId + " = count(get_defined_vars());" // http://stackoverflow.com/a/13629024/1640765 + ].join('\n'), + afterUserScript: [ + "$_" + uniqueId + " = array_slice(get_defined_vars(), $" + uniqueId + " + 1);", + ].join('\n'), + classBegin: [ + "class KataTest extends CodeWars\\TestCase {", + "public function testSolution() {", + "extract($this->userScriptVariables);" + ].join('\n'), + classEnd : [ + "}", + "}" + ].join('\n'), + execute: [ + "$suite = new PHPUnit_Framework_TestSuite();", + "$test = new KataTest('testSolution', ['userScriptVariables' => $_" + uniqueId + "]);", + "$suite->addTest($test);", + "PHPUnit_TextUI_TestRunner::run($suite);" + ].join('\n') + } + } +}; + +module.exports.snippets.python3 = module.exports.snippets.python; diff --git a/lib/runner.js b/lib/runner.js new file mode 100644 index 00000000..68b56af2 --- /dev/null +++ b/lib/runner.js @@ -0,0 +1,6 @@ +// runs the code, supports both callback and Promise formats +module.exports.run = function (opts, cb) { + // opts.code is an alias for opts.solution + if(opts.code) opts.solution = opts.code; + return require("./runners/" + opts.language).run(opts, cb); +}; diff --git a/lib/runners/README.md b/lib/runners/README.md new file mode 100644 index 00000000..cbc3d6ad --- /dev/null +++ b/lib/runners/README.md @@ -0,0 +1,10 @@ +# Runners +This directory contains language specific "runners". Each runner has two strategies in which it can be called in. + +## Strategies + +### solutionOnly +In this strategy, the code is simply executed and the output is returned. There is no test suite integration. + +### fullProject +In this strategy, the code is executed within a test suite and the test output is returned. diff --git a/lib/runners/arm.js b/lib/runners/arm.js new file mode 100644 index 00000000..28bfdb4d --- /dev/null +++ b/lib/runners/arm.js @@ -0,0 +1,29 @@ +var shovel = require('../shovel'), + util = require('../util'), + path = require('path'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) { + temp.track(); + var dir = temp.mkdirSync('arm'); + + shovel.start(opts, cb, { + solutionOnly: function (run) { + var executable = path.join(dir, 'solution'), + solutionFile = util.codeWriteSync('arm', opts.solution + '\n', dir, 'solution.s'), + objectFile = solutionFile.replace(/\.[^\.]+$/, '.o'), + armCommand = ['arm-linux-gnueabi-as', solutionFile, '-o', objectFile].join(' '), + // Check for whether we need to link against libc + linker = opts.solution.search(/\.glob[a]?l\W+_start/) == -1 ? "arm-linux-gnueabi-gcc-4.7" : "arm-linux-gnueabi-ld", + linkerCommand = [linker, objectFile, '-o', executable].join(' '); + util.exec(armCommand, function () { + util.exec(linkerCommand, function () { + run({'name': 'qemu-arm', 'args': ['-L', '/usr/arm-linux-gnueabi/', executable]}); + }); + }); + }, + fullProject: function (run) { + throw new Error('Test framework is not supported'); + } + }); +}; diff --git a/lib/runners/bash.js b/lib/runners/bash.js new file mode 100644 index 00000000..398b32c1 --- /dev/null +++ b/lib/runners/bash.js @@ -0,0 +1,22 @@ +var shovel = require('../shovel'), + util = require('../util'), + config = require('../config'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) +{ + temp.track(); + var dir = temp.mkdirSync('bash'); + + shovel.start(opts, cb, { + solutionOnly: function (run) + { + var file = util.codeWriteSync('bash', opts.solution, dir, 'solution.sh') + run({name: 'bash', 'args': [file]}); + }, + fullProject: function (run) + { + throw 'Test framework is not supported' + } + }); +}; \ No newline at end of file diff --git a/lib/runners/c.js b/lib/runners/c.js new file mode 100644 index 00000000..e3496471 --- /dev/null +++ b/lib/runners/c.js @@ -0,0 +1,25 @@ +var shovel = require('../shovel'), + util = require('../util'), + path = require('path'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) { + temp.track(); + var dir = temp.mkdirSync('c'); + + shovel.start(opts, cb, { + solutionOnly: function (run) { + var executable = path.join(dir, 'solution'), + solutionFile = util.codeWriteSync('c', opts.solution, dir, 'solution.c'), + args = ['tcc', '-o', executable, solutionFile]; + if (opts.setup) { + var setupFile = util.codeWriteSync('c', opts.setup, dir, 'setup.c'); + args.push(setupFile); + } + util.exec(args.join(' '), function () { run({'name': executable, 'args': []}); }); + }, + fullProject: function (run) { + throw Exception("C is not supported"); + } + }); +}; diff --git a/lib/runners/clojure.js b/lib/runners/clojure.js new file mode 100644 index 00000000..564e6049 --- /dev/null +++ b/lib/runners/clojure.js @@ -0,0 +1,22 @@ +var shovel = require('../shovel'), + path = require('path'); + +module.exports.run = function run(opts, cb) { + var uberJar = path.resolve(__dirname, '../../jvm-runner/target/jvm-runner-0.1.1-standalone.jar'); + shovel.start(opts, cb, { + solutionOnly: function (run) { + run({ + name: 'java', + args: ['-jar', uberJar], + stdin: JSON.stringify(opts) + }); + }, + fullProject: function (run) { + return run({ + name: 'java', + args: ['-jar', uberJar], + stdin: JSON.stringify(opts) + }); + } + }); +}; diff --git a/lib/runners/coffeescript.js b/lib/runners/coffeescript.js new file mode 100644 index 00000000..60e74a6b --- /dev/null +++ b/lib/runners/coffeescript.js @@ -0,0 +1,43 @@ +var shovel = require('../shovel'), + util = require('../util'), + config = require('../config'); + +module.exports.run = function run(opts, cb) { + shovel.start(opts, cb, { + solutionOnly: function (run) { + var code = opts.solution; + + if (opts.setup) { + code = opts.setup + ';\n' + code; + } + + run({name: 'coffee', 'args': ['-e', code]}); + }, + fullProject: function (run) { + switch (opts.testFramework) { + case 'cw-2': + return prepareCw2(opts, run); + + default: + throw 'Test framework is not supported' + } + } + }); +}; + +function prepareCw2(opts, run) { + + var code = config.snippets.javascript.requireCw2; + code += "`\n" + config.snippets.javascript.start + "`\n"; + if (opts.setup) { + code += opts.setup + '\n'; + } + + code += opts.solution + '\n'; + code += '`\n' + config.snippets.javascript.inlineTestFixture.start + '`\n'; + code += opts.fixture; + code += '\n`' + config.snippets.javascript.inlineTestFixture.end + '\n'; + code += config.snippets.javascript.end + "`"; + + run({name: 'coffee', 'args': ['-e', code]}); +} \ No newline at end of file diff --git a/lib/runners/cpp.js b/lib/runners/cpp.js new file mode 100644 index 00000000..141743d5 --- /dev/null +++ b/lib/runners/cpp.js @@ -0,0 +1,36 @@ +var shovel = require('../shovel'), + util = require('../util'), + path = require('path'), + temp = require('temp'), + exec = require('child_process').exec; + +function compile(args, cb) { + args.unshift('clang++', '-std=c++11'); + exec(args.join(' '), cb); +} + +module.exports.run = function run(opts, cb) { + temp.track(); + var dir = temp.mkdirSync('cpp'); + + shovel.start(opts, cb, { + solutionOnly: function (run) { + var executable = path.join(dir, 'solution'), + solutionFile = util.codeWriteSync('c++', opts.solution, dir, 'solution.cpp'), + args = [solutionFile, '-o', executable]; + if (opts.setup) { + var setupFile = util.codeWriteSync('cpp', opts.setup, dir, 'setup.cpp'); + args.unshift(setupFile); + } + compile(args, function (error, stdout, stderr) { + if (stdout) console.log(stdout); + if (stderr) throw new Error(stderr); + if (error !== null) throw error; + run({'name': executable, 'args': []}); + }); + }, + fullProject: function (run) { + throw new Error('Test framework is not supported'); + } + }); +}; diff --git a/lib/runners/csharp.js b/lib/runners/csharp.js new file mode 100644 index 00000000..d171f078 --- /dev/null +++ b/lib/runners/csharp.js @@ -0,0 +1,64 @@ +var shovel = require('../shovel'), + util = require('../util'), + temp = require('temp').track(), + path = require('path'), + nunitAssemblies = ['nunit.core.dll', 'nunit.core.interfaces.dll', 'nunit.util.dll', 'nunit.framework.dll'].join(','), + nunitPath = path.resolve(__dirname, '..', '..', 'frameworks', 'csharp', 'nunit'); + +module.exports.run = function run(opts, cb) { + shovel.start(opts, cb, { + solutionOnly: function (run) { + var dir = temp.mkdirSync('csharp'), + codeFile = util.codeWriteSync('csharp', opts.solution, dir, 'code.cs'), + exe = path.join(dir, 'solution.exe'), + args = ['mcs', '-out:' + exe, codeFile]; + + if (opts.setup) { + args.push(util.codeWriteSync('csharp', opts.solution, dir, 'setup.cs')); + } + util.exec(args.join(' '), function (error) { + if (error && error != '') return run(error.toString()); + run({'name': 'mono', 'args': [exe]}); + }); + }, + fullProject: function (run) { + var dir = temp.mkdirSync('csharp'), + fixtureFile = util.codeWriteSync('csharp', opts.fixture, dir, 'fixture.cs'), + codeFile = util.codeWriteSync('csharp', opts.solution, dir, 'code.cs'), + testDLL = path.join(dir, 'test.dll'), + args = [ + 'mcs', + '-out:' + testDLL, + '-lib:' + nunitPath, + '-r:' + nunitAssemblies, + '-reference:System.Numerics.dll', + '-reference:System.Drawing.dll', + '-reference:System.Data.dll', + '-reference:System.Messaging.dll', + '-reference:System.Xml.dll', + '-target:library', + codeFile, + fixtureFile + ]; + + if (opts.setup) { + args.push(util.codeWriteSync('csharp', opts.setup, dir, 'setup.cs')); + } + + util.exec(args.join(' '), function (error) { + if (error && error != '') return run(error.toString()); + run({ + name: "mono", + args: [ + path.join(nunitPath, 'nunit-console.exe'), + '-nologo', + '-noresult', + testDLL + ], + options: {env: process.env} + }); + }); + } + }); +}; + diff --git a/lib/runners/elixir.js b/lib/runners/elixir.js new file mode 100644 index 00000000..655c624d --- /dev/null +++ b/lib/runners/elixir.js @@ -0,0 +1,18 @@ +var shovel = require('../shovel'); + +module.exports.run = function run(opts, cb) { + shovel.start(opts, cb, { + solutionOnly: function (run) { + if (opts.setup) { + opts.solution = opts.setup + opts.solution; + } + run({ + name: 'elixir', + args: ['-e', opts.solution] + }); + }, + fullProject: function (run) { + throw new Error('Test framework is not supported'); + } + }); +}; \ No newline at end of file diff --git a/lib/runners/erlang.js b/lib/runners/erlang.js new file mode 100644 index 00000000..275ba331 --- /dev/null +++ b/lib/runners/erlang.js @@ -0,0 +1,66 @@ +var shovel = require('../shovel'), + config = require('../config'), + codeWriteSync = require('../util').codeWriteSync, + fs = require('fs'), + path = require('path'), + temp = require('temp'); + +function moduleName(fileName) { + return path.basename(fileName).replace(/\.[^/.]+$/, ""); +} + +function erlangCompileCommand(fileName, erlangCodeDir) { + return [ + 'compile:file("', + fileName, + '", {outdir,"', erlangCodeDir ,'"}),' + ].join(''); +} + +function compileFileSync(code,erlangCodeDir) { + return erlangCompileCommand( codeWriteSync('erlang', code, erlangCodeDir), erlangCodeDir); +} + +module.exports.run = function(opts, cb) { + temp.track(); + var erlangCodeDir = temp.mkdirSync('erlang'); + shovel.start(opts, cb, { + solutionOnly: function (exec) { + var setup = opts.setup ? compileFileSync(opts.setup, erlangCodeDir) : ''; + exec({ + name: 'erl', + args: ['-pz', erlangCodeDir, '-noshell', '-eval', [setup, opts.solution].join('')], + options: { env: { + HOME: process.env['HOME'], + ERL_CRASH_DUMP: "/dev/null" + }} + }); + }, + fullProject: function (exec) { + var setup = opts.setup ? compileFileSync(opts.setup, erlangCodeDir) : '', + solutionFileName = codeWriteSync('erlang', opts.solution, erlangCodeDir), + solutionModuleName = moduleName(solutionFileName), + testFixture = compileFileSync([ + '-module(' + solutionModuleName + '_tests).', + '-compile(export_all).', + '-include_lib("eunit/include/eunit.hrl").', + opts.fixture + ].join('\n'), erlangCodeDir); + + exec({ + name: 'erl', + args: ['-pz', erlangCodeDir, '-noshell', '-eval', + [ + setup, + erlangCompileCommand(solutionFileName, erlangCodeDir), + testFixture, + 'eunit:test(', solutionModuleName, '), init:stop().' + ].join('')], + options: { env: { + HOME: process.env['HOME'], + ERL_CRASH_DUMP: "/dev/null" + }} + }); + } + }); +}; \ No newline at end of file diff --git a/lib/runners/fsharp.js b/lib/runners/fsharp.js new file mode 100644 index 00000000..6ff77352 --- /dev/null +++ b/lib/runners/fsharp.js @@ -0,0 +1,28 @@ +var shovel = require('../shovel'), + util = require('../util'), + config = require('../config'), + temp = require('temp'); + +module.exports.run = function(opts, cb) +{ + temp.track(); + var dir = temp.mkdirSync('fsharp'); + + shovel.start(opts, cb, { + solutionOnly: function (run) + { + var file = util.codeWriteSync('fsharp', opts.solution, dir, 'solution.fsx'); + run({name: 'fsharpi', 'args': [file]}); + }, + fullProject: function (run) + { + throw 'Test framework is not supported' + } + }); +}; + + + + + + diff --git a/lib/runners/gas.js b/lib/runners/gas.js new file mode 100644 index 00000000..48112e44 --- /dev/null +++ b/lib/runners/gas.js @@ -0,0 +1,29 @@ +var shovel = require('../shovel'), + util = require('../util'), + path = require('path'), + temp = require('temp'); + +module.exports.run = function(opts, cb) { + temp.track(); + var dir = temp.mkdirSync('gas'); + + shovel.start(opts, cb, { + solutionOnly: function(run) { + var executable = path.join(dir, 'solution'), + solutionFile = util.codeWriteSync('gas', opts.solution + '\n', dir, 'solution.s'), + objectFile = solutionFile.replace(/\.[^\.]+$/, '.o'), + gasCommand = ['gcc', '-c', solutionFile, '-o', objectFile].join(' '), + // Check for whether we need to link against libc + linker = opts.solution.search(/\.global\W+_start/) == -1 ? "gcc" : "ld"; + linkerCommand = [linker, objectFile, '-o', executable].join(' '); + util.exec(gasCommand, function () { + util.exec(linkerCommand, function () { + run({'name': executable, 'args': []}); + }); + }); + }, + fullProject: function (run) { + throw new Error('Test framework is not supported'); + } + }); +}; diff --git a/lib/runners/go.js b/lib/runners/go.js new file mode 100644 index 00000000..9b2751a6 --- /dev/null +++ b/lib/runners/go.js @@ -0,0 +1,21 @@ +var shovel = require('../shovel'), + util = require('../util'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) +{ + temp.track(); + var dir = temp.mkdirSync('go'); + + shovel.start(opts, cb, { + solutionOnly: function (run) + { + var file = util.codeWriteSync('go', opts.solution, dir, 'solution.go') + run({name: 'go', 'args': ['run', file]}); + }, + fullProject: function () + { + throw 'Test framework is not supported' + } + }); +}; \ No newline at end of file diff --git a/lib/runners/groovy.js b/lib/runners/groovy.js new file mode 100644 index 00000000..8aa92985 --- /dev/null +++ b/lib/runners/groovy.js @@ -0,0 +1,22 @@ +var shovel = require('../shovel'), + path = require('path'); + +module.exports.run = function run(opts, cb) { + var uberJar = path.resolve(__dirname, '../../jvm-runner/target/jvm-runner-0.1.1-standalone.jar'); + shovel.start(opts, cb, { + solutionOnly: function (run) { + run({ + name: 'java', + args: ['-jar', uberJar], + stdin: JSON.stringify(opts) + }); + }, + fullProject: function (run) { + run({ + name: 'java', + args: ['-jar', uberJar], + stdin: JSON.stringify(opts) + }); + } + }); +}; diff --git a/lib/runners/haskell.js b/lib/runners/haskell.js new file mode 100644 index 00000000..40647093 --- /dev/null +++ b/lib/runners/haskell.js @@ -0,0 +1,36 @@ +var shovel = require('../shovel'), + config = require('../config'), + codeWriteSync = require('../util').codeWriteSync, + fs = require('fs'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) { + temp.track(); + var haskellCodeDir = temp.mkdirSync('haskell'); + shovel.start(opts, cb, { + solutionOnly: function (run) { + if (opts.setup) codeWriteSync('haskell', opts.setup, haskellCodeDir); + run({ + name: 'runhaskell', + args: [ + '-i' + ['frameworks/haskell', haskellCodeDir].join(':'), + codeWriteSync('haskell', opts.solution, haskellCodeDir, "Main.hs") + ] + }); + }, + fullProject: function (run) { + if (opts.setup) codeWriteSync('haskell', opts.setup, haskellCodeDir); + var solutionFileName = codeWriteSync('haskell', opts.solution, haskellCodeDir, "Main.hs"), + fixtureFileName = solutionFileName.split('/').pop() == "Main.hs" ? + codeWriteSync('haskell', opts.fixture, haskellCodeDir) : + codeWriteSync('haskell', opts.fixture, haskellCodeDir, "Main.hs"); + process.env["solutionFileName"] = solutionFileName; + + run({ + name: 'runhaskell', + args: ['-i' + ['frameworks/haskell', haskellCodeDir].join(':'), fixtureFileName], + options: { env: process.env } + }); + } + }); +}; diff --git a/lib/runners/java.js b/lib/runners/java.js new file mode 100644 index 00000000..8aa92985 --- /dev/null +++ b/lib/runners/java.js @@ -0,0 +1,22 @@ +var shovel = require('../shovel'), + path = require('path'); + +module.exports.run = function run(opts, cb) { + var uberJar = path.resolve(__dirname, '../../jvm-runner/target/jvm-runner-0.1.1-standalone.jar'); + shovel.start(opts, cb, { + solutionOnly: function (run) { + run({ + name: 'java', + args: ['-jar', uberJar], + stdin: JSON.stringify(opts) + }); + }, + fullProject: function (run) { + run({ + name: 'java', + args: ['-jar', uberJar], + stdin: JSON.stringify(opts) + }); + } + }); +}; diff --git a/lib/runners/javascript.js b/lib/runners/javascript.js new file mode 100644 index 00000000..bfc33dbd --- /dev/null +++ b/lib/runners/javascript.js @@ -0,0 +1,145 @@ +var shovel = require('../shovel'), + util = require('../util'), + config = require('../config'), + temp = require('temp'), + child_process = require('child_process'); + +module.exports.run = function run(opts, cb) +{ + shovel.start(opts, cb, { + solutionOnly: function (run) + { + var code = opts.solution; + + if (opts.setup) + code = opts.setup + ';\n' + code; + + run({name: 'node', 'args': ['-e', transform(code)]}); + }, + fullProject: function (run) + { + switch (opts.testFramework) + { + case 'cw-2': + return prepareCw2(opts, run); + + case 'mocha': + case 'mocha_bdd': + return prepareMocha(opts, 'bdd', run); + + case 'mocha_tdd': + return prepareMocha(opts, 'tdd', run); + + default: + throw 'Test framework is not supported' + } + }, + sanitizeStdErr: function(error) + { + error = error || '' + return error.replace(/(\()?\/codewars\/[(\w\/-\d.js:) ;]*/g, '') + .replace(/( Object. )?[\(]?\[eval\][-:\w\d\)]* at/g, '') + .replace(/Module._compile.*/g, '') + .replace('Object.Test.handleError ', '') + .replace(' ', ' '); + }, + sanitizeStdOut: function(stdout) + { + return this.sanitizeStdErr(stdout); + } + }); +}; + +function prepareMocha(opts, interfaceType, run) { + var dir = temp.mkdirSync('javascript'); + var code = ''; + + if (opts.setup) + { + code = opts.setup + ';\n'; + } + + code += opts.solution + ';\n'; + + // run tests inline to the context but within their own scope. Redefine the key test methods in case they were + // locally redefined within the solution. + + // TODO: instead of using one file, we should require the solution file into the spec file (see TypeScript implementation) + code += config.snippets.javascript.closure.start; + code += opts.fixture; + code += config.snippets.javascript.closure.end; + + var solutionFile = util.codeWriteSync('javascript', transform(code), dir, 'mocha', true); + run({name: 'mocha', 'args': ['--harmony', '-u', interfaceType, '-R', 'mocha-reporter', solutionFile]}); +} + +function prepareCw2(opts, run) +{ + var code = config.snippets.javascript.requireCw2; + code += "var assert = require('assert');\n"; + + code += config.snippets.javascript.start; + + if (opts.setup) + { + code += opts.setup + ';\n'; + } + + code += opts.solution + ';\n'; + + // run tests inline to the context but within their own scope. Redefine the key test methods in case they were + // locally redefined within the solution. + code += ';' + config.snippets.javascript.inlineTestFixture.start; + code += opts.fixture; + code += config.snippets.javascript.inlineTestFixture.end; + code += config.snippets.javascript.end; + run({name: 'node', 'args': ['-e', transform(code)]}); +} + +function transform(code) { + try { + return require('babel-core').transform(code, { + presets: ["stage-1", "react"], + plugins: [ + "transform-runtime", + "check-es2015-constants", + "transform-es2015-arrow-functions", + "transform-es2015-block-scoped-functions", + "transform-es2015-block-scoping", + "transform-es2015-classes", + "transform-es2015-computed-properties", + "transform-es2015-destructuring", + "transform-es2015-duplicate-keys", + "transform-es2015-for-of", + "transform-es2015-function-name", + "transform-es2015-literals", + "transform-es2015-object-super", + "transform-es2015-parameters", + "transform-es2015-shorthand-properties", + "transform-es2015-spread", + "transform-es2015-sticky-regex", + "transform-es2015-template-literals", + "transform-es2015-typeof-symbol", + "transform-es2015-unicode-regex", + "transform-regenerator", + ], + ast: false, + filename: 'kata' + }).code; + } + catch(ex) { + var msg = ex.message; + if (ex.loc) { + // replace the line number since it is not what the user sees + msg = msg.replace(/ \(\d*:\d*\)/, ":" + ex.loc.column) + var lines = code.split('\n'); + msg += "\n" + lines[ex.loc.line - 1]; + msg += "\n"; + for(var i = 1;i < ex.loc.column; i++) { + msg += ' '; + } + msg += '^'; + } + throw new shovel.CompileError(msg); + } +} diff --git a/lib/runners/julia.js b/lib/runners/julia.js new file mode 100644 index 00000000..42ae3955 --- /dev/null +++ b/lib/runners/julia.js @@ -0,0 +1,28 @@ +var shovel = require('../shovel'), + config = require('../config'), + codeWriteSync = require('../util').codeWriteSync, + fs = require('fs'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) { + temp.track(); + var juliaCodeDir = temp.mkdirSync('julia'); + shovel.start(opts, cb, { + solutionOnly: function (run) { + if (opts.setup) codeWriteSync('julia', opts.setup, juliaCodeDir); + run({ + name: 'julia', + args: ['-P', ['push!(LOAD_PATH, "', juliaCodeDir, '", "frameworks/julia")'].join(""), + '-e', opts.solution] + }); + }, + fullProject: function (run) { + codeWriteSync('julia', opts.solution, juliaCodeDir); + if (opts.setup) codeWriteSync('julia', opts.setup, juliaCodeDir); + run({ + name: 'julia', + args: ['-P', ['push!(LOAD_PATH, "', juliaCodeDir , '", "frameworks/julia")'].join(""), '-e', opts.fixture] + }); + } + }); +}; \ No newline at end of file diff --git a/lib/runners/lisp.js b/lib/runners/lisp.js new file mode 100644 index 00000000..f1b3573d --- /dev/null +++ b/lib/runners/lisp.js @@ -0,0 +1,27 @@ +var shovel = require('../shovel'), + util = require('../util'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) { + temp.track(); + var lispCodeDir = temp.mkdirSync('lisp'), + args = [ + '--noinform', // Disable banner + '--disable-ldb', // Disable the low-level debugger + '--lose-on-corruption', // Don't try to recover + '--non-interactive' // No REPL + ]; + shovel.start(opts, cb, { + solutionOnly: function (run) { + if (opts.setup) { + var setupFile = util.codeWriteSync('lisp', opts.setup, lispCodeDir, 'setup.lisp'); + args.push('--load', setupFile); + } + args.push('--eval', opts.solution); + run({name: 'sbcl', args: args}); + }, + fullProject: function (run) { + throw 'Test framework is not supported'; + } + }); +}; \ No newline at end of file diff --git a/lib/runners/lua.js b/lib/runners/lua.js new file mode 100644 index 00000000..10a0bddd --- /dev/null +++ b/lib/runners/lua.js @@ -0,0 +1,28 @@ +var shovel = require('../shovel'), + util = require('../util'), + config = require('../config'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) +{ + temp.track(); + var dir = temp.mkdirSync('lua'); + + shovel.start(opts, cb, { + solutionOnly: function (run) + { + var file = util.codeWriteSync('lua', opts.solution, dir, 'solution.lua') + run({name: 'lua', 'args': [file]}); + }, + fullProject: function (run) + { + throw 'Test framework is not supported' + } + }); +}; + + + + + + diff --git a/lib/runners/nasm.js b/lib/runners/nasm.js new file mode 100644 index 00000000..d0c2546b --- /dev/null +++ b/lib/runners/nasm.js @@ -0,0 +1,30 @@ +var shovel = require('../shovel'), + util = require('../util'), + path = require('path'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) { + temp.track(); + var dir = temp.mkdirSync('nasm'); + + shovel.start(opts, cb, { + solutionOnly: function (run) { + // TODO: Support setup code; setup code should either be NASM or C, and we should automatically detect it + var executable = path.join(dir, 'solution'), + solutionFile = util.codeWriteSync('nasm', opts.solution + '\n', dir, 'solution.asm'), + nasmCommand = ['nasm', '-felf64', solutionFile].join(' '), + objectFile = solutionFile.replace(/\.[^\.]+$/, '.o'), + // Check for whether we need to link against libc + linker = opts.solution.search(/global\W+_start/) == -1 ? "gcc" : "ld"; + linkerCommand = [linker, objectFile, '-o', executable].join(' '); + util.exec(nasmCommand, function () { + util.exec(linkerCommand, function () { + run({'name': executable, 'args': []}); + }); + }); + }, + fullProject: function (run) { + throw new Error('Test framework is not supported'); + } + }); +}; diff --git a/lib/runners/objc.js b/lib/runners/objc.js new file mode 100644 index 00000000..fb4ddce2 --- /dev/null +++ b/lib/runners/objc.js @@ -0,0 +1,36 @@ +var shovel = require('../shovel'), + util = require('../util'), + path = require('path'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) { + // Sandbox expects files to have this directory as an ancestor + var objcDir = '/tmp/objc'; + util.mkdirParentSync(objcDir); + temp.track(); + var dir = temp.mkdirSync({dir: objcDir}), + objcSandbox = path.resolve('frameworks', 'osx', 'objc.sb'); + + shovel.start(opts, cb, { + solutionOnly: function (run) { + var solutionFile = util.codeWriteSync('objc', opts.code, dir, 'main.m'), + command = 'clang -lobjc -framework Foundation -o main ' + solutionFile; + + if ("setup" in opts) { + util.codeWriteSync('objcHeader', opts.setupHeader, dir, 'setup.h'); + command = command + ' ' + util.codeWriteSync('objc', opts.setup, dir, 'setup.m'); + } + + util.exec(command, {'cwd': dir}, function () { + run({ + 'name': 'sandbox-exec', + 'args': ['-f', objcSandbox, './main'], + 'options': {'cwd': dir} + }); + }); + }, + fullProject: function (run) { + require('./xcode').fullProject(opts, run); + } + }); +}; diff --git a/lib/runners/ocaml.js b/lib/runners/ocaml.js new file mode 100644 index 00000000..1bf4bb24 --- /dev/null +++ b/lib/runners/ocaml.js @@ -0,0 +1,13 @@ +var shovel = require('../shovel'); + +module.exports.run = function run(opts, cb) { + shovel.start(opts, cb, { + solutionOnly: function (run) { + run({ + name: 'ocaml', + args: ['-stdin'], + stdin: opts.solution + }); + } + }); +}; diff --git a/lib/runners/perl.js b/lib/runners/perl.js new file mode 100644 index 00000000..e7825a5f --- /dev/null +++ b/lib/runners/perl.js @@ -0,0 +1,22 @@ +var shovel = require('../shovel'), + util = require('../util'), + config = require('../config'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) +{ + temp.track(); + var dir = temp.mkdirSync('perl'); + + shovel.start(opts, cb, { + solutionOnly: function (run) + { + var file = util.codeWriteSync('perl', opts.solution, dir, 'solution.pl') + run({name: 'perl', 'args': [file]}); + }, + fullProject: function (run) + { + throw 'Test framework is not supported' + } + }); +}; \ No newline at end of file diff --git a/lib/runners/php.js b/lib/runners/php.js new file mode 100644 index 00000000..d2fadb46 --- /dev/null +++ b/lib/runners/php.js @@ -0,0 +1,77 @@ +var shovel = require('../shovel'), + util = require('../util'), + config = require('../config'); + +var PASSED = ''; +var FAILED = ''; +var NEWLINE = '<:LF:>'; +// var NEWLINE = '\n'; + +module.exports.run = function run(opts, cb) +{ + shovel.start(opts, cb, { + solutionOnly: function (run) + { + var code = opts.solution; + + if (opts.setup) + { + code = opts.setup + ';\n' + code; + } + + run({name: 'php', 'args': ['-r', code]}); + }, + fullProject: function (run) + { + var code = [ + config.snippets.php.bootstrap, + (opts.setup || ''), + config.snippets.php.beforeUserScript, + opts.solution, + config.snippets.php.afterUserScript, + config.snippets.php.classBegin, + opts.fixture, + config.snippets.php.classEnd, + config.snippets.php.execute + ].join('\n'); + + run({name: 'php', 'args': ['-r', code]}); + }, + //sanitizeStdOut : function (output) { + // var lines = output.split('\n'); + // var success = (lines[lines.length - 2] || '').slice(0, 4) === 'OK ('; + // + // if (success) { + // return PASSED + ' All tests passed.'; + // } + // + // return FAILED + filterLines(lines).join(NEWLINE); + //} + }); +}; + +var filterLines = (function () { + var blacklist = [ + /^PHPUnit \d\.\d\.\d by Seb/, + /^\d\) KataTest::testSolution/, + /^Time: \d+ ms, Memory:/, + /^There was \d+ failure/, + /^FAILURES!$/, + /^Tests: \d+, Assertions:/ + + ]; + + /** + * Strip lines from output we don't want + * + * @param array lines + * @return array + */ + return function (lines) { + return lines.filter(function (line) { + return blacklist.every(function (regex) { + return !regex.test(line); + }); + }); + }; +}()); \ No newline at end of file diff --git a/lib/runners/python.js b/lib/runners/python.js new file mode 100644 index 00000000..72060186 --- /dev/null +++ b/lib/runners/python.js @@ -0,0 +1,42 @@ +var shovel = require('../shovel'), + config = require('../config'); + +module.exports.run = function run(opts, cb) { + shovel.start(opts, cb, { + solutionOnly: function (run) { + var code = [opts.setup, opts.solution].join("\n"); + run({name: 'python', 'args': ['-c', code]}); + }, + fullProject: function (run) { + var code; + with (config.snippets.python) { + switch (opts.testFramework) { + case 'cw-2': + code = [ + addPythonFramework, + requireCw2, + opts.setup, opts.solution, opts.fixture].join('\n'); + break; + case 'unittest': + code = [ + opts.setup, opts.solution, + addPythonFramework, + requireUnittest, + opts.fixture, + runUnittest].join('\n'); + break; + default: + throw new Error('test framework is not supported'); + } + } + run({name: 'python', 'args': ['-c', code]}); + }, + sanitizeStdErr: function (err) { + // get rid of some of the noisy content. We remove line numbers since + // they don't match up to what the user sees and will only confuse them. + return err.replace(/File "()?", line \d*,/g, '') + .replace(' (most recent call last)', '') + .replace(' in in ', ' in '); + } + }); +}; diff --git a/lib/runners/python3.js b/lib/runners/python3.js new file mode 100644 index 00000000..e51bd510 --- /dev/null +++ b/lib/runners/python3.js @@ -0,0 +1,4 @@ +var path = require('path'), + pythonRunnerCode = require('fs').readFileSync(path.join(__dirname,'python.js'),'utf8'); + +eval(pythonRunnerCode.split('python').join('python3')); diff --git a/lib/runners/r.js b/lib/runners/r.js new file mode 100644 index 00000000..c5fccf62 --- /dev/null +++ b/lib/runners/r.js @@ -0,0 +1,18 @@ +var shovel = require('../shovel'); + +module.exports.run = function run(opts, cb) { + shovel.start(opts, cb, { + solutionOnly: function (run) { + if (opts.setup) { + opts.solution = opts.setup + opts.solution; + } + run({ + name: 'R', + args: ['--vanilla', '--slave', '-e', opts.solution] + }); + }, + fullProject: function (run) { + throw new Error('Test framework is not supported'); + } + }); +}; \ No newline at end of file diff --git a/lib/runners/racket.js b/lib/runners/racket.js new file mode 100644 index 00000000..dd0f2c3c --- /dev/null +++ b/lib/runners/racket.js @@ -0,0 +1,25 @@ +var shovel = require('../shovel'), + util = require('../util'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) { + temp.track(); + var racketCodeDir = temp.mkdirSync('racket'), + args = ['-l', 'racket/base']; + shovel.start(opts, cb, { + solutionOnly: function (run) { + if (opts.setup) { + var setupFile = util.codeWriteSync('racket', opts.setup, racketCodeDir, 'setup.rkt'); + args.push('-t', setupFile); + } + args.push('-e', opts.solution); + run({ + name: 'racket', + args: args + }); + }, + fullProject: function (run) { + throw 'Test framework is not supported'; + } + }); +}; diff --git a/lib/runners/ruby.js b/lib/runners/ruby.js new file mode 100644 index 00000000..80626a6c --- /dev/null +++ b/lib/runners/ruby.js @@ -0,0 +1,73 @@ +var shovel = require('../shovel'), + util = require('../util'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) +{ + shovel.start(opts, cb, { + solutionOnly: function (run) + { + var code = opts.solution; + + if (opts.setup) + { + code = opts.setup + '\n' + code; + } + + run({name: 'ruby', 'args': ['-e', code]}); + }, + fullProject: function (run) + { + switch (opts.testFramework) + { + case 'cw-2': + return prepareCw2(opts, run); + case 'rspec': + return prepareRSpec(opts, run); + + default: + throw 'Test framework is not supported' + } + }, + sanitizeStdErr: function(error) + { + return error.replace(/[\w/-]*(cw-2.rb):[\d]*:in( `(measure|wrap_error|it|describe)'<:LF:>)?/g, '') + .replace(/-e:[\d]*:in/g, '') + .replace(/<:LF:> `(block in )?(
|describe|it)'/g, '') + .replace(' ', ' '); + }, + sanitizeStdOut: function(stdout) + { + return this.sanitizeStdErr(stdout); + } + }); +}; + +function prepareCw2(opts, run) +{ + var code = ["require('./frameworks/ruby/cw-2')"]; + + if (opts.setup) + { + code.push(opts.setup); + } + + code.push(opts.solution); + code.push(opts.fixture); + + run({name: 'ruby', 'args': ['-e', code.join('\n')]}); +} + +function prepareRSpec(opts, run) +{ + temp.track(); + var dir = temp.mkdirSync('ruby'), + code = [opts.solution,opts.fixture]; + + if (opts.setup) + code.unshift(opts.setup); + + var solution = util.codeWriteSync('ruby', code.join('\n'), dir, 'solution.rb'); + + run({name: 'rspec', 'args': [solution, '--require', './frameworks/ruby/cwrspecformatter.rb', '--format', 'CwRSpecFormatter']}); +} diff --git a/lib/runners/rust.js b/lib/runners/rust.js new file mode 100644 index 00000000..94653a6e --- /dev/null +++ b/lib/runners/rust.js @@ -0,0 +1,32 @@ +var shovel = require('../shovel'), + util = require('../util'), + path = require('path'), + temp = require('temp'), + exec = require('child_process').exec; + +function compile(args, cb) { + args.unshift('rustc'); + exec(args.join(' '), cb); +} + +module.exports.run = function run(opts, cb) { + temp.track(); + var dir = temp.mkdirSync('rust'); + + shovel.start(opts, cb, { + solutionOnly: function (run) { + var executable = path.join(dir, 'solution'), + solutionFile = util.codeWriteSync('rust', opts.solution, dir, 'solution.rs'), + args = [solutionFile, '-o', executable]; + compile(args, function (error, stdout, stderr) { + if (stdout) console.log(stdout); + if (stderr) throw new Error(stderr); + if (error !== null) throw error; + run({'name': executable, 'args': []}); + }); + }, + fullProject: function (run) { + throw new Error('Test framework is not supported'); + } + }); +}; \ No newline at end of file diff --git a/lib/runners/scala.js b/lib/runners/scala.js new file mode 100644 index 00000000..76757983 --- /dev/null +++ b/lib/runners/scala.js @@ -0,0 +1,33 @@ +var shovel = require('../shovel'), + util = require('../util'), + path = require('path'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) { + temp.track(); + var dir = temp.mkdirSync('scala'); + + shovel.start(opts, cb, { + solutionOnly: function (run) { + var classDirectory = path.join(dir, 'classes'), + solutionFile = util.codeWriteSync('scala', opts.solution, dir), + solutionClassName = path.basename(solutionFile, '.scala'), + args = ['scalac', '-d', classDirectory, solutionFile]; + + if (opts.setup) { + var setupFile = util.codeWriteSync('scala', opts.setup, dir); + args.push(setupFile); + } + util.mkdirParentSync(classDirectory); + util.exec(args.join(' '), function () { + run({ + 'name': 'scala', + 'args': ['-classpath', classDirectory, solutionClassName] + }); + }); + }, + fullProject: function (run) { + throw new Error('Test framework is not supported'); + } + }); +}; diff --git a/lib/runners/swift.js b/lib/runners/swift.js new file mode 100644 index 00000000..f0588804 --- /dev/null +++ b/lib/runners/swift.js @@ -0,0 +1,30 @@ +var shovel = require('../shovel'), + util = require('../util'), + temp = require('temp'), + path = require('path'); + +module.exports.run = function run(opts, cb) { + // Sandbox expects files to have this directory as an ancestor + var swiftDir = '/tmp/swift'; + util.mkdirParentSync(swiftDir); + temp.track(); + var dir = temp.mkdirSync({dir: swiftDir}), + swiftSandbox = path.resolve('frameworks','osx','swift.sb'); + + shovel.start(opts, cb, { + solutionOnly: function (run) { + var solutionFile = util.codeWriteSync(null, opts.code, dir, 'main.swift'), + command = 'xcrun -sdk macosx swiftc -emit-executable ' + solutionFile; + if ("setup" in opts) + command = command + ' ' + util.codeWriteSync('swift', opts.setup, dir, 'setup.swift'); + util.exec(command, {'cwd': dir}, function () { + run({'name': 'sandbox-exec', + 'args': ['-f', swiftSandbox, './main'], + 'options': {'cwd': dir}}); + }); + }, + fullProject: function (run) { + require('./xcode').fullProject(opts, run); + } + }); +}; diff --git a/lib/runners/typescript.js b/lib/runners/typescript.js new file mode 100644 index 00000000..9d08f4c5 --- /dev/null +++ b/lib/runners/typescript.js @@ -0,0 +1,63 @@ +var shovel = require('../shovel'), + util = require('../util'), + temp = require('temp'); + +module.exports.run = function run(opts, cb) { + var dir = temp.mkdirSync('typescript'); + shovel.start(opts, cb, { + solutionOnly: function (run) { + // TODO: Support Setup Code + + var solutionFile = util.codeWriteSync('typescript', opts.solution, dir, 'solution.ts', true); + util.exec('tsc ' + solutionFile + ' --module commonjs', function () { + run({name: 'node', args: [solutionFile.replace('.ts', '.js')]}); + }); + }, + fullProject: function (run) { + switch (opts.testFramework) { + case 'mocha': + case 'mocha_bdd': + return prepareMocha(opts, 'bdd', run); + case 'mocha_tdd': + return prepareMocha(opts, 'tdd', run); + default: + throw 'Test framework is not supported' + } + }, + sanitizeStdErr: function(error) + { + error = error || '' + return error.replace(/(\()?\/codewars\/[(\w\/-\d.js:) ;]*/g, '') + .replace(/( Object. )?[\(]?\[eval\][-:\w\d\)]* at/g, '') + .replace(/Module._compile.*/g, '') + .replace('Object.Test.handleError ', '') + .replace(' ', ' '); + }, + sanitizeStdOut: function(stdout) + { + return this.sanitizeStdErr(stdout); + } + }); + + function prepareMocha(opts, interfaceType, run) { + var dir = temp.mkdirSync('typescript'); + var code = ''; + + if (opts.setup) code = opts.setup + ';\n'; + + code += opts.solution + ';\n'; + + var codeFile = util.codeWriteSync('typescript', code, dir, 'solution.ts', true); + + util.exec('tsc --module commonjs ' + codeFile, function () { + var spec = "var solution = require('./solution.js')\n" + opts.fixture, + specFile = util.codeWriteSync('typescript', spec, dir, 'spec.ts', true); + + util.exec('tsc --module commonjs ' + specFile, function () { + specFile = specFile.replace('.ts', '.js') + run({name: 'mocha', 'args': ['--harmony', '-u', interfaceType, '-R', 'mocha-reporter', specFile]}); + }); + }); + } + +}; \ No newline at end of file diff --git a/lib/runners/xcode.js b/lib/runners/xcode.js new file mode 100644 index 00000000..17fc5a60 --- /dev/null +++ b/lib/runners/xcode.js @@ -0,0 +1,21 @@ +var shovel = require("../shovel"), +codeWriteSync = require('../util').codeWriteSync, +_ = require("lodash"), +path = require("path"), +temp = require("temp"); + +module.exports.fullProject = function fullProject(opts,run) { + temp.track(); + var tempCodeDir = temp.mkdirSync("xcode"), + script = path.resolve(__dirname, "../../frameworks/osx/run_template.sh"), + files = {"CODE": codeWriteSync(opts.language, opts.code, tempCodeDir, "code"), + "FIXTURE": codeWriteSync(opts.language, opts.fixture, tempCodeDir, "test")}; + if (opts.language == "objc") + files.CODE_HEADER = codeWriteSync("objcHeader", opts.codeHeader, tempCodeDir, "code.h"); + if ("setup" in opts) { + files.SETUP = codeWriteSync(opts.language, opts.setup, tempCodeDir, "setup"); + if (opts.language == "objc") + files.SETUP_HEADER = codeWriteSync("objcHeader", opts.setupHeader, tempCodeDir, "setup.h"); + } + run({ name: script, + options: {"env": _.merge({}, process.env, opts, files)}});}; diff --git a/lib/shovel.js b/lib/shovel.js new file mode 100644 index 00000000..640350f6 --- /dev/null +++ b/lib/shovel.js @@ -0,0 +1,200 @@ +var util = require('util'), + spawn = require('child_process').spawn, + config = require('./config'), + os = require('os'); + +// used for indicating an error which is related to user code and not an application error. +// useful for when we run code compilation inside of this host process. +var CompileError = module.exports.CompileError = function(message) { + this.name = "CompileError"; + this.message = message; +} +CompileError.prototype = Error.prototype; + +//runs the strategy specified in opts and reports the results of the run, then runs the callback +module.exports.start = function start(opts, cb, strategies) +{ + cb = cb || function (){}; + if(strategies.compile) + { + module.exports.compile(opts, function() + { + run(opts, strategies, function (buffer) + { + reportBuffer(opts, buffer, strategies); + cb(buffer); + }); + }, strategies.compile); + } + else + { + run(opts, strategies, function (buffer) + { + reportBuffer(opts, buffer, strategies); + cb(buffer); + }); + } +}; + +// given the options provided and a list of strategies on how to handle them, run will pick the +// appropriate strategy and execute it. +function run(opts, strategies, cb) +{ + function runStrategy(strategy) + { + // if is error + if (typeof strategy === 'string') + { + cb({stdout: [''], stderr: [strategy], wallTime: 0}); + } + else + { + exec(opts, strategy.name, strategy.args, strategy.options, strategy.stdin, cb); + } + } + + try { + (!opts.fixture) ? strategies.solutionOnly(runStrategy) : strategies.fullProject(runStrategy); + } + catch(ex) { + // our special error which allows us to raise an exception outside of a child process and still react to it as + // if its normal. + if (ex.name === "CompileError") { + runStrategy(ex.message); + } + else throw ex; + } +} + +function exec(opts, name, args, process_options, process_stdin, cb) +{ + var args = args || [], + child = spawn(name, args, process_options), + buffer = {stdout: [], stderr: []}, + start = new Date(), + finished = false, + stdoutLength = 0, + maxTime = opts.timeout || config.timeouts[opts.language] || config.timeouts.default; + + function exit(reason) + { + if (!finished) + { + child.kill('SIGKILL'); + if (reason) buffer.stderr.push(reason + '\n'); + finished = true; + } + cb(buffer); + } + + function cleanupFiles() + { + // cleanup temp files + if (opts.tempFiles) + { + for (var i = 0, l = opts.tempFiles.length; i < l; i++) + { + fs.unlink(opts.tempFiles[i]); + } + delete opts.tempFiles; + } + } + + if (process_stdin) child.stdin.write(process_stdin); + + // Listen + child.stdout.on('data', function (data) + { + if (!!data) + { + buffer.stdout.push(data.toString()); + stdoutLength += data.length; + } + + if (stdoutLength > 750000) + { + buffer.status = 'max_buffer_reached'; + exit('Max Buffer reached: Too much information has been written to stdout.'); + } + }); + + child.stderr.on('data', function (data) + { + if (!!data) buffer.stderr.push(data.toString()); + }); + + child.on('error', exit); + + // prevent the process from running for too long + var timeout = setTimeout(function () + { + if (!finished) + { + buffer.status = 'max_time_reached'; + exit('Process was terminated. It took longer than ' + maxTime + 'ms to complete'); + } + process.exit(1); + }, maxTime); + + child.on('exit', function (code) + { + clearTimeout(timeout); + finished = true; + buffer.exitCode = code; + buffer.wallTime = new Date() - start; + + cleanupFiles(); + cb(buffer); + + // if we are within the run script + if (!opts.compiling && (process.argv[1] || '').indexOf('/run') >= 0) + { + //ensure that node exits now, even if processes have forked off + process.exit(0); + } + }); + + + child.stdin.end(); +} + + +function reportBuffer(opts, buffer, strategies) +{ + buffer.stdout = buffer.stdout.join(''); + buffer.stderr = buffer.stderr.join(''); + + if (strategies) + { + if(strategies.transformOutput) + { + buffer.stdout = strategies.transformOutput(opts); + } + + // if there is an error, provide the ability to sanitize it. This is useful for when + // output can be noisy. + if (buffer.stderr && strategies.sanitizeStdErr) + { + buffer.stderr = strategies.sanitizeStdErr(buffer.stderr); + } + + if (buffer.stdout && strategies.sanitizeStdOut) + { + buffer.stdout = strategies.sanitizeStdOut(buffer.stdout); + } + } + + if (opts.format == 'json') + { + console.log(JSON.stringify(buffer)); + } + else + { + if (buffer.stdout) console.log(buffer.stdout); + if (buffer.stderr) console.error(buffer.stderr); + if (buffer.wallTime && opts.debug) + { + console.info(buffer.wallTime + 'ms'); + } + } +} diff --git a/lib/test_utils.js b/lib/test_utils.js new file mode 100644 index 00000000..4b500e00 --- /dev/null +++ b/lib/test_utils.js @@ -0,0 +1,5 @@ +var fs = require('fs'), + expect = require('chai').expect, + yaml = require('js-yaml'), + runner = require('./runner'); + diff --git a/lib/util.js b/lib/util.js new file mode 100644 index 00000000..9bfe462a --- /dev/null +++ b/lib/util.js @@ -0,0 +1,75 @@ +var fs = require('fs'), + path = require('path'), + config = require('./config'), + child_process = require('child_process'), + yaml = require('js-yaml') + +module.exports.exec = function (command, opts, cb) { + if (!cb) { + cb = opts; + opts = null; + } + + function handleOutput (error, stdout, stderr) { + if (stdout) console.log(stdout); + if (stderr) throw new Error(stderr); + if (error !== null) throw error; + cb(); + } + + if (opts) child_process.exec(command, opts, handleOutput); + else child_process.exec(command, handleOutput); +}; + +// mkdir -p +function mkdirParentSync(dirPath, mode) { + var dirs = dirPath.split("/"), partialPath; + for (var idx = (dirPath[0] == '/' ? 1 : 0); idx < dirs.length; idx++) { + partialPath = dirs.slice(0, idx + 1).join("/"); + if (!fs.existsSync(partialPath)) { + fs.mkdirSync(partialPath, mode); + } + } +} + +module.exports.mkdirParentSync = mkdirParentSync; + +// Infer the name of a file from a module or namespace declaration in the code +function codeFileName(language, code, defaultFileName) { + if (config.moduleRegExs[language]) { + var fileExtensionMatch = (new RegExp('\\.' + config.fileExtensions[language] + '$')).exec(defaultFileName), + moduleMatch = config.moduleRegExs[language].exec(code); + + return moduleMatch !== null ? + moduleMatch[1].replace(/\./g, '/').replace(/-/g, '_') + '.' + config.fileExtensions[language] : + fileExtensionMatch !== null ? + defaultFileName : + defaultFileName + '.' + config.fileExtensions[language]; + } + else { + return defaultFileName || language; + } +} + +module.exports.codeWriteSync = function (language, code, codeDir, defaultFileName, overwrite) { + var fileName = codeFileName(language, code, defaultFileName); + if (!(typeof fileName == 'string' || fileName instanceof String)) { + throw new Error(["Could not determine valid name from code:\n\n", code].join("")); + } + + if (code == "") { + throw new Error(["Code cannot be empty!"]); + } + + fileName = path.join(codeDir, fileName); + if (fs.existsSync(fileName)) { + if (!overwrite) { + throw new Error(["Could not write code to file ", fileName, + " because file already exists:\n\n", code].join("")); + } + } + mkdirParentSync(path.dirname(fileName)); + fs.writeFileSync(fileName, code); + return fileName; +}; + diff --git a/package.json b/package.json new file mode 100644 index 00000000..d6b8e3e5 --- /dev/null +++ b/package.json @@ -0,0 +1,58 @@ +{ + "name": "runner", + "description": "Codewars.com code sandbox capabilities", + "version": "0.1.6", + "author": { + "name": "Jake Hoffner", + "email": "jake@codewars.com" + }, + "scripts": { + "osx-test": "./node_modules/.bin/mocha -t 5000 test/runners/{objc,swift}_spec", + "js-test": "mocha -t 5000 test/runners/javascript_spec", + "ts-test": "./node_modules/.bin/mocha -t 5000 test/runners/typescript_spec", + "cs-test": "./node_modules/.bin/mocha -t 5000 test/runners/csharp_spec", + "ruby-test": "./node_modules/.bin/mocha -t 5000 test/runners/ruby_spec" + }, + "repository": { + "type": "git", + "url": "http://github.com/codewars/runner.git" + }, + "dependencies": { + "chai": "1.9.x", + "lodash": "^2.4.1", + "mocha": "1.19.x", + "nomnom": "1.6.x", + "temp": "*", + "asyncawait": "*", + "bluebird": "*", + "js-yaml": "*", + "mocha-reporter": "git://github.com/codewars/mocha-reporter" + }, + "devDependencies": { + "babel-core": "6.7.x", + "babel-runtime": "6.6.x", + "babel-preset-stage-1": "6.5.x", + "babel-preset-react": "6.5.x", + "babel-plugin-transform-runtime": "6.7.*", + "babel-plugin-check-es2015-constants": "*", + "babel-plugin-transform-es2015-arrow-functions": "*", + "babel-plugin-transform-es2015-block-scoped-functions": "*", + "babel-plugin-transform-es2015-block-scoping": "*", + "babel-plugin-transform-es2015-classes": "*", + "babel-plugin-transform-es2015-computed-properties": "*", + "babel-plugin-transform-es2015-destructuring": "*", + "babel-plugin-transform-es2015-duplicate-keys": "*", + "babel-plugin-transform-es2015-for-of": "*", + "babel-plugin-transform-es2015-function-name": "*", + "babel-plugin-transform-es2015-literals": "*", + "babel-plugin-transform-es2015-object-super": "*", + "babel-plugin-transform-es2015-parameters": "*", + "babel-plugin-transform-es2015-shorthand-properties": "*", + "babel-plugin-transform-es2015-spread": "*", + "babel-plugin-transform-es2015-sticky-regex": "*", + "babel-plugin-transform-es2015-template-literals": "*", + "babel-plugin-transform-es2015-typeof-symbol": "*", + "babel-plugin-transform-es2015-unicode-regex": "*", + "babel-plugin-transform-regenerator": "*" + } +} diff --git a/run-json.js b/run-json.js new file mode 100644 index 00000000..7725b615 --- /dev/null +++ b/run-json.js @@ -0,0 +1 @@ +require('./lib/runner').run(JSON.parse(process.argv[2])); diff --git a/run.js b/run.js new file mode 100644 index 00000000..5674e5e4 --- /dev/null +++ b/run.js @@ -0,0 +1,52 @@ +var run = require('./lib/runner').run, + opts = require("nomnom") + .options({ + code: { + abbr: 'c', + help: 'code to run' + }, + fixture: { + abbr: 'f', + help: 'Test fixture code to test with' + }, + setup: { + abbr: 's', + help: 'Setup code to be used for executing the code' + }, + language: { + abbr: 'l', + help: 'The language to execute the code in' + }, + testFramework: { + abbr: 't', + full: 'test-framework', + help: 'The language specific framework to run in' + }, + timeout: { + help: 'The timeout to be used for running the code. If not specified a language specific default will be used' + }, + format: { + help: 'The output format that will be returned. Options are "default" and "json"', + default: 'default', + choices: ['default', 'json'], + abbr: 'fmt' + }, + debug: { + abbr: 'd', + help: 'Print debugging info', + flag: true + }, + version: { + abbr: 'v', + flag: true, + help: 'Print version and exit', + callback: function () { + return require('./lib/config').version; + } + } + }) + .help('This utility will run code in a specified language, using the specified testing suite.') + .parse(); + + +run(opts); diff --git a/test/runner.js b/test/runner.js new file mode 100644 index 00000000..708673c8 --- /dev/null +++ b/test/runner.js @@ -0,0 +1,42 @@ +var fs = require('fs'), + expect = require('chai').expect, + yaml = require('js-yaml'), + runner = require('../lib/runner'); + +module.exports.run = runner.run; + +// loops through the language specific examples within the examples.yml file and calls the cb function with each individual example +function iterateCodeExamples(language, cb) { + var examples = yaml.safeLoad(fs.readFileSync('./examples/' + language + '.yml', 'utf8')); + if (examples) { + for (var framework in examples) { + for (var example in examples[framework]) { + cb(framework, example, examples[framework][example]); + } + } + } +} + +module.exports.assertCodeExamples = function(language) { + describe('example challenges', function() { + iterateCodeExamples(language, function (framework, name, example) { + it ('should define an initial code block', function() { + expect(example.initial).to.be.a('string'); + }); + + it ('should have a passing ' + name + ' example', function(done) { + runner.run({ + language: language, + setup: example.setup, + code: example.answer, + fixture: example.fixture, + testFramework: framework + }, function(buffer) { + expect(buffer.stdout).to.not.contain(''); + expect(buffer.stdout).to.not.contain(''); + done(); + }); + }); + }); + }); +}; diff --git a/test/runners/arm_spec.js b/test/runners/arm_spec.js new file mode 100644 index 00000000..bee01336 --- /dev/null +++ b/test/runners/arm_spec.js @@ -0,0 +1,75 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe('arm runner', function () { + // commenting out for now since we dont care and this just throws timeout errors sometimes + //describe('.run', function () { + // it('should handle basic code evaluation (no libc)', function (done) { + // runner.run({language: 'arm', + // code: [ + // '.data', + // 'message: .ascii "ARMed and dangerous :D"', + // 'len = . - message', + // '.text', + // '.global _start', + // '_start:', + // ' mov %r0, $1', + // ' ldr %r1, =message', + // ' ldr %r2, =len', + // ' mov %r7, $4', + // ' swi $0', + // ' mov %r0, $0', + // ' mov %r7, $1', + // ' swi $0' + // ].join('\n')}, + // function (buffer) { + // console.log(buffer); + // expect(buffer.stdout).to.equal('ARMed and dangerous :D'); + // done(); + // }); + // }); + // it('should not use libc even with alternate spelling of global as globl', function (done) { + // runner.run({language: 'arm', + // code: [ + // '.data', + // 'message: .ascii "Tokyo dialect"', + // 'len = . - message', + // '.text', + // '.globl _start', + // '_start:', + // ' mov %r0, $1', + // ' ldr %r1, =message', + // ' ldr %r2, =len', + // ' mov %r7, $4', + // ' swi $0', + // ' mov %r0, $0', + // ' mov %r7, $1', + // ' swi $0' + // ].join('\n')}, + // function (buffer) { + // console.log(buffer); + // expect(buffer.stdout).to.equal('Tokyo dialect'); + // done(); + // }); + // }); + // it('should handle basic code evaluation (with libc)', function (done) { + // runner.run({language: 'arm', + // code: [ + // '.global main', + // 'main:', + // ' push {ip, lr}', + // ' ldr r0, =message', + // ' bl puts', + // ' mov r0, #0', + // ' pop {ip, pc}', + // 'message: .asciz "ARM works with libc, too"' + // ].join('\n')}, + // function (buffer) { + // console.log(buffer); + // expect(buffer.stdout).to.equal('ARM works with libc, too\n'); + // done(); + // }); + // }); + //}); +}); diff --git a/test/runners/bash_spec.js b/test/runners/bash_spec.js new file mode 100644 index 00000000..ba82c309 --- /dev/null +++ b/test/runners/bash_spec.js @@ -0,0 +1,14 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'bash runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'bash', code: 'echo 42'}, function(buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/test/runners/c_spec.js b/test/runners/c_spec.js new file mode 100644 index 00000000..7c67c6c9 --- /dev/null +++ b/test/runners/c_spec.js @@ -0,0 +1,77 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + +describe( 'c runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + var solution = ['#include ', + 'int main() {', + ' printf("I think the next language codewars should support is PL/I. Wikipedia says it\'s still used in production to this day; presumably in nursing homes?");', + '}', + ''].join('\n'); + + runner.run({language: 'c', code: solution}, function(buffer) { + expect(buffer.stdout).to.equal("I think the next language codewars should support is PL/I. Wikipedia says it\'s still used in production to this day; presumably in nursing homes?"); + done(); + }); + }); + it('should handle setup code and imports', function (done) { + runner.run({ + language: 'c', + setup: [ + 'int square(int a) { return a * a ; }' + ].join('\n'), + code: [ + '#include ', + 'int square(int);', + 'int main() {', + ' printf("%i",square(5));', + '}', + ].join('\n') + }, function (buffer) { + expect(buffer.stdout).to.equal('25'); + done(); + }); + }); + describe('codewars test framework', function () { + it('should be able to run a basic test', function (done) { + runner.run({ + language: 'c', + code: [ + 'int square(int a) { return a * a ; }' + ].join('\n'), + fixture: [ + '#include ', + 'int square(int);', + 'int main() {', + ' ASSERT_EQUALS(25,square(5));', + '}' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it('should be able to run a basic test', function (done) { + runner.run({ + language: 'c', + code: [ + 'int square(int a) { return a * a ; }' + ].join('\n'), + fixture: [ + '#include ', + 'int square(int);', + 'int main() {', + ' ASSERT_EQUALS(25,square(5));', + '}' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + }); + }); +}); \ No newline at end of file diff --git a/test/runners/clojure_spec.js b/test/runners/clojure_spec.js new file mode 100644 index 00000000..27565b46 --- /dev/null +++ b/test/runners/clojure_spec.js @@ -0,0 +1,194 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + +describe('clojure runner', function () { + describe('.run', function () { + it('should handle basic code evaluation', function (done) { + runner.run({ + language: 'clojure', + code: '(println "42")' + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + it('should handle running a namespace with imports', function (done) { + runner.run({ + language: 'clojure', + code: [ + '(ns foo (:require [clojure.edn :as edn]))', + '(print (get (edn/read-string "{:code \\"wars\\"}") :code))' + ].join('\n') + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.equal('wars'); + done(); + }); + }); + it('should handle setup code', function (done) { + runner.run({ + language: 'clojure', + code: [ + '(ns foo.code-code (:require [foo.fighters]))', + '(foo.fighters/everlong)' + ].join('\n'), + setup: [ + '(ns foo.fighters)', + '(defn everlong [] (print "Hello, I\'ve waited here for you"))' + ].join('\n') + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.equal('Hello, I\'ve waited here for you'); + done(); + }); + }); + }); + describe('codewars test framework (clojure.test)', function () { + it('should be able to run a basic test', function (done) { + runner.run({ + language: 'clojure', + code: '(ns empty.namespace)', + fixture: [ + '(ns clojure.test.example (:use clojure.test))', + '(deftest add-1-to-1 (testing "arithmetic works" (is (= 2 (+ 1 1)))))' + ].join('\n') + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.contain('add-1-to-1'); + expect(buffer.stdout).to.contain('arithmetic works'); + expect(buffer.stdout).to.contain('Test Passed'); + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + it('should be able to fail', function (done) { + runner.run({ + language: 'clojure', + code: '(ns empty.namespace)', + fixture: [ + '(ns clojure.test.example (:use clojure.test))', + '(deftest sad-path (testing "won\'t work" (is (= 2 1) "bad math")))' + ].join('\n') + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.contain('sad-path'); + expect(buffer.stdout).to.contain('won\'t work'); + expect(buffer.stdout).to.contain('bad math'); + expect(buffer.stdout).to.contain('expected: (= 2 1)'); + expect(buffer.stdout).to.contain('actual: (not (= 2 1))'); + done(); + }); + }); + it('should print', function (done) { + runner.run({ + language: 'clojure', + code: '(ns foo) (defn bar [] (print "yolo") 1)', + fixture: [ + '(ns clojure.test.example (:use clojure.test) (:require [foo]))', + '(deftest printing (testing "foo/bar" (is (= 1 (foo/bar)))))' + ].join('\n') + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.contain('printing'); + expect(buffer.stdout).to.contain('yolofoo/bar'); + expect(buffer.stdout).to.contain('Test Passed'); + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + it('should have an error when there\'s an exception', function (done) { + runner.run({ + language: 'clojure', + code: '(ns foo)', + fixture: [ + '(ns clojure.test.example (:use clojure.test))', + '(deftest exception (testing "1 / 0" (is (= 1 (/ 1 0)))))' + ].join('\n') + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.contain('exception'); + expect(buffer.stdout).to.contain('1 / 0'); + expect(buffer.stdout).to.contain(''); + expect(buffer.stdout).to.contain('expected: (= 1 (/ 1 0))'); + expect(buffer.stdout).to.contain('actual: java.lang.ArithmeticException'); + done(); + }); + }); + it('should handle a typical kata', function (done) { + runner.run({ + language: 'clojure', + code: [ + '(ns last (:refer-clojure :exclude [last]))', + '(defn last [lst] (reduce #(do %2) lst))' + ].join('\n'), + fixture: [ + '(ns last-test', + ' (:require [clojure.test :refer :all]', + ' [last :as last])', + ' (:refer-clojure :exclude [last]))', + '(defn- last [lst] (reduce #(do %2) lst))', + '(with-redefs', + ' [clojure.core/last', + ' (fn [& _] ', + ' (throw (Exception. "Sorry! The last built-in is disabled for this kata!")))', + ' clojure.core/take-last', + ' (fn [& _] ', + ' (throw (Exception. "Sorry! The take-last built-in is disabled for this kata!")))]', + ' (deftest test-last-function', + ' (let [input1 [1 9 13 1 99 9 9 13]', + ' input2 (repeatedly (+ 5 (rand-int 10)) #(rand-int 100))', + ' input3 "foop"]', + ' (testing (prn-str input1)', + ' (is (= (last/last input1) 13)))', + ' (testing (prn-str input2)', + ' (is (= (last/last input2) (last input2))))', + ' (testing (str "String: " (prn-str input3))', + ' (is (= (last/last input3) (last input3)))))))' + + ].join('\n') + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.contain('test-last-function'); + expect(buffer.stdout).to.contain('[1 9 13 1 99 9 9 13]'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it('should fail fast', function (done) { + runner.run({ + language: 'clojure', + code: '(ns empty.namespace)', + fixture: [ + '(ns clojure.test.example (:use clojure.test))', + '(deftest fast-fail', + ' (testing "quit early" (is (= 2 1) "not true"))', + ' (testing "shouldn\'t happen" (is (= 3 1) "can\'t get here"))', + ')' + ].join('\n') + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.contain('fast-fail'); + expect(buffer.stdout).to.contain('quit early'); + expect(buffer.stdout).to.contain('not true'); + expect(buffer.stdout).to.contain('expected: (= 2 1)'); + expect(buffer.stdout).to.contain('actual: (not (= 2 1))'); + expect(buffer.stdout).to.not.contain("shouldn't happen"); + expect(buffer.stdout).to.not.contain("can't get here"); + done(); + }); + }); + }); + describe('potpourri', function () { + it('test framework should not think HOME is /root', function (done) { + runner.run({ + language: 'clojure', + code: '(print (System/getenv "HOME"))' + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.not.equal('/root'); + done(); + }); + }); + }); +}); diff --git a/test/runners/coffeescript_spec.js b/test/runners/coffeescript_spec.js new file mode 100644 index 00000000..25ad4a7c --- /dev/null +++ b/test/runners/coffeescript_spec.js @@ -0,0 +1,46 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'coffeescript runner', function(){ + describe( '.run', function(){ + runner.assertCodeExamples('coffeescript'); + + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'coffeescript', code: 'console.log 42'}, function(buffer) { + expect(buffer.stdout ).to.equal('42\n'); + done(); + }); + }); + + describe('cw-2', function() { + it( 'should handle a basic assertion', function(done){ + runner.run({language: 'coffeescript', code: 'a = 1', fixture: 'Test.expect a == 1', testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout ).to.equal('Test Passed\n'); + done(); + }); + }); + }); + + it( 'should handle comments as fixture', function(done){ + runner.run({language: 'coffeescript', code: 'console.log(42)', fixture: '#', testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout ).to.equal('42\n'); + done(); + }); + }); + + it( 'should handle a basic failed test', function(done){ + runner.run({language: 'coffeescript', code: 'a = 1', fixture: 'Test.expect(a == 2)', testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout ).to.equal('Value is not what was expected\n'); + done(); + }); + }); + + it( 'should handle logging objects', function(done){ + runner.run({language: 'coffeescript', code:'console.log {a: 1}', testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout ).to.equal('{ a: 1 }\n'); + done(); + }); + }); + }); +}); diff --git a/test/runners/cpp_spec.js b/test/runners/cpp_spec.js new file mode 100644 index 00000000..bbd2034c --- /dev/null +++ b/test/runners/cpp_spec.js @@ -0,0 +1,51 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + +describe('cpp runner', function () { + describe('.run', function () { + it('should handle basic code evaluation', function (done) { + var code = [ + '#include ', + 'int main()', + '{ std::cout << "\\\"Within C++, there is a much smaller and cleaner language struggling to get out.\\\" - Bjarn Stroustrup"; }' + ].join('\n'); + + runner.run({language: 'cpp', code: code}, function (buffer) { + expect(buffer.stdout).to.equal("\"Within C++, there is a much smaller and cleaner language struggling to get out.\" - Bjarn Stroustrup"); + done(); + }); + }); + it('should handle C++11 nonsense', function (done) { + var code = [ + '#include "stdio.h"', + 'int main() {', + ' auto f = []{ printf("Finally, lambdas in C++. Now if we had typeclasses, purity and laziness we might have a reasonable functional programming language."); };', + ' f();', + '}' + ].join('\n'); + + runner.run({language: 'cpp', code: code}, function (buffer) { + expect(buffer.stdout).to.equal("Finally, lambdas in C++. Now if we had typeclasses, purity and laziness we might have a reasonable functional programming language."); + done(); + }); + }); + it('should handle setup code and imports', function (done) { + runner.run({ + language: 'cpp', + setup: [ + 'int square(int a) { return a * a ; }' + ].join('\n'), + code: [ + '#include ', + 'int square(int);', + 'int main() {', + ' std::cout << square(6);', + '}', + ].join('\n') + }, function (buffer) { + expect(buffer.stdout).to.equal('36'); + done(); + }); + }); + }); +}); diff --git a/test/runners/csharp_spec.js b/test/runners/csharp_spec.js new file mode 100644 index 00000000..8d2f46b3 --- /dev/null +++ b/test/runners/csharp_spec.js @@ -0,0 +1,56 @@ +var expect = require('chai').expect, + runner = require('../runner'), + fs = require('fs'); + +describe( 'c# runner', function() { + describe( '.run', function() { + runner.assertCodeExamples('csharp'); + + it('should handle basic code evaluation', function (done) { + runner.run({language: 'csharp', + code: 'public class Hello1 { public static void Main() { System.Console.WriteLine("Hello, World!");}}' + }, function (buffer) + { + //console.log(buffer); + expect(buffer.stdout).to.contain('Hello, World!\n'); + done(); + }); + }); + + it('should handle basic nunit tests', function (done) { + runner.run({ language: 'csharp', + code: 'namespace Bank { using System; public class Account { private decimal balance; public void Deposit(decimal amount) { Console.WriteLine("slorgs"); balance += amount; } public void Withdraw(decimal amount) { balance -= amount; } public void TransferFunds(Account destination, decimal amount) { } public decimal Balance { get { return balance; } } } } ', + fixture: 'namespace Bank { using NUnit.Framework; [TestFixture] public class AccountTest { [Test] public void TransferFunds() { Account source = new Account(); source.Deposit(200m); Account destination = new Account(); destination.Deposit(150m); source.TransferFunds(destination, 100m); Assert.AreEqual(250m, destination.Balance); Assert.AreEqual(100m, source.Balance); } [Test] public void CheckFunds() { Account source = new Account(); source.Deposit(200m); Account destination = new Account(); destination.Deposit(150m); Assert.AreEqual(200m, source.Balance); } } } ' }, function (buffer) + { + //console.log(buffer); + expect(buffer.stdout).to.contain("slorgs"); + expect(buffer.stdout).to.contain(""); + expect(buffer.stdout).to.contain(""); + expect(buffer.stdout).to.contain(""); + expect(buffer.stdout).to.contain(""); + done(); + }); + }); + + it('should handle bad code', function (done) { + runner.run({ language: 'csharp', + code: 'namespace Bank { using System; using System.Drawing; public class Account { private decimal balance; public void Deposit(decimal amount) { Console.WriteLine("slorgs"); balance += amount; } public void Withdraw(decimal amount) { balance -= Amount; } public void TransferFunds(Account destination, decimal amount) { } public decimal Balance { get { return balance; } } } } ', + fixture: 'namespace Bank { using NUnit.Framework; [TestFixture] public class AccountTest { [Test] public void TransferFunds() { Account source = new Account(); source.Deposit(200m); Account destination = new Account(); destination.Deposit(150m); source.TransferFunds(destination, 100m); Assert.AreEqual(250m, destination.Balance); Assert.AreEqual(100m, source.Balance); } [Test] public void CheckFunds() { Account source = new Account(); source.Deposit(200m); Account destination = new Account(); destination.Deposit(150m); Assert.AreEqual(200m, source.Balance); } } } ' }, function (buffer) + { + //console.log(buffer); + expect(buffer.stdout).to.not.contain("lib/runners/csharp.js"); + done(); + }); + }); + + it('should handle partially passed code', function (done) { + runner.run({ language: 'csharp', + code: 'using System; public class Account { } ', + fixture: 'using NUnit.Framework; [TestFixture] public class AccountTest { [Test] public void A() { Assert.AreEqual(1, 1); } [Test] public void Z() { Assert.AreEqual(1, 1); throw new System.Exception(); } } ' }, function (buffer) + { + expect(buffer.stdout).to.contain(""); + done(); + }); + }); + }); +}); diff --git a/test/runners/elixir_spec.js b/test/runners/elixir_spec.js new file mode 100644 index 00000000..f8bd6cf4 --- /dev/null +++ b/test/runners/elixir_spec.js @@ -0,0 +1,14 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'elixir runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'elixir', code: 'IO.puts "This was real. And it was me. I had lived that life, and I had died that death. I was staring at the very end of me. ― Hilary Duff, Elixir (2010)"'}, function(buffer) { + expect(buffer.stdout).to.contain('This was real'); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/test/runners/erlang_spec.js b/test/runners/erlang_spec.js new file mode 100644 index 00000000..8a54d448 --- /dev/null +++ b/test/runners/erlang_spec.js @@ -0,0 +1,60 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + +describe('erlang runner', function () { + describe('.run', function () { + it('should handle setup code and imports', function (done) { + runner.run({ + language: 'erlang', + setup: [ + '-module(foo).', + '-export([bar/0]).', + 'bar() -> io:format("baz").' + ].join('\n'), + code: [ + 'foo:bar(), init:stop().' + ].join('\n') + }, function (buffer) { + expect(buffer.stdout).to.equal('baz'); + done(); + }); + }); + it('should handle basic code evaluation', function (done) { + runner.run({ + language: 'erlang', + code: 'io:fwrite("42\n"), init:stop().' + }, function (buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + it('should be running the most recent erlang version', function (done) { + runner.run({ + language: 'erlang', + code: 'io:fwrite(erlang:system_info(otp_release)), init:stop().' + }, function (buffer) { + expect(buffer.stdout).to.equal('18'); + done(); + }); + }); + }); + describe('codewars test framework (eunit)', function () { + it('should be able to run a basic test', function (done) { + runner.run({ + language: 'erlang', + code: [ + '-module(solution).', + '-export([foo/0]).', + 'foo() -> "bar".', + ].join('\n'), + fixture: [ + 'foo_test() -> "bar" = solution:foo().' + ].join('\n') + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.contain('Test passed.'); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/test/runners/fsharp_spec.js b/test/runners/fsharp_spec.js new file mode 100644 index 00000000..4d6951db --- /dev/null +++ b/test/runners/fsharp_spec.js @@ -0,0 +1,14 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'fsharp runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'fsharp', code: 'printfn "42"'}, function(buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + }); +}); diff --git a/test/runners/gas_spec.js b/test/runners/gas_spec.js new file mode 100644 index 00000000..acbcd2fb --- /dev/null +++ b/test/runners/gas_spec.js @@ -0,0 +1,47 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe('gas runner', function () { + describe('.run', function () { + it('should handle basic code evaluation (no libc)', function (done) { + runner.run({language: 'gas', + code: [ + ' .global _start', + ' .text', + '_start:', + ' mov $1, %rax', + ' mov $1, %rdi', + ' mov $message, %rsi', + ' mov $8, %rdx', + ' syscall', + ' mov $60, %rax', + ' xor %rdi, %rdi', + ' syscall', + 'message:', + ' .ascii "PV = nRT"' + ].join('\n')}, + function (buffer) { + expect(buffer.stdout).to.equal('PV = nRT'); + done(); + }); + }); + it('should handle basic code evaluation (with libc)', function (done) { + runner.run({language: 'gas', + code: [ + ' .global main', + ' .text', + 'main:', + ' mov $message, %rdi', + ' call puts', + ' ret', + 'message:', + ' .asciz "Gas works with libc, too"' + ].join('\n')}, + function (buffer) { + expect(buffer.stdout).to.equal('Gas works with libc, too\n'); + done(); + }); + }); + }); +}); diff --git a/test/runners/go_spec.js b/test/runners/go_spec.js new file mode 100644 index 00000000..52f56dd5 --- /dev/null +++ b/test/runners/go_spec.js @@ -0,0 +1,20 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + +describe( 'go runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + var solution = ['package main', + 'import "fmt"', + 'func main() {', + ' fmt.Println("42")', + '}', + ''].join('\n'); + + runner.run({language: 'go', code: solution}, function(buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/test/runners/groovy_spec.js b/test/runners/groovy_spec.js new file mode 100644 index 00000000..b9da590c --- /dev/null +++ b/test/runners/groovy_spec.js @@ -0,0 +1,14 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'groovy runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'groovy', code: "println '42'"}, function(buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + }); +}); diff --git a/test/runners/haskell_spec.js b/test/runners/haskell_spec.js new file mode 100644 index 00000000..678c6d77 --- /dev/null +++ b/test/runners/haskell_spec.js @@ -0,0 +1,626 @@ +var expect = require('chai').expect, + runner = require('../runner'); + +describe('haskell runner', function () { + describe('.run', function () { + runner.assertCodeExamples('haskell'); + + it('should handle basic code evaluation', function (done) { + runner.run({language: 'haskell', + code: 'main = putStrLn "42"' + }, function (buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + it('should handle running a module with imports', function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module Foo where', + 'import Control.Monad (filterM)', + 'powerset :: [a] -> [[a]]', + 'powerset = filterM (const [True,False])', + 'main :: IO ()', + 'main = putStr $ show $ powerset [1..3]' + ].join('\n') + }, function (buffer) { + expect(buffer.stdout).to.equal('[[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]]'); + done(); + }); + }); + it('should handle setup code', function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module Foo where', + 'import Foo.Utils as Setup (powerset)', + 'main :: IO ()', + 'main = putStr $ show $ Setup.powerset [1..3]' + ].join('\n'), + setup: [ + 'module Foo.Utils (powerset) where', + 'import Control.Monad (filterM)', + 'powerset :: [a] -> [[a]]', + 'powerset = filterM (const [True,False])' + ].join('\n') + }, function (buffer) { + expect(buffer.stdout).to.equal('[[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]]'); + done(); + }); + }); + it('should handle skipping module declaration', function (done) { + runner.run({ + language: 'haskell', + code: [ + 'import Foo.Utils as Setup (powerset)', + 'main :: IO ()', + 'main = putStr $ show $ Setup.powerset [1..3]' + ].join('\n'), + setup: [ + 'module Foo.Utils (powerset) where', + 'import Control.Monad (filterM)', + 'powerset :: [a] -> [[a]]', + 'powerset = filterM (const [True,False])' + ].join('\n') + }, function (buffer) { + expect(buffer.stdout).to.equal('[[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]]'); + done(); + }); + }); + }); + + describe('codewars test framework (hspec)', function () { + it('should be able to run a basic test', function (done) { + runner.run({ + language: 'haskell', + code: 'module Foo where', + fixture: [ + 'module Basic.Test where', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Prelude.head" $ do', + ' it "returns the first element of a list" $ do', + ' head [23 ..] `shouldBe` (23 :: Int)' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Prelude.head'); + expect(buffer.stdout).to.contain('returns the first element of a list'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it("should work even if test module name isn't specified", function (done) { + runner.run({ + language: 'haskell', + code: 'module Foo where', + fixture: [ + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Prelude.head" $ do', + ' it "returns the first element of a list" $ do', + ' head [23 ..] `shouldBe` (23 :: Int)' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Prelude.head'); + expect(buffer.stdout).to.contain('returns the first element of a list'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it("should work be able to import the code", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module CodeWars.Solution where', + 'x :: Int', + 'x = 1' + ].join('\n'), + fixture: [ + 'import CodeWars.Solution (x)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "x" $ do', + ' it "is 1" $ do', + ' x `shouldBe` (1 :: Int)' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('x'); + expect(buffer.stdout).to.contain('is 1'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it("should be able to import the code even when code module name is unspecified (the default is module name for the code is 'Main')", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'x :: Int', + 'x = 1' + ].join('\n'), + fixture: [ + 'module Basic.Test where', + 'import Main (x)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "x" $ do', + ' it "is 1" $ do', + ' x `shouldBe` (1 :: Int)' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('x'); + expect(buffer.stdout).to.contain('is 1'); + done(); + }); + }); + it("should report when something is wrong", function (done) { + runner.run({ + language: 'haskell', + code: 'x = 1', + fixture: [ + 'module Sad.Path.Test where', + 'import Test.Hspec', + 'import Main (x)', + 'main = hspec $ do', + ' describe "x" $ do', + ' it "is 2" $ do', + ' x `shouldBe` 2' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('x'); + expect(buffer.stdout).to.contain('is 2'); + expect(buffer.stdout).to.contain('expected: 2'); + expect(buffer.stdout).to.contain('but got: 1'); + done(); + }); + }); + it("should print as a side effect", function (done) { + runner.run({ + language: 'haskell', + code: 'x = do putStrLn "Test" ; return 1', + fixture: [ + 'module PrintEffect where', + 'import Test.Hspec', + 'import Main (x)', + 'main = hspec $ do', + ' describe "x" $ do', + ' it "prints and returns 1" $ do', + ' xval <- x', + ' xval `shouldBe` 1' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('x'); + expect(buffer.stdout).to.contain('Test\nprints and returns 1'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it("should fail fast", function (done) { + runner.run({ + language: 'haskell', + code: 'x = 1', + fixture: [ + 'module Fast.Fail.Test where', + 'import Test.Hspec', + 'import Main (x)', + 'main = hspec $ do', + ' describe "x" $ do', + ' it "is not really 2" $ do', + ' x `shouldBe` 2', + ' it "should never get here" $ do', + ' x `shouldBe` 3' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('x'); + expect(buffer.stdout).to.contain('is not really 2'); + expect(buffer.stdout).to.contain('expected: 2'); + expect(buffer.stdout).to.contain('but got: 1'); + expect(buffer.stdout).to.not.contain('should never get here'); + expect(buffer.stdout).to.not.contain('expected: 3 but got: 1'); + done(); + }); + }); + it("should report exceptions as errors", function (done) { + runner.run({ + language: 'haskell', + code: 'x = head []', + fixture: [ + 'module Fast.Fail.Test where', + 'import Test.Hspec', + 'import Main (x)', + 'main = hspec $ do', + ' describe "exception" $ do', + ' it "should throw" $ do', + ' x `shouldBe` 2' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('exception'); + expect(buffer.stdout).to.contain('should throw'); + expect(buffer.stdout).to.contain('ErrorCall (Prelude.head: empty list)'); + done(); + }); + }); + it("should be able to hide a module from the code code", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module CodeWars.Solution where', + 'x :: Int', + 'x = 1' + ].join('\n'), + fixture: [ + 'import CodeWars.Solution (x)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Testing BlackListing a module (happy path)" $ do', + ' it "Data.Monoid is hidden" $ do', + ' hidden $ Module \"Data.Monoid\"' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Data.Monoid is hidden'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it("should fail if a module which is supposed to be hidden is not", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module CodeWars.Solution where', + 'import Data.Monoid', + 'x :: Int', + 'x = 1' + ].join('\n'), + fixture: [ + 'import CodeWars.Solution (x)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Testing BlackListing a module (sad path)" $ do', + ' it "Data.Monoid is not hidden!" $ do', + ' hidden $ Module \"Data.Monoid\"' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Data.Monoid is not hidden!'); + expect(buffer.stdout).to.contain('Import declarations must hide Data.Monoid'); + done(); + }); + }); + it("should recognize when things are hidden from a particular module", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module CodeWars.Solution where', + 'import Data.List hiding (reverse)', + 'reverse :: [a] -> [a]', + 'reverse = foldl (flip (:)) []' + ].join('\n'), + fixture: [ + 'import CodeWars.Solution (reverse)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Testing BlackListing a particular function (happy path)" $ do', + ' it "Data.List.reverse is hidden" $ do', + ' hidden $ FromModule \"Data.List\" \"reverse\"' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Data.List.reverse is hidden'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it("should fail when a symbol from a module that ought to be hidden is not", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module CodeWars.Solution where', + 'import Data.List (intercalate)', + 'reverse :: [a] -> [a]', + 'reverse = foldl (flip (:)) []' + ].join('\n'), + fixture: [ + 'import CodeWars.Solution (reverse)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Testing BlackListing a particular function (sad path)" $ do', + ' it "Data.List.intercalate is not hidden!" $ do', + ' hidden $ FromModule \"Data.List\" \"intercalate\"' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Data.List.intercalate is not hidden!'); + expect(buffer.stdout).to.contain('Import declarations must hide Data.List.intercalate'); + done(); + }); + }); + it("should fail when a symbol from a module that ought to be hidden is not because the whole module was imported", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module CodeWars.Solution where', + 'import Data.List', + 'reverse :: [a] -> [a]', + 'reverse = foldl (flip (:)) []' + ].join('\n'), + fixture: [ + 'import CodeWars.Solution (reverse)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Testing BlackListing a particular function (sad path)" $ do', + ' it "Data.List.intercalate is not hidden, because the whole module was imported!" $ do', + ' hidden $ FromModule \"Data.List\" \"intercalate\"' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Data.List.intercalate is not hidden, because the whole module was imported!'); + expect(buffer.stdout).to.contain('Import declarations must hide Data.List.intercalate'); + done(); + }); + }); + it("should fail when a symbol from a module that ought to be hidden is not because it wasn't hidden properly", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module CodeWars.Solution where', + 'import Data.List hiding (reverse)', + 'import Control.Monad hiding ((=<<))', + 'reverse :: [a] -> [a]', + 'reverse = foldl (flip (:)) []' + ].join('\n'), + fixture: [ + 'import CodeWars.Solution (reverse)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Testing BlackListing a particular function (sad path)" $ do', + ' it "Control.Monad.>=> is not hidden, because we forgot!" $ do', + ' hidden $ FromModule \"Control.Monad\" \">=>\"' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Control.Monad.>=> is not hidden, because we forgot!'); + expect(buffer.stdout).to.contain('Import declarations must hide Control.Monad.>=>'); + done(); + }); + }); + it("should fail when a function is hidden once in a module, but later imported", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module CodeWars.Solution where', + 'import Data.List hiding (reverse)', + 'import Control.Monad hiding ((>=>))', + 'import Control.Monad ((>=>))', + 'reverse :: [a] -> [a]', + 'reverse = foldl (flip (:)) []' + ].join('\n'), + fixture: [ + 'import CodeWars.Solution (reverse)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Testing BlackListing a particular function (sad path)" $ do', + ' it "Control.Monad.>=> is not hidden, because we imported it after all!" $ do', + ' hidden $ FromModule \"Control.Monad\" \">=>\"' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Control.Monad.>=> is not hidden, because we imported it after all!'); + expect(buffer.stdout).to.contain('Import declarations must hide Control.Monad.>=>'); + done(); + }); + }); + it("should fail when a function is hidden once in a module, but later imported as qualified", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module CodeWars.Solution where', + 'import Data.List hiding (reverse)', + 'import Control.Monad hiding ((>=>))', + 'import qualified Control.Monad as WhatMonadRhymesWith', + 'reverse :: [a] -> [a]', + 'reverse = foldl (flip (:)) []' + ].join('\n'), + fixture: [ + 'import CodeWars.Solution (reverse)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Testing BlackListing a particular function (sad path)" $ do', + ' it "Control.Monad.>=> is not hidden, because we imported Control.Monad qualified!" $ do', + ' hidden $ FromModule \"Control.Monad\" \">=>\"' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Control.Monad.>=> is not hidden, because we imported Control.Monad qualified!'); + expect(buffer.stdout).to.contain('Import declarations must hide Control.Monad.>=>'); + done(); + }); + }); + it("should be able to hide Prelude functions", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module CodeWars.Solution where', + 'import Prelude hiding (reverse)', + 'reverse :: [a] -> [a]', + 'reverse = foldl (flip (:)) []' + ].join('\n'), + fixture: [ + 'import CodeWars.Solution (reverse)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Testing BlackListing a particular function from Prelude (happy path)" $ do', + ' it "Prelude.reverse is hidden" $ do', + ' hidden $ FromModule \"Prelude\" \"reverse\"' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Prelude.reverse is hidden'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it("should detect when we failed to hide a Prelude function", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'module CodeWars.Solution where', + 'reverse :: [a] -> [a]', + 'reverse = foldl (flip (:)) []' + ].join('\n'), + fixture: [ + 'import CodeWars.Solution (reverse)', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Testing BlackListing a particular function from Prelude (sad path)" $ do', + ' it "Prelude.reverse is NOT hidden!" $ do', + ' hidden $ FromModule \"Prelude\" \"reverse\"' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Prelude.reverse is NOT hidden!'); + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + it("should detect when we hid a Prelude function, even when we forgot to say our module name", function (done) { + runner.run({ + language: 'haskell', + code: [ + 'import Prelude hiding (reverse)', + 'reverse :: [a] -> [a]', + 'reverse = foldl (flip (:)) []' + ].join('\n'), + fixture: [ + 'module Default.Module.Name.Is.Main.Test where', + 'import qualified Main', + 'import Test.Hspec', + 'main :: IO ()', + 'main = hspec $ do', + ' describe "Testing BlackListing a particular function from Prelude, when module name is not specified (happy path)" $ do', + ' it "Prelude.reverse is indeed hidden" $ do', + ' hidden [FromModule \"Prelude\" \"reverse\"]', + ' describe "Main.reverse reverses a thing" $ do', + ' it "Main.reverse is functionally the same as Prelude.reverse" $ do', + ' let testInput = [1..10]', + ' Main.reverse testInput `shouldBe` reverse testInput', + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Prelude.reverse is indeed hidden'); + expect(buffer.stdout).to.contain('Main.reverse is functionally the same as Prelude.reverse'); + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + }); + describe('haskell', function () { + it('can handle SQLite interaction', function (done) { + runner.run({language: 'haskell', + code: [ + '{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-}', + '{-# LANGUAGE OverloadedStrings, GADTs, FlexibleContexts, MultiParamTypeClasses #-}', + '{-# LANGUAGE NoMonomorphismRestriction, GeneralizedNewtypeDeriving #-}', + 'module Movies where', + 'import Database.Persist (insertMany)', + 'import Database.Persist.Sqlite (runSqlite, runMigration)', + 'import Database.Persist.TH (mkPersist, mkMigrate, persistUpperCase, share, sqlSettings)', + 'share [mkPersist sqlSettings, mkMigrate "migrateTables"] [persistUpperCase|', + 'Movies', + ' title String', + ' year Int', + ' rating Int', + ' deriving Eq Show', + '|]', + 'mkMoviesDB :: IO ()', + 'mkMoviesDB = runSqlite "/tmp/movies.db" $ do', + ' runMigration migrateTables', + ' insertMany', + ' [ Movies "Rise of the Planet of the Apes" 2011 77', + ' , Movies "Dawn of the Planet of the Apes" 2014 91', + ' , Movies "Alien" 1979 97', + ' , Movies "Aliens" 1986 98', + ' , Movies "Mad Max" 1979 95', + ' , Movies "Mad Max 2: The Road Warrior" 1981 100', + ' ]', + ' return ()' + ].join('\n'), + fixture: [ + '{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-}', + '{-# LANGUAGE OverloadedStrings, GADTs, FlexibleContexts #-}', + '{-# LANGUAGE NoMonomorphismRestriction #-}', + 'import Test.Hspec', + 'import Database.Persist', + 'import Control.Monad.IO.Class (MonadIO(liftIO))', + 'import Database.Persist.Sqlite (runSqlite)', + 'import Database.Persist.Sql (rawQuery)', + 'import Data.Conduit (($$), (=$))', + 'import Data.Conduit.List as CL', + 'import Data.Text (pack, unpack)', + 'import Movies (mkMoviesDB)', + 'import Control.Monad (when)', + 'import System.Posix.Files (fileExist)', + 'import System.Directory (removeFile)', + + 'data Movie = Movie String Integer Integer deriving (Eq, Show)', + + 'moviesDBFileName :: String', + 'moviesDBFileName = "/tmp/movies.db"', + + 'getMovies :: IO [Movie]', + 'getMovies = runSqlite (pack moviesDBFileName) $ do', + ' rawQuery "select Title, Year, Rating from Movies" [] $$ CL.map toMovie =$ consume', + ' where', + ' toMovie [PersistText title, PersistInt64 year, PersistInt64 rating] =', + ' Movie (unpack title) (toInteger year) (toInteger rating)', + + 'deleteIfExists :: String -> IO ()', + 'deleteIfExists fileName = do', + ' exists <- fileExist fileName', + ' when exists $ removeFile fileName', + + 'main :: IO ()', + 'main = hspec $ do', + ' describe "/tmp/movies.db" ', + ' $ before (deleteIfExists moviesDBFileName)', + ' $ after (deleteIfExists moviesDBFileName)', + ' $ do', + ' it "contains the movies we expect" $ do', + ' mkMoviesDB', + ' movies <- getMovies', + ' liftIO $ movies `shouldBe` [ Movie "Rise of the Planet of the Apes" 2011 77', + ' , Movie "Dawn of the Planet of the Apes" 2014 91', + ' , Movie "Alien" 1979 97,Movie "Aliens" 1986 98', + ' , Movie "Mad Max" 1979 95', + ' , Movie "Mad Max 2: The Road Warrior" 1981 100]' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + }); +}); diff --git a/test/runners/java_spec.js b/test/runners/java_spec.js new file mode 100644 index 00000000..8c4e573e --- /dev/null +++ b/test/runners/java_spec.js @@ -0,0 +1,67 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe('java runner', function () { + describe('.run', function () { + it('should handle basic code evaluation', function (done) { + runner.run({language: 'java', + code: [ + 'class Solution {', + ' static void main(String[] args){', + ' System.out.println("42");', + ' }', + '}'].join('\n') + }, function (buffer) { + expect(buffer.stdout).to.contain('42\n'); + done(); + }); + }); + }); + describe('junit', function () { + it('should handle basic junit tests', function (done) { + runner.run({language: 'java', + code: 'public class Solution {\n' + + ' public Solution(){}\n' + + ' public int testthing(){return 3;}\n' + + '}\n', + fixture: 'import static org.junit.Assert.assertEquals;\n' + + 'import org.junit.Test;\n' + + 'import org.junit.runners.JUnit4;\n' + + 'public class TestFixture {\n' + + ' public TestFixture(){}' + + ' @Test\n' + + ' public void myTestFunction(){\n' + + ' Solution s = new Solution();\n' + + ' assertEquals("wow", 3, s.testthing());\n' + + ' System.out.println("test out");\n' + + '}}' + }, function (buffer) { + expect(buffer.stdout).to.contain('myTestFunction(TestFixture)<:LF:>\ntest out\nTest Passed<:LF:>\n'); + done(); + }); + }); + it('should handle junit tests failing', function (done) { + runner.run({language: 'java', + code: 'public class Solution {\n' + + ' public Solution(){}\n' + + ' public int testthing(){return 3;}\n' + + '}\n', + fixture: 'import static org.junit.Assert.assertEquals;\n' + + 'import org.junit.Test;\n' + + 'import org.junit.runners.JUnit4;\n' + + 'public class TestFixture {\n' + + ' public TestFixture(){}' + + ' @Test\n' + + ' public void myTestFunction(){\n' + + ' Solution s = new Solution();\n' + + ' assertEquals("Failed Message", 5, s.testthing());\n' + + ' System.out.println("test out");\n' + + '}}' + }, function (buffer) { + expect(buffer.stdout).to.contain('myTestFunction(TestFixture)<:LF:>\nFailed Message expected:<5> but was:<3><:LF:>\n'); + done(); + }); + }); + }); +}); diff --git a/test/runners/javascript_spec.js b/test/runners/javascript_spec.js new file mode 100644 index 00000000..79d34e20 --- /dev/null +++ b/test/runners/javascript_spec.js @@ -0,0 +1,220 @@ +var expect = require('chai').expect, + runner = require('../runner'); + +describe( 'javascript runner', function(){ + describe( '.run', function(){ + runner.assertCodeExamples('javascript'); + + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'javascript', code: 'console.log(42)'}, function(buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + it( 'should handle es6 code evaluation', function(done){ + runner.run({language: 'javascript', code: 'let a = 42; console.log(42);'}, function(buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + + it( 'should handle bad syntax', function(done){ + runner.run({language: 'javascript', code: 'var a = function(){returns 42;};\na();'}, function(buffer) { + expect(buffer.stderr).to.contain('kata: Unexpected token:27'); + done(); + }); + }); + it( 'should handle react syntax', function(done){ + runner.run({language: 'javascript', code: 'var React = require("react");var ReactDOM = require("react-dom/server");var div =

Test

;console.log(ReactDOM.renderToStaticMarkup(div));'}, function(buffer) { + expect(buffer.stdout).to.contain('

Test

'); + done(); + }); + }); + it( 'should load libraries', function(done){ + runner.run({language: 'javascript', code: 'var _ = require("lodash");console.log(_.map([1], n => n * 2));'}, function(buffer) { + expect(buffer.stdout).to.contain('[ 2 ]'); + done(); + }); + }); + it( 'should handle stderr', function(done){ + runner.run({language: 'javascript', code: 'console.error("404 Not Found")'}, function(buffer) { + expect(buffer.stderr).to.equal('404 Not Found\n'); + done(); + }); + }); + it( 'should handle stdout and stderr', function(done){ + runner.run({language: 'javascript', code: 'console.log("stdout"); console.error("stderr")'}, function(buffer) { + expect(buffer.stdout).to.equal('stdout\n'); + expect(buffer.stderr).to.equal('stderr\n'); + done(); + }); + }); + + describe('mocha bdd', function() { + it( 'should handle outputting objects', function(done){ + runner.run({ + language: 'javascript', + code: 'var a = {b: 2};console.log(this);', + fixture: 'var assert = require("chai").assert;describe("test", function(){it("should be 2", function(){assert.equal(2, a.b);})});', + testFramework: 'mocha_bdd'}, + function(buffer) { + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + it( 'should handle failures', function(done){ + runner.run({ + language: 'javascript', + code: 'a = {b: 2};', + fixture: 'var assert = require("chai").assert;describe("test", function(){describe("failures", function(){it("should be 1", function(){assert.equal(1, a.b);})})});', + testFramework: 'mocha_bdd'}, + function(buffer) { + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + it( 'should handle errors', function(done){ + runner.run({ + language: 'javascript', + code: 'a = {b: 2};', + fixture: 'describe("test", function(){describe("failures", function(){it("should be 1", function(){throw new Error("test error");})})});', + testFramework: 'mocha_bdd'}, + function(buffer) { + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + }); + + describe('mocha tdd', function() { + it( 'should handle outputting objects', function(done){ + runner.run({ + language: 'javascript', + code: 'var a = {b: 2};console.log(this);', + fixture: 'var assert = require("chai").assert;suite("test", function(){test("should be 2", function(){assert.equal(2, a.b);})});', + testFramework: 'mocha_tdd'}, + function(buffer) { + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + it( 'should handle failures', function(done){ + runner.run({ + language: 'javascript', + code: 'a = {b: 2};', + fixture: 'var assert = require("assert"); suite("test", function(){suite("failures", function(){test("should be 1", function(){assert.equal(1, a.b);})})});', + testFramework: 'mocha_tdd'}, + function(buffer) { + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + it( 'should handle errors', function(done){ + runner.run({ + language: 'javascript', + code: 'a = {b: 2};', + fixture: 'suite("test", function(){suite("failures", function(){test("should be 1", function(){throw new Error("test error");})})});', + testFramework: 'mocha_tdd'}, + function(buffer) { + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + }); + + describe('cw-2', function() { + it( 'should handle outputting objects', function(done){ + runner.run({language: 'javascript', code: 'a = {b: 2};', fixture: 'Test.expect(false, a);', testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout).to.contain('{ b: 2 }'); + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + + it('should handle a basic assertion', function(done){ + runner.run({language: 'javascript', code: 'a = 1', fixture: 'Test.expect(a == 1);', testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout).to.equal('Test Passed\n'); + done(); + }); + }); + + it('should handle comments as fixture', function(done){ + runner.run({language: 'javascript', code: 'console.log(42)', fixture: '//', testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + + it('should handle a basic failed test', function(done){ + runner.run({language: 'javascript', code: 'a = 1', fixture: 'Test.expect(a == 2)', testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout).to.equal('Value is not what was expected\n'); + done(); + }); + }); + + it('should handle logging objects', function(done){ + runner.run({language: 'javascript', code:'console.log({a: 1});', testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout).to.equal('{ a: 1 }\n'); + done(); + }); + }); + + describe('error handling', function() { + it( 'should handle a mix of failures and successes', function(done) { + runner.run({language: 'javascript', + code:'var a = 1', + fixture: 'describe("test", function(){\n' + + 'it("test1", function(){ Test.expect(false) });' + + 'it("test2", function(){ Test.expect(true)});})', + testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout).to.contain('Value is not what was expected'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it('should gracefully handle custom errors', function(done) { + runner.run({language: 'javascript', + code:'var a = 1', + fixture: 'describe("test", function(){\n' + + 'it("test1", function(){ throw "boom!" });' + + 'it("test2", function(){ Test.expect(true)});})', + testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout).to.contain(''); + expect(buffer.stdout).to.contain('boom!'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it('should gracefully handle reference errors', function(done) { + runner.run({language: 'javascript', + code:'var a = 1', + fixture: 'describe("test", function(){\n' + + 'it("test1", function(){ b.test() });' + + 'it("test2", function(){ Test.expect(true)});})', + testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout).to.contain(''); + expect(buffer.stdout).to.contain('<:LF:>'); + expect(buffer.stdout).to.contain('ReferenceError:'); + expect(buffer.stdout).to.not.contain('[eval]'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it('should gracefully top level handle reference errors', function(done) { + runner.run({language: 'javascript', + code:'b.test()', + fixture: 'describe("test", function(){\n' + + 'it("test2", function(){ Test.expect(true)});})', + testFramework: 'cw-2'}, function(buffer) { + expect(buffer.stdout).to.contain(''); + expect(buffer.stdout).to.contain('<:LF:>'); + expect(buffer.stdout).to.contain('ReferenceError:'); + expect(buffer.stdout).to.not.contain('[eval]'); + expect(buffer.stdout).to.not.contain('Object.Test.handleError'); + done(); + }); + }); + }); + }); + }); +}); diff --git a/test/runners/julia_spec.js b/test/runners/julia_spec.js new file mode 100644 index 00000000..e69de29b diff --git a/test/runners/lisp_spec.js b/test/runners/lisp_spec.js new file mode 100644 index 00000000..76af68c2 --- /dev/null +++ b/test/runners/lisp_spec.js @@ -0,0 +1,30 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'lisp runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'lisp', code: '(format t "~a~%" 42)'}, function(buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + + it('should handle setup code and imports', function (done) { + runner.run({ + language: 'lisp', + setup: [ + '(defun twice (x) (+ x x))' + ].join('\n'), + code: [ + '(format t "~a~%" (twice 4))' + ].join('\n') + }, function (buffer) { + expect(buffer.stdout).to.equal('8\n'); + done(); + }); + }); + + }); +}); diff --git a/test/runners/lua_spec.js b/test/runners/lua_spec.js new file mode 100644 index 00000000..20bcaa08 --- /dev/null +++ b/test/runners/lua_spec.js @@ -0,0 +1,14 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'lua runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'lua', code: 'print(42)'}, function(buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/test/runners/nasm_spec.js b/test/runners/nasm_spec.js new file mode 100644 index 00000000..1c06d1bf --- /dev/null +++ b/test/runners/nasm_spec.js @@ -0,0 +1,48 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe('nasm runner', function () { + describe('.run', function () { + it('should handle basic code evaluation (no libc)', function (done) { + runner.run({language: 'nasm', + code: [ + ' global _start', + ' section .text', + '_start:', + ' mov rax, 1', + ' mov rdi, 1', + ' mov rsi, message', + ' mov rdx, 25', + ' syscall', + ' mov eax, 60', + ' xor rdi, rdi', + ' syscall', + 'message:', + 'db "Hello, Netwide Assembler!", 25' + ].join('\n')}, + function (buffer) { + expect(buffer.stdout).to.equal('Hello, Netwide Assembler!'); + done(); + }); + }); + it('should handle basic code evaluation (with libc)', function (done) { + runner.run({language: 'nasm', + code: [ + ' global main', + ' extern puts', + ' section .text', + 'main:', + ' mov rdi, message', + ' call puts', + ' ret', + 'message:', + 'db "Netwide Assembler together with LIBC! Let\'s Port Codewars From Rails to THIS! \\m/", 0' + ].join('\n')}, + function (buffer) { + expect(buffer.stdout).to.equal('Netwide Assembler together with LIBC! Let\'s Port Codewars From Rails to THIS! \\m/\n'); + done(); + }); + }); + }); +}); diff --git a/test/runners/objc_spec.js b/test/runners/objc_spec.js new file mode 100644 index 00000000..0502622d --- /dev/null +++ b/test/runners/objc_spec.js @@ -0,0 +1,146 @@ +if (process.platform == 'darwin') { + var expect = require('chai').expect; + var runner = require('../runner'); + + describe( 'objc runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({ + language: 'objc', + code: [ + '#import ', + '#import ', + 'int main(void)', + '{', + 'NSLog(@"Object-oriented programming is an exceptionally bad idea which could only have originated in California. - Edsger Dijkstra");', + 'return 0;', + '}' + ].join('\n') + }, function(buffer) { + console.log(buffer); + expect(buffer.stderr).to.contain('Object-oriented programming is an exceptionally bad idea which could only have originated in California. - Edsger Dijkstra\n'); + done(); + }); + }); + it('should handle basic code setup code', function(done) { + runner.run({ + language: 'objc', + setup: 'int foo(void) { return 999; }', + setupHeader: [ + '//', + '// test_setup.h', + 'int foo(void);' + ].join('\n'), + code: [ + '#import ', + '#import ', + '#import "test_setup.h"', + 'int main(void)', + '{', + 'NSLog(@"A string: %i", foo());', + 'return 0;', + '}' + ].join('\n') + }, function(buffer) { + console.log(buffer); + expect(buffer.stderr).to.contain('999'); + done(); + }); + }); + it('should handle broken fixture', function(done) { + runner.run({ + language: 'objc', + code: 'int flah(void) { return 9999; }', + codeHeader: [ + '// code.h', + 'int flah(void);' + ].join('\n'), + fixture: [ + '#import ', + '@interface MyAppTests : XCTestCase', + '@end', + '@implementation MyAppTests', + '- (void)testXXXX', + '{', + 'XCTAssert(1)', + '}', + '@end' + ].join('\n') + + + }, function(buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain('test.m:7:13: error: expected'); + done(); + }); + }); + it('should handle test fixture', function(done) { + runner.run({ + language: 'objc', + code: 'float flah(void) { return 9999; }', + codeHeader: [ + '// code.h', + 'float flah(void);' + ].join('\n'), + fixture: [ + '#import ', + '#include "code.h"', + '@interface MyAppTests : XCTestCase', + '@end', + '@implementation MyAppTests', + '- (void)testXXXX', + '{', + 'XCTAssert(flah() == 9999);', + '}', + '@end' + ].join('\n') + + + }, function(buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain("Test Case '-[MyAppTests testXXXX]' passed"); + done(); + }); + }); + it('should handle test fixture with setup', function(done) { + runner.run({ + language: 'objc', + setup: [ + 'float bar(void) { return 30.75; }' + ].join('\n'), + setupHeader: [ + '// bar.h', + 'float bar(void);' + ].join('\n'), + code: [ + '#include "bar.h"', + 'float foo(void) { return bar(); }' + ].join('\n'), + codeHeader: [ + '// payload.h', + 'float foo(void);' + ].join('\n'), + fixture: [ + '#import ', + '#include "payload.h"', + '@interface FooOBJCTests : XCTestCase', + '@end', + '@implementation FooOBJCTests', + '- (void)testFOO', + '{', + 'XCTAssertEqual(foo(), 30.75);', + '}', + '@end' + ].join('\n') + + + }, function(buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain("Test Case '-[FooOBJCTests testFOO]' passed"); + done(); + }); + }); + + }); + }); +} diff --git a/test/runners/ocaml_spec.js b/test/runners/ocaml_spec.js new file mode 100644 index 00000000..9cc74f97 --- /dev/null +++ b/test/runners/ocaml_spec.js @@ -0,0 +1,14 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'ocaml runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'ocaml', code: 'print_string "42\n";;'}, function(buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + }); +}); diff --git a/test/runners/perl_spec.js b/test/runners/perl_spec.js new file mode 100644 index 00000000..03a3eb8d --- /dev/null +++ b/test/runners/perl_spec.js @@ -0,0 +1,14 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'perl runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'perl', code: 'print 42'}, function(buffer) { + expect(buffer.stdout).to.equal('42'); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/test/runners/php_spec.js b/test/runners/php_spec.js new file mode 100644 index 00000000..f2d08839 --- /dev/null +++ b/test/runners/php_spec.js @@ -0,0 +1,14 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'php runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'php', solution: 'echo 42 . PHP_EOL;'}, function(buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/test/runners/python3_spec.js b/test/runners/python3_spec.js new file mode 100644 index 00000000..6a7ae1b6 --- /dev/null +++ b/test/runners/python3_spec.js @@ -0,0 +1,9 @@ +describe('python3', function () { + it('can evaluate exactly the same tests as the python2 runner', function (done) { + require('fs').readFile('test/runners/python_spec.js', 'utf8', function (error, data) { + if (error) throw error; + eval(data.split('python').join('python3')); + done(); + }); + }); +}); diff --git a/test/runners/python_spec.js b/test/runners/python_spec.js new file mode 100644 index 00000000..f4901f6d --- /dev/null +++ b/test/runners/python_spec.js @@ -0,0 +1,148 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + +describe('python runner', function () { + + describe('.run', function () { + runner.assertCodeExamples('python'); + + it('should handle basic code evaluation', function (done) { + runner.run({language: 'python', code: 'import sys; sys.stdout.write("42")'}, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.equal('42'); + done(); + }); + }); + it('stderr', function (done) { + runner.run({language: 'python', code: 'import sys; sys.stderr.write("Error! Codewars cannot and will not accept any more Fibonacci kata.")'}, function (buffer) { + console.log(buffer); + expect(buffer.stderr).to.equal("Error! Codewars cannot and will not accept any more Fibonacci kata."); + done(); + }); + }); + it('stderr', function (done) { + runner.run({language: 'python', code: 'import sys; sys.stderr.write("florp"); sys.stdout.write("foop")'}, function (buffer) { + console.log(buffer); + expect(buffer.stderr).to.equal("florp"); + expect(buffer.stdout).to.equal("foop"); + done(); + }); + }); + }); + describe('cw-2', function () { + it('should handle a basic assertion', function (done) { + runner.run({ + language: 'python', + code: 'a = 1', + fixture: 'test.expect(a == 1)', + testFramework: 'cw-2' + }, + function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.equal('Test Passed\n'); + done(); + }); + }); + it('should handle a basic assert_equals', function (done) { + runner.run({ + language: 'python', + code: 'a = 1', + fixture: 'test.assert_equals(a, 1)', + testFramework: 'cw-2' + }, + function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.equal('Test Passed\n'); + done(); + }); + }); + it('should handle a basic setup', function (done) { + runner.run({ + language: 'python', + code: 'a = 1', + setup: 'b = 2', + fixture: 'test.assert_equals(b, 2)', + testFramework: 'cw-2' + }, + function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.equal('Test Passed\n'); + done(); + }); + }); + it('should handle a failed assertion', function (done) { + runner.run({ + language: 'python', + code: 'a = 1', + fixture: 'test.expect(a == 2)', + testFramework: 'cw-2' + }, + function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.equal('Value is not what was expected\n'); + done(); + }); + }); + + it('should handle a failed assertion', function (done) { + runner.run({language: 'python', + code: 'a.fail()', + testFramework: 'cw-2'}, + function (buffer) { + console.log(buffer); + expect(buffer.stderr).to.not.contain('File '); + expect(buffer.stderr).to.not.contain(', line '); + expect(buffer.stderr).to.not.contain('most recent call last'); + done(); + }); + }); + }); + describe('unittest', function () { + it('should handle a basic assertion', function (done) { + runner.run({language: 'python', + code: 'a = 1', + fixture: [ + 'class Test(unittest.TestCase):', + ' def test_assert(self):', + ' self.assertEqual(a, 1)' + ].join('\n'), + testFramework: 'unittest'}, + function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.equal('Test Passed\n'); + done(); + }); + }); + it('should handle a failed assetion', function (done) { + runner.run({language: 'python', + code: 'a = 1', + fixture: [ + 'class Test(unittest.TestCase):', + ' def test_assert(self):', + ' self.assertEqual(a, 2, "test failed")' + ].join('\n'), + testFramework: 'unittest'}, + function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain(''); + expect(buffer.stdout).to.contain('test failed'); + done(); + }); + }); + it('should handle a failed assetion', function (done) { + runner.run({language: 'python', + code: 'a = 1', + fixture: [ + 'class Test(unittest.TestCase):', + ' def test_assert(self):', + ' raise Exception("exceptions are my favorite, I always throw them")' + ].join('\n'), + testFramework: 'unittest'}, + function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.equal('Unhandled Exception: exceptions are my favorite, I always throw them\n'); + done(); + }); + }); + }); +}); diff --git a/test/runners/r_spec.js b/test/runners/r_spec.js new file mode 100644 index 00000000..f1faf601 --- /dev/null +++ b/test/runners/r_spec.js @@ -0,0 +1,14 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'r runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'r', code: 'cat("What a pirate says?")'}, function(buffer) { + expect(buffer.stdout).to.equal('What a pirate says?'); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/test/runners/racket_spec.js b/test/runners/racket_spec.js new file mode 100644 index 00000000..a4392936 --- /dev/null +++ b/test/runners/racket_spec.js @@ -0,0 +1,32 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'racket runner', function(){ + describe( '.run', function(){ + it( 'should handle basic code evaluation', function(done){ + runner.run({language: 'racket', code: '(print 42)'}, function(buffer) { + expect(buffer.stdout).to.equal('42'); + done(); + }); + }); + + it('should handle setup code and imports', function (done) { + runner.run({ + language: 'racket', + setup: [ + '#lang racket/base', + '(provide twice)', + '(define (twice x) (+ x x))' + ].join('\n'), + code: [ + "(print (twice 2))" + ].join('\n') + }, function (buffer) { + expect(buffer.stdout).to.equal('4'); + done(); + }); + }); + + }); +}); diff --git a/test/runners/ruby_spec.js b/test/runners/ruby_spec.js new file mode 100644 index 00000000..4fcddf84 --- /dev/null +++ b/test/runners/ruby_spec.js @@ -0,0 +1,203 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe('ruby runner', function () { + describe('.run', function () { + runner.assertCodeExamples('ruby'); + + it('should handle basic code evaluation', function (done) { + runner.run({language: 'ruby', code: 'puts 42'}, function (buffer) { + expect(buffer.stdout).to.equal('42\n'); + done(); + }); + }); + + describe('cw-2', function () { + it('should handle a basic assertion', function (done) { + runner.run({language: 'ruby', code: 'a = 1', fixture: 'Test.expect a == 1', testFramework: 'cw-2'}, function (buffer) { + expect(buffer.stdout).to.equal('Test Passed\n'); + done(); + }); + }); + + it('should handle a basic description', function (done) { + runner.run({language: 'ruby', code: 'a = 1', fixture: 'describe("test") { Test.expect a == 1 }', testFramework: 'cw-2'}, function (buffer) { + expect(buffer.stdout).to.contain('test\nTest Passed\n'); + expect(buffer.stdout).to.contain('ms'); + done(); + }); + }); + + describe('error handling', function () { + it('should handle a mix of failures and successes', function (done) { + runner.run({language: 'ruby', + code: 'a = 1', + fixture: 'describe "test" do\n' + + 'it("test1") { Test.expect(false) }\n' + + 'it("test2") { Test.expect(true) }\n' + + 'end', + testFramework: 'cw-2'}, function (buffer) { + console.log(buffer.stdout) + expect(buffer.stdout).to.contain('Value is not what was expected'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it('should gracefully handle custom errors', function (done) { + runner.run({language: 'ruby', + code: 'a = 1', + fixture: 'describe "test" do\n' + + 'it("test1") { raise "boom!" }\n' + + 'it("test2") { Test.expect(true)}\n' + + 'end', + testFramework: 'cw-2'}, function (buffer) { + expect(buffer.stdout).to.contain(''); + expect(buffer.stdout).to.contain('boom!'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + it('should gracefully handle reference errors', function (done) { + runner.run({language: 'ruby', + code: 'a = 1', + fixture: 'describe "test" do\n' + + 'it("test1") { a.idontexist() }\n' + + 'it("test2") { Test.expect(true)}\n' + + 'end', + testFramework: 'cw-2'}, function (buffer) { + expect(buffer.stdout).to.contain(''); + expect(buffer.stdout).to.contain('<:LF:>'); + expect(buffer.stdout).to.contain('NoMethodError:'); + expect(buffer.stdout).to.not.contain('from /cli-runner/'); + expect(buffer.stdout).to.not.contain('-e:'); + expect(buffer.stdout).to.not.contain('cw-2.rb'); + expect(buffer.stdout).to.contain('Test Passed'); + done(); + }); + }); + + it('should prevent short circuiting', function (done) { + runner.run({language: 'ruby', + code: [ + "def example", + " Test.expect(true);", + " raise 'early error'", + "end" + ].join("\n"), + fixture: [ + 'describe "test" do', + ' it("test1") { example }', + ' it("test2") { Test.expect(false)}', + 'end' + ].join('\n'), + testFramework: 'cw-2'}, function (buffer) { + expect(buffer.stdout).to.contain(''); + done(); + } + ); + }); + }); + }); + describe('rspec', function () { + it('should handle a basic assertion', function (done) { + runner.run({language: 'ruby', + code: 'a = 1', + fixture: 'describe "test" do\n' + + 'it("test2") { expect(1).to eq(1)}\n' + + 'end', + testFramework: 'rspec'}, function (buffer) { + expect(buffer.stdout).to.equal('test\ntest2\nTest Passed\n\n'); + done(); + } + ); + }); + it('should support let', function (done) { + runner.run({language: 'ruby', + code: 'a = 1', + fixture: ['describe "test" do', + 'let(:b) { a }', + 'it("test2") { expect(b).to eq(1)}', + 'end'].join('\n'), + testFramework: 'rspec'}, function (buffer) { + expect(buffer.stdout).to.equal('test\ntest2\nTest Passed\n\n'); + done(); + } + ); + }); + it('should handle a basic failed assertion', function (done) { + runner.run({language: 'ruby', + code: 'a = 1', + fixture: 'describe "test" do\n' + + 'it("test2") { expect(1).to eq(2)}\n' + + 'end', + testFramework: 'rspec'}, function (buffer) { + expect(buffer.stdout).to.contain('test\ntest2'); + expect(buffer.stdout).to.contain(''); + expect(buffer.stdout).to.not.contain(''); + expect(buffer.stdout).to.not.contain('simplified backtrace'); + done(); + } + ); + }); + it('should handle errored code', function (done) { + runner.run({language: 'ruby', + code: 'a = 1', + fixture: 'describe "test" do\n' + + 'it("test1") { a.idontexist() }\n' + + 'it("test2") { expect(true)}\n' + + 'end', + testFramework: 'rspec'}, function (buffer) { + expect(buffer.stdout).to.contain('test'); + expect(buffer.stdout).to.contain('test1'); + expect(buffer.stdout).to.contain('test2'); + expect(buffer.stdout).to.contain(''); + done(); + } + ); + }); + it('should prevent short circuiting', function (done) { + runner.run({language: 'ruby', + code: [ + "def example", + " expect(true);", + " raise 'early error'", + "end" + ].join("\n"), + fixture: [ + 'describe "test" do', + ' it("test1") { example }', + ' it("test2") { expect(false)}', + 'end' + ].join('\n'), + testFramework: 'rspec'}, function (buffer) { + expect(buffer.stdout).to.contain(''); + done(); + } + ); + }); + }); + describe('potpourri', function () { + it('can run redis', function (done) { + runner.run({ + language: 'ruby', + code: [ + 'fork do', + ' exec "redis-server"', + 'end', + "require 'redis'", + 'r = Redis.new', + "r.set('a', 'b')" + ].join('\n'), + fixture: "Test.assert_equals(r.get('a'), 'b')", + testFramework: 'cw-2' + }, function (buffer) { + console.log(buffer.stderr); + expect(buffer.stdout).to.contain('Test Passed: Value == \"b\"'); + done(); + }); + }); + }); + }); + +}); diff --git a/test/runners/scala_spec.js b/test/runners/scala_spec.js new file mode 100644 index 00000000..e9eedd52 --- /dev/null +++ b/test/runners/scala_spec.js @@ -0,0 +1,48 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + +describe('scala runner', function () { + describe('.run', function () { + it('should handle basic code evaluation', function (done) { + var code = [ + 'object HelloWorld {', + 'def main(args: Array[String]) {', + 'println("Hello, world!")', + '}', + '}' + ].join('\n'); + + runner.run({language: 'scala', code: code}, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.equal("Hello, world!\n"); + done(); + }); + }); + it('should handle setup code and imports', function (done) { + runner.run({ + language: 'scala', + setup: [ + 'package problems', + 'object Lists {', + 'def last(list: List[Any]): Option[Any] = list match {', + 'case Nil => None', + 'case x :: Nil => Some(x)', + 'case _ :: xs => last(xs)', + '}', + '}' + ].join('\n'), + code: [ + 'import problems.Lists._', + 'object Test extends App {', + ' println("Starting tests...")', + ' println(last(List(1,2,3,4,5)))', + '}' + ].join('\n') + }, function (buffer) { + expect(buffer.stdout).to.contain('Starting tests...'); + expect(buffer.stdout).to.contain('5'); + done(); + }); + }); + }); +}); diff --git a/test/runners/swift_spec.js b/test/runners/swift_spec.js new file mode 100644 index 00000000..ad904043 --- /dev/null +++ b/test/runners/swift_spec.js @@ -0,0 +1,103 @@ +if (process.platform == 'darwin') { + var expect = require('chai').expect; + var runner = require('../runner'); + + + describe('swift runner', function () { + describe('.run', function () { + it('should handle basic code evaluation', function (done) { + runner.run({ + language: 'swift', + code: "println(\"You've baked a really lovely cake, but then you've used dog shit for frosting. - Steve Jobs (commenting on an employee's program)\")" + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.equal("You've baked a really lovely cake, but then you've used dog shit for frosting. - Steve Jobs (commenting on an employee's program)\n"); + done(); + }); + }); + it('should handle setup code', function (done) { + runner.run({ + language: 'swift', + setup: "func foo() -> Int { return 999; }", + code: "println(foo())" + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.equal("999\n"); + done(); + }); + }); + it('should handle a full test', function (done) { + runner.run({ + language: 'swift', + code: [ + '// payload1.swift', + 'func foo() -> Int { return 999; }' + ].join('\n'), + fixture: [ + '// fixture1.swift', + 'import XCTest', + 'class runner_test: XCTestCase {', + ' func testExample() {', + ' XCTAssert(foo() == 998 , "badbadbad")', + ' }', + '}' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain("badbadbad"); + done(); + }); + }); + it('should handle a broken test', function (done) { + runner.run({ + language: 'swift', + code: [ + '// payload2.swift', + 'func foo() ->' + ].join('\n'), + fixture: [ + '// fixture2.swift', + 'import XCTest', + 'class runner_test: XCTestCase {', + ' func testExample() {', + ' XCTAssert(foo() == 998 , "badbadbad")', + ' }', + '}' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain("payload2.swift:2:14: error: expected type for function result"); + done(); + }); + }); + + it('should handle a full with setup', function (done) { + runner.run({ + language: 'swift', + setup: [ + '// bar.swift', + 'func bar() -> Int { return 999; }' + ].join('\n'), + code: [ + '// payload3.swift', + 'func foo() -> Int { return bar(); }' + ].join('\n'), + fixture: [ + '// fixture3.swift', + 'import XCTest', + 'class setup_test: XCTestCase {', + ' func testFooBar() {', + ' XCTAssert(foo() == 999 , "badbadbad")', + ' }', + '}' + ].join('\n') + }, function (buffer) { + console.log(buffer); + expect(buffer.stdout).to.contain("Test Case '-[setup_test testFooBar]' passed"); + done(); + }); + }); + + }); + }); +} diff --git a/test/runners/typescript_spec.js b/test/runners/typescript_spec.js new file mode 100644 index 00000000..7150ada2 --- /dev/null +++ b/test/runners/typescript_spec.js @@ -0,0 +1,50 @@ +var expect = require('chai').expect; +var runner = require('../runner'); + + +describe( 'typescript runner', function(){ + //describe( '.run', function(){ + // it( 'should handle basic code evaluation', function(done){ + // runner.run({language: 'typescript', code: 'console.log(42)'}, function(buffer) { + // expect(buffer.stdout).to.equal('42\n'); + // done(); + // }); + // }); + //}); + + describe('mocha bdd', function() { + it( 'should handle outputting objects', function(done){ + runner.run({ + language: 'typescript', + code: 'interface B { b:number }; var a:B = {b: 3};exports.a = a;', + fixture: 'var assert = require("chai").assert;describe("test", function(){it("should be 3", function(){assert.equal(3, solution.a.b);})});', + testFramework: 'mocha_bdd'}, + function(buffer) { + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + it( 'should handle failures', function(done){ + runner.run({ + language: 'typescript', + code: 'exports.a = {b: 2};', + fixture: 'var assert = require("chai").assert;describe("test", function(){describe("failures", function(){it("should be 1", function(){assert.equal(1, solution.a.b);})})});', + testFramework: 'mocha_bdd'}, + function(buffer) { + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + it( 'should handle errors', function(done){ + runner.run({ + language: 'typescript', + code: 'exports.a = {b: 2};', + fixture: 'describe("test", function(){describe("failures", function(){it("should be 1", function(){throw new Error("test error");})})});', + testFramework: 'mocha_bdd'}, + function(buffer) { + expect(buffer.stdout).to.contain(''); + done(); + }); + }); + }); +}); diff --git a/test_cs.sh b/test_cs.sh new file mode 100644 index 00000000..41f46535 --- /dev/null +++ b/test_cs.sh @@ -0,0 +1,11 @@ +mv -f ../../NUnit-codewars/bin/Debug/nunit.framework.dll frameworks/csharp/nunit/nunit.framework.dll +mv -f ../../NUnit-codewars/bin/Debug/nunit.util.dll frameworks/csharp/nunit/nunit.util.dll +mv -f ../../NUnit-codewars/bin/Debug/nunit.core.dll frameworks/csharp/nunit/nunit.core.dll +mv -f ../../NUnit-codewars/bin/Debug/nunit.core.interfaces.dll frameworks/csharp/nunit/nunit.core.interfaces.dll +mv -f ../../NUnit-codewars/bin/Debug/nunit-console.exe frameworks/csharp/nunit/nunit-console.exe +mv -f ../../NUnit-codewars/bin/Debug/nunit-console.exe.config frameworks/csharp/nunit/nunit-console.exe.config +mv -f ../../NUnit-codewars/bin/Debug/log4net.dll frameworks/csharp/nunit/log4net.dll +cp -r ../../NUnit-codewars/bin/Debug/framework/* frameworks/csharp/nunit/framework +cp -r ../../NUnit-codewars/bin/Debug/lib/* frameworks/csharp/nunit/lib + +mocha test/runners/csharp_spec diff --git a/typings.json b/typings.json new file mode 100644 index 00000000..0baa5323 --- /dev/null +++ b/typings.json @@ -0,0 +1,14 @@ +{ + "ambientDependencies": { + "baconjs": "registry:dt/baconjs#0.7.0+20160209151603", + "chai": "registry:dt/chai#3.4.0+20160216071402", + "lodash": "registry:dt/lodash#3.10.0+20160308151359", + "mocha": "registry:dt/mocha#2.2.5+20151023103246", + "mocha-node": "registry:dt/mocha-node#2.2.5+20150623123832", + "mongoose": "registry:dt/mongoose#3.8.5+20160209123716", + "node": "registry:dt/node#4.0.0+20160226132328", + "react": "registry:dt/react#0.14.0+20160302224448", + "redis": "registry:dt/redis#0.12.1+20160303114034", + "rx": "registry:dt/rx#2.5.3+20150720134954" + } +} diff --git a/typings/browser.d.ts b/typings/browser.d.ts new file mode 100644 index 00000000..8fdf7e20 --- /dev/null +++ b/typings/browser.d.ts @@ -0,0 +1,10 @@ +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// diff --git a/typings/browser/ambient/baconjs/index.d.ts b/typings/browser/ambient/baconjs/index.d.ts new file mode 100644 index 00000000..13d19349 --- /dev/null +++ b/typings/browser/ambient/baconjs/index.d.ts @@ -0,0 +1,3132 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9027703c0bd831319dcdf7f3169f7a468537f448/baconjs/baconjs.d.ts +// Type definitions for Bacon.js 0.7.0 +// Project: https://baconjs.github.io/ +// Definitions by: Alexander Matsievsky +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface JQuery { + /** + * @method + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a jQuery or Zepto.js object. + * @param {string} eventName + * @returns {EventStream} + * @example + * $("#my-div").asEventStream("click"); + */ + asEventStream(eventName:string):Bacon.EventStream; + + /** + * @method + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a jQuery or Zepto.js object. You can pass an argument to add a jQuery live `selector`. + * @param {string} eventName + * @param {string} selector + * @returns {EventStream} + * @example + * $("#my-div").asEventStream("click", ".more-specific-selector"); + */ + asEventStream(eventName:string, selector:string):Bacon.EventStream; + + /** + * @callback JQuery#asEventStream1~f + * @param {JQueryEventObject} event + * @param {*[]} args + * @returns {A} + */ + /** + * @method JQuery#asEventStream1 + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a jQuery or Zepto.js object. You can pass an argument to add a function `f` that processes the jQuery event and its parameters. + * @param {string} eventName + * @param {JQuery#asEventStream1~f} f + * @returns {EventStream} + * @example + * $("#my-div").asEventStream("click", (event, args) => args[0]); + */ + asEventStream(eventName:string, f:(event:JQueryEventObject, args:any[]) => A):Bacon.EventStream; + + /** + * @callback JQuery#asEventStream2~f + * @param {JQueryEventObject} event + * @param {*[]} args + * @returns {A} + */ + /** + * @method JQuery#asEventStream2 + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a jQuery or Zepto.js object. You can pass an argument to add a jQuery live `selector` and a function `f` that processes the jQuery event and its parameters. + * @param {string} eventName + * @param {string} selector + * @param {JQuery#asEventStream2~f} f + * @returns {Bacon.EventStream} + * @example + * $("#my-div").asEventStream("click", ".more-specific-selector", (event, args) => args[0]); + */ + asEventStream(eventName:string, selector:string, f:(event:JQueryEventObject, args:any[]) => A):Bacon.EventStream; +} + +/** @module Bacon */ +declare module Bacon { + /** + * @function + * @description Creates an [EventStream]{@link Bacon.EventStream} from a `promise` Promise object such as JQuery Ajax. This stream will contain a single value or an error, followed immediately by stream end. You can use the optional `abort` flag (i.e. ´Bacon.fromPromise(p, true)´ to have the `abort` method of the given promise be called when all subscribers have been removed from the created stream. + * @param {Promise|JQueryXHR} promise + * @param {boolean} [abort] + * @returns {EventStream} + * @example + * Bacon.fromPromise($.ajax("https://baconjs.github.io/")); + * Bacon.fromPromise(Promise.resolve(1)); + * Bacon.fromPromise($.ajax("https://baconjs.github.io/"), true); + * Bacon.fromPromise(Promise.resolve(1), false); + */ + function fromPromise(promise:Promise|JQueryXHR, abort?:boolean):EventStream; + + /** + * @callback Bacon.fromPromise~eventTransformer + * @param {A} value + * @returns {(Initial|Next|End|Error)[]} + */ + /** + * @function Bacon.fromPromise + * @description Creates an [EventStream]{@link Bacon.EventStream} from a `promise` Promise object such as JQuery Ajax. This stream will contain a single value or an error, followed immediately by stream end. You can use the `abort` flag (i.e. ´Bacon.fromPromise(p, true)´ to have the `abort` method of the given promise be called when all subscribers have been removed from the created stream, and also pass a function `eventTransformer` that transforms the promise value into Events. The default is to transform the value into `[new Bacon.Next(value), new Bacon.End()]`. + * @param {Promise|JQueryXHR} promise + * @param {boolean} abort + * @param {Bacon.fromPromise~eventTransformer} eventTransformer + * @returns {EventStream} + * @example + * Bacon.fromPromise($.ajax("https://baconjs.github.io/"), true, (n:string) => { + * return [new Bacon.Next(n), new Bacon.Next(() => n), new Bacon.End()]; + * }); + * Bacon.fromPromise(Promise.resolve(1), false, n => { + * return [new Bacon.Next(n), new Bacon.Next(() => n), new Bacon.End()]; + * }); + */ + function fromPromise(promise:Promise|JQueryXHR, abort:boolean, eventTransformer:(value:A) => (Initial|Next|End|Error)[]):EventStream; + + /** + * @function + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a DOM EventTarget or Node.JS EventEmitter object, or an object that supports event listeners using `on`/`off` methods. + * @param {EventTarget|NodeJS.EventEmitter|JQuery} target + * @param {string} eventName + * @returns {EventStream} + * @example + * Bacon.fromEvent(document.body, "click").onValue(() => { + * alert("Bacon!"); + * }); + * Bacon.fromEvent(process.stdin, "readable", () => { + * alert("Bacon!"); + * }); + * Bacon.fromEvent($("body"), "click").onValue(() => { + * alert("Bacon!"); + * }); + */ + function fromEvent(target:EventTarget|NodeJS.EventEmitter|JQuery, eventName:string):EventStream; + + /** + * @callback Bacon.fromEvent~eventTransformer + * @param {A} event + * @returns {B} + */ + /** + * @function Bacon.fromEvent + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a DOM EventTarget or Node.JS EventEmitter object, or an object that supports event listeners using `on`/`off` methods. You can pass a function `eventTransformer` that transforms the emitted events' parameters. + * @param {EventTarget|NodeJS.EventEmitter|JQuery} target + * @param {string} eventName + * @param {Bacon.fromEvent~eventTransformer} eventTransformer + * @returns {EventStream} + * @example + * Bacon.fromEvent(document.body, "click", (event:MouseEvent) => event.clientX).onValue(clientX => { + * alert("Bacon!"); + * }); + */ + function fromEvent(target:EventTarget|NodeJS.EventEmitter|JQuery, eventName:string, eventTransformer:(event:A) => B):EventStream; + + /** + * @callback Bacon.fromCallback1~f + * @param {Bacon.fromCallback1~callback} callback + * @returns {void} + */ + /** + * @callback Bacon.fromCallback1~callback + * @param {...*} args + * @returns {void} + */ + /** + * @function Bacon.fromCallback1 + * @description Creates an [EventStream]{@link Bacon.EventStream} from a function `f` that accepts a `callback`. The function is supposed to call its callback just once. + * @param {Bacon.fromCallback1~f} f + * @returns {EventStream} + * @example + * // This would create a stream that outputs a single value "Bacon!" and ends after that. The use of setTimeout causes the value to be delayed by 1 second. + * Bacon.fromCallback(callback => { + * setTimeout(() => { + * callback("Bacon!"); + * }, 1000); + * }); + */ + function fromCallback(f:(callback:(...args:any[]) => void) => void):EventStream; + + /** + * @callback Bacon.fromCallback2~f + * @param {...*} args + * @returns {void} + */ + /** + * @function Bacon.fromCallback2 + * @description Creates an [EventStream]{@link Bacon.EventStream} from a function `f` that accepts a `callback`. The function is supposed to call its callback just once. + * @param {Bacon.fromCallback2~f} f + * @param {...*} args + * @returns {EventStream} + * @example + * // You can also give any number of arguments to `fromCallback`, which will be passed to the function. These arguments can be simple variables, Bacon EventStreams or Properties. For example the following will output "Bacon rules": + * Bacon.fromCallback((a, b, callback) => { + * callback(a + " " + b); + * }, Bacon.constant("bacon"), "rules").log(); + */ + function fromCallback(f:(...args:any[]) => void, ...args:any[]):EventStream; + + /** + * @function + * @description Creates an [EventStream]{@link Bacon.EventStream} from a `methodName` method of a given `object`. The function is supposed to call its callback just once. + * @param {Object} object + * @param {string} methodName + * @param {...*} args + * @returns {EventStream} + */ + function fromCallback(object:Object, methodName:string, ...args:any[]):EventStream; + + /** + * @callback Bacon.fromNodeCallback~f + * @param {Bacon.fromNodeCallback~callback} callback + * @returns {void} + */ + /** + * @callback Bacon.fromNodeCallback~callback + * @param {E} error + * @param {A} data + * @returns {void} + */ + /** + * @function Bacon.fromNodeCallback + * @description Creates an [EventStream]{@link Bacon.EventStream} from a function `f` that accepts a Node.js `callback`: callback(error, data), where error is `null` if everything is fine. The function is supposed to call its callback just once. + * @param {Bacon.fromNodeCallback~f} f + * @param {...*} args + * @returns {EventStream} + * @example + * { + * let fs = require("fs"), + * read = Bacon.fromNodeCallback(fs.readFile, "input.txt"); + * read.onError(error => { + * console.log("Reading failed: " + error); + * }); + * read.onValue(value => { + * console.log("Read contents: " + value); + * }); + * } + */ + function fromNodeCallback(f:(callback:(error:E, data:A) => void) => void, ...args:any[]):EventStream; + + /** + * @function + * @description Creates an [EventStream]{@link Bacon.EventStream} from a `methodName` method of a given `object`. + * @param {Object} object + * @param {string} methodName + * @param {...*} args + * @returns {EventStream} + */ + function fromNodeCallback(object:Object, methodName:string, ...args:any[]):EventStream; + + /** + * @callback Bacon.fromPoll~f + * @returns {Next|End} + */ + /** + * @function Bacon.fromPoll + * @description Polls given function `f` with given `interval`. Function should return events: either [Next]{@link Bacon.Next} or [End]{@link Bacon.End}. Polling occurs only when there are subscribers to the stream. Polling ends permanently when `f` returns [End]{@link Bacon.End}. + * @param {number} interval + * @param {Bacon.fromPoll~f} f + * @returns {EventStream} + */ + function fromPoll(interval:number, f:() => Next|End):EventStream; + + /** + * @function Bacon.once + * @description Creates an [EventStream]{@link Bacon.EventStream} that delivers the given single `value` for the first subscriber. The stream will end immediately after this value. You can also send an [Error]{@link Bacon.Error} event instead of a `value`. + * @param {A|Error} value + * @returns {EventStream} + * @example + * Bacon.once(new Bacon.Error("fail")); + */ + function once(value:A|Error):EventStream; + + /** + * @function + * @description Creates an [EventStream]{@link Bacon.EventStream} that delivers the given series of `values` (given as array) to the first subscriber. The stream ends after these values have been delivered. You can also send [Error]{@link Bacon.Error} events, or any combination of pure values and error events. + * @param {(A|Error)[]} values + * @returns {EventStream} + * @example + * Bacon.fromArray([1, new Bacon.Error("")]); + */ + function fromArray(values:(A|Error)[]):EventStream; + + /** + * @function + * @description Repeats the single `value` indefinitely with the given `interval` (in milliseconds). + * @param {number} interval + * @param {A} value + * @returns {EventStream} + */ + function interval(interval:number, value:A):EventStream; + + /** + * @function + * @description Creates a [EventStream]{@link Bacon.EventStream} containing given `values` (given as array) with the given `interval` (in milliseconds). + * @param {number} interval + * @param {A[]} values + * @returns {EventStream} + */ + function sequentially(interval:number, values:A[]):EventStream; + + /** + * @function + * @description Repeats given `values` indefinitely with then given `interval` (in milliseconds). + * @param {number} interval + * @param {A[]} values + * @returns {EventStream} + * @example + * // The following would lead to `1,2,3,1,2,3...` to be repeated indefinitely: + * Bacon.fromArray([1, new Bacon.Error("")]); + */ + function repeatedly(interval:number, values:A[]):EventStream; + + /** + * @callback Bacon.repeat~f + * @param {number} iteration + * @returns {boolean|Observable} + */ + /** + * @function Bacon.repeat + * @description Calls generator function `f` which is expected to return an [Observable]{@link Bacon.Observable}. The returned [EventStream]{@link Bacon.EventStream} contains values and errors from the spawned observable. When the spawned Observable ends, the generator `f` is called again to spawn a new Observable. This is repeated until the generator `f` returns a falsy value (such as `undefined` or `false`). The generator `f` is called with one argument — `iteration` number starting from `0`. + * @param {Bacon.repeat~f} f + * @returns {EventStream} + * @example + * // The following will produce values `0,1,2`. + * Bacon.repeat(i => { + * if (i < 3) { + * return Bacon.once(i); + * } else { + * return false; + * } + * }).log(); + */ + function repeat(f:(iteration:number) => boolean|Observable):EventStream; + + /** + * @function Bacon.never + * @description Creates an [EventStream]{@link Bacon.EventStream} that immediately ends. + * @returns {EventStream} + */ + function never():EventStream; + + /** + * @function + * @description Creates a single-element [EventStream]{@link Bacon.EventStream} that produces given `value` after a given `delay` (in milliseconds). + * @param {number} delay + * @param {A} value + * @returns {EventStream} + */ + function later(delay:number, value:A):EventStream; + + /** + * @function + * @description Creates a constant [Property]{@link Bacon.Property} with value `x`. + * @param {A} x + * @returns {Property} + */ + function constant(x:A):Property; + + /** + * @callback Bacon.fromBinder~subscribe + * @param {Bacon.fromBinder~sink} sink + * @returns {Bacon.fromBinder~unsubscribe} + */ + /** + * @callback Bacon.fromBinder~sink + * @param {More|NoMore|(A|Initial|Next|End|Error)|(A|Initial|Next|End|Error)[]} value + * @returns {void} + */ + /** + * @callback Bacon.fromBinder~unsubscribe + * @returns {void} + */ + /** + * @function Bacon.fromBinder + * @description Creates an [EventStream]{@link Bacon.EventStream} with the given [subscribe]{@link Bacon.fromBinder~subscribe} function. The parameter `subscribe` is a function that accepts a [sink]{@link Bacon.fromBinder~sink} which is a function that your `subscribe` function can "push" events to. You can push: a plain value, like `"first value"`; an [Event]{@link Bacon.Event} object including [Error]{@link Bacon.Error} (wraps an error) and [End]{@link Bacon.End} (indicates stream end); an array of event objects at once. The `subscribe` function must return a function. Let's call that function [unsubscribe]{@link Bacon.fromBinder~unsubscribe}. The returned function can be used by the subscriber (directly or indirectly) to unsubscribe from the EventStream. It should release all resources that the `subscribe` function reserved. The `sink` function may return [noMore]{@link Bacon.noMore} (as well as [more]{@link Bacon.more} or any other value). If it returns `noMore`, no further events will be consumed by the subscriber. The `subscribe` function may choose to clean up all resources at this point (e.g., by calling `unsubscribe`). This is usually not necessary, because further calls to `sink` are ignored, but doing so can increase performance in rare cases. The EventStream will wrap your `subscribe` function so that it will only be called when the first stream listener is added, and the `unsubscribe` function is called only after the last listener has been removed. The subscribe-unsubscribe cycle may of course be repeated indefinitely, so prepare for multiple calls to the `subscribe` function. + * @param {Bacon.fromBinder~subscribe} subscribe + * @returns {EventStream} + * @example + * let stream = Bacon.fromBinder(sink => { + * sink("first value"); + * sink([new Bacon.Next("2nd"), new Bacon.Next("3rd")]); + * sink(new Bacon.Next(() => { + * return "This one will be evaluated lazily" + * })); + * sink(new Bacon.Error("oops, an error")); + * sink(new Bacon.End()); + * return () => { + * // unsub functionality here, this one's a no-op + * }; + * }); + * stream.log(); + */ + function fromBinder(subscribe:(sink:(value:More|NoMore|(A|Initial|Next|End|Error)|(A|Initial|Next|End|Error)[]) => void) => (() => void)):EventStream; + + /** + * @interface + * @see Bacon.more + */ + interface More { + } + /** + * @property more + * @constant + * @description The opaque value `sink` function may return. See [Bacon.fromBinder]{@link Bacon.fromBinder}. + */ + var more:More; + + /** + * @interface + * @see Bacon.noMore + */ + interface NoMore { + } + /** + * @property noMore + * @constant + * @description The opaque value `sink` function may return. See [Bacon.fromBinder]{@link Bacon.fromBinder}. + */ + var noMore:NoMore; + + /** + * @class Observable + * @description A superclass for [EventStream]{@link Bacon.EventStream} and [Property]{@link Bacon.Property}. + * */ + interface Observable { + /** + * @callback Observable#onValue~f + * @param {A} value + * @returns {void} + */ + /** + * @callback Observable#onValue~unsubscribe + * @returns {void} + */ + /** + * @method Observable#onValue + * @description Subscribes a given handler function `f` to the [Observable]{@link Bacon.Observable}. Function will be called for each new value. This is the simplest way to assign a side-effect to an Observable. The difference to the [EventStream.subscribe]{@link Bacon.EventStream#subscribe} and [Property.subscribe]{@link Bacon.Property#subscribe} methods is that the actual stream `value`s are received, instead of [Event]{@link Bacon.Event} objects. [EventStream.onValue]{@link Bacon.EventStream#onValue} and [Property.onValue]{@link Bacon.Property#onValue} behave similarly, except that the latter also pushes the initial value of the Property, in case there is one. + * @param {Observable#onValue~f} f + * @returns {Observable#onValue~unsubscribe} + */ + onValue(f:(value:A) => void):() => void; + + /** + * @callback Observable#onError~f + * @param {E} error + * @returns {void} + */ + /** + * @callback Observable#onError~unsubscribe + * @returns {void} + */ + /** + * @method Observable#onError + * @description Subscribes a given handler function `f` to [Error]{@link Bacon.Error} events. The function `f` will be called for each error in the [Observable]{@link Bacon.Observable}. + * @param {Observable#onError~f} f + * @returns {Observable#onError~unsubscribe} + */ + onError(f:(error:E) => void):() => void; + + /** + * @callback Observable#onEnd~f + * @returns {void} + */ + /** + * @callback Observable#onEnd~unsubscribe + * @returns {void} + */ + /** + * @method Observable#onEnd + * @description Subscribes a given handler function `f` to [End]{@link Bacon.End} event. The function `f` will be called when the [Observable]{@link Bacon.Observable} ends. Just like [EventStream.subscribe]{@link Bacon.EventStream#subscribe} and [Property.subscribe]{@link Bacon.Property#subscribe}, this method returns a function for `unsubscribe`ing. + * @param {Observable#onEnd~f} f + * @returns {Observable#onEnd~unsubscribe} + */ + onEnd(f:() => void):() => void; + + /** + * @callback Observable#toPromise~promiseCtr + * @param {A} value + * @returns {Promise} + */ + /** + * @method Observable#toPromise + * @description Returns a Promise which will be resolved with the last event coming from an [Observable]{@link Bacon.Observable}. The global ES6 promise implementation will be used unless a promise constructor `promiseCtr` is given. Use a shim if you need to support legacy browsers or platforms. + * @param {Observable#toPromise~promiseCtr} [promiseCtr] + * @returns {Promise} + */ + toPromise(promiseCtr?:(value:A) => Promise):Promise; + + /** + * @callback Observable#firstToPromise~promiseCtr + * @param {A} value + * @returns {Promise} + */ + /** + * @method Observable#firstToPromise + * @description Returns a Promise which will be resolved with the first event coming from an [Observable]{@link Bacon.Observable}. Like [Observable.toPromise]{@link Bacon.Observable#toPromise}, the global ES6 promise implementation will be used unless a promise constructor `promiseCtr` is given. + * @param {Observable#firstToPromise~promiseCtr} [promiseCtr] + * @returns {Promise} + */ + firstToPromise(promiseCtr?:(value:A) => Promise):Promise; + + /** + * @method + * @description Throttles the [Observable]{@link Bacon.Observable} using a buffer so that at most one value event in `minimumInteval` is issued. Unlike [EventStream.throttle]{@link Bacon.EventStream#throttle} and [Property.throttle]{@link Bacon.Property#throttle}, it doesn't discard the excessive events but buffers them instead, outputting them with a rate of at most one value per `minimumInterval`. + * @param {number} minimumInterval + * @returns {EventStream} + */ + bufferingThrottle(minimumInterval:number):EventStream; + + /** + * @callback Observable#flatMap~f + * @param {A} value + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMap + * @description For each element in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f`, and collect events from each of the spawned streams into the result [EventStream]{@link Bacon.EventStream}. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. The result of [flatMap]{@link Bacon.Observable#flatMap} is always an EventStream. The "Function Construction rules" apply here. `flatMap` can be used conveniently with [Bacon.once]{@link Bacon.once} and [Bacon.never]{@link Bacon.never} for converting and filtering at the same time, including only some of the results. + * @param {Observable#flatMap~f} f + * @returns {EventStream} + * @example + * // Converting strings to integers, skipping empty values: + * Bacon.once("").flatMap(text => { + * return text != "" ? parseInt(text) : Bacon.never(); + * }); + */ + flatMap(f:(value:A) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#flatMapLatest~f + * @param {A} value + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMapLatest + * @description For each element in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f`, but instead of including events from all spawned streams, only includes them from the latest spawned stream into the result [EventStream]{@link Bacon.EventStream}. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. The result of [flatMapLatest]{@link Bacon.Observable#flatMapLatest} is always an EventStream. + * @param {Observable#flatMapLatest~f} f + * @returns {EventStream} + */ + flatMapLatest(f:(value:A) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#flatMapFirst~f + * @param {A} value + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMapFirst + * @description For each element in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f` only if the previously spawned stream has ended, and collect events from each of the spawned streams into the result [EventStream]{@link Bacon.EventStream}. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. The result of [flatMapFirst]{@link Bacon.Observable#flatMapFirst} is always an EventStream. + * @param {Observable#flatMapFirst~f} f + * @returns {EventStream} + */ + flatMapFirst(f:(value:A) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#flatMapError~f + * @param {E} error + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMapError + * @description For each [Error]{@link Bacon.Error} event in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f`, and collect events from each of the spawned streams into the result [EventStream]{@link Bacon.EventStream}. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. The result of [flatMapError]{@link Bacon.Observable#flatMapError} is always an EventStream. + * @param {Observable#flatMapError~f} f + * @returns {EventStream} + */ + flatMapError(f:(error:E) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#flatMapWithConcurrencyLimit~f + * @param {A} value + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMapWithConcurrencyLimit + * @description For each element in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f`, and collect events from each of the spawned streams into the result [EventStream]{@link Bacon.EventStream}, but limit the number of open spawned streams and buffers incoming events by `limit` amount. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. [flatMapConcat]{@link Bacon.Observable#flatMapConcat} is [flatMapWithConcurrencyLimit]{@link Bacon.Observable#flatMapWithConcurrencyLimit}(1) (only one input active), and [flatMap]{@link Bacon.Observable#flatMap} is [flatMapWithConcurrencyLimit]{@link Bacon.Observable#flatMapWithConcurrencyLimit}(∞) (all inputs are piped to output). The result of `flatMapWithConcurrencyLimit` is always an EventStream. + * @param {number} limit + * @param {Observable#flatMapWithConcurrencyLimit~f} f + * @returns {EventStream} + */ + flatMapWithConcurrencyLimit(limit:number, f:(value:A) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#flatMapConcat~f + * @param {A} value + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMapConcat + * @description For each element in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f`, and collect events from each of the spawned streams into the result [EventStream]{@link Bacon.EventStream}, but limit the number of open spawned streams and buffers incoming events to 1. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. The result of `flatMapConcat` is always an EventStream. + * @param {Observable#flatMapConcat~f} f + * @returns {EventStream} + */ + flatMapConcat(f:(value:A) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#scan~f + * @param {B} acc + * @param {A} next + * @returns {B} + */ + /** + * @method Observable#scan + * @description Scans [Observable]{@link Bacon.Observable} with given `seed` value and accumulator function `f`, resulting to a [Property]{@link Bacon.Property}. For example, you might use zero as `seed` and a "plus" function as the accumulator to create an "integral" Property. When applied to a Property as in `r = p.scan(seed, f)`, there's a (hopefully insignificant) catch: the starting value for `r` depends on whether `p` has an initial value when `scan` is applied. If there's no initial value, this works identically to `[EventStream]{@link Bacon.EventStream}.scan`: the `seed` will be the initial value of `r`. However, if `r` already has a current/initial value `x`, the seed won't be output as is. Instead, the initial value of `r` will be `f(seed, x)`. This makes sense, because there can only be 1 initial value for a Property at a time. + * @param {B} seed + * @param {Observable#scan~f} f + * @returns {Property} + * @example + * Bacon.sequentially(1, [1, 2, 3]).scan(0, (a, b) => a + b); + */ + scan(seed:B, f:(acc:B, next:A) => B):Property; + + /** + * @callback Observable#fold~f + * @param {B} acc + * @param {A} next + * @returns {B} + */ + /** + * @method Observable#fold + * @description Scans [Observable]{@link Bacon.Observable} with given `seed` value and accumulator function `f`, but only emits the final value, i.e. the value just before the Observable ends. Returns a [Property]{@link Bacon.Property}. + * @param {B} seed + * @param {Observable#fold~f} f + * @returns {Property} + */ + fold(seed:B, f:(acc:B, next:A) => B):Property; + + /** + * @callback Observable#reduce~f + * @param {B} acc + * @param {A} next + * @returns {B} + */ + /** + * @method Observable#reduce + * @description Scans [Observable]{@link Bacon.Observable} with given `seed` value and accumulator function `f`, but only emits the final value, i.e. the value just before the Observable ends. Returns a [Property]{@link Bacon.Property}. + * @param {B} seed + * @param {Observable#reduce~f} f + * @returns {Property} + */ + reduce(seed:B, f:(acc:B, next:A) => B):Property; + + /** + * @callback Observable#diff~f + * @param {A} a + * @param {B} b + * @returns {B} + */ + /** + * @method Observable#diff + * @description Returns a [Property]{@link Bacon.Property} that represents the result of a comparison `f` between the previous and current value of the [Observable]{@link Bacon.Observable}. For the initial value of the Observable, the previous value will be the given `start`. + * @param {A} start + * @param {Observable#diff~f} f + * @returns {Property} + * @example + * Bacon.sequentially(1, [1, 2, 3]).diff(0, (a, b) => Math.abs(b - a)); + */ + diff(start:A, f:(a:A, b:A) => B):Property; + + /** + * @callback Observable#zip~f + * @param {A} a + * @param {B} b + * @returns {C} + */ + /** + * @method Observable#zip + * @description Returns an [EventStream]{@link Bacon.EventStream} with elements pair-wise lined up with events from this and the `other` EventStream. A zipped EventStream will publish only when it has a value from each EventStream and will only produce values up to when any single EventStream ends. The given function `f` is used to create the result value from value in the two source EventStream. If no function `f` is given, the values are zipped into an array. Be careful not to have too much "drift" between streams. If one stream produces many more values than some other excessive buffering will occur inside the zipped observable. + * @param {EventStream} other + * @param {Observable#zip~f} f + * @returns {EventStream} + * @example + * { + * let x = Bacon.fromArray([1, 2]), + * y = Bacon.fromArray([3, 4]); + * x.zip(y, (x, y) => x + y); + * } + */ + zip(other:EventStream, f:(a:A, b:B) => C):EventStream; + + /** + * @method + * @description Returns a [Property]{@link Bacon.Property} that represents a "sliding window" into the history of the values of the [Observable]{@link Bacon.Observable}. The resulting Property will have a value that is an array containing the last `n` values of the original Observable, where `n` is at most the value of the `max` argument, and at least the value of the `min` argument. If the `min` argument is omitted, there's no lower limit of values. + * @param {number} max + * @param {number} [min] + * @returns {Property} + * @example + * // If you have a EventStream `s` with a value sequence `1,2,3,4,5`, the respective values in `s.slidingWindow(2)` would be `[],[1],[1,2],[2,3],[3,4],[4,5]`: + * Bacon.fromArray([1, 2, 3, 4, 5]).slidingWindow(2); + * // The values of `s.slidingWindow(2,2)`would be `[1,2],[2,3],[3,4],[4,5]`: + * Bacon.fromArray([1, 2, 3, 4, 5]).slidingWindow(2, 2); + */ + slidingWindow(max:number, min?:number):Property; + + /** + * @callback Observable#combine~f + * @param {A} a + * @param {B} b + * @returns {C} + */ + /** + * @method Observable#combine + * @description Combines the latest values of the two [EventStream]{@link Bacon.EventStream}s or [Property]{@link Bacon.Property}s using a two-arg function `f`. The result is a Property. + * @param {Property} property2 + * @param {Observable#combine~f} f + * @returns {Property} + */ + combine(property2:Property, f:(a:A, b:B) => C):Property; + + /** + * @callback Observable#withStateMachine~f + * @param {B} state + * @param {Initial|Next|End|Error} event + * @returns {[B, (Initial|Next|End|Error)[]]} + */ + /** + * @method Observable#withStateMachine + * @description Lets you run a state machine on an [Observable]{@link Bacon.Observable}. Give it an initial state `initState` object and a state transformation function `f` that processes each incoming [Event]{@link Bacon.Event} and returns and array containing the next `state` and an array of output Event's. + * @param {B} initState + * @param {Observable#withStateMachine~f} f + * @returns {EventStream} + * @example + * // Calculate the total sum of all numbers in the stream and output the value on stream end: + * Bacon.fromArray([1, 2, 3]).withStateMachine(0, (sum, event) => { + * if (event.hasValue()) { + * // had to cast to `number` because event:Bacon.Next|Bacon.Error<{}> + * return [sum + event.value(), []]; + * } else if (event.isEnd()) { + * return [undefined, [new Bacon.Next(sum), event]]; + * } else { + * return [sum, [event]]; + * } + * }); + */ + withStateMachine(initState:B, f:(state:B, event:Initial|Next|End|Error) => [B, (Initial|Next|End|Error)[]]):EventStream; + + /** + * @method + * @description Decodes input [Observable]{@link Bacon.Observable} using the given `mapping`. Is a bit like a switch-case or the decode function in Oracle SQL. The return value of `decode` is always a [Property]{@link Bacon.Property}. + * @param {Object} mapping + * @returns {Property} + * @example + * { + * let property = Bacon.fromArray([1, 2, 3]).toProperty(), + * who = Bacon.fromArray(["A", "B", "C"]).toProperty(); + * // The following would map the value 1 into the string "mike" and the value 2 into the value of the `who` property: + * property.decode({1: "mike", 2: who}); + * // You can compose static and dynamic data quite freely, as in: + * property.decode({1: {type: "mike"}, 2: {type: "other", whoThen: who}}); + * } + */ + decode(mapping:Object):Property; + + /** + * @method + * @description Creates a [Property]{@link Bacon.Property} that indicates whether Observable is awaiting `otherObservable`, i.e. has produced a value after the latest value from `otherObservable`. + * @param {Observable} otherObservable + * @returns {Property} + * @example + * { + * // This is handy for keeping track whether we are currently awaiting an AJAX response: + * let ajaxRequest = >{}, + * ajaxResponse = >{}, + * showAjaxIndicator = ajaxRequest.awaiting(ajaxResponse); + * } + */ + awaiting(otherObservable:Observable):Property; + } + + /** + * @class EventStream + * @augments Bacon.Observable + * @description A stream of events. + * */ + interface EventStream extends Observable { + /** + * @callback EventStream#map~f + * @param {A} value + * @returns {B} + */ + /** + * @method EventStream#map + * @description Maps [EventStream]{@link Bacon.EventStream} values using given function `f`, returning a new EventStream. The `map` method, among many others, uses lazy evaluation. + * @param {EventStream#map~f} f + * @returns {EventStream} + * */ + map(f:(value:A) => B):EventStream; + + /** + * @method + * @description Maps [EventStream]{@link Bacon.EventStream} values using given `constant` value, returning a new EventStream. The `map` method, among many others, uses lazy evaluation. + * @param {B} constant + * @returns {EventStream} + * */ + map(constant:B):EventStream; + + /** + * @method + * @description Maps [EventStream]{@link Bacon.EventStream} values using given `propertyExtractor` string like ".keyCode", returning a new EventStream. So, if `propertyExtractor` is a string starting with a dot, the elements will be mapped to the corresponding field/function in the event value. For instance map(".keyCode") will pluck the keyCode field from the input values. If `keyCode` was a function, the result EventStream would contain the values returned by the function. The "Function Construction rules" apply here. The `map` method, among many others, uses lazy evaluation. + * @param {string} propertyExtractor + * @returns {EventStream} + * */ + map(propertyExtractor:string):EventStream; + + /** + * @method + * @description Maps [EventStream]{@link Bacon.EventStream} events to the current value of the given [Property]{@link Bacon.Property} `property`. This is equivalent to [Property.sampledBy]{@link Bacon.Property#sampledBy}. + * @param {Property} property + * @returns {EventStream} + */ + map(property:Property):EventStream; + + /** + * @callback EventStream#mapError~f + * @param {E} error + * @returns {B} + */ + /** + * @method EventStream#mapError + * @description Maps [EventStream]{@link Bacon.EventStream} [Error]{@link Bacon.Error}s using given function `f`. More specifically, feeds the "error" field of the Error event to the function and produces a [Next]{@link Bacon.Next} event based on the return value. The "Function Construction rules" apply here. + * @param {EventStream#mapError~f} f + * @returns {EventStream} + */ + mapError(f:(error:E) => B):EventStream; + + /** + * @method + * @description Returns an [EventStream]{@link Bacon.EventStream} containing [Error]{@link Bacon.Error} events only. Same as filtering with a function that always returns `false`. + * @returns {EventStream} + */ + errors():EventStream; + + /** + * @method + * @description Skips all [Error]{@link Bacon.Error}s. + * @returns {EventStream} + */ + skipErrors():EventStream; + + /** + * @callback EventStream#mapEnd~f + * @returns {A} + */ + /** + * @method EventStream#mapEnd + * @description Adds an extra [Next]{@link Bacon.Next} event just before [End]{@link Bacon.End} to [EventStream]{@link Bacon.EventStream}. The value is created by calling the given function `f` when the source [EventStream]{@link Bacon.EventStream} ends. + * @param {EventStream#mapEnd~f} f + * @returns {EventStream} + */ + mapEnd(f:() => A):EventStream; + + /** + * @method + * @description Adds an extra [Next]{@link Bacon.Next} event just before [End]{@link Bacon.End} to [EventStream]{@link Bacon.EventStream}. A static `value` is used. + * @param {A} value + * @returns {EventStream} + */ + mapEnd(value:A):EventStream; + + /** + * @callback EventStream#filter~f + * @param {A} value + * @returns {boolean} + */ + /** + * @method EventStream#filter + * @description Filters [EventStream]{@link Bacon.EventStream} `value`s using a given predicate function `f`. + * @param {EventStream#filter~f} f + * @returns {EventStream} + */ + filter(f:(value:A) => boolean):EventStream; + + /** + * @method + * @description Filters [EventStream]{@link Bacon.EventStream} values using a given `constant` value (`true` to include all, `false` to exclude all). + * @param {boolean} bool + * @returns {EventStream} + */ + filter(bool:boolean):EventStream; + + /** + * @method + * @description Filters [EventStream]{@link Bacon.EventStream} values using a given `propertyExtractor` string (like ".isValuable"). + * @param {string} propertyExtractor + * @returns {EventStream} + */ + filter(propertyExtractor:string):EventStream; + + /** + * @method + * @description Filters [EventStream]{@link Bacon.EventStream} values based on the value of a [Property]{@link Bacon.Property} `property`. [Event]{@link Bacon.Event} will be included in output IF AND ONLY IF the `property` holds `true` at the time of the event. + * @param {Property} property + * @returns {EventStream} + */ + filter(property:Property):EventStream; + + /** + * @callback EventStream#takeWhile~f + * @param {A} value + * @returns {boolean} + */ + /** + * @method EventStream#takeWhile + * @description Takes [EventStream]{@link Bacon.EventStream} values while given predicate function `f` holds `true`, and then ends. + * @param {EventStream#takeWhile} f + * @returns {EventStream} + */ + takeWhile(f:(value:A) => boolean):EventStream; + + /** + * @method + * @description Takes [EventStream]{@link Bacon.EventStream} values while the value of a `property` holds `true`, and then ends. + * @param {Property} property + * @returns {EventStream} + */ + takeWhile(property:Property):EventStream; + + /** + * @method + * @description Takes at most n elements from the [EventStream]{@link Bacon.EventStream}. Equal to `Bacon.never()` if `n <= 0`. + * @param {number} n + * @returns {EventStream} + */ + take(n:number):EventStream; + + /** + * @method + * @description Takes elements from [EventStream]{@link Bacon.EventStream} until a [Next]{@link Bacon.Next} event appears in the EventStream `stream`. If `stream` ends without value, it is ignored. + * @param {EventStream} stream + * @returns {EventStream} + */ + takeUntil(stream:EventStream):EventStream; + + /** + * @method + * @description Takes the first element from the [EventStream]{@link Bacon.EventStream}. Essentially [Observable.take]{@link Bacon.EventStream#take}(1). + * @returns {EventStream} + */ + first():EventStream; + + /** + * @method + * @description Takes the last element from the [EventStream]{@link Bacon.EventStream}. None, if EventStream is empty. + * @returns {EventStream} + * @example + * // This creates the stream which doesn't produce any events and never ends: + * Bacon.interval(1e1, 0).last(); + */ + last():EventStream; + + /** + * @method + * @description Skips the first `n` elements from the [EventStream]{@link Bacon.EventStream}. + * @param {number} n + * @returns {EventStream} + */ + skip(n:number):EventStream; + + /** + * @method + * @description Delays the [EventStream]{@link Bacon.EventStream} by given `delay` (in milliseconds). + * @param {number} delay + * @returns {EventStream} + */ + delay(delay:number):EventStream; + + /** + * @method EventStream#throttle + * @description Throttles the [EventStream]{@link Bacon.EventStream} by given `delay` (in milliseconds). Events are emitted with the minimum interval of `delay`. The implementation is based on [EventStream.bufferWithTime]{@link Bacon.EventStream#bufferWithTime}. + * @param {number} delay + * @returns {EventStream} + */ + throttle(delay:number):EventStream; + + /** + * @method EventStream#debounce + * @description Throttles the [EventStream]{@link Bacon.EventStream} by given `delay` (in milliseconds), but so that event is only emitted after the given "quiet period". The difference of [throttle]{@link Bacon.EventStream#throttle} and [debounce]{@link Bacon.EventStream#debounce} is the same as it is in the same methods in jQuery. + * @param {number} delay + * @returns {EventStream} + */ + debounce(delay:number):EventStream; + + /** + * @method + * @description Passes the first event in the [EventStream]{@link Bacon.EventStream} through, but after that, only passes events after a given `delay` (in milliseconds) have passed since previous output. + * @param {number} delay + * @returns {EventStream} + */ + debounceImmediate(delay:number):EventStream; + + /** + * @callback EventStream#doAction~f + * @param {A} value + * @returns {void} + */ + /** + * @method EventStream#doAction + * @description Returns an [EventStream]{@link Bacon.EventStream} where the function `f` is executed for each value, before dispatching to subscribers. This is useful for debugging, but also for stuff like calling the `preventDefault()` method for events. + * @param {EventStream#doAction~f} f + * @returns {EventStream} + */ + doAction(f:(value:A) => void):EventStream; + + /** + * @method + * @description Returns an [EventStream]{@link Bacon.EventStream} where the `propertyExtractor` string is applied to each value, before dispatching to subscribers. This is useful for debugging, but also for stuff like calling the `preventDefault()` method for events. + * @param {string} propertyExtractor + * @returns {EventStream} + */ + doAction(propertyExtractor:string):EventStream; + + /** + * @callback EventStream#doError~f + * @param {E} error + * @returns {void} + */ + /** + * @method EventStream#doError + * @description Returns an [EventStream]{@link Bacon.EventStream} where the function `f` is executed for each error, before dispatching to subscribers. That is, same as `doAction` but for errors. + * @param {EventStream#doError~f} f + * @returns {EventStream} + */ + doError(f:(error:E) => void):EventStream; + + /** + * @method + * @description Returns an [EventStream]{@link Bacon.EventStream} that inverts boolean values. + * @returns {EventStream} + */ + not():EventStream; + + /** + * @method EventStream#log + * @description Logs each value of the [EventStream]{@link Bacon.EventStream} to the console. It optionally takes a `label` argument to pass to `console.log()` alongside each value. To assist with chaining, it returns the original EventStream. Note that as a side-effect, the EventStream will have a constant listener and will not be garbage-collected. So, use this for debugging only and remove from production code. + * @param {string} [label] + * @returns {EventStream} + */ + log(label?:string):EventStream; + + /** + * @method EventStream#doLog + * @description Logs each value of the [EventStream]{@link Bacon.EventStream} to the console. [doLog]{@link Bacon.EventStream#doLog} behaves like [log]{@link Bacon.EventStream#log} but does not subscribe to the EventStream. You can think of `doLog` as a logger function that – unlike `log` – is safe to use in production. `doLog` is safe, because it does not cause the same surprising side-effects as `log` does. + * @returns {EventStream} + */ + doLog():EventStream; + + /** + * @method + * @description Ends the [EventStream]{@link Bacon.EventStream} on first [Error]{@link Bacon.Error} event. The error is included in the output of the returned EventStream. + * @returns {EventStream} + */ + endOnError():EventStream; + + /** + * @callback EventStream#endOnError~f + * @param {E} error + * @returns {boolean} + */ + /** + * @method EventStream#endOnError + * @description Ends the [EventStream]{@link Bacon.EventStream} on first [Error]{@link Bacon.Error} event for which the given predicate function `f` returns `true`. The error is included in the output of the returned EventStream. + * @param {EventStream#endOnError} f + * @returns {EventStream} + */ + endOnError(f:(error:E) => boolean):EventStream; + + /** + * @callback EventStream#withHandler~f + * @param {Initial|Next|End|Error} event + * @returns {*} + */ + /** + * @method EventStream#withHandler + * @description Lets you do more custom event handling on [EventStream]{@link Bacon.EventStream}: you get all events to your function `f` and you can output any number of events and end the stream if you choose. Note that it's important to return the value from `this.push` so that the connection to the underlying stream will be closed when no more events are needed. + * @param {EventStream#withHandler~f} f + * @returns {EventStream} + * @example + * // Send an error and end the stream in case a value is below zero: + * Bacon.fromArray([1, 2, -3, 3]).withHandler(function (event) { + * if (event.hasValue() && event.value() < 0) { + * this.push(new Bacon.Error("Value below zero")); + * return this.push(new Bacon.End()); + * } else { + * return this.push(event); + * } + * }); + */ + withHandler(f:(event:Initial|Next|End|Error) => any):EventStream; + + /** + * @method + * @description Sets the name of the [EventStream]{@link Bacon.EventStream}. Overrides the default implementation of `toString` and `inspect`. Returns itself. + * @param {string} newName + * @returns {EventStream} + */ + name(newName:string):EventStream; + + /** + * @method + * @description Sets the structured description of the [EventStream]{@link Bacon.EventStream}. The `toString` and `inspect` methods use this data recursively to create a string representation for the `EventStream`. This method is probably useful for Bacon core/library/plugin development only. + * @param {...*} param + * @returns {EventStream} + * @example + * { + * let src = Bacon.once(1), + * obs = src.map(x => -x); + * + * console.log(obs.toString()); + * // Bacon.once(1).map(function) + * + * obs.withDescription(src, "times", -1); + * console.log(obs.toString()); + * // Bacon.once(1).times(-1) + */ + withDescription(...param:any[]):EventStream; + + /** + * @callback EventStream#groupBy1~keyF + * @param {A} value + * @returns {B} + */ + /** + * @method EventStream#groupBy1 + * @description Groups [EventStream]{@link Bacon.EventStream} events to new EventStream's by `keyF`. + * @param {EventStream#groupBy1~keyF} keyF + * @returns {EventStream>} + */ + groupBy(keyF:(value:A) => B):EventStream>; + + /** + * @callback keyF + * @param {A} value + * @returns {B} + */ + /** + * @callback limitF + * @param {EventStream} groupedStream + * @param {Initial|Next|End|Error} groupStartingEvent + * @returns {EventStream} + */ + /** + * @description Groups [EventStream]{@link Bacon.EventStream} events to new EventStream's by `keyF`. `limitF` is provided to limit grouped stream life. EventStream transformed by `limitF` is passed on if provided. `limitF` gets grouped stream and the original [Event]{@link Bacon.Event} causing the EventStream to start as parameters. + * @param {keyF} keyF + * @param {limitF} limitF + * @returns {EventStream>} Grouped streams. + */ + groupBy(keyF:(value:A) => B, limitF:(groupedStream:EventStream, groupStartingEvent:Initial|Next|End|Error) => EventStream):EventStream>; + + /** + * @callback EventStream#subscribe~f + * @param {Event} event + * @returns {void|NoMore} + */ + /** + * @callback EventStream#subscribe~unsubscribe + * @returns {void} + */ + /** + * @method EventStream#subscribe + * @description Subscribes a given handler function `f` to [EventStream]{@link Bacon.EventStream}. Function will receive [Event]{@link Bacon.Event} objects. The [subscribe]{@link EventStream#subscribe} call returns an [unsubscribe function]{@link EventStream#subscribe~unsubscribe} that you can call to unsubscribe. You can also unsubscribe by returning [Bacon.noMore]{@link Bacon.noMore} from the handler function as a reply to an Event. + * @param {EventStream#subscribe~f} f + * @returns {EventStream#subscribe~unsubscribe} + */ + subscribe(f:(event:Event) => void|NoMore):() => void; + + /** + * @callback EventStream#onValue~f + * @param {A} value + * @returns {void} + */ + /** + * @callback EventStream#onValue~unsubscribe + * @returns {void} + */ + /** + * @method EventStream#onValue + * @description Subscribes a given handler function `f` to [EventStream]{@link Bacon.EventStream}. Function will be called for each new value in the EventStream. This is the simplest way to assign a side-effect to a EventStream. The difference to the [subscribe]{@link Bacon.EventStream#subscribe} method is that the actual EventStream values are received, instead of [Event]{@link Bacon.Event} objects. Just like `subscribe`, this method returns a function for `unsubscribe`ing. + * @param {EventStream#onValue~f} f + * @returns {EventStream#onValue~unsubscribe} + */ + onValue(f:(value:A) => void):() => void; + + /** + * @callback EventStream#onValues~f + * @param {*[]} args + * @returns {void} + */ + /** + * @callback EventStream#onValues~unsubscribe + * @returns {void} + */ + /** + * @method EventStream#onValues + * @description Subscribes a given handler function `f` to [EventStream]{@link Bacon.EventStream}. Like [EventStream.onValue]{@link Bacon.EventStream#onValue}, but splits the value (assuming its an array) as function arguments to `f`. + * @param {EventStream#onValues~f} f + * @returns {EventStream#onValues~unsubscribe} + */ + onValues(f:(...args:any[]) => void):() => void; + + /** + * @callback EventStream#skipDuplicates~isEqual + * @param {A} oldValue + * @param {A} newValue + * @returns {boolean} + */ + /** + * @method EventStream#skipDuplicates + * @description Drops consecutive equal elements of the [EventStream]{@link Bacon.EventStream}. Uses the === operator for equality checking by default. If the `isEqual` argument is supplied, checks by calling [isEqual]{@link EventStream#skipDuplicates~isEqual}. For instance, to do a deep comparison, you can use the `isEqual` function from underscore.js like `stream.skipDuplicates(_.isEqual)`. + * @param {EventStream#skipDuplicates~isEqual} [isEqual] + * @returns {EventStream} + * @example + * Bacon.fromArray([1, 2, 2, 1]).skipDuplicates().log(); + * // > returns [1, 2, 1] in an order + */ + skipDuplicates(isEqual?:(oldValue:A, newValue:A) => boolean):EventStream; + + /** + * @method + * @description Concatenates two [EventStream]{@link Bacon.EventStream}s into one so that it will deliver events from EventStream until it ends and then deliver events from `otherStream`. This means too that events from `otherStream`, occurring before the end of EventStream will not be included in the result EventStream. + * @param {EventStream} otherStream + * @returns {EventStream} + */ + concat(otherStream:EventStream):EventStream; + + /** + * @method + * @description Merges two [EventStream]{@link Bacon.EventStream}s into one that delivers events from both. + * @param {EventStream} otherStream + * @returns {EventStream} + */ + merge(otherStream:EventStream):EventStream; + + /** + * @method + * @description Pauses and buffers the [EventStream]{@link Bacon.EventStream} if last event in `valve` is truthy. All buffered events are released when `valve` becomes falsy. + * @param {Observable} valve + * @returns {EventStream} + */ + holdWhen(valve:Observable):EventStream; + + /** + * @method + * @description Adds a starting `value` to the [EventStream]{@link Bacon.EventStream}, i.e. concats a EventStream containing a single `value` with this EventStream. + * @param {A} value + * @returns {EventStream} + */ + startWith(value:A):EventStream; + + /** + * @callback EventStream#skipWhile~f + * @param {A} value + * @returns {boolean} + */ + /** + * @method EventStream#skipWhile + * @description Skips elements in the [EventStream]{@link Bacon.EventStream} until the given predicate function `f` returns falsy once, and then lets all events pass through. + * @param {EventStream#skipWhile~f} f + * @returns {EventStream} + */ + skipWhile(f:(value:A) => boolean):EventStream; + + /** + * @method + * @description Skips elements in the [EventStream]{@link Bacon.EventStream} until the value of the given [Property]{@link Bacon.Property} `property` is falsy once, and then lets all events pass through. + * @param {Property} property + * @returns {EventStream} + */ + skipWhile(property:Property):EventStream; + + /** + * @method + * @description Skips elements from the [EventStream]{@link Bacon.EventStream} until a [Next]{@link Bacon.Next} event appears in `stream2`. In other words, starts delivering values from `stream` after first event appears in `stream2`. + * @param {EventStream} stream2 + * @returns {EventStream} + */ + skipUntil(stream2:EventStream):EventStream; + + /** + * @method + * @description Buffers the [EventStream]{@link Bacon.EventStream} with given `delay` (in milliseconds). The buffer is flushed at most once in the given `delay`. + * @param {number} delay + * @returns {EventStream} + * @example + * // You might get two events containing [1,2,3,4] and [5,6,7] respectively, given that the flush occurs between numbers 4 and 5: + * Bacon.fromArray([1, 2, 3, 4, 5, 6, 7]).bufferWithTime(0); + */ + bufferWithTime(delay:number):EventStream; + + /** + * @callback EventStream#bufferWithTime~f + * @param {EventStream#bufferWithTime~defer} defer + * @returns {void} + */ + /** + * @callback EventStream#bufferWithTime~defer + * @param {...*} args + * @returns {void} + */ + /** + * @method EventStream#bufferWithTime + * @description Buffers the [EventStream]{@link Bacon.EventStream} with given "defer-function" `f`. + * @param {EventStream#bufferWithTime~f} f + * @returns {EventStream} + * @example + * // Here's an equivalent to `stream.bufferWithTime(10)`: + * let stream = Bacon.fromArray([1, 2, 3, 4, 5, 6, 7]); + * stream.bufferWithTime(f => { setTimeout(f, 10); }); } + */ + bufferWithTime(f:(defer:(...args:any[]) => void) => void):EventStream; + + /** + * @method + * @description Buffers the [EventStream]{@link Bacon.EventStream} events with given `count`. The buffer is flushed when it contains the given `count` of elements. + * @param {number} count + * @returns {EventStream} + * @example + * // You will get output events with values `[1, 2]`, `[3, 4]` and `[5]`. + * Bacon.fromArray([1, 2, 3, 4, 5]).bufferWithCount(2); + */ + bufferWithCount(count:number):EventStream; + + /** + * @method + * @description Buffers the [EventStream]{@link Bacon.EventStream} events and flushes when either the buffer contains the given `count` of elements or the given `delay` (in milliseconds) has passed since last buffered event. + * @param {number} delay + * @param {number} count + * @returns {EventStream} + */ + bufferWithTimeOrCount(delay:number, count:number):EventStream; + + /** + * @method EventStream#toProperty + * @description Creates a [Property]{@link Bacon.Property} based on the [EventStream]{@link Bacon.EventStream}. Without arguments, you'll get a Property without an initial value and will get its first actual value from the EventStream, and after that it'll always have a current value. Given `initialValue` will be used as the current value until the first value comes from the EventStream. + * @param {A} [initialValue] + * @returns {Property} + */ + toProperty(initialValue?:A):Property; + } + + var EventStream:{ + /** + * @callback EventStream#new~subscribe + * @param {EventStream#new~sink} sink + * @returns {EventStream#new~unsubscribe} + */ + /** + * @callback EventStream#new~sink + * @param {More|NoMore|(A|Initial|Next|End|Error)|(A|Initial|Next|End|Error)[]} value + * @returns {void} + */ + /** + * @callback EventStream#new~unsubscribe + * @returns {void} + */ + /** + * @constructor EventStream#new + * @constructs Bacon.EventStream + * @description Creates an [EventStream]{@link Bacon.EventStream} with the given `subscribe` function. + * @param {EventStream#new~subscribe} subscribe + * @returns {EventStream} + */ + new(subscribe:(sink:(value:More|NoMore|(A|Initial|Next|End|Error)|(A|Initial|Next|End|Error)[]) => void) => (() => void)):EventStream; + }; + + /** + * @class Property + * @augments Bacon.Observable + * @description A reactive property. Has the concept of "current value". You can create a Property from an [EventStream]{@link Bacon.EventStream} by using either [EventStream.toProperty]{@link Bacon.EventStream#toProperty} or [Observable.scan]{@link Bacon.Observable#scan} method. Note: depending on how a Property is created, it may or may not have an initial value. The current value stays as its last value after the EventStream has ended. + * */ + interface Property extends Observable { + /** + * @callback Property#map~f + * @param {A} value + * @returns {B} + */ + /** + * @method Property#map + * @description Maps the [Property]{@link Bacon.Property} values using given function `f`, returning a new Property. This method, among many others, uses lazy evaluation. + * @param {Property#map~f} f + * @returns {Property} + * */ + map(f:(value:A) => B):Property; + + /** + * @method + * @description Maps the [Property]{@link Bacon.Property} values using given `constant` value, returning a new Property. This method, among many others, uses lazy evaluation. + * @param {B} constant + * @returns {Property} + * */ + map(constant:B):Property; + + /** + * @method + * @description Maps the [Property]{@link Bacon.Property} values using given `propertyExtractor` string like ".keyCode", returning a new Property. So, if f is a string starting with a dot, the elements will be mapped to the corresponding field/function in the event value. For instance map(".keyCode") will pluck the keyCode field from the input values. If "keyCode" was a function, the resulting Property would contain the values returned by the function. This method, among many others, uses lazy evaluation. + * @param {string} propertyExtractor + * @returns {Property} + * */ + map(propertyExtractor:string):Property; + + /** + * @callback Property#mapError~f + * @param {E} error + * @returns {B} + */ + /** + * @method Property#mapError + * @description Maps the [Property]{@link Bacon.Property} errors using given function `f`. More specifically, feeds the "error" field of the [Error]{@link Bacon.Error} event to the function `f` and produces a [Next]{@link Bacon.Next} event based on the return value. + * @param {Property#mapError~f} f + * @returns {Property} + */ + mapError(f:(error:E) => B):Property; + + /** + * @method + * @description Returns a [Property]{@link Bacon.Property} containing [Error]{@link Bacon.Error} events only. Same as filtering with a function that always returns false. + * @returns {Property} + */ + errors():Property; + + /** + * @method + * @description Skips all [Error]{@link Bacon.Error}s. + * @returns {Property} + */ + skipErrors():Property; + + /** + * @callback Property#mapEnd~f + * @returns {A} + */ + /** + * @method Property#mapEnd + * @description Adds an extra [Next]{@link Bacon.Next} event just before [End]{@link Bacon.End} of the [Property]{@link Bacon.Property}. The value is created by calling the given function `f` when the source Property ends. + * @param {Property#mapEnd~f} f + * @returns {Property} + */ + mapEnd(f:() => A):Property; + + /** + * @method + * @description Adds an extra [Next]{@link Bacon.Next} event just before [End]{@link Bacon.End} of the [Property]{@link Bacon.Property}. A static `value` is used. + * @param {A} value + * @returns {Property} + */ + mapEnd(value:A):Property; + + /** + * @callback Property#filter~f + * @param {A} value + * @returns {boolean} + */ + /** + * @method Property#filter + * @description Filters the [Property]{@link Bacon.Property} values using a given predicate function `f`. + * @param {Property#filter~f} f + * @returns {Property} + */ + filter(f:(value:A) => boolean):Property; + + /** + * @method + * @description Filters the [Property]{@link Bacon.Property} values using a given constant `bool` value (`true` to include all, `false` to exclude all). + * @param {boolean} bool + * @returns {Property} + */ + filter(bool:boolean):Property; + + /** + * @method + * @description Filters the [Property]{@link Bacon.Property} values using a given `propertyExtractor` string (like ".isValuable"). + * @param {string} propertyExtractor + * @returns {Property} + */ + filter(propertyExtractor:string):Property; + + /** + * @method + * @description Filters the [Property]{@link Bacon.Property} values based on the value of the Property `property`. Event will be included in output IF AND ONLY IF the `property` holds `true` at the time of the event. + * @param {Property} property + * @returns {Property} + */ + filter(property:Property):Property; + + /** + * @callback Property#takeWhile~f + * @param {A} value + * @returns {boolean} + */ + /** + * @method Property#takeWhile + * @description Takes the [Property]{@link Bacon.Property} values while given predicate function `f` holds `true`, and then ends. + * @param {Property#takeWhile~f} f + * @returns {Property} + */ + takeWhile(f:(value:A) => boolean):Property; + + /** + * @method + * @description Takes the [Property]{@link Bacon.Property} values while the value of a `property` holds `true`, and then ends. + * @param {Property} property + * @returns {Property} + */ + takeWhile(property:Property):Property; + + /** + * @method Property#take + * @description Takes at most `n` elements from the [Property]{@link Bacon.Property}. Equal to `Bacon.never()` if `n <= 0`. + * @param {number} n + * @returns {Property} + */ + take(n:number):Property; + + /** + * @method + * @description Takes elements from the [Property]{@link Bacon.Property} until a [Next]{@link Bacon.Next} event appears in the `stream`. If `stream` ends without value, it is ignored. + * @param {EventStream} stream + * @returns {Property} + */ + takeUntil(stream:EventStream):Property; + + /** + * @method + * @description Takes the first element from the [Property]{@link Bacon.Property}. Essentially [Property.take]{@link Bacon.Property#take}(1). + * @returns {Property} + */ + first():Property; + + /** + * @method + * @description Takes the last element from the [Property]{@link Bacon.Property}. None, if Property is empty. + * @returns {Property} + * @example + * // This creates the property which doesn't produce any events and never ends: + * Bacon.interval(1e1, 0).toProperty().last(); + */ + last():Property; + + /** + * @method + * @description Skips the first `n` elements from the [Property]{@link Bacon.Property}. + * @param {number} n + * @returns {Property} + */ + skip(n:number):Property; + + /** + * @method + * @description Delays the [Property]{@link Bacon.Property} by given `delay` (in milliseconds). Does not delay the initial value of a Property. + * @param {number} delay + * @returns {Property} + */ + delay(delay:number):Property; + + /** + * @method Property#throttle + * @description Throttles the [Property]{@link Bacon.Property} by given `delay` (in milliseconds). Events are emitted with the minimum interval of `delay`. The implementation is based on [EventStream.bufferWithTime]{@link Bacon.EventStream#bufferWithTime}. Does not affect emitting the initial value of a Property. + * @param {number} delay + * @returns {Property} + */ + throttle(delay:number):Property; + + /** + * @method Property#debounce + * @description Throttles the [Property]{@link Bacon.Property} by given `delay` (in milliseconds), but so that event is only emitted after the given "quiet period". Does not affect emitting the initial value of a Property. The difference of [throttle]{@link Bacon.Property#throttle} and [debounce]{@link Bacon.Property#debounce} is the same as it is in the same methods in jQuery. + * @param {number} delay + * @returns {Property} + */ + debounce(delay:number):Property; + + /** + * @method + * @description Passes the first event in the [Property]{@link Bacon.Property} through, but after that, only passes events after a given `delay` (in milliseconds) have passed since previous output. + * @param {number} delay + * @returns {Property} + */ + debounceImmediate(delay:number):Property; + + /** + * @callback Property#doAction~f + * @param {A} value + * @returns {void} + */ + /** + * @method Property#doAction + * @description Returns a [Property]{@link Bacon.Property} where the function `f` is executed for each value, before dispatching to subscribers. This is useful for debugging, but also for stuff like calling the `preventDefault()` method for events. + * @param {Property#doAction~f} f + * @returns {Property} + */ + doAction(f:(value:A) => void):Property; + + /** + * @method + * @description Returns a [Property]{@link Bacon.Property} where the `propertyExtractor` string is applied to each value, before dispatching to subscribers. This is useful for debugging, but also for stuff like calling the `preventDefault()` method for events. + * @param {string} propertyExtractor + * @returns {Property} + */ + doAction(propertyExtractor:string):Property; + + /** + * @callback Property#doError~f + * @param {E} error + * @returns {void} + */ + /** + * @method Property#doError + * @description Returns a [Property]{@link Bacon.Property} where the function `f` is executed for each error, before dispatching to subscribers. That is, same as [doAction]{@link Bacon.Property#doAction} but for [Error]{@link Bacon.Error}s. + * @param {Property#doError~f} f + * @returns {Property} + */ + doError(f:(error:E) => void):Property; + + /** + * @method + * @description Returns a [Property]{@link Bacon.Property} that inverts boolean values. + * @returns {Property} + */ + not():Property; + + /** + * @method Property#log + * @description Logs each value of the [Property]{@link Bacon.Property} to the console. It optionally takes a `label` argument to pass to `console.log()` alongside each value. To assist with chaining, it returns the original Property. Note that as a side-effect, the Property will have a constant listener and will not be garbage-collected. So, use this for debugging only and remove from production code. + * @param {string} [label] + * @returns {Property} + */ + log(label?:string):Property; + + /** + * @method Property#doLog + * @description Logs each value of the [Property]{@link Bacon.Property} to the console. [doLog]{@link Bacon.Property#doLog} behaves like [log]{@link Bacon.Property#log} but does not subscribe to the Property. You can think of `doLog` as a logger function that – unlike `log` – is safe to use in production. `doLog` is safe, because it does not cause the same surprising side-effects as `log` does. + * @returns {Property} + */ + doLog():Property; + + /** + * @method + * @description Ends the [Property]{@link Bacon.Property} on first [Error]{@link Bacon.Error} event. The error is included in the output of the returned Property. + * @returns {Property} + */ + endOnError():Property; + + /** + * @callback Property#endOnError~f + * @param {E} error + * @returns {boolean} + */ + /** + * @method Property#endOnError + * @description Ends the [Property]{@link Bacon.Property} on first [Error]{@link Bacon.Error} event for which the given predicate function `f` returns `true`. The error is included in the output of the returned Property. + * @param {Property#endOnError~f} f + * @returns {Property} + */ + endOnError(f:(error:E) => boolean):Property; + + /** + * @callback Property#withHandler~f + * @param {Initial|Next|End|Error} event + * @returns {*} + */ + /** + * @method Property#withHandler + * @description Lets you do more custom event handling on the [Property]{@link Bacon.Property}: you get all events to your function `f` and you can output any number of [Event]{@link Bacon.Event}s and end the Property if you choose. Note that it's important to return the value from `this.push` so that the connection to the underlying stream will be closed when no more events are needed. + * @param {Property#withHandler~f} f + * @returns {Property} + * @example + * // Send an error and end the stream in case a value is below zero: + * Bacon.fromArray([1, 2, -3, 3]).withHandler(function (event) { + * if (event.hasValue() && event.value() < 0) { + * this.push(new Bacon.Error("Value below zero")); + * return this.push(new Bacon.End()); + * } else { + * return this.push(event); + * } + * }); + */ + withHandler(f:(event:Initial|Next|End|Error) => any):Property; + + /** + * @method + * @description Sets the `newName` of the [Property]{@link Bacon.Property}. Overrides the default implementation of `toString` and `inspect`. Returns itself. + * @param {string} newName + * @returns {Property} + */ + name(newName:string):Property; + + /** + * @method + * @description Sets the structured description of the [Property]{@link Bacon.Property}. The `toString` and `inspect` methods use this data recursively to create a string representation for the Property. This method is probably useful for Bacon core/library/plugin development only. + * @param {...*} param + * @returns {Property} + * @example + * let src = Bacon.once(1), + * obs = src.map(x => -x); + * + * console.log(obs.toString()); + * // Bacon.once(1).map(function) + * + * obs.withDescription(src, "times", -1); + * console.log(obs.toString()); + * // Bacon.once(1).times(-1) + */ + withDescription(...param:any[]):Property; + + /** + * @method + * @description Creates an [EventStream]{@link Bacon.EventStream} based on this [Property]{@link Bacon.Property}. The EventStream contains also an event for the current value of this Property at the time this method was called. + * @returns {EventStream} + */ + toEventStream():EventStream; + + /** + * @callback Property#subscribe~f + * @param {Event} event + * @returns {void} + */ + /** + * @callback Property#subscribe~unsubscribe + * @returns {void} + */ + /** + * @method Property#subscribe + * @description Subscribes a handler function `f` to [Property]{@link Bacon.Property}. If there's a current value, an [Initial]{@link Bacon.Initial} event will be pushed immediately. [Next]{@link Bacon.Next} event will be pushed on updates and an [End]{@link Bacon.End} event in case the source Property ends. Returns a function that you call to `unsubscribe`. + * @param {Property#subscribe~f} f + * @returns {Property#subscribe~unsubscribe} + */ + subscribe(f:(event:Event) => void):() => void; + + /** + * @callback Property#onValue~f + * @param {A} value + * @returns {void} + */ + /** + * @callback Property#onValue~unsubscribe + * @returns {void} + */ + /** + * @method Property#onValue + * @description Subscribes a handler function `f` to [Property]{@link Bacon.Property}. Similar to [EventStream.onValue]{@link Bacon.EventStream#onValue}, except that also pushes the initial value of the Property, in case there is one. Just like [subscribe]{@link Bacon.Property#subscribe}, this method returns a function for `unsubscribe`ing. + * @param {Property#onValue~f} f + * @returns {Property#onValue~unsubscribe} + */ + onValue(f:(value:A) => void):() => void; + + /** + * @callback Property#onValues~f + * @param {*[]} args + * @returns {void} + */ + /** + * @callback Property#onValues~unsubscribe + * @returns {void} + */ + /** + * @method Property#onValues + * @description Subscribes a handler function `f` to [Property]{@link Bacon.Property}. Like [onValue]{@link Bacon.Property#onValue}, but splits the value (assuming its an array) as function arguments to `f`. + * @param {Property#onValues~f} f + * @returns {Property#onValues~unsubscribe} + */ + onValues(f:(...args:any[]) => void):() => void; + + /** + * @method Property#assign + * @description Calls the `method` of the given `object` with each value of this [Property]{@link Bacon.Property}. You can optionally supply `params` which will be used as the first arguments of the `method` call. Note that the [assign]{@link Bacon.Property#assign} method is actually just a synonym for [onValue]{@link Bacon.Property#onValue}. + * @param {Object} obj + * @param {string} method + * @param {...*} params + * @returns {void} + * @example + * let property = Bacon.fromArray([1, 2, 3, 4, 5]).toProperty(); + * // If you want to assign your Property to the "disabled" attribute of a JQuery object, you can do this: + * property.assign($("#my-button"), "attr", "disabled"); + * // A simpler example would be to toggle the visibility of an element based on a Property: + * property.assign($("#my-button"), "toggle"); + */ + assign(obj:Object, method:string, ...params:any[]):void; + + /** + * @method + * @description Creates an [EventStream]{@link Bacon.EventStream} by sampling the [Property]{@link Bacon.Property} value at given `interval` (in milliseconds). + * @param {number} interval + * @returns {EventStream} + */ + sample(interval:number):EventStream; + + /** + * @method Property#sampledBy + * @description Creates an [EventStream]{@link Bacon.EventStream} by sampling the [Property]{@link Bacon.Property} value at each event from the given `stream`. The result EventStream will contain the value at each event in the source Property. + * @param {EventStream} stream + * @returns {EventStream} + */ + sampledBy(stream:EventStream):EventStream; + + /** + * @method + * @description Creates a [Property]{@link Bacon.Property} by sampling the value at each event from the given [Property]{@link Bacon.Property} `property`. The result Property will contain the value at each event in the source Property. + * @param {Property} property + * @returns {Property} + */ + sampledBy(property:Property):Property; + + /** + * @callback Property#sampledBy~f + * @param {A} propertyValue + * @param {B} samplerValue + * @returns {C} + */ + /** + * @method Property#sampledBy + * @description Samples the [Property]{@link Bacon.Property} on `streamOrProperty` events. The result values will be formed using the given function `f`. + * @param {Observable} streamOrProperty + * @param {Property#sampledBy~f} f + * @returns {EventStream} + */ + sampledBy(streamOrProperty:Observable, f:(propertyValue:A, samplerValue:B) => C):EventStream; + + /** + * @callback Property#skipDuplicates~isEqual + * @param {A} oldValue + * @param {A} newValue + * @returns {boolean} + */ + /** + * @method Property#skipDuplicates + * @description Drops consecutive equal elements. Uses the `===` operator for equality checking by default. If the `isEqual` argument is supplied, checks by calling `isEqual(oldValue, newValue)`. The old name for this method was `distinctUntilChanged`. + * @param {Property#skipDuplicates~isEqual} [isEqual] + * @returns {Property} + */ + skipDuplicates(isEqual?:(oldValue:A, newValue:A) => boolean):Property; + + /** + * @method Property#changes + * @description Returns an [EventStream]{@link Bacon.EventStream} of [Property]{@link Bacon.Property} value changes. Returns exactly the same events as the Property itself, except any [Initial]{@link Bacon.Initial} events (the stream DOES NOT include an event for the current value of the Property at the time this method was called). Note that [Property.changes]{@link Bacon.Property#changes} DOES NOT skip duplicate values, use [Property.skipDuplicates]{@link Bacon.Property#skipDuplicates} for that. + * @returns {EventStream} + */ + changes():EventStream; + + /** + * @method + * @description Combines [Property]{@link Bacon.Property}s with the && operator. + * @param {Property} other + * @returns {Property} + */ + and(other:Property):Property; + + /** + * @method + * @description Combines [Property]{@link Bacon.Property}s with the || operator. + * @param {Property} other + * @returns {Property} + */ + or(other:Property):Property; + + /** + * @method + * @description Adds an initial "default" value for the [Property]{@link Bacon.Property}. If the Property doesn't have an initial value of it's own, the given `value` will be used as the initial value. If the property has an initial value of its own, the given `value` will be ignored. + * @param {A} value + * @returns {Property} + */ + startWith(value:A):Property; + } + + /** + * @function Bacon.combineAsArray + * @description Combines [Property]{@link Bacon.Property}s, [EventStream]{@link Bacon.EventStream}s and constant values so that the result Property will have an array of all property values as its value. The input array may contain both Properties and EventStreams. In the latter case, the stream is first converted into a Property and then combined with the other Property's. + * @param {(A|Observable)[]} streams + * @returns {Property} + */ + function combineAsArray(streams:(A|Observable)[]):Property; + + /** + * @function + * @description Combines [Property]{@link Bacon.Property}s, [EventStream]{@link Bacon.EventStream}s and constant values so that the result Property will have an array of all property values as its value. Like [Bacon.combineAsArray]{@link Bacon.combineAsArray}, but `streams` are provided as a list of arguments as opposed to a single array. + * @param {...(A|Observable)} streams + * @returns {Property} + */ + function combineAsArray(...streams:(A|Observable)[]):Property; + + /** + * @callback Property#combineWith~f + * @param {...A} args + * @returns {B} + */ + /** + * @function Property#combineWith + * @description Combines given n [Property]{@link Bacon.Property}s, [EventStream]{@link Bacon.EventStream}s and constant values using the given n-ary function `f`. + * @param {Property#combineWith~f} f + * @param {...(A|Observable)} streams + * @returns {Property} + */ + function combineWith(f:(...args:A[]) => B, ...streams:(A|Observable)[]):Property; + + /** + * @function + * @description Combines [Property]{@link Bacon.Property}s, [EventStream]{@link Bacon.EventStream}s and constant values using a `template` object. + * @param {{string:number|boolean|string|Object|Observable}} template + * @returns {Property} + */ + function combineTemplate(template:{[label:string]:number|boolean|string|Object|Observable}):Property; + + /** + * @function + * @description Merges given array of [EventStream]{@link Bacon.EventStream}s. + * @param {EventStream[]} streams + * @returns {EventStream} + */ + function mergeAll(streams:EventStream[]):EventStream; + + /** + * @function + * @description Merges given array of [EventStream]{@link Bacon.EventStream}s. + * @param {...EventStream} streams + * @returns {EventStream} + */ + function mergeAll(...streams:EventStream[]):EventStream; + + /** + * @function + * @description Zips the array of `streams` in to a new [EventStream]{@link Bacon.EventStream} that will have an array of values from each source EventStream as its value. Zipping means that events from each EventStream are combine pairwise so that the 1st event from each EventStream is published first, then the 2nd event from each. The results will be published as soon as there is a value from each source EventStream. Be careful not to have too much "drift" between EventStream's. If one EventStream produces many more values than some other excessive buffering will occur inside the zipped [Observable]{@link Bacon.Observable}. + * @param {EventStream[]} streams + * @returns {EventStream} + */ + function zipAsArray(streams:EventStream[]):EventStream; + + /** + * @function + * @description Zips the `streams` in to a new [EventStream]{@link Bacon.EventStream} that will have an array of values from each source EventStream as its value. Zipping means that events from each EventStream are combine pairwise so that the 1st event from each EventStream is published first, then the 2nd event from each. The results will be published as soon as there is a value from each source EventStream. EventStream's are provided as a list of arguments as opposed to a single array. Be careful not to have too much "drift" between EventStream's. If one EventStream produces many more values than some other excessive buffering will occur inside the zipped [Observable]{@link Bacon.Observable}. + * @param {...EventStream} streams + * @returns {EventStream} + */ + function zipAsArray(...streams:EventStream[]):EventStream; + + /** + * @callback Bacon.zipWith1~f + * @param {...A} args + * @returns {B} + */ + /** + * @function Bacon.zipWith1 + * @description Zips the array of `streams` in to a new [EventStream]{@link Bacon.EventStream} that will combine the n values from EventStream's with n-ary function `f`. Zipping means that events from each EventStream are combine pairwise so that the 1st event from each EventStream is published first, then the 2nd event from each. The results will be published as soon as there is a value from each source EventStream. Be careful not to have too much "drift" between EventStream's. If one EventStream produces many more values than some other excessive buffering will occur inside the zipped [Observable]{@link Bacon.Observable}. + * @param {EventStream[]} streams + * @param {Bacon.zipWith1~f} f + * @returns {EventStream} + */ + function zipWith(streams:EventStream[], f:(...args:A[]) => B):EventStream; + + /** + * @callback Bacon.zipWith2~f + * @param {...A} args + * @returns {B} + */ + /** + * @function Bacon.zipWith2 + * @description Zips the `streams` in to a new [EventStream]{@link Bacon.EventStream} that will combine the n values from EventStream's with n-ary function `f`. Zipping means that events from each EventStream are combine pairwise so that the 1st event from each EventStream is published first, then the 2nd event from each. The results will be published as soon as there is a value from each source EventStream. Streams are provided as a list of arguments as opposed to a single array. Be careful not to have too much "drift" between EventStream's. If one EventStream produces many more values than some other excessive buffering will occur inside the zipped [Observable]{@link Bacon.Observable}. + * @param {Bacon.zipWith2~f} f + * @param {...EventStream} streams + * @returns {EventStream} + */ + function zipWith(f:(...args:A[]) => B, ...streams:EventStream[]):EventStream; + + /** + * @function + * @description Is a shorthand for combining multiple sources ([EventStream]{@link Bacon.EventStream}s, [Property]{@link Bacon.Property}s, constants) as array and assigning the side-effect function `f` for the values. + * @param {...*} args + * @returns {void} + */ + function onValues(...args:any[]):void; + + /** + * @class Bus + * @augments Bacon.EventStream + * @description An [EventStream]{@link Bacon.EventStream} that allows you to [push]{@link Bacon.Bus#push} values into the EventStream. It also allows [plug]{@link Bacon.Bus#plug}ging other EventStream's into the Bus. The Bus practically merges all plugged-in streams and the values pushed using the [push]{@link Bacon.Bus#push} method. + */ + interface Bus extends EventStream { + /** + * @method Bus#push + * @description Pushes the given `value` to the [Bus]{@link Bacon.Bus}. + * @param {A} value + * @returns {void} + */ + push(value:A):void; + + /** + * @method + * @description Ends the [Bus]{@link Bacon.Bus}. Sends an [End]{@link Bacon.End} event to all subscribers. After this call, there'll be no more events to the subscribers. Also, the [Bus.push]{@link Bacon.Bus#push} and [Bus.plug]{@link Bacon.Bus#plug} methods have no effect. + * @returns {void} + */ + end():void; + + /** + * @method + * @description Sends an [Error]{@link Bacon.Error} with given `error` message to all subscribers. + * @param {E} error + * @returns {void} + */ + error(error:E):void; + + /** + * @callback Bus#plug~unplug + * @returns {void} + */ + /** + * @method Bus#plug + * @description Plugs the given [EventStream]{@link Bacon.EventStream} to the [Bus]{@link Bacon.Bus}. All events from the given `stream` will be delivered to the subscribers of the Bus. Returns a function `unplug` that can be used to unplug the same stream. The [plug]{@link Bacon.Bus#plug} method practically allows you to merge in other EventStream's after the creation of the Bus. + * @param {EventStream} stream + * @returns {Bus#plug~unplug} + */ + plug(stream:EventStream):() => void; + } + + var Bus:{ + /** + * @constructor + * @constructs Bacon.Bus + * @description Returns a new [Bus]{@link Bacon.Bus}. + * @returns {Bus} + */ + new():Bus; + }; + + /** + * @class Event + * @description Has subclasses [Initial]{@link Bacon.Initial}, [Next]{@link Bacon.Next}, [End]{@link Bacon.End} and [Error]{@link Bacon.Error}. + * */ + class Event { + /** + * @method + * @description Returns the value associated with a [Initial]{@link Bacon.Initial} or [Next]{@link Bacon.Next} event. + * @returns {A} + */ + value():A; + + /** + * @method + * @description Returns `true` for events of type [Initial]{@link Bacon.Initial} or [Next]{@link Bacon.Next}. + * @returns {boolean} + */ + hasValue():boolean; + + /** + * @method Error#isInitial + * @description Returns `true` for events of type [Initial]{@link Bacon.Initial}. + * @returns {boolean} + */ + isInitial():boolean; + + /** + * @method Error#isNext + * @description Returns `true` for events of type [Next]{@link Bacon.Next}. + * @returns {boolean} + */ + isNext():boolean; + + /** + * @method Error#isError + * @description Returns `true` for events of type [Error]{@link Bacon.Error}. + * @returns {boolean} + */ + isError():boolean; + + /** + * @method Error#isEnd + * @description Returns `true` for events of type [End]{@link Bacon.End}. + * @returns {boolean} + */ + isEnd():boolean; + } + + /** + * @class Error + * @augments Bacon.Event + * @description An error event. Call [Event.isError]{@link Bacon.Event#isError} to distinguish these events in your subscriber, or use [onError]{@link Bacon.Observable#onError} to react to error events only. [Error.error]{@link Bacon.Error#error} returns the associated error object (usually string). [Error]{@link Bacon.Error} events are always passed through all stream combinators. So, even if you filter all values out, the error events will pass through. If you use [Observable.flatMap]{@link Bacon.Observable#flatMap}, the result stream will contain Error events from the source as well as all the spawned stream. You can take action on errors by using the [Observable.onError]{@link Bacon.Observable#onError}. See documentation on [Observable.onError]{@link Bacon.Observable#onError}, [EventStream.mapError]{@link Bacon.EventStream#mapError}, [Property.mapError]{@link Bacon.Property#mapError}, [EventStream.errors]{@link Bacon.EventStream#errors}, [Property.errors]{@link Bacon.Property#errors}, [EventStream.skipErrors]{@link Bacon.EventStream#skipErrors}, [Property.skipErrors]{@link Bacon.Property#skipErrors}, [Bacon.retry]{@link Bacon.retry} and [Observable.flatMapError]{@link Bacon.Observable#flatMapError}. An Error does not terminate the stream. The methods [EventStream.endOnError]{@link Bacon.EventStream#endOnError} and [EventStream.endOnError]{@link Bacon.EventStream#endOnError} returns a stream/property that ends immediately after first error. Bacon.js doesn't currently generate any Error events itself (except when converting errors using [Bacon.fromPromise]{@link Bacon.fromPromise}). Error events definitely would be generated by streams derived from IO sources such as AJAX calls. + * @example + * // In case you want to convert (some) value events into Error events, you may use `flatMap` like this: + * Bacon.fromArray([1, 2, 3, 4]).flatMap(x => { + * NOTE: had to explicitly specify the `` typing for `flatMap`. + * return x > 2 ? new Bacon.Error("too big") : x; + * }); + * + * // Conversely, if you want to convert some Error events into value events, you may use `flatMapError`: + * Bacon.fromArray([1, 2, 3, 4]).flatMapError(error => { + * let isNonCriticalError = error => Math.random() < .5, + * handleNonCriticalError = error => 42; + * return isNonCriticalError(error) ? handleNonCriticalError(error) : new Bacon.Error(error); + * }); + * + * // Note also that Bacon.js combinators do not catch errors that are thrown. Especially `map` doesn't do so. If you want to map things and wrap caught errors into Error events, you can do the following: + * Bacon.fromArray([1, 2, 3, 4]).flatMap(x => { + * let dangerousFunction = x => { + * throw new Error("dangerous function!"); + * }; + * try { + * return dangerousFunction(x); + * } catch (e) { + * return new Bacon.Error(e); + * } + * }); + */ + class Error extends Event { + /** + * @constructor + * @constructs Error + * @param {E} error + * */ + constructor(error:E); + + /** + * @property Error#error + * @description Returns the `error` associated with an [Error]{@link Bacon.Error} event. + * @returns {E} + */ + error:E; + } + + /** + * @class End + * @augments Bacon.Event + * @description An end-of-stream event of [EventStream]{@link Bacon.EventStream} or [Property]{@link Bacon.Property}. Call [Event.isEnd]{@link Bacon.Event#isEnd} to distinguish an End from other events. + * */ + class End extends Event { + /** + * @constructor + * @constructs Bacon.End + * */ + constructor(); + } + + /** + * @class Initial + * @augments Bacon.Event + * @description The initial (current) value of a [Property]{@link Bacon.Property}. Call [Event.isInitial]{@link Bacon.Event#isInitial} to distinguish from other events. Only sent immediately after subscription to a Property. + * */ + class Initial extends Event { + /** + * @constructor + * @constructs Bacon.Initial + * @param {A} value + * */ + constructor(value:A); + } + + /** + * @class Next + * @augments Bacon.Event + * @description Next value in an [EventStream]{@link Bacon.EventStream} or a [Property]{@link Bacon.Property}. Call [Event.isNext]{@link Bacon.Event#isNext} to distinguish a Next event from other events. + * */ + class Next extends Event { + /** + * @constructor + * @constructs Bacon.Next + * @param {A} value + * @example + * new Bacon.Next("value"); + * */ + constructor(value:A); + + /** + * @callback Next#constructor + * @returns {A} + */ + /** + * @constructor Next#constructor + * @constructs Bacon.Next + * @description This version is safe only when you know that the actual value in the stream is not a function. The idea in using a function `f` instead of a plain value is that the internals on Bacon.js take advantage of lazy evaluation by deferring the evaluations of values created by `map`, `combine`. + * @param {Next#constructor} f + * @example + * new Bacon.Next(() => "value"); + * */ + constructor(f:() => A); + } + + /** + * @callback Bacon.retry1~source + * @description Function that produces an [EventStream]{@link Bacon.EventStream}. + * @returns {EventStream} + */ + /** + * @callback Bacon.retry1~isRetryable + * @description Function returning `true` to continue retrying, `false` to stop. Defaults to `true`. The [Error]{@link Bacon.Error} that occurred is given as a parameter. For example, there is usually no reason to retry a 404 HTTP error, whereas a 500 or a timeout might work on the next attempt. + * @param {E} error + * @returns {boolean} + */ + /** + * @callback Bacon.retry1~delay + * @description Function that returns the time in milliseconds to wait before retrying. Defaults to `0`. The function is given a `context` object with the keys `error` (the [Error]{@link Bacon.Error} that occurred) and `retriesDone` (the number of retries already performed) to help determine the appropriate delay, e.g. for an incremental backoff. + * @param {Object} context + * @param {E} context.error [Error]{@link Bacon.Error} that occurred + * @param {number} context.retriesDone number of retries already performed + * @returns {number} + */ + /** + * @function Bacon.retry1 + * @description Is used to retry the call when there is an [Error]{@link Bacon.Error} event in the [EventStream]{@link Bacon.EventStream} produced by the `source` function. + * @param {Object} options + * @param {Bacon.retry1~source} options.source function that produces an [EventStream]{@link Bacon.EventStream} + * @param {number} options.retries number of times to retry the `source` function in addition to the initial attempt + * @param {Bacon.retry1~isRetryable} [options.isRetryable] function returning `true` to continue retrying, `false` to stop. Defaults to `true`. + * @param {Bacon.retry1~delay} [options.delay] - function that returns the time in milliseconds to wait before retrying. Defaults to `0`. + * @returns {EventStream} + */ + function retry(options:{ + source:() => EventStream; + retries:number; + isRetryable?:(error:E) => boolean; + delay?:(context:{error:E; retriesDone:number}) => number; + }):EventStream; + + /** + * @callback Bacon.retry1~source + * @description Function that produces an [Property]{@link Bacon.Property}. + * @returns {Property} + */ + /** + * @callback Bacon.retry1~isRetryable + * @description Function returning `true` to continue retrying, `false` to stop. Defaults to `true`. The [Error]{@link Bacon.Error} that occurred is given as a parameter. For example, there is usually no reason to retry a 404 HTTP error, whereas a 500 or a timeout might work on the next attempt. + * @param {E} error + * @returns {boolean} + */ + /** + * @callback Bacon.retry1~delay + * @description Function that returns the time in milliseconds to wait before retrying. Defaults to `0`. The function is given a `context` object with the keys `error` (the [Error]{@link Bacon.Error} that occurred) and `retriesDone` (the number of retries already performed) to help determine the appropriate delay, e.g. for an incremental backoff. + * @param {Object} context + * @param {E} context.error [Error]{@link Bacon.Error} that occurred + * @param {number} context.retriesDone number of retries already performed + * @returns {number} + */ + /** + * @function Bacon.retry1 + * @description Is used to retry the call when there is an [Error]{@link Bacon.Error} event in the [Property]{@link Bacon.Property} produced by the `source` function. + * @param {Object} options + * @param {Bacon.retry1~source} options.source function that produces an [Property]{@link Bacon.Property} + * @param {number} options.retries number of times to retry the `source` function in addition to the initial attempt + * @param {Bacon.retry1~isRetryable} [options.isRetryable] function returning `true` to continue retrying, `false` to stop. Defaults to `true`. + * @param {Bacon.retry1~delay} [options.delay] - function that returns the time in milliseconds to wait before retrying. Defaults to `0`. + * @returns {Property} + */ + function retry(options:{ + source:() => Property; + retries:number; + isRetryable?:(error:E) => boolean; + delay?:(context:{error:E; retriesDone:number}) => number; + }):Property; + + /** + * @callback Bacon.when1~f1 + * @param {...A1} args + * @returns {B} + */ + /** + * @method Bacon.when1 + * @description Creates an [EventStream]{@link Bacon.EventStream} from join-pattern system. + * @param {Observable[]} pattern1 + * @param {Bacon.when1~f1} f1 + * @returns {EventStream} + * @example + * { + * // Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick: + * let tick = Bacon.interval(1e2, 0), + * keyEvent = Bacon.fromEvent(document.body, "click", _ => Date.now()), + * handleTick = _ => `timestamp: NONE`, + * handleKeyEvent = timestamp => `timestamp: ${timestamp}`; + * Bacon.when( + * [tick, keyEvent], (_, timestamp) => handleKeyEvent(timestamp), + * [tick], handleTick + * ); + * // Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick. + * } + * + * { + * // Join patterns are indeed a generalization of `zip`, and `zip` is equivalent to a single-rule join pattern. The following `Observable`s have the same output: + * let a = Bacon.once("a"), + * b = Bacon.once("b"), + * c = Bacon.once("c"), + * f = (a, b, c) => `a = ${a}; b = ${b}; c = ${c}.`; + * Bacon.zipWith(f, a, b, c); + * Bacon.when([a, b, c], f); + * } + * + * { + * // Join patterns as a "chemical machine". + * // A quick way to get some intuition for join patterns is to understand them through an analogy in terms of atoms and molecules. A join pattern can here be regarded as a recipe for a chemical reaction. Lets say we have observables `oxygen`, `carbon` and `hydrogen`, where an event in these spawns an 'atom' of that type into a mixture. We can state reactions: + * let oxygen = Bacon.interval(1e3, "O"), + * hydrogen = Bacon.interval(2e3, "H"), + * carbon = Bacon.interval(1.5e3, "C"), + * makeWater = (oxygen:string, hydrogen1:string, hydrogen2:string) => `${hydrogen1}${[hydrogen1, hydrogen2].length}${oxygen}`, + * makeCarbonMonoxide = (oxygen:string, carbon:string) => `${carbon}${oxygen}`; + * Bacon.when( + * [oxygen, hydrogen, hydrogen], makeWater, + * [oxygen, carbon], makeCarbonMonoxide + * ); + * // Now, every time a new 'atom' is spawned from one of the observables, this atom is added to the mixture. If at any time there are two hydrogen atoms, and an oxygen atom, the corresponding atoms are *consumed*, and output is produced via `makeWater`. The same semantics apply for the second rule to create carbon monoxide. The rules are tried at each point from top to bottom. + * } + * + * { + * // Join patterns and properties. + * // Properties are not part of the synchronization pattern, but are instead just sampled. The following example take three input streams `$price`, `$quantity` and `$total`, e.g. coming from input fields, and defines mutally recursive behaviours in properties `price`, `quantity` and `total` such that: + * // -- updating `quantity` sets `total` to `price * quantity`; + * // -- updating `total` sets `price` to `total / quantity`. + * let random = (x:number) => Math.round(x * Math.random()), + * id = (x:A):A => x; + * let $quantity = Bacon.interval(1e3, 10).map(random), + * $price = Bacon.interval(2e3, 100).map(random), + * $total = Bacon.interval(1.5e3, 1000).map(random); + * let quantity = $quantity.toProperty(1), + * price = Bacon.when( + * [$price], id, + * [$total, quantity], (x, y) => x / y + * ).toProperty(0), + * total = Bacon.when( + * [$total], id, + * [$price, quantity], (x, y) => x * y, + * [price, $quantity], (x, y) => x * y + * ).toProperty(0); + * } + * + * { + * // Join patterns and `Bacon.Bus`. + * // The result functions of join patterns are allowed to push values onto a `Bus` that may in turn be in one of its patterns. For instance, an implementation of the dining philosophers problem can be written as follows: + * // Availability of chopsticks are implemented using bus. + * let chopsticks = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // Hungry could be any type of observable, but we'll use bus here. + * hungry = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // A philosopher eats for one second, then makes the chopsticks available again by pushing values onto their bus. + * eat = (i:number) => () => { + * setTimeout(() => { + * console.log("done!"); + * chopsticks[i].push({}); + * chopsticks[(i + 1) % 3].push({}); + * }, 1e3); + * return `philosopher ${i} eating`; + * }, + * // We use Bacon.when to make sure a hungry philosopher can eat only when both his chopsticks are available. + * dining = Bacon.when( + * [hungry[0], chopsticks[0], chopsticks[1]], eat(0), + * [hungry[1], chopsticks[1], chopsticks[2]], eat(1), + * [hungry[2], chopsticks[2], chopsticks[0]], eat(2) + * ).log("dining"); + * // Make all chopsticks initially available. + * chopsticks[0].push({}); + * chopsticks[1].push({}); + * chopsticks[2].push({}); + * // Make philosophers hungry in some way, in this case we just push to their bus. + * for (let i = 0; i < 3; i++) { + * hungry[0].push({}); + * hungry[1].push({}); + * hungry[2].push({}); + * } + * } + */ + function when(pattern1:Observable[], f1:(...args:A1[]) => B):EventStream; + + /** + * @callback Bacon.when2~f1 + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.when2~f2 + * @param {...A2} args + * @returns {B} + */ + /** + * @method Bacon.when2 + * @description Creates an [EventStream]{@link Bacon.EventStream} from join-pattern system. + * @param {Observable[]} pattern1 + * @param {Bacon.when2~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.when2~f2} f2 + * @returns {EventStream} + * @example + * { + * // Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick: + * let tick = Bacon.interval(1e2, 0), + * keyEvent = Bacon.fromEvent(document.body, "click", _ => Date.now()), + * handleTick = _ => `timestamp: NONE`, + * handleKeyEvent = timestamp => `timestamp: ${timestamp}`; + * Bacon.when( + * [tick, keyEvent], (_, timestamp) => handleKeyEvent(timestamp), + * [tick], handleTick + * ); + * // Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick. + * } + * + * { + * // Join patterns are indeed a generalization of `zip`, and `zip` is equivalent to a single-rule join pattern. The following `Observable`s have the same output: + * let a = Bacon.once("a"), + * b = Bacon.once("b"), + * c = Bacon.once("c"), + * f = (a, b, c) => `a = ${a}; b = ${b}; c = ${c}.`; + * Bacon.zipWith(f, a, b, c); + * Bacon.when([a, b, c], f); + * } + * + * { + * // Join patterns as a "chemical machine". + * // A quick way to get some intuition for join patterns is to understand them through an analogy in terms of atoms and molecules. A join pattern can here be regarded as a recipe for a chemical reaction. Lets say we have observables `oxygen`, `carbon` and `hydrogen`, where an event in these spawns an 'atom' of that type into a mixture. We can state reactions: + * let oxygen = Bacon.interval(1e3, "O"), + * hydrogen = Bacon.interval(2e3, "H"), + * carbon = Bacon.interval(1.5e3, "C"), + * makeWater = (oxygen:string, hydrogen1:string, hydrogen2:string) => `${hydrogen1}${[hydrogen1, hydrogen2].length}${oxygen}`, + * makeCarbonMonoxide = (oxygen:string, carbon:string) => `${carbon}${oxygen}`; + * Bacon.when( + * [oxygen, hydrogen, hydrogen], makeWater, + * [oxygen, carbon], makeCarbonMonoxide + * ); + * // Now, every time a new 'atom' is spawned from one of the observables, this atom is added to the mixture. If at any time there are two hydrogen atoms, and an oxygen atom, the corresponding atoms are *consumed*, and output is produced via `makeWater`. The same semantics apply for the second rule to create carbon monoxide. The rules are tried at each point from top to bottom. + * } + * + * { + * // Join patterns and properties. + * // Properties are not part of the synchronization pattern, but are instead just sampled. The following example take three input streams `$price`, `$quantity` and `$total`, e.g. coming from input fields, and defines mutally recursive behaviours in properties `price`, `quantity` and `total` such that: + * // -- updating `quantity` sets `total` to `price * quantity`; + * // -- updating `total` sets `price` to `total / quantity`. + * let random = (x:number) => Math.round(x * Math.random()), + * id = (x:A):A => x; + * let $quantity = Bacon.interval(1e3, 10).map(random), + * $price = Bacon.interval(2e3, 100).map(random), + * $total = Bacon.interval(1.5e3, 1000).map(random); + * let quantity = $quantity.toProperty(1), + * price = Bacon.when( + * [$price], id, + * [$total, quantity], (x, y) => x / y + * ).toProperty(0), + * total = Bacon.when( + * [$total], id, + * [$price, quantity], (x, y) => x * y, + * [price, $quantity], (x, y) => x * y + * ).toProperty(0); + * } + * + * { + * // Join patterns and `Bacon.Bus`. + * // The result functions of join patterns are allowed to push values onto a `Bus` that may in turn be in one of its patterns. For instance, an implementation of the dining philosophers problem can be written as follows: + * // Availability of chopsticks are implemented using bus. + * let chopsticks = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // Hungry could be any type of observable, but we'll use bus here. + * hungry = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // A philosopher eats for one second, then makes the chopsticks available again by pushing values onto their bus. + * eat = (i:number) => () => { + * setTimeout(() => { + * console.log("done!"); + * chopsticks[i].push({}); + * chopsticks[(i + 1) % 3].push({}); + * }, 1e3); + * return `philosopher ${i} eating`; + * }, + * // We use Bacon.when to make sure a hungry philosopher can eat only when both his chopsticks are available. + * dining = Bacon.when( + * [hungry[0], chopsticks[0], chopsticks[1]], eat(0), + * [hungry[1], chopsticks[1], chopsticks[2]], eat(1), + * [hungry[2], chopsticks[2], chopsticks[0]], eat(2) + * ).log("dining"); + * // Make all chopsticks initially available. + * chopsticks[0].push({}); + * chopsticks[1].push({}); + * chopsticks[2].push({}); + * // Make philosophers hungry in some way, in this case we just push to their bus. + * for (let i = 0; i < 3; i++) { + * hungry[0].push({}); + * hungry[1].push({}); + * hungry[2].push({}); + * } + * } + */ + function when(pattern1:Observable[], f1:(...args:A1[]) => B, pattern2:Observable[], f2:(...args:A2[]) => B):EventStream; + + /** + * @callback Bacon.when3~f1 + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.when3~f2 + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.when3~f3 + * @param {...A3} args + * @returns {B} + */ + /** + * @method Bacon.when3 + * @description Creates an [EventStream]{@link Bacon.EventStream} from join-pattern system. + * @param {Observable[]} pattern1 + * @param {Bacon.when3~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.when3~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.when3~f3} f3 + * @returns {EventStream} + * @example + * { + * // Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick: + * let tick = Bacon.interval(1e2, 0), + * keyEvent = Bacon.fromEvent(document.body, "click", _ => Date.now()), + * handleTick = _ => `timestamp: NONE`, + * handleKeyEvent = timestamp => `timestamp: ${timestamp}`; + * Bacon.when( + * [tick, keyEvent], (_, timestamp) => handleKeyEvent(timestamp), + * [tick], handleTick + * ); + * // Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick. + * } + * + * { + * // Join patterns are indeed a generalization of `zip`, and `zip` is equivalent to a single-rule join pattern. The following `Observable`s have the same output: + * let a = Bacon.once("a"), + * b = Bacon.once("b"), + * c = Bacon.once("c"), + * f = (a, b, c) => `a = ${a}; b = ${b}; c = ${c}.`; + * Bacon.zipWith(f, a, b, c); + * Bacon.when([a, b, c], f); + * } + * + * { + * // Join patterns as a "chemical machine". + * // A quick way to get some intuition for join patterns is to understand them through an analogy in terms of atoms and molecules. A join pattern can here be regarded as a recipe for a chemical reaction. Lets say we have observables `oxygen`, `carbon` and `hydrogen`, where an event in these spawns an 'atom' of that type into a mixture. We can state reactions: + * let oxygen = Bacon.interval(1e3, "O"), + * hydrogen = Bacon.interval(2e3, "H"), + * carbon = Bacon.interval(1.5e3, "C"), + * makeWater = (oxygen:string, hydrogen1:string, hydrogen2:string) => `${hydrogen1}${[hydrogen1, hydrogen2].length}${oxygen}`, + * makeCarbonMonoxide = (oxygen:string, carbon:string) => `${carbon}${oxygen}`; + * Bacon.when( + * [oxygen, hydrogen, hydrogen], makeWater, + * [oxygen, carbon], makeCarbonMonoxide + * ); + * // Now, every time a new 'atom' is spawned from one of the observables, this atom is added to the mixture. If at any time there are two hydrogen atoms, and an oxygen atom, the corresponding atoms are *consumed*, and output is produced via `makeWater`. The same semantics apply for the second rule to create carbon monoxide. The rules are tried at each point from top to bottom. + * } + * + * { + * // Join patterns and properties. + * // Properties are not part of the synchronization pattern, but are instead just sampled. The following example take three input streams `$price`, `$quantity` and `$total`, e.g. coming from input fields, and defines mutally recursive behaviours in properties `price`, `quantity` and `total` such that: + * // -- updating `quantity` sets `total` to `price * quantity`; + * // -- updating `total` sets `price` to `total / quantity`. + * let random = (x:number) => Math.round(x * Math.random()), + * id = (x:A):A => x; + * let $quantity = Bacon.interval(1e3, 10).map(random), + * $price = Bacon.interval(2e3, 100).map(random), + * $total = Bacon.interval(1.5e3, 1000).map(random); + * let quantity = $quantity.toProperty(1), + * price = Bacon.when( + * [$price], id, + * [$total, quantity], (x, y) => x / y + * ).toProperty(0), + * total = Bacon.when( + * [$total], id, + * [$price, quantity], (x, y) => x * y, + * [price, $quantity], (x, y) => x * y + * ).toProperty(0); + * } + * + * { + * // Join patterns and `Bacon.Bus`. + * // The result functions of join patterns are allowed to push values onto a `Bus` that may in turn be in one of its patterns. For instance, an implementation of the dining philosophers problem can be written as follows: + * // Availability of chopsticks are implemented using bus. + * let chopsticks = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // Hungry could be any type of observable, but we'll use bus here. + * hungry = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // A philosopher eats for one second, then makes the chopsticks available again by pushing values onto their bus. + * eat = (i:number) => () => { + * setTimeout(() => { + * console.log("done!"); + * chopsticks[i].push({}); + * chopsticks[(i + 1) % 3].push({}); + * }, 1e3); + * return `philosopher ${i} eating`; + * }, + * // We use Bacon.when to make sure a hungry philosopher can eat only when both his chopsticks are available. + * dining = Bacon.when( + * [hungry[0], chopsticks[0], chopsticks[1]], eat(0), + * [hungry[1], chopsticks[1], chopsticks[2]], eat(1), + * [hungry[2], chopsticks[2], chopsticks[0]], eat(2) + * ).log("dining"); + * // Make all chopsticks initially available. + * chopsticks[0].push({}); + * chopsticks[1].push({}); + * chopsticks[2].push({}); + * // Make philosophers hungry in some way, in this case we just push to their bus. + * for (let i = 0; i < 3; i++) { + * hungry[0].push({}); + * hungry[1].push({}); + * hungry[2].push({}); + * } + * } + */ + function when(pattern1:Observable[], f1:(...args:A1[]) => B, pattern2:Observable[], f2:(...args:A2[]) => B, pattern3:Observable[], f3:(...args:A3[]) => B):EventStream; + + /** + * @callback Bacon.when4~f1 + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.when4~f2 + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.when4~f3 + * @param {...A3} args + * @returns {B} + */ + /** + * @callback Bacon.when4~f4 + * @param {...A4} args + * @returns {B} + */ + /** + * @method Bacon.when4 + * @description Creates an [EventStream]{@link Bacon.EventStream} from join-pattern system. + * @param {Observable[]} pattern1 + * @param {Bacon.when4~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.when4~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.when4~f3} f3 + * @param {Observable[]} pattern4 + * @param {Bacon.when4~f4} f4 + * @returns {EventStream} + * @example + * { + * // Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick: + * let tick = Bacon.interval(1e2, 0), + * keyEvent = Bacon.fromEvent(document.body, "click", _ => Date.now()), + * handleTick = _ => `timestamp: NONE`, + * handleKeyEvent = timestamp => `timestamp: ${timestamp}`; + * Bacon.when( + * [tick, keyEvent], (_, timestamp) => handleKeyEvent(timestamp), + * [tick], handleTick + * ); + * // Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick. + * } + * + * { + * // Join patterns are indeed a generalization of `zip`, and `zip` is equivalent to a single-rule join pattern. The following `Observable`s have the same output: + * let a = Bacon.once("a"), + * b = Bacon.once("b"), + * c = Bacon.once("c"), + * f = (a, b, c) => `a = ${a}; b = ${b}; c = ${c}.`; + * Bacon.zipWith(f, a, b, c); + * Bacon.when([a, b, c], f); + * } + * + * { + * // Join patterns as a "chemical machine". + * // A quick way to get some intuition for join patterns is to understand them through an analogy in terms of atoms and molecules. A join pattern can here be regarded as a recipe for a chemical reaction. Lets say we have observables `oxygen`, `carbon` and `hydrogen`, where an event in these spawns an 'atom' of that type into a mixture. We can state reactions: + * let oxygen = Bacon.interval(1e3, "O"), + * hydrogen = Bacon.interval(2e3, "H"), + * carbon = Bacon.interval(1.5e3, "C"), + * makeWater = (oxygen:string, hydrogen1:string, hydrogen2:string) => `${hydrogen1}${[hydrogen1, hydrogen2].length}${oxygen}`, + * makeCarbonMonoxide = (oxygen:string, carbon:string) => `${carbon}${oxygen}`; + * Bacon.when( + * [oxygen, hydrogen, hydrogen], makeWater, + * [oxygen, carbon], makeCarbonMonoxide + * ); + * // Now, every time a new 'atom' is spawned from one of the observables, this atom is added to the mixture. If at any time there are two hydrogen atoms, and an oxygen atom, the corresponding atoms are *consumed*, and output is produced via `makeWater`. The same semantics apply for the second rule to create carbon monoxide. The rules are tried at each point from top to bottom. + * } + * + * { + * // Join patterns and properties. + * // Properties are not part of the synchronization pattern, but are instead just sampled. The following example take three input streams `$price`, `$quantity` and `$total`, e.g. coming from input fields, and defines mutally recursive behaviours in properties `price`, `quantity` and `total` such that: + * // -- updating `quantity` sets `total` to `price * quantity`; + * // -- updating `total` sets `price` to `total / quantity`. + * let random = (x:number) => Math.round(x * Math.random()), + * id = (x:A):A => x; + * let $quantity = Bacon.interval(1e3, 10).map(random), + * $price = Bacon.interval(2e3, 100).map(random), + * $total = Bacon.interval(1.5e3, 1000).map(random); + * let quantity = $quantity.toProperty(1), + * price = Bacon.when( + * [$price], id, + * [$total, quantity], (x, y) => x / y + * ).toProperty(0), + * total = Bacon.when( + * [$total], id, + * [$price, quantity], (x, y) => x * y, + * [price, $quantity], (x, y) => x * y + * ).toProperty(0); + * } + * + * { + * // Join patterns and `Bacon.Bus`. + * // The result functions of join patterns are allowed to push values onto a `Bus` that may in turn be in one of its patterns. For instance, an implementation of the dining philosophers problem can be written as follows: + * // Availability of chopsticks are implemented using bus. + * let chopsticks = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // Hungry could be any type of observable, but we'll use bus here. + * hungry = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // A philosopher eats for one second, then makes the chopsticks available again by pushing values onto their bus. + * eat = (i:number) => () => { + * setTimeout(() => { + * console.log("done!"); + * chopsticks[i].push({}); + * chopsticks[(i + 1) % 3].push({}); + * }, 1e3); + * return `philosopher ${i} eating`; + * }, + * // We use Bacon.when to make sure a hungry philosopher can eat only when both his chopsticks are available. + * dining = Bacon.when( + * [hungry[0], chopsticks[0], chopsticks[1]], eat(0), + * [hungry[1], chopsticks[1], chopsticks[2]], eat(1), + * [hungry[2], chopsticks[2], chopsticks[0]], eat(2) + * ).log("dining"); + * // Make all chopsticks initially available. + * chopsticks[0].push({}); + * chopsticks[1].push({}); + * chopsticks[2].push({}); + * // Make philosophers hungry in some way, in this case we just push to their bus. + * for (let i = 0; i < 3; i++) { + * hungry[0].push({}); + * hungry[1].push({}); + * hungry[2].push({}); + * } + * } + */ + function when(pattern1:Observable[], f1:(...args:A1[]) => B, pattern2:Observable[], f2:(...args:A2[]) => B, pattern3:Observable[], f3:(...args:A3[]) => B, pattern4:Observable[], f4:(...args:A4[]) => B):EventStream; + + /** + * @callback Bacon.when5~f1 + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.when5~f2 + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.when5~f3 + * @param {...A3} args + * @returns {B} + */ + /** + * @callback Bacon.when5~f4 + * @param {...A4} args + * @returns {B} + */ + /** + * @callback Bacon.when5~f5 + * @param {...A5} args + * @returns {B} + */ + /** + * @method Bacon.when5 + * @description Creates an [EventStream]{@link Bacon.EventStream} from join-pattern system. + * @param {Observable[]} pattern1 + * @param {Bacon.when5~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.when5~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.when5~f3} f3 + * @param {Observable[]} pattern4 + * @param {Bacon.when5~f4} f4 + * @param {Observable[]} pattern5 + * @param {Bacon.when5~f5} f5 + * @returns {EventStream} + * @example + * { + * // Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick: + * let tick = Bacon.interval(1e2, 0), + * keyEvent = Bacon.fromEvent(document.body, "click", _ => Date.now()), + * handleTick = _ => `timestamp: NONE`, + * handleKeyEvent = timestamp => `timestamp: ${timestamp}`; + * Bacon.when( + * [tick, keyEvent], (_, timestamp) => handleKeyEvent(timestamp), + * [tick], handleTick + * ); + * // Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick. + * } + * + * { + * // Join patterns are indeed a generalization of `zip`, and `zip` is equivalent to a single-rule join pattern. The following `Observable`s have the same output: + * let a = Bacon.once("a"), + * b = Bacon.once("b"), + * c = Bacon.once("c"), + * f = (a, b, c) => `a = ${a}; b = ${b}; c = ${c}.`; + * Bacon.zipWith(f, a, b, c); + * Bacon.when([a, b, c], f); + * } + * + * { + * // Join patterns as a "chemical machine". + * // A quick way to get some intuition for join patterns is to understand them through an analogy in terms of atoms and molecules. A join pattern can here be regarded as a recipe for a chemical reaction. Lets say we have observables `oxygen`, `carbon` and `hydrogen`, where an event in these spawns an 'atom' of that type into a mixture. We can state reactions: + * let oxygen = Bacon.interval(1e3, "O"), + * hydrogen = Bacon.interval(2e3, "H"), + * carbon = Bacon.interval(1.5e3, "C"), + * makeWater = (oxygen:string, hydrogen1:string, hydrogen2:string) => `${hydrogen1}${[hydrogen1, hydrogen2].length}${oxygen}`, + * makeCarbonMonoxide = (oxygen:string, carbon:string) => `${carbon}${oxygen}`; + * Bacon.when( + * [oxygen, hydrogen, hydrogen], makeWater, + * [oxygen, carbon], makeCarbonMonoxide + * ); + * // Now, every time a new 'atom' is spawned from one of the observables, this atom is added to the mixture. If at any time there are two hydrogen atoms, and an oxygen atom, the corresponding atoms are *consumed*, and output is produced via `makeWater`. The same semantics apply for the second rule to create carbon monoxide. The rules are tried at each point from top to bottom. + * } + * + * { + * // Join patterns and properties. + * // Properties are not part of the synchronization pattern, but are instead just sampled. The following example take three input streams `$price`, `$quantity` and `$total`, e.g. coming from input fields, and defines mutally recursive behaviours in properties `price`, `quantity` and `total` such that: + * // -- updating `quantity` sets `total` to `price * quantity`; + * // -- updating `total` sets `price` to `total / quantity`. + * let random = (x:number) => Math.round(x * Math.random()), + * id = (x:A):A => x; + * let $quantity = Bacon.interval(1e3, 10).map(random), + * $price = Bacon.interval(2e3, 100).map(random), + * $total = Bacon.interval(1.5e3, 1000).map(random); + * let quantity = $quantity.toProperty(1), + * price = Bacon.when( + * [$price], id, + * [$total, quantity], (x, y) => x / y + * ).toProperty(0), + * total = Bacon.when( + * [$total], id, + * [$price, quantity], (x, y) => x * y, + * [price, $quantity], (x, y) => x * y + * ).toProperty(0); + * } + * + * { + * // Join patterns and `Bacon.Bus`. + * // The result functions of join patterns are allowed to push values onto a `Bus` that may in turn be in one of its patterns. For instance, an implementation of the dining philosophers problem can be written as follows: + * // Availability of chopsticks are implemented using bus. + * let chopsticks = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // Hungry could be any type of observable, but we'll use bus here. + * hungry = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // A philosopher eats for one second, then makes the chopsticks available again by pushing values onto their bus. + * eat = (i:number) => () => { + * setTimeout(() => { + * console.log("done!"); + * chopsticks[i].push({}); + * chopsticks[(i + 1) % 3].push({}); + * }, 1e3); + * return `philosopher ${i} eating`; + * }, + * // We use Bacon.when to make sure a hungry philosopher can eat only when both his chopsticks are available. + * dining = Bacon.when( + * [hungry[0], chopsticks[0], chopsticks[1]], eat(0), + * [hungry[1], chopsticks[1], chopsticks[2]], eat(1), + * [hungry[2], chopsticks[2], chopsticks[0]], eat(2) + * ).log("dining"); + * // Make all chopsticks initially available. + * chopsticks[0].push({}); + * chopsticks[1].push({}); + * chopsticks[2].push({}); + * // Make philosophers hungry in some way, in this case we just push to their bus. + * for (let i = 0; i < 3; i++) { + * hungry[0].push({}); + * hungry[1].push({}); + * hungry[2].push({}); + * } + * } + */ + function when(pattern1:Observable[], f1:(...args:A1[]) => B, pattern2:Observable[], f2:(...args:A2[]) => B, pattern3:Observable[], f3:(...args:A3[]) => B, pattern4:Observable[], f4:(...args:A4[]) => B, pattern5:Observable[], f5:(...args:A5[]) => B):EventStream; + + /** + * @callback Bacon.update1~f1 + * @param {B} initial + * @param {...A1} args + * @returns {B} + */ + /** + * @method Bacon.update1 + * @description Creates an [Property]{@link Bacon.Property} from an `initial` value and a join-pattern system. + * @param {B} initial + * @param {Observable[]} pattern1 + * @param {Bacon.update1~f1} f1 + * @returns {Property} + * @example + * { + * // The inputs to `Bacon.update` are defined like this: + * let initial = 0, + * x = Bacon.interval(1e3, 1), + * y = Bacon.interval(2e3, 1), + * z = Bacon.interval(1.5e3, 1); + * // NOTE: had to explicitly specify the typing for `previous:number` + * Bacon.update(initial, + * [x, y, z], (previous:number, x, y, z) => previous + x + y + z, + * [x, y], (previous:number, x, y) => previous + x + y + z + * ); + * // As input, each function above will get the previous value of the `result` Property, along with values from the listed Observables. The value returned by the function will be used as the next value of `result`. Just like in `Bacon.when`, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream. + * } + * + * { + * // Here's a simple gaming example: + * let scoreMultiplier = Bacon.constant(1), + * hitUfo = new Bacon.Bus(), + * hitMotherShip = new Bacon.Bus(), + * score = Bacon.update(0, + * [hitUfo, scoreMultiplier], (score, _, multiplier:number) => score + 100 * multiplier, + * [hitMotherShip], (score, _) => score + 2000 + * ); + * // In the example, the `score` property is updated when either `hitUfo` or `hitMotherShip` occur. The `scoreMultiplier` Property is sampled to take multiplier into account when `hitUfo` occurs. + * } + */ + function update(initial:B, pattern1:Observable[], f1:(initial:B, ...args:A1[]) => B):Property; + + /** + * @callback Bacon.update2~f1 + * @param {B} initial + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.update2~f2 + * @param {B} initial + * @param {...A2} args + * @returns {B} + */ + /** + * @method Bacon.update2 + * @description Creates an [Property]{@link Bacon.Property} from an `initial` value and a join-pattern system. + * @param {B} initial + * @param {Observable[]} pattern1 + * @param {Bacon.update2~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.update2~f2} f2 + * @returns {Property} + * @example + * { + * // The inputs to `Bacon.update` are defined like this: + * let initial = 0, + * x = Bacon.interval(1e3, 1), + * y = Bacon.interval(2e3, 1), + * z = Bacon.interval(1.5e3, 1); + * // NOTE: had to explicitly specify the typing for `previous:number` + * Bacon.update(initial, + * [x, y, z], (previous:number, x, y, z) => previous + x + y + z, + * [x, y], (previous:number, x, y) => previous + x + y + z + * ); + * // As input, each function above will get the previous value of the `result` Property, along with values from the listed Observables. The value returned by the function will be used as the next value of `result`. Just like in `Bacon.when`, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream. + * } + * + * { + * // Here's a simple gaming example: + * let scoreMultiplier = Bacon.constant(1), + * hitUfo = new Bacon.Bus(), + * hitMotherShip = new Bacon.Bus(), + * score = Bacon.update(0, + * [hitUfo, scoreMultiplier], (score, _, multiplier:number) => score + 100 * multiplier, + * [hitMotherShip], (score, _) => score + 2000 + * ); + * // In the example, the `score` property is updated when either `hitUfo` or `hitMotherShip` occur. The `scoreMultiplier` Property is sampled to take multiplier into account when `hitUfo` occurs. + * } + */ + function update(initial:B, pattern1:Observable[], f1:(initial:B, ...args:A1[]) => B, pattern2:Observable[], f2:(initial:B, ...args:A2[]) => B):Property; + + /** + * @callback Bacon.update3~f1 + * @param {B} initial + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.update3~f2 + * @param {B} initial + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.update3~f3 + * @param {B} initial + * @param {...A3} args + * @returns {B} + */ + /** + * @method Bacon.update3 + * @description Creates an [Property]{@link Bacon.Property} from an `initial` value and a join-pattern system. + * @param {B} initial + * @param {Observable[]} pattern1 + * @param {Bacon.update3~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.update3~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.update3~f3} f3 + * @returns {Property} + * @example + * { + * // The inputs to `Bacon.update` are defined like this: + * let initial = 0, + * x = Bacon.interval(1e3, 1), + * y = Bacon.interval(2e3, 1), + * z = Bacon.interval(1.5e3, 1); + * // NOTE: had to explicitly specify the typing for `previous:number` + * Bacon.update(initial, + * [x, y, z], (previous:number, x, y, z) => previous + x + y + z, + * [x, y], (previous:number, x, y) => previous + x + y + z + * ); + * // As input, each function above will get the previous value of the `result` Property, along with values from the listed Observables. The value returned by the function will be used as the next value of `result`. Just like in `Bacon.when`, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream. + * } + * + * { + * // Here's a simple gaming example: + * let scoreMultiplier = Bacon.constant(1), + * hitUfo = new Bacon.Bus(), + * hitMotherShip = new Bacon.Bus(), + * score = Bacon.update(0, + * [hitUfo, scoreMultiplier], (score, _, multiplier:number) => score + 100 * multiplier, + * [hitMotherShip], (score, _) => score + 2000 + * ); + * // In the example, the `score` property is updated when either `hitUfo` or `hitMotherShip` occur. The `scoreMultiplier` Property is sampled to take multiplier into account when `hitUfo` occurs. + * } + */ + function update(initial:B, pattern1:Observable[], f1:(initial:B, ...args:A1[]) => B, pattern2:Observable[], f2:(initial:B, ...args:A2[]) => B, pattern3:Observable[], f3:(initial:B, ...args:A3[]) => B):Property; + + /** + * @callback Bacon.update4~f1 + * @param {B} initial + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.update4~f2 + * @param {B} initial + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.update4~f3 + * @param {B} initial + * @param {...A3} args + * @returns {B} + */ + /** + * @callback Bacon.update4~f4 + * @param {B} initial + * @param {...A4} args + * @returns {B} + */ + /** + * @method Bacon.update4 + * @description Creates an [Property]{@link Bacon.Property} from an `initial` value and a join-pattern system. + * @param {B} initial + * @param {Observable[]} pattern1 + * @param {Bacon.update4~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.update4~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.update4~f3} f3 + * @param {Observable[]} pattern4 + * @param {Bacon.update4~f4} f4 + * @returns {Property} + * @example + * { + * // The inputs to `Bacon.update` are defined like this: + * let initial = 0, + * x = Bacon.interval(1e3, 1), + * y = Bacon.interval(2e3, 1), + * z = Bacon.interval(1.5e3, 1); + * // NOTE: had to explicitly specify the typing for `previous:number` + * Bacon.update(initial, + * [x, y, z], (previous:number, x, y, z) => previous + x + y + z, + * [x, y], (previous:number, x, y) => previous + x + y + z + * ); + * // As input, each function above will get the previous value of the `result` Property, along with values from the listed Observables. The value returned by the function will be used as the next value of `result`. Just like in `Bacon.when`, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream. + * } + * + * { + * // Here's a simple gaming example: + * let scoreMultiplier = Bacon.constant(1), + * hitUfo = new Bacon.Bus(), + * hitMotherShip = new Bacon.Bus(), + * score = Bacon.update(0, + * [hitUfo, scoreMultiplier], (score, _, multiplier:number) => score + 100 * multiplier, + * [hitMotherShip], (score, _) => score + 2000 + * ); + * // In the example, the `score` property is updated when either `hitUfo` or `hitMotherShip` occur. The `scoreMultiplier` Property is sampled to take multiplier into account when `hitUfo` occurs. + * } + */ + function update(initial:B, pattern1:Observable[], f1:(initial:B, ...args:A1[]) => B, pattern2:Observable[], f2:(initial:B, ...args:A2[]) => B, pattern3:Observable[], f3:(initial:B, ...args:A3[]) => B, pattern4:Observable[], f4:(initial:B, ...args:A4[]) => B):Property; + + /** + * @callback Bacon.update5~f1 + * @param {B} initial + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.update5~f2 + * @param {B} initial + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.update5~f3 + * @param {B} initial + * @param {...A3} args + * @returns {B} + */ + /** + * @callback Bacon.update5~f4 + * @param {B} initial + * @param {...A4} args + * @returns {B} + */ + /** + * @callback Bacon.update5~f5 + * @param {B} initial + * @param {...A5} args + * @returns {B} + */ + /** + * @method Bacon.update5 + * @description Creates an [Property]{@link Bacon.Property} from an `initial` value and a join-pattern system. + * @param {B} initial + * @param {Observable[]} pattern1 + * @param {Bacon.update5~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.update5~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.update5~f3} f3 + * @param {Observable[]} pattern4 + * @param {Bacon.update5~f4} f4 + * @param {Observable[]} pattern5 + * @param {Bacon.update5~f5} f5 + * @returns {Property} + * @example + * { + * // The inputs to `Bacon.update` are defined like this: + * let initial = 0, + * x = Bacon.interval(1e3, 1), + * y = Bacon.interval(2e3, 1), + * z = Bacon.interval(1.5e3, 1); + * // NOTE: had to explicitly specify the typing for `previous:number` + * Bacon.update(initial, + * [x, y, z], (previous:number, x, y, z) => previous + x + y + z, + * [x, y], (previous:number, x, y) => previous + x + y + z + * ); + * // As input, each function above will get the previous value of the `result` Property, along with values from the listed Observables. The value returned by the function will be used as the next value of `result`. Just like in `Bacon.when`, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream. + * } + * + * { + * // Here's a simple gaming example: + * let scoreMultiplier = Bacon.constant(1), + * hitUfo = new Bacon.Bus(), + * hitMotherShip = new Bacon.Bus(), + * score = Bacon.update(0, + * [hitUfo, scoreMultiplier], (score, _, multiplier:number) => score + 100 * multiplier, + * [hitMotherShip], (score, _) => score + 2000 + * ); + * // In the example, the `score` property is updated when either `hitUfo` or `hitMotherShip` occur. The `scoreMultiplier` Property is sampled to take multiplier into account when `hitUfo` occurs. + * } + */ + function update(initial:B, pattern1:Observable[], f1:(initial:B, ...args:A1[]) => B, pattern2:Observable[], f2:(initial:B, ...args:A2[]) => B, pattern3:Observable[], f3:(initial:B, ...args:A3[]) => B, pattern4:Observable[], f4:(initial:B, ...args:A4[]) => B, pattern5:Observable[], f5:(initial:B, ...args:A5[]) => B):Property; +} + +declare module "baconjs" { + export = Bacon; +} \ No newline at end of file diff --git a/typings/browser/ambient/chai/index.d.ts b/typings/browser/ambient/chai/index.d.ts new file mode 100644 index 00000000..56660a5b --- /dev/null +++ b/typings/browser/ambient/chai/index.d.ts @@ -0,0 +1,403 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/1914a00b3c740348dae407ee0d2be89b0b58ad7f/chai/chai.d.ts +// Type definitions for chai 3.4.0 +// Project: http://chaijs.com/ +// Definitions by: Jed Mao , +// Bart van der Schoor , +// Andrew Brown , +// Olivier Chevet , +// Matt Wistrand +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// + +declare module Chai { + + interface ChaiStatic { + expect: ExpectStatic; + should(): Should; + /** + * Provides a way to extend the internals of Chai + */ + use(fn: (chai: any, utils: any) => void): ChaiStatic; + assert: AssertStatic; + config: Config; + AssertionError: typeof AssertionError; + } + + export interface ExpectStatic extends AssertionStatic { + fail(actual?: any, expected?: any, message?: string, operator?: string): void; + } + + export interface AssertStatic extends Assert { + } + + export interface AssertionStatic { + (target: any, message?: string): Assertion; + } + + interface ShouldAssertion { + equal(value1: any, value2: any, message?: string): void; + Throw: ShouldThrow; + throw: ShouldThrow; + exist(value: any, message?: string): void; + } + + interface Should extends ShouldAssertion { + not: ShouldAssertion; + fail(actual: any, expected: any, message?: string, operator?: string): void; + } + + interface ShouldThrow { + (actual: Function): void; + (actual: Function, expected: string|RegExp, message?: string): void; + (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; + } + + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + not: Assertion; + deep: Deep; + any: KeyFilter; + all: KeyFilter; + a: TypeComparison; + an: TypeComparison; + include: Include; + includes: Include; + contain: Include; + contains: Include; + ok: Assertion; + true: Assertion; + false: Assertion; + null: Assertion; + undefined: Assertion; + NaN: Assertion; + exist: Assertion; + empty: Assertion; + arguments: Assertion; + Arguments: Assertion; + equal: Equal; + equals: Equal; + eq: Equal; + eql: Equal; + eqls: Equal; + property: Property; + ownProperty: OwnProperty; + haveOwnProperty: OwnProperty; + ownPropertyDescriptor: OwnPropertyDescriptor; + haveOwnPropertyDescriptor: OwnPropertyDescriptor; + length: Length; + lengthOf: Length; + match: Match; + matches: Match; + string(string: string, message?: string): Assertion; + keys: Keys; + key(string: string): Assertion; + throw: Throw; + throws: Throw; + Throw: Throw; + respondTo: RespondTo; + respondsTo: RespondTo; + itself: Assertion; + satisfy: Satisfy; + satisfies: Satisfy; + closeTo: CloseTo; + approximately: CloseTo; + members: Members; + increase: PropertyChange; + increases: PropertyChange; + decrease: PropertyChange; + decreases: PropertyChange; + change: PropertyChange; + changes: PropertyChange; + extensible: Assertion; + sealed: Assertion; + frozen: Assertion; + oneOf(list: any[], message?: string): Assertion; + } + + interface LanguageChains { + to: Assertion; + be: Assertion; + been: Assertion; + is: Assertion; + that: Assertion; + which: Assertion; + and: Assertion; + has: Assertion; + have: Assertion; + with: Assertion; + at: Assertion; + of: Assertion; + same: Assertion; + } + + interface NumericComparison { + above: NumberComparer; + gt: NumberComparer; + greaterThan: NumberComparer; + least: NumberComparer; + gte: NumberComparer; + below: NumberComparer; + lt: NumberComparer; + lessThan: NumberComparer; + most: NumberComparer; + lte: NumberComparer; + within(start: number, finish: number, message?: string): Assertion; + } + + interface NumberComparer { + (value: number, message?: string): Assertion; + } + + interface TypeComparison { + (type: string, message?: string): Assertion; + instanceof: InstanceOf; + instanceOf: InstanceOf; + } + + interface InstanceOf { + (constructor: Object, message?: string): Assertion; + } + + interface CloseTo { + (expected: number, delta: number, message?: string): Assertion; + } + + interface Deep { + equal: Equal; + include: Include; + property: Property; + members: Members; + } + + interface KeyFilter { + keys: Keys; + } + + interface Equal { + (value: any, message?: string): Assertion; + } + + interface Property { + (name: string, value?: any, message?: string): Assertion; + } + + interface OwnProperty { + (name: string, message?: string): Assertion; + } + + interface OwnPropertyDescriptor { + (name: string, descriptor: PropertyDescriptor, message?: string): Assertion; + (name: string, message?: string): Assertion; + } + + interface Length extends LanguageChains, NumericComparison { + (length: number, message?: string): Assertion; + } + + interface Include { + (value: Object, message?: string): Assertion; + (value: string, message?: string): Assertion; + (value: number, message?: string): Assertion; + keys: Keys; + members: Members; + any: KeyFilter; + all: KeyFilter; + } + + interface Match { + (regexp: RegExp|string, message?: string): Assertion; + } + + interface Keys { + (...keys: string[]): Assertion; + (keys: any[]): Assertion; + (keys: Object): Assertion; + } + + interface Throw { + (): Assertion; + (expected: string, message?: string): Assertion; + (expected: RegExp, message?: string): Assertion; + (constructor: Error, expected?: string, message?: string): Assertion; + (constructor: Error, expected?: RegExp, message?: string): Assertion; + (constructor: Function, expected?: string, message?: string): Assertion; + (constructor: Function, expected?: RegExp, message?: string): Assertion; + } + + interface RespondTo { + (method: string, message?: string): Assertion; + } + + interface Satisfy { + (matcher: Function, message?: string): Assertion; + } + + interface Members { + (set: any[], message?: string): Assertion; + } + + interface PropertyChange { + (object: Object, prop: string, msg?: string): Assertion; + } + + export interface Assert { + /** + * @param expression Expression to test for truthiness. + * @param message Message to display on error. + */ + (expression: any, message?: string): void; + + fail(actual?: any, expected?: any, msg?: string, operator?: string): void; + + ok(val: any, msg?: string): void; + isOk(val: any, msg?: string): void; + notOk(val: any, msg?: string): void; + isNotOk(val: any, msg?: string): void; + + equal(act: any, exp: any, msg?: string): void; + notEqual(act: any, exp: any, msg?: string): void; + + strictEqual(act: any, exp: any, msg?: string): void; + notStrictEqual(act: any, exp: any, msg?: string): void; + + deepEqual(act: any, exp: any, msg?: string): void; + notDeepEqual(act: any, exp: any, msg?: string): void; + + isTrue(val: any, msg?: string): void; + isFalse(val: any, msg?: string): void; + + isNotTrue(val: any, msg?: string): void; + isNotFalse(val: any, msg?: string): void; + + isNull(val: any, msg?: string): void; + isNotNull(val: any, msg?: string): void; + + isUndefined(val: any, msg?: string): void; + isDefined(val: any, msg?: string): void; + + isNaN(val: any, msg?: string): void; + isNotNaN(val: any, msg?: string): void; + + isAbove(val: number, abv: number, msg?: string): void; + isBelow(val: number, blw: number, msg?: string): void; + + isAtLeast(val: number, atlst: number, msg?: string): void; + isAtMost(val: number, atmst: number, msg?: string): void; + + isFunction(val: any, msg?: string): void; + isNotFunction(val: any, msg?: string): void; + + isObject(val: any, msg?: string): void; + isNotObject(val: any, msg?: string): void; + + isArray(val: any, msg?: string): void; + isNotArray(val: any, msg?: string): void; + + isString(val: any, msg?: string): void; + isNotString(val: any, msg?: string): void; + + isNumber(val: any, msg?: string): void; + isNotNumber(val: any, msg?: string): void; + + isBoolean(val: any, msg?: string): void; + isNotBoolean(val: any, msg?: string): void; + + typeOf(val: any, type: string, msg?: string): void; + notTypeOf(val: any, type: string, msg?: string): void; + + instanceOf(val: any, type: Function, msg?: string): void; + notInstanceOf(val: any, type: Function, msg?: string): void; + + include(exp: string, inc: any, msg?: string): void; + include(exp: any[], inc: any, msg?: string): void; + + notInclude(exp: string, inc: any, msg?: string): void; + notInclude(exp: any[], inc: any, msg?: string): void; + + match(exp: any, re: RegExp, msg?: string): void; + notMatch(exp: any, re: RegExp, msg?: string): void; + + property(obj: Object, prop: string, msg?: string): void; + notProperty(obj: Object, prop: string, msg?: string): void; + deepProperty(obj: Object, prop: string, msg?: string): void; + notDeepProperty(obj: Object, prop: string, msg?: string): void; + + propertyVal(obj: Object, prop: string, val: any, msg?: string): void; + propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; + deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + lengthOf(exp: any, len: number, msg?: string): void; + //alias frenzy + throw(fn: Function, msg?: string): void; + throw(fn: Function, regExp: RegExp): void; + throw(fn: Function, errType: Function, msg?: string): void; + throw(fn: Function, errType: Function, regExp: RegExp): void; + + throws(fn: Function, msg?: string): void; + throws(fn: Function, regExp: RegExp): void; + throws(fn: Function, errType: Function, msg?: string): void; + throws(fn: Function, errType: Function, regExp: RegExp): void; + + Throw(fn: Function, msg?: string): void; + Throw(fn: Function, regExp: RegExp): void; + Throw(fn: Function, errType: Function, msg?: string): void; + Throw(fn: Function, errType: Function, regExp: RegExp): void; + + doesNotThrow(fn: Function, msg?: string): void; + doesNotThrow(fn: Function, regExp: RegExp): void; + doesNotThrow(fn: Function, errType: Function, msg?: string): void; + doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; + + operator(val: any, operator: string, val2: any, msg?: string): void; + closeTo(act: number, exp: number, delta: number, msg?: string): void; + approximately(act: number, exp: number, delta: number, msg?: string): void; + + sameMembers(set1: any[], set2: any[], msg?: string): void; + sameDeepMembers(set1: any[], set2: any[], msg?: string): void; + includeMembers(superset: any[], subset: any[], msg?: string): void; + + ifError(val: any, msg?: string): void; + + isExtensible(obj: {}, msg?: string): void; + extensible(obj: {}, msg?: string): void; + isNotExtensible(obj: {}, msg?: string): void; + notExtensible(obj: {}, msg?: string): void; + + isSealed(obj: {}, msg?: string): void; + sealed(obj: {}, msg?: string): void; + isNotSealed(obj: {}, msg?: string): void; + notSealed(obj: {}, msg?: string): void; + + isFrozen(obj: Object, msg?: string): void; + frozen(obj: Object, msg?: string): void; + isNotFrozen(obj: Object, msg?: string): void; + notFrozen(obj: Object, msg?: string): void; + + oneOf(inList: any, list: any[], msg?: string): void; + } + + export interface Config { + includeStack: boolean; + } + + export class AssertionError { + constructor(message: string, _props?: any, ssf?: Function); + name: string; + message: string; + showDiff: boolean; + stack: string; + } +} + +declare var chai: Chai.ChaiStatic; + +declare module "chai" { + export = chai; +} + +interface Object { + should: Chai.Assertion; +} \ No newline at end of file diff --git a/typings/browser/ambient/lodash/index.d.ts b/typings/browser/ambient/lodash/index.d.ts new file mode 100644 index 00000000..5b90e6e5 --- /dev/null +++ b/typings/browser/ambient/lodash/index.d.ts @@ -0,0 +1,15453 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/3d572e1ee3e6492983ef01f8b7adf6150d345b11/lodash/lodash-3.10.d.ts +// Type definitions for Lo-Dash +// Project: http://lodash.com/ +// Definitions by: Brian Zengel , Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var _: _.LoDashStatic; + +declare module _ { + interface LoDashStatic { + /** + * Creates a lodash object which wraps the given value to enable intuitive method chaining. + * + * In addition to Lo-Dash methods, wrappers also have the following Array methods: + * concat, join, pop, push, reverse, shift, slice, sort, splice, and unshift + * + * Chaining is supported in custom builds as long as the value method is implicitly or + * explicitly included in the build. + * + * The chainable wrapper functions are: + * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, + * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, + * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, + * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, + * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, + * remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times, + * toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip + * + * The non-chainable wrapper functions are: + * clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast, + * findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean, + * isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, + * isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin, + * noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some, + * sortedIndex, runInContext, template, unescape, uniqueId, and value + * + * The wrapper functions first and last return wrapped values when n is provided, otherwise + * they return unwrapped values. + * + * Explicit chaining can be enabled by using the _.chain method. + **/ + (value: number): LoDashImplicitWrapper; + (value: string): LoDashImplicitStringWrapper; + (value: boolean): LoDashImplicitWrapper; + (value: Array): LoDashImplicitNumberArrayWrapper; + (value: Array): LoDashImplicitArrayWrapper; + (value: T): LoDashImplicitObjectWrapper; + (value: any): LoDashImplicitWrapper; + + /** + * The semantic version number. + **/ + VERSION: string; + + /** + * An object used to flag environments features. + **/ + support: Support; + + /** + * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby + * (ERB). Change the following template settings to use alternative delimiters. + **/ + templateSettings: TemplateSettings; + } + + /** + * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby + * (ERB). Change the following template settings to use alternative delimiters. + **/ + interface TemplateSettings { + /** + * The "escape" delimiter. + **/ + escape?: RegExp; + + /** + * The "evaluate" delimiter. + **/ + evaluate?: RegExp; + + /** + * An object to import into the template as local variables. + **/ + imports?: Dictionary; + + /** + * The "interpolate" delimiter. + **/ + interpolate?: RegExp; + + /** + * Used to reference the data object in the template text. + **/ + variable?: string; + } + + /** + * Creates a cache object to store key/value pairs. + */ + interface MapCache { + /** + * Removes `key` and its value from the cache. + * @param key The key of the value to remove. + * @return Returns `true` if the entry was removed successfully, else `false`. + */ + delete(key: string): boolean; + + /** + * Gets the cached value for `key`. + * @param key The key of the value to get. + * @return Returns the cached value. + */ + get(key: string): any; + + /** + * Checks if a cached value for `key` exists. + * @param key The key of the entry to check. + * @return Returns `true` if an entry for `key` exists, else `false`. + */ + has(key: string): boolean; + + /** + * Sets `value` to `key` of the cache. + * @param key The key of the value to cache. + * @param value The value to cache. + * @return Returns the cache object. + */ + set(key: string, value: any): _.Dictionary; + } + + /** + * An object used to flag environments features. + **/ + interface Support { + /** + * Detect if an arguments object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). + **/ + argsClass: boolean; + + /** + * Detect if arguments objects are Object objects (all but Narwhal and Opera < 10.5). + **/ + argsObject: boolean; + + /** + * Detect if name or message properties of Error.prototype are enumerable by default. + * (IE < 9, Safari < 5.1) + **/ + enumErrorProps: boolean; + + /** + * Detect if prototype properties are enumerable by default. + * + * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 (if the prototype or a property on the + * prototype has been set) incorrectly set the [[Enumerable]] value of a function’s prototype property to true. + **/ + enumPrototypes: boolean; + + /** + * Detect if Function#bind exists and is inferred to be fast (all but V8). + **/ + fastBind: boolean; + + /** + * Detect if functions can be decompiled by Function#toString (all but PS3 and older Opera + * mobile browsers & avoided in Windows 8 apps). + **/ + funcDecomp: boolean; + + /** + * Detect if Function#name is supported (all but IE). + **/ + funcNames: boolean; + + /** + * Detect if arguments object indexes are non-enumerable (Firefox < 4, IE < 9, PhantomJS, + * Safari < 5.1). + **/ + nonEnumArgs: boolean; + + /** + * Detect if properties shadowing those on Object.prototype are non-enumerable. + * + * In IE < 9 an objects own properties, shadowing non-enumerable ones, are made + * non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). + **/ + nonEnumShadows: boolean; + + /** + * Detect if own properties are iterated after inherited properties (all but IE < 9). + **/ + ownLast: boolean; + + /** + * Detect if Array#shift and Array#splice augment array-like objects correctly. + * + * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array shift() and splice() + * functions that fail to remove the last element, value[0], of array-like objects even + * though the length property is set to 0. The shift() method is buggy in IE 8 compatibility + * mode, while splice() is buggy regardless of mode in IE < 9 and buggy in compatibility mode + * in IE 9. + **/ + spliceObjects: boolean; + + /** + * Detect lack of support for accessing string characters by index. + * + * IE < 8 can't access characters by index and IE 8 can only access characters by index on + * string literals. + **/ + unindexedChars: boolean; + } + + interface LoDashWrapperBase { } + + interface LoDashImplicitWrapperBase extends LoDashWrapperBase { } + + interface LoDashExplicitWrapperBase extends LoDashWrapperBase { } + + interface LoDashImplicitWrapper extends LoDashImplicitWrapperBase> { } + + interface LoDashExplicitWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitStringWrapper extends LoDashImplicitWrapper { } + + interface LoDashExplicitStringWrapper extends LoDashExplicitWrapper { } + + interface LoDashImplicitObjectWrapper extends LoDashImplicitWrapperBase> { } + + interface LoDashExplicitObjectWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitArrayWrapper extends LoDashImplicitWrapperBase> { + pop(): T; + push(...items: T[]): LoDashImplicitArrayWrapper; + shift(): T; + sort(compareFn?: (a: T, b: T) => number): LoDashImplicitArrayWrapper; + splice(start: number): LoDashImplicitArrayWrapper; + splice(start: number, deleteCount: number, ...items: any[]): LoDashImplicitArrayWrapper; + unshift(...items: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitNumberArrayWrapper extends LoDashImplicitArrayWrapper { } + + interface LoDashExplicitNumberArrayWrapper extends LoDashExplicitArrayWrapper { } + + // join (exists only in wrappers) + interface LoDashImplicitWrapper { + /** + * @see _.join + */ + join(separator?: string): string; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.join + */ + join(separator?: string): string; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.join + */ + join(separator?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.join + */ + join(separator?: string): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.join + */ + join(separator?: string): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.join + */ + join(separator?: string): LoDashExplicitWrapper; + } + + /********* + * Array * + *********/ + + //_.chunk + interface LoDashStatic { + /** + * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the + * final chunk will be the remaining elements. + * + * @param array The array to process. + * @param size The length of each chunk. + * @return Returns the new array containing chunks. + */ + chunk( + array: List, + size?: number + ): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashExplicitArrayWrapper; + } + + //_.compact + interface LoDashStatic { + /** + * Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are + * falsey. + * + * @param array The array to compact. + * @return (Array) Returns the new array of filtered values. + */ + compact(array?: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.compact + */ + compact(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.compact + */ + compact(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.compact + */ + compact(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.compact + */ + compact(): LoDashExplicitArrayWrapper; + } + + //_.difference + interface LoDashStatic { + /** + * Creates an array of unique array values not included in the other provided arrays using SameValueZero for + * equality comparisons. + * + * @param array The array to inspect. + * @param values The arrays of values to exclude. + * @return Returns the new array of filtered values. + */ + difference( + array: T[]|List, + ...values: (T[]|List)[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.difference + */ + difference(...values: (T[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.difference + */ + difference(...values: (TValue[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.difference + */ + difference(...values: (T[]|List)[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.difference + */ + difference(...values: (TValue[]|List)[]): LoDashExplicitArrayWrapper; + } + + //_.drop + interface LoDashStatic { + /** + * Creates a slice of array with n elements dropped from the beginning. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + drop(array: T[]|List, n?: number): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashExplicitArrayWrapper; + } + + //_.dropRight + interface LoDashStatic { + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + dropRight( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashExplicitArrayWrapper; + } + + //_.dropRightWhile + interface LoDashStatic { + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + dropRightWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.dropWhile + interface LoDashStatic { + /** + * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + dropWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropWhile + */ + dropWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropWhile + */ + dropWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.fill + interface LoDashStatic { + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + fill( + array: any[], + value: T, + start?: number, + end?: number + ): T[]; + + /** + * @see _.fill + */ + fill( + array: List, + value: T, + start?: number, + end?: number + ): List; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitObjectWrapper>; + } + + //_.findIndex + interface LoDashStatic { + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the index of the found element, else -1. + */ + findIndex( + array: List, + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + array: List, + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + array: List, + predicate?: W + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + //_.findLastIndex + interface LoDashStatic { + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param thisArg The function invoked per iteration. + * @return Returns the index of the found element, else -1. + */ + findLastIndex( + array: List, + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + array: List, + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + array: List, + predicate?: W + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + //_.first + interface LoDashStatic { + /** + * Gets the first element of array. + * + * @alias _.head + * + * @param array The array to query. + * @return Returns the first element of array. + */ + first(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.first + */ + first(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.first + */ + first(): TResult; + } + + interface RecursiveArray extends Array> {} + interface ListOfRecursiveArraysOrValues extends List> {} + + //_.flatten + interface LoDashStatic { + /** + * Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it’s only + * flattened a single level. + * + * @param array The array to flatten. + * @param isDeep Specify a deep flatten. + * @return Returns the new flattened array. + */ + flatten(array: ListOfRecursiveArraysOrValues, isDeep: boolean): T[]; + + /** + * @see _.flatten + */ + flatten(array: List): T[]; + + /** + * @see _.flatten + */ + flatten(array: ListOfRecursiveArraysOrValues): RecursiveArray; + } + + interface LoDashImplicitWrapper { + /** + * @see _.flatten + */ + flatten(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flatten + */ + flatten(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; + } + + //_.flattenDeep + interface LoDashStatic { + /** + * Recursively flattens a nested array. + * + * @param array The array to recursively flatten. + * @return Returns the new flattened array. + */ + flattenDeep(array: ListOfRecursiveArraysOrValues): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + //_.head + interface LoDashStatic { + /** + * @see _.first + */ + head(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.first + */ + head(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.first + */ + head(): TResult; + } + + //_.indexOf + interface LoDashStatic { + /** + * Gets the index at which the first occurrence of value is found in array using SameValueZero for equality + * comparisons. If fromIndex is negative, it’s used as the offset from the end of array. If array is sorted + * providing true for fromIndex performs a faster binary search. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return The index to search from or true to perform a binary search on a sorted array. + */ + indexOf( + array: List, + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: TValue, + fromIndex?: boolean|number + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: T, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: TValue, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + //_.initial + interface LoDashStatic { + /** + * Gets all but the last element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + initial(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.initial + */ + initial(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.initial + */ + initial(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.initial + */ + initial(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.initial + */ + initial(): LoDashExplicitArrayWrapper; + } + + //_.intersection + interface LoDashStatic { + /** + * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of shared values. + */ + intersection(...arrays: (T[]|List)[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashExplicitArrayWrapper; + } + + //_.last + interface LoDashStatic { + /** + * Gets the last element of array. + * + * @param array The array to query. + * @return Returns the last element of array. + */ + last(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.last + */ + last(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.last + */ + last(): T; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.last + */ + last(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.last + */ + last(): LoDashExplicitObjectWrapper; + } + + //_.lastIndexOf + interface LoDashStatic { + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + lastIndexOf( + array: List, + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: TResult, + fromIndex?: boolean|number + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: T, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: TResult, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + //_.object + interface LoDashStatic { + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): _.Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + //_.pull + interface LoDashStatic { + /** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * Note: Unlike _.without, this method mutates array. + * + * @param array The array to modify. + * @param values The values to remove. + * @return Returns array. + */ + pull( + array: T[], + ...values: T[] + ): T[]; + + /** + * @see _.pull + */ + pull( + array: List, + ...values: T[] + ): List; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pull + */ + pull(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pull + */ + pull(...values: TValue[]): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pull + */ + pull(...values: T[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pull + */ + pull(...values: TValue[]): LoDashExplicitObjectWrapper>; + } + + //_.pullAt + interface LoDashStatic { + /** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * Note: Unlike _.at, this method mutates array. + * + * @param array The array to modify. + * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @return Returns the new array of removed elements. + */ + pullAt( + array: List, + ...indexes: (number|number[])[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper; + } + + //_.remove + interface LoDashStatic { + /** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed + * elements. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Note: Unlike _.filter, this method mutates array. + * + * @param array The array to modify. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new array of removed elements. + */ + remove( + array: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.remove + */ + remove( + array: List, + predicate?: string, + thisArg?: any + ): T[]; + + /** + * @see _.remove + */ + remove( + array: List, + predicate?: W + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashExplicitArrayWrapper; + } + + //_.rest + interface LoDashStatic { + /** + * Gets all but the first element of array. + * + * @alias _.tail + * + * @param array The array to query. + * @return Returns the slice of array. + */ + rest(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.rest + */ + rest(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rest + */ + rest(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.rest + */ + rest(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.rest + */ + rest(): LoDashExplicitArrayWrapper; + } + + //_.slice + interface LoDashStatic { + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + slice( + array: T[], + start?: number, + end?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashExplicitArrayWrapper; + } + + //_.sortedIndex + interface LoDashStatic { + /** + * Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order. If an iteratee function is provided it’s invoked for value and each element of array to compute their sort ranking. The iteratee is bound to thisArg and invoked with one argument; (value). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @return The this binding of iteratee. + */ + sortedIndex( + array: List, + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; + } + + //_.sortedLastIndex + interface LoDashStatic { + /** + * This method is like _.sortedIndex except that it returns the highest index at which value should be + * inserted into array in order to maintain its sort order. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the index at which value should be inserted into array. + */ + sortedLastIndex( + array: List, + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; + } + + //_.tail + interface LoDashStatic { + /** + * @see _.rest + */ + tail(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.rest + */ + tail(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rest + */ + tail(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.rest + */ + tail(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.rest + */ + tail(): LoDashExplicitArrayWrapper; + } + + //_.take + interface LoDashStatic { + /** + * Creates a slice of array with n elements taken from the beginning. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + take( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashExplicitArrayWrapper; + } + + //_.takeRight + interface LoDashStatic { + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + takeRight( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashExplicitArrayWrapper; + } + + //_.takeRightWhile + interface LoDashStatic { + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + takeRightWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.takeWhile + interface LoDashStatic { + /** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + takeWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeWhile + */ + takeWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeWhile + */ + takeWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.union + interface LoDashStatic { + /** + * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of combined values. + */ + union(...arrays: List[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + //_.uniq + interface LoDashStatic { + /** + * Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only + * the first occurrence of each element is kept. Providing true for isSorted performs a faster search + * algorithm for sorted arrays. If an iteratee function is provided it’s invoked for each element in the + * array to generate the criterion by which uniqueness is computed. The iteratee is bound to thisArg and + * invoked with three arguments: (value, index, array). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.unique + * + * @param array The array to inspect. + * @param isSorted Specify the array is sorted. + * @param iteratee The function invoked per iteration. + * @param thisArg iteratee + * @return Returns the new duplicate-value-free array. + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: TWhere + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.unique + interface LoDashStatic { + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: TWhere + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.unzip + interface LoDashStatic { + /** + * This method is like _.zip except that it accepts an array of grouped elements and creates an array + * regrouping the elements to their pre-zip configuration. + * + * @param array The array of grouped elements to process. + * @return Returns the new array of regrouped elements. + */ + unzip(array: List>): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashExplicitArrayWrapper; + } + + //_.unzipWith + interface LoDashStatic { + /** + * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * + * @param array The array of grouped elements to process. + * @param iteratee The function to combine regrouped values. + * @param thisArg The this binding of iteratee. + * @return Returns the new array of regrouped elements. + */ + unzipWith( + array: List>, + iteratee?: MemoIterator, + thisArg?: any + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + //_.without + interface LoDashStatic { + /** + * Creates an array excluding all provided values using SameValueZero for equality comparisons. + * + * @param array The array to filter. + * @param values The values to exclude. + * @return Returns the new array of filtered values. + */ + without( + array: List, + ...values: T[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashExplicitArrayWrapper; + } + + //_.xor + interface LoDashStatic { + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + xor(...arrays: List[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + //_.zip + interface LoDashStatic { + /** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @param arrays The arrays to process. + * @return Returns the new array of grouped elements. + */ + zip(...arrays: List[]): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashExplicitArrayWrapper; + } + + //_.zipObject + interface LoDashStatic { + /** + * The inverse of _.pairs; this method returns an object composed from arrays of property names and values. + * Provide either a single two dimensional array, e.g. [[key1, value1], [key2, value2]] or two arrays, one of + * property names and one of corresponding values. + * + * @alias _.object + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + zipObject( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + zipObject( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + zipObject( + props: List|List>, + values?: List + ): _.Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + //_.zipWith + interface LoDashStatic { + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee] The function to combine grouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + zipWith(...args: any[]): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipWith + */ + zipWith(...args: any[]): LoDashImplicitArrayWrapper; + } + + /********* + * Chain * + *********/ + + //_.chain + interface LoDashStatic { + /** + * Creates a lodash object that wraps value with explicit method chaining enabled. + * + * @param value The value to wrap. + * @return Returns the new lodash wrapper instance. + */ + chain(value: number): LoDashExplicitWrapper; + chain(value: string): LoDashExplicitWrapper; + chain(value: boolean): LoDashExplicitWrapper; + chain(value: T[]): LoDashExplicitArrayWrapper; + chain(value: T): LoDashExplicitObjectWrapper; + chain(value: any): LoDashExplicitWrapper; + } + + interface LoDashImplicitWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.chain + */ + chain(): TWrapper; + } + + //_.tap + interface LoDashStatic { + /** + * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one + * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @parem thisArg The this binding of interceptor. + * @return Returns value. + **/ + tap( + value: T, + interceptor: (value: T) => void, + thisArg?: any + ): T; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.tap + */ + tap( + interceptor: (value: T) => void, + thisArg?: any + ): TWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.tap + */ + tap( + interceptor: (value: T) => void, + thisArg?: any + ): TWrapper; + } + + //_.thru + interface LoDashStatic { + /** + * This method is like _.tap except that it returns the result of interceptor. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @param thisArg The this binding of interceptor. + * @return Returns the result of interceptor. + */ + thru( + value: T, + interceptor: (value: T) => TResult, + thisArg?: any + ): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitObjectWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult[], + thisArg?: any): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult[], + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + //_.prototype.commit + interface LoDashImplicitWrapperBase { + /** + * Executes the chained sequence and returns the wrapped result. + * + * @return Returns the new lodash wrapper instance. + */ + commit(): TWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.commit + */ + commit(): TWrapper; + } + + //_.prototype.concat + interface LoDashImplicitWrapperBase { + /** + * Creates a new array joining a wrapped array with any additional arrays and/or values. + * + * @param items + * @return Returns the new concatenated array. + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + } + + //_.prototype.plant + interface LoDashImplicitWrapperBase { + /** + * Creates a clone of the chained sequence planting value as the wrapped value. + * @param value The value to plant as the wrapped value. + * @return Returns the new lodash wrapper instance. + */ + plant(value: number): LoDashImplicitWrapper; + + /** + * @see _.plant + */ + plant(value: string): LoDashImplicitStringWrapper; + + /** + * @see _.plant + */ + plant(value: boolean): LoDashImplicitWrapper; + + /** + * @see _.plant + */ + plant(value: number[]): LoDashImplicitNumberArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T[]): LoDashImplicitArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T): LoDashImplicitObjectWrapper; + + /** + * @see _.plant + */ + plant(value: any): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.plant + */ + plant(value: number): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: string): LoDashExplicitStringWrapper; + + /** + * @see _.plant + */ + plant(value: boolean): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: number[]): LoDashExplicitNumberArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T[]): LoDashExplicitArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T): LoDashExplicitObjectWrapper; + + /** + * @see _.plant + */ + plant(value: any): LoDashExplicitWrapper; + } + + //_.prototype.reverse + interface LoDashImplicitArrayWrapper { + /** + * Reverses the wrapped array so the first element becomes the last, the second element becomes the second to + * last, and so on. + * + * Note: This method mutates the wrapped array. + * + * @return Returns the new reversed lodash wrapper instance. + */ + reverse(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.reverse + */ + reverse(): LoDashExplicitArrayWrapper; + } + + //_.prototype.run + interface LoDashWrapperBase { + /** + * @see _.value + */ + run(): T; + } + + //_.prototype.toJSON + interface LoDashWrapperBase { + /** + * @see _.value + */ + toJSON(): T; + } + + //_.prototype.toString + interface LoDashWrapperBase { + /** + * Produces the result of coercing the unwrapped value to a string. + * + * @return Returns the coerced string value. + */ + toString(): string; + } + + //_.prototype.value + interface LoDashWrapperBase { + /** + * Executes the chained sequence to extract the unwrapped value. + * + * @alias _.run, _.toJSON, _.valueOf + * + * @return Returns the resolved unwrapped value. + */ + value(): T; + } + + //_.valueOf + interface LoDashWrapperBase { + /** + * @see _.value + */ + valueOf(): T; + } + + /************** + * Collection * + **************/ + + //_.all + interface LoDashStatic { + /** + * @see _.every + */ + all( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: List|Dictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.any + interface LoDashStatic { + /** + * @see _.some + */ + any( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: List|Dictionary|NumericDictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: List|Dictionary|NumericDictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.at + interface LoDashStatic { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param collection The collection to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + at( + collection: List|Dictionary, + ...props: (number|string|(number|string)[])[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; + } + + //_.collect + interface LoDashStatic { + /** + * @see _.map + */ + collect( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: List|Dictionary, + iteratee?: string + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: List|Dictionary, + iteratee?: TObject + ): boolean[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + //_.contains + interface LoDashStatic { + /** + * @see _.includes + */ + contains( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + contains( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + contains( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + contains( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + contains( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + contains( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + contains( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + contains( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.countBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + countBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: NumericDictionary, + iteratee?: NumericDictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: W + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + //_.detect + interface LoDashStatic { + /** + * @see _.find + */ + detect( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: List|Dictionary, + predicate?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.find + */ + detect( + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + predicate?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.find + */ + detect( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + detect( + predicate?: string, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + detect( + predicate?: TObject + ): TResult; + } + + //_.each + interface LoDashStatic { + /** + * @see _.forEach + */ + each( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEach + */ + each( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEach + */ + each( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEach + */ + each( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEach + */ + each( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.eachRight + interface LoDashStatic { + /** + * @see _.forEachRight + */ + eachRight( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEachRight + */ + eachRight( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEachRight + */ + eachRight( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.every + interface LoDashStatic { + /** + * Checks if predicate returns truthy for all elements of collection. The predicate is bound to thisArg and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.all + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns true if all elements pass the predicate check, else false. + */ + every( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: List|Dictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.filter + interface LoDashStatic { + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.select + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + filter( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.filter + */ + filter( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.find + interface LoDashStatic { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.detect + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the matched element, else undefined. + */ + find( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: List|Dictionary, + predicate?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.find + */ + find( + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.find + */ + find( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): TResult; + } + + //_.findWhere + interface LoDashStatic { + /** + * @see _.find + **/ + findWhere( + collection: Array, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findWhere( + collection: List, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findWhere( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: Array, + whereValue: W): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: List, + whereValue: W): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: Dictionary, + whereValue: W): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: Array, + pluckValue: string): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: List, + pluckValue: string): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: Dictionary, + pluckValue: string): T; + } + + //_.findLast + interface LoDashStatic { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param callback The function called per iteration. + * @param thisArg The this binding of callback. + * @return The found element, else undefined. + **/ + findLast( + collection: Array, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findLast( + collection: List, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findLast( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: Array, + whereValue: W): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: List, + whereValue: W): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: Dictionary, + whereValue: W): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: Array, + pluckValue: string): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: List, + pluckValue: string): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: Dictionary, + pluckValue: string): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findLast + */ + findLast( + callback: ListIterator, + thisArg?: any): T; + /** + * @see _.findLast + * @param _.where style callback + */ + findLast( + whereValue: W): T; + + /** + * @see _.findLast + * @param _.where style callback + */ + findLast( + pluckValue: string): T; + } + + //_.forEach + interface LoDashStatic { + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + forEach( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEach + */ + forEach( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEach + */ + forEach( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.forEachRight + interface LoDashStatic { + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + forEachRight( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.groupBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + groupBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: TValue + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: TWhere + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashExplicitObjectWrapper>; + } + + //_.include + interface LoDashStatic { + /** + * @see _.includes + */ + include( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + include( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + include( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + include( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + include( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + include( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + include( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + include( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.includes + interface LoDashStatic { + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @alias _.contains, _.include + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + includes( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + includes( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + includes( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + includes( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + includes( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + includes( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + includes( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + includes( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.indexBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + indexBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: NumericDictionary, + iteratee?: NumericDictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: W + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: Object + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: Object + ): LoDashExplicitObjectWrapper>; + } + + //_.invoke + interface LoDashStatic { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + invoke( + collection: Array, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: List, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Dictionary, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Array, + method: Function, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: List, + method: Function, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Dictionary, + method: Function, + ...args: any[]): any; + } + + //_.map + interface LoDashStatic { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @alias _.collect + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + map( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: List|Dictionary, + iteratee?: string + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: List|Dictionary, + iteratee?: TObject + ): boolean[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + //_.partition + interface LoDashStatic { + /** + * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, + * while the second of which contains elements predicate returns falsey for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the array of grouped elements. + **/ + partition( + collection: List, + callback: ListIterator, + thisArg?: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + whereValue: W): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + whereValue: W): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + path: string, + srcValue: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + path: string, + srcValue: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + pluckValue: string): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + pluckValue: string): T[][]; + } + + interface LoDashImplicitStringWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + whereValue: W): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + path: string, + srcValue: any): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + pluckValue: string): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + callback: DictionaryIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + path: string, + srcValue: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + pluckValue: string): LoDashImplicitArrayWrapper; + } + + //_.pluck + interface LoDashStatic { + /** + * Gets the property value of path from all elements in collection. + * + * @param collection The collection to iterate over. + * @param path The path of the property to pluck. + * @return A new array of property values. + */ + pluck( + collection: List|Dictionary, + path: StringRepresentable|StringRepresentable[] + ): any[]; + + /** + * @see _.pluck + */ + pluck( + collection: List|Dictionary, + path: StringRepresentable|StringRepresentable[] + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; + } + + //_.reduce + interface LoDashStatic { + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @param thisArg The this binding of callback. + * @return Returns the accumulated value. + **/ + reduce( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + thisArg?: any): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + thisArg?: any): TResult; + } + + //_.reduceRight + interface LoDashStatic { + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @param thisArg The this binding of callback. + * @return The accumulated value. + **/ + reduceRight( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + } + + //_.reject + interface LoDashStatic { + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + reject( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.reject + */ + reject( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.reject + */ + reject( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.reject + */ + reject( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.sample + interface LoDashStatic { + /** + * Retrieves a random element or n random elements from a collection. + * @param collection The collection to sample. + * @return Returns the random sample(s) of collection. + **/ + sample(collection: Array): T; + + /** + * @see _.sample + **/ + sample(collection: List): T; + + /** + * @see _.sample + **/ + sample(collection: Dictionary): T; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: Array, n: number): T[]; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: List, n: number): T[]; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: Dictionary, n: number): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sample + **/ + sample(n: number): LoDashImplicitArrayWrapper; + + /** + * @see _.sample + **/ + sample(): LoDashImplicitWrapper; + } + + //_.select + interface LoDashStatic { + /** + * @see _.filter + */ + select( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.filter + */ + select( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.filter + */ + select( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.filter + */ + select( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.shuffle + interface LoDashStatic { + /** + * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. + * + * @param collection The collection to shuffle. + * @return Returns the new shuffled array. + */ + shuffle(collection: List|Dictionary): T[]; + + /** + * @see _.shuffle + */ + shuffle(collection: string): string[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + //_.size + interface LoDashStatic { + /** + * Gets the size of collection by returning its length for array-like values or the number of own enumerable + * properties for objects. + * + * @param collection The collection to inspect. + * @return Returns the size of collection. + */ + size(collection: List|Dictionary): number; + + /** + * @see _.size + */ + size(collection: string): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + //_.some + interface LoDashStatic { + /** + * Checks if predicate returns truthy for any element of collection. The function returns as soon as it finds + * a passing value and does not iterate over the entire collection. The predicate is bound to thisArg and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.any + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns true if any element passes the predicate check, else false. + */ + some( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: List|Dictionary|NumericDictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: List|Dictionary|NumericDictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.sortBy + interface LoDashStatic { + /** + * Creates an array of elements, sorted in ascending order by the results of running each element in a + * collection through iteratee. This method performs a stable sort, that is, it preserves the original sort + * order of equal elements. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * valueof the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new sorted array. + */ + sortBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary, + iteratee: string + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary, + whereValue: W + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashExplicitArrayWrapper; + } + + //_.sortByAll + interface LoDashStatic { + /** + * This method is like "_.sortBy" except that it can sort by multiple iteratees or + * property names. + * + * If a property name is provided for an iteratee the created "_.property" style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created "_.matchesProperty" style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for an iteratee the created "_.matches" style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of callback. + * @return A new array of sorted elements. + **/ + sortByAll( + collection: Array, + iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: List, + iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: Array, + ...iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: List, + ...iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts + * @param args The rules by which to sort + */ + sortByAll( + collection: (Array|List), + ...args: (ListIterator|Object|string)[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts + * @param args The rules by which to sort + */ + sortByAll(...args: (ListIterator|Object|string)[]): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByAll + **/ + sortByAll( + iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByAll + **/ + sortByAll( + ...iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; + } + + //_.sortByOrder + interface LoDashStatic { + /** + * This method is like _.sortByAll except that it allows specifying the sort orders of the iteratees to sort + * by. If orders is unspecified, all values are sorted in ascending order. Otherwise, a value is sorted in + * ascending order if its corresponding order is "asc", and descending if "desc". + * + * If a property name is provided for an iteratee the created _.property style callback returns the property + * value of the given element. + * + * If an object is provided for an iteratee the created _.matches style callback returns true for elements + * that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratees The iteratees to sort by. + * @param orders The sort orders of iteratees. + * @return Returns the new sorted array. + */ + sortByOrder( + collection: List, + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: List, + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: Dictionary, + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: Dictionary, + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|(ListIterator|string)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|(ListIterator|string)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + //_.where + interface LoDashStatic { + /** + * Performs a deep comparison of each element in a collection to the given properties + * object, returning an array of all elements that have equivalent property values. + * @param collection The collection to iterate over. + * @param properties The object of property values to filter by. + * @return A new array of elements that have the given properties. + **/ + where( + list: Array, + properties: U): T[]; + + /** + * @see _.where + **/ + where( + list: List, + properties: U): T[]; + + /** + * @see _.where + **/ + where( + list: Dictionary, + properties: U): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.where + **/ + where(properties: U): LoDashImplicitArrayWrapper; + } + + /******** + * Date * + ********/ + + //_.now + interface LoDashStatic { + /** + * Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @return The number of milliseconds. + */ + now(): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.now + */ + now(): number; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.now + */ + now(): LoDashExplicitWrapper; + } + + /************* + * Functions * + *************/ + + //_.after + interface LoDashStatic { + /** + * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. + * + * @param n The number of calls before func is invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + after( + n: number, + func: TFunc + ): TFunc; + } + + interface LoDashImplicitWrapper { + /** + * @see _.after + **/ + after(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.after + **/ + after(func: TFunc): LoDashExplicitObjectWrapper; + } + + //_.ary + interface LoDashStatic { + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + ary( + func: Function, + n?: number + ): TResult; + + ary( + func: T, + n?: number + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.ary + */ + ary(n?: number): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.ary + */ + ary(n?: number): LoDashExplicitObjectWrapper; + } + + //_.backflow + interface LoDashStatic { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.before + interface LoDashStatic { + /** + * Creates a function that invokes func, with the this binding and arguments of the created function, while + * it’s called less than n times. Subsequent calls to the created function return the result of the last func + * invocation. + * + * @param n The number of calls at which func is no longer invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + before( + n: number, + func: TFunc + ): TFunc; + } + + interface LoDashImplicitWrapper { + /** + * @see _.before + **/ + before(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.before + **/ + before(func: TFunc): LoDashExplicitObjectWrapper; + } + + //_.bind + interface FunctionBind { + placeholder: any; + + ( + func: T, + thisArg: any, + ...partials: any[] + ): TResult; + + ( + func: Function, + thisArg: any, + ...partials: any[] + ): TResult; + } + + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind + * arguments to those provided to the bound function. + * + * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for + * partially applied arguments. + * + * Note: Unlike native Function#bind this method does not set the "length" property of bound functions. + * + * @param func The function to bind. + * @param thisArg The this binding of func. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + bind: FunctionBind; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bind + */ + bind( + thisArg: any, + ...partials: any[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bind + */ + bind( + thisArg: any, + ...partials: any[] + ): LoDashExplicitObjectWrapper; + } + + //_.bindAll + interface LoDashStatic { + /** + * Binds methods of an object to the object itself, overwriting the existing method. Method names may be + * specified as individual arguments or as arrays of method names. If no method names are provided all + * enumerable function properties, own and inherited, of object are bound. + * + * Note: This method does not set the "length" property of bound functions. + * + * @param object The object to bind and assign the bound methods to. + * @param methodNames The object method names to bind, specified as individual method names or arrays of + * method names. + * @return Returns object. + */ + bindAll( + object: T, + ...methodNames: (string|string[])[] + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bindAll + */ + bindAll(...methodNames: (string|string[])[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bindAll + */ + bindAll(...methodNames: (string|string[])[]): LoDashExplicitObjectWrapper; + } + + //_.bindKey + interface FunctionBindKey { + placeholder: any; + + ( + object: T, + key: any, + ...partials: any[] + ): TResult; + + ( + object: Object, + key: any, + ...partials: any[] + ): TResult; + } + + interface LoDashStatic { + /** + * Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments + * to those provided to the bound function. + * + * This method differs from _.bind by allowing bound functions to reference methods that may be redefined + * or don’t yet exist. See Peter Michaux’s article for more details. + * + * The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder + * for partially applied arguments. + * + * @param object The object the method belongs to. + * @param key The key of the method. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + bindKey: FunctionBindKey; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bindKey + */ + bindKey( + key: any, + ...partials: any[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bindKey + */ + bindKey( + key: any, + ...partials: any[] + ): LoDashExplicitObjectWrapper; + } + + //_.compose + interface LoDashStatic { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.createCallback + interface LoDashStatic { + /** + * Produces a callback bound to an optional thisArg. If func is a property name the created + * callback will return the property value for a given element. If func is an object the created + * callback will return true for elements that contain the equivalent object properties, + * otherwise it will return false. + * @param func The value to convert to a callback. + * @param thisArg The this binding of the created callback. + * @param argCount The number of arguments the callback accepts. + * @return A callback function. + **/ + createCallback( + func: string, + thisArg?: any, + argCount?: number): () => any; + + /** + * @see _.createCallback + **/ + createCallback( + func: Dictionary, + thisArg?: any, + argCount?: number): () => boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.createCallback + **/ + createCallback( + thisArg?: any, + argCount?: number): LoDashImplicitObjectWrapper<() => any>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.createCallback + **/ + createCallback( + thisArg?: any, + argCount?: number): LoDashImplicitObjectWrapper<() => any>; + } + + //_.curry + interface LoDashStatic { + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1) => R): + CurriedFunction1; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2) => R): + CurriedFunction2; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3) => R): + CurriedFunction3; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): + CurriedFunction4; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): + CurriedFunction5; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + curry( + func: Function, + arity?: number): TResult; + } + + interface CurriedFunction1 { + (): CurriedFunction1; + (t1: T1): R; + } + + interface CurriedFunction2 { + (): CurriedFunction2; + (t1: T1): CurriedFunction1; + (t1: T1, t2: T2): R; + } + + interface CurriedFunction3 { + (): CurriedFunction3; + (t1: T1): CurriedFunction2; + (t1: T1, t2: T2): CurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; + } + + interface CurriedFunction4 { + (): CurriedFunction4; + (t1: T1): CurriedFunction3; + (t1: T1, t2: T2): CurriedFunction2; + (t1: T1, t2: T2, t3: T3): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; + } + + interface CurriedFunction5 { + (): CurriedFunction5; + (t1: T1): CurriedFunction4; + (t1: T1, t2: T2): CurriedFunction3; + (t1: T1, t2: T2, t3: T3): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.curry + **/ + curry(arity?: number): LoDashImplicitObjectWrapper; + } + + //_.curryRight + interface LoDashStatic { + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1) => R): + CurriedFunction1; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2) => R): + CurriedFunction2; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3) => R): + CurriedFunction3; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): + CurriedFunction4; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): + CurriedFunction5; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + curryRight( + func: Function, + arity?: number): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.curryRight + **/ + curryRight(arity?: number): LoDashImplicitObjectWrapper; + } + + //_.debounce + interface DebounceSettings { + /** + * Specify invoking on the leading edge of the timeout. + */ + leading?: boolean; + + /** + * The maximum time func is allowed to be delayed before it’s invoked. + */ + maxWait?: number; + + /** + * Specify invoking on the trailing edge of the timeout. + */ + trailing?: boolean; + } + + interface LoDashStatic { + /** + * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since + * the last time the debounced function was invoked. The debounced function comes with a cancel method to + * cancel delayed invocations. Provide an options object to indicate that func should be invoked on the + * leading and/or trailing edge of the wait timeout. Subsequent calls to the debounced function return the + * result of the last func invocation. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only + * if the the debounced function is invoked more than once during the wait timeout. + * + * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. + * + * @param func The function to debounce. + * @param wait The number of milliseconds to delay. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new debounced function. + */ + debounce( + func: T, + wait?: number, + options?: DebounceSettings + ): T & Cancelable; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.debounce + */ + debounce( + wait?: number, + options?: DebounceSettings + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.debounce + */ + debounce( + wait?: number, + options?: DebounceSettings + ): LoDashExplicitObjectWrapper; + } + + //_.defer + interface LoDashStatic { + /** + * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to + * func when it’s invoked. + * + * @param func The function to defer. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + defer( + func: T, + ...args: any[] + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defer + */ + defer(...args: any[]): LoDashImplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.defer + */ + defer(...args: any[]): LoDashExplicitWrapper; + } + + //_.delay + interface LoDashStatic { + /** + * Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked. + * + * @param func The function to delay. + * @param wait The number of milliseconds to delay invocation. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + delay( + func: T, + wait: number, + ...args: any[] + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.delay + */ + delay( + wait: number, + ...args: any[] + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.delay + */ + delay( + wait: number, + ...args: any[] + ): LoDashExplicitWrapper; + } + + //_.flow + interface LoDashStatic { + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + flow(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flow + */ + flow(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flow + */ + flow(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.flowRight + interface LoDashStatic { + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @alias _.backflow, _.compose + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + flowRight(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + flowRight(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + flowRight(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + + //_.memoize + interface MemoizedFunction extends Function { + cache: MapCache; + } + + interface LoDashStatic { + /** + * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for + * storing the result based on the arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with + * the this binding of the memoized function. + * @param func The function to have its output memoized. + * @param resolver The function to resolve the cache key. + * @return Returns the new memoizing function. + */ + memoize: { + (func: T, resolver?: Function): T & MemoizedFunction; + Cache: MapCache; + } + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.memoize + */ + memoize(resolver?: Function): LoDashImplicitObjectWrapper; + } + + //_.modArgs + interface LoDashStatic { + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + modArgs( + func: T, + ...transforms: Function[] + ): TResult; + + /** + * @see _.modArgs + */ + modArgs( + func: T, + transforms: Function[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.modArgs + */ + modArgs(...transforms: Function[]): LoDashImplicitObjectWrapper; + + /** + * @see _.modArgs + */ + modArgs(transforms: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.modArgs + */ + modArgs(...transforms: Function[]): LoDashExplicitObjectWrapper; + + /** + * @see _.modArgs + */ + modArgs(transforms: Function[]): LoDashExplicitObjectWrapper; + } + + //_.negate + interface LoDashStatic { + /** + * Creates a function that negates the result of the predicate func. The func predicate is invoked with + * the this binding and arguments of the created function. + * + * @param predicate The predicate to negate. + * @return Returns the new function. + */ + negate(predicate: T): (...args: any[]) => boolean; + + /** + * @see _.negate + */ + negate(predicate: T): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.negate + */ + negate(): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + + /** + * @see _.negate + */ + negate(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper; + } + + //_.once + interface LoDashStatic { + /** + * Creates a function that is restricted to invoking func once. Repeat calls to the function return the value + * of the first call. The func is invoked with the this binding and arguments of the created function. + * + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + once(func: T): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.once + */ + once(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.once + */ + once(): LoDashExplicitObjectWrapper; + } + + //_.partial + interface LoDashStatic { + /** + * Creates a function that, when called, invokes func with any additional partial arguments + * prepended to those provided to the new function. This method is similar to _.bind except + * it does not alter the this binding. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + partial: Partial; + } + + type PH = LoDashStatic; + + interface Function0 { + (): R; + } + interface Function1 { + (t1: T1): R; + } + interface Function2 { + (t1: T1, t2: T2): R; + } + interface Function3 { + (t1: T1, t2: T2, t3: T3): R; + } + interface Function4 { + (t1: T1, t2: T2, t3: T3, t4: T4): R; + } + + interface Partial { + // arity 0 + (func: Function0): Function0; + // arity 1 + (func: Function1): Function1; + (func: Function1, arg1: T1): Function0; + // arity 2 + (func: Function2): Function2; + (func: Function2, arg1: T1): Function1< T2, R>; + (func: Function2, plc1: PH, arg2: T2): Function1; + (func: Function2, arg1: T1, arg2: T2): Function0< R>; + // arity 3 + (func: Function3): Function3; + (func: Function3, arg1: T1): Function2< T2, T3, R>; + (func: Function3, plc1: PH, arg2: T2): Function2; + (func: Function3, arg1: T1, arg2: T2): Function1< T3, R>; + (func: Function3, plc1: PH, plc2: PH, arg3: T3): Function2; + (func: Function3, arg1: T1, plc2: PH, arg3: T3): Function1< T2, R>; + (func: Function3, plc1: PH, arg2: T2, arg3: T3): Function1; + (func: Function3, arg1: T1, arg2: T2, arg3: T3): Function0< R>; + // arity 4 + (func: Function4): Function4; + (func: Function4, arg1: T1): Function3< T2, T3, T4, R>; + (func: Function4, plc1: PH, arg2: T2): Function3; + (func: Function4, arg1: T1, arg2: T2): Function2< T3, T4, R>; + (func: Function4, plc1: PH, plc2: PH, arg3: T3): Function3; + (func: Function4, arg1: T1, plc2: PH, arg3: T3): Function2< T2, T4, R>; + (func: Function4, plc1: PH, arg2: T2, arg3: T3): Function2; + (func: Function4, arg1: T1, arg2: T2, arg3: T3): Function1< T4, R>; + (func: Function4, plc1: PH, plc2: PH, plc3: PH, arg4: T4): Function3; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, arg4: T4): Function2< T2, T3, R>; + (func: Function4, plc1: PH, arg2: T2, plc3: PH, arg4: T4): Function2; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, arg4: T4): Function1< T3, R>; + (func: Function4, plc1: PH, plc2: PH, arg3: T3, arg4: T4): Function2; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, arg4: T4): Function1< T2, R>; + (func: Function4, plc1: PH, arg2: T2, arg3: T3, arg4: T4): Function1; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; + // catch-all + (func: Function, ...args: any[]): Function; + } + + //_.partialRight + interface LoDashStatic { + /** + * This method is like _.partial except that partial arguments are appended to those provided + * to the new function. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + partialRight: PartialRight + } + + interface PartialRight { + // arity 0 + (func: Function0): Function0; + // arity 1 + (func: Function1): Function1; + (func: Function1, arg1: T1): Function0; + // arity 2 + (func: Function2): Function2; + (func: Function2, arg1: T1, plc2: PH): Function1< T2, R>; + (func: Function2, arg2: T2): Function1; + (func: Function2, arg1: T1, arg2: T2): Function0< R>; + // arity 3 + (func: Function3): Function3; + (func: Function3, arg1: T1, plc2: PH, plc3: PH): Function2< T2, T3, R>; + (func: Function3, arg2: T2, plc3: PH): Function2; + (func: Function3, arg1: T1, arg2: T2, plc3: PH): Function1< T3, R>; + (func: Function3, arg3: T3): Function2; + (func: Function3, arg1: T1, plc2: PH, arg3: T3): Function1< T2, R>; + (func: Function3, arg2: T2, arg3: T3): Function1; + (func: Function3, arg1: T1, arg2: T2, arg3: T3): Function0< R>; + // arity 4 + (func: Function4): Function4; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, plc4: PH): Function3< T2, T3, T4, R>; + (func: Function4, arg2: T2, plc3: PH, plc4: PH): Function3; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, plc4: PH): Function2< T3, T4, R>; + (func: Function4, arg3: T3, plc4: PH): Function3; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, plc4: PH): Function2< T2, T4, R>; + (func: Function4, arg2: T2, arg3: T3, plc4: PH): Function2; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, plc4: PH): Function1< T4, R>; + (func: Function4, arg4: T4): Function3; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, arg4: T4): Function2< T2, T3, R>; + (func: Function4, arg2: T2, plc3: PH, arg4: T4): Function2; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, arg4: T4): Function1< T3, R>; + (func: Function4, arg3: T3, arg4: T4): Function2; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, arg4: T4): Function1< T2, R>; + (func: Function4, arg2: T2, arg3: T3, arg4: T4): Function1; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; + // catch-all + (func: Function, ...args: any[]): Function; + } + + //_.rearg + interface LoDashStatic { + /** + * Creates a function that invokes func with arguments arranged according to the specified indexes where the + * argument value at the first index is provided as the first argument, the argument value at the second index + * is provided as the second argument, and so on. + * @param func The function to rearrange arguments for. + * @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes. + * @return Returns the new function. + */ + rearg(func: Function, indexes: number[]): TResult; + + /** + * @see _.rearg + */ + rearg(func: Function, ...indexes: number[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rearg + */ + rearg(indexes: number[]): LoDashImplicitObjectWrapper; + + /** + * @see _.rearg + */ + rearg(...indexes: number[]): LoDashImplicitObjectWrapper; + } + + //_.restParam + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * + * Note: This method is based on the rest parameter. + * + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + restParam( + func: Function, + start?: number + ): TResult; + + /** + * @see _.restParam + */ + restParam( + func: TFunc, + start?: number + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.restParam + */ + restParam(start?: number): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.restParam + */ + restParam(start?: number): LoDashExplicitObjectWrapper; + } + + //_.spread + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * + * Note: This method is based on the spread operator. + * + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + spread(func: F): T; + + /** + * @see _.spread + */ + spread(func: Function): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.spread + */ + spread(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.spread + */ + spread(): LoDashExplicitObjectWrapper; + } + + //_.throttle + interface ThrottleSettings { + /** + * If you'd like to disable the leading-edge call, pass this as false. + */ + leading?: boolean; + + /** + * If you'd like to disable the execution on the trailing-edge, pass false. + */ + trailing?: boolean; + } + + interface LoDashStatic { + /** + * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled + * function comes with a cancel method to cancel delayed invocations. Provide an options object to indicate + * that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls to + * the throttled function return the result of the last func call. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if + * the the throttled function is invoked more than once during the wait timeout. + * + * @param func The function to throttle. + * @param wait The number of milliseconds to throttle invocations to. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new throttled function. + */ + throttle( + func: T, + wait?: number, + options?: ThrottleSettings + ): T & Cancelable; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashExplicitObjectWrapper; + } + + //_.wrap + interface LoDashStatic { + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + wrap( + value: V, + wrapper: W + ): R; + + /** + * @see _.wrap + */ + wrap( + value: V, + wrapper: Function + ): R; + + /** + * @see _.wrap + */ + wrap( + value: any, + wrapper: Function + ): R; + } + + interface LoDashImplicitWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + /******** + * Lang * + ********/ + + //_.clone + interface CloneCustomizer { + (value: TValue): TResult; + } + + interface LoDashStatic { + /** + * Creates a clone of value. If isDeep is true nested objects are cloned, otherwise they are assigned by + * reference. If customizer is provided it's invoked to produce the cloned values. If customizer returns + * undefined cloning is handled by the method instead. The customizer is bound to thisArg and invoked with + * up to three argument; (value [, index|key, object]). + * + * Note: This method is loosely based on the structured clone algorithm. The enumerable properties of + * arguments objects and objects created by constructors other than Object are cloned to plain Object + * objects. An empty object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, + * and WeakMaps. + * + * @param value The value to clone. + * @param isDeep Specify a deep clone. + * @param customizer The function to customize cloning values. + * @param thisArg The this binding of customizer. + * @return Returns the cloned value. + */ + clone( + value: any, + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + value: T, + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + + /** + * @see _.clone + */ + clone( + value: any, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + value: T, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + value: T, + isDeep?: boolean + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): T; + } + + interface LoDashExplicitWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): LoDashExplicitObjectWrapper; + } + + //_.cloneDeep + interface CloneDeepCustomizer { + (value: TValue): TResult; + } + + interface LoDashStatic { + /** + * Creates a deep clone of value. If customizer is provided it's invoked to produce the cloned values. + * If customizer returns undefined cloning is handled by the method instead. The customizer is bound to + * thisArg and invoked with up to three argument; (value [, index|key, object]). + * + * Note: This method is loosely based on the structured clone algorithm. The enumerable properties of + * arguments objects and objects created by constructors other than Object are cloned to plain Object objects. + * An empty object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, and WeakMaps. + * + * @param value The value to deep clone. + * @param customizer The function to customize cloning values. + * @param thisArg The this binding of customizer. + * @return Returns the deep cloned value. + */ + cloneDeep( + value: any, + customizer: CloneDeepCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.cloneDeep + */ + cloneDeep( + value: T, + customizer: CloneDeepCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.cloneDeep + */ + cloneDeep( + value: T + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.cloneDeep + */ + cloneDeep(): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.cloneDeep + */ + cloneDeep(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.cloneDeep + */ + cloneDeep(): T; + } + + interface LoDashExplicitWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + isDeep?: boolean + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + isDeep?: boolean + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + isDeep?: boolean + ): LoDashExplicitObjectWrapper; + } + + //_.eq + interface LoDashStatic { + /** + * @see _.isEqual + */ + eq( + value: any, + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEqual + */ + eq( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEqual + */ + eq( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + } + + //_.gt + interface LoDashStatic { + /** + * Checks if value is greater than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than other, else false. + */ + gt( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.gt + */ + gt(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.gt + */ + gt(other: any): LoDashExplicitWrapper; + } + + //_.gte + interface LoDashStatic { + /** + * Checks if value is greater than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than or equal to other, else false. + */ + gte( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.gte + */ + gte(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.gte + */ + gte(other: any): LoDashExplicitWrapper; + } + + //_.isArguments + interface LoDashStatic { + /** + * Checks if value is classified as an arguments object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isArguments(value?: any): value is IArguments; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArguments + */ + isArguments(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArguments + */ + isArguments(): LoDashExplicitWrapper; + } + + //_.isArray + interface LoDashStatic { + /** + * Checks if value is classified as an Array object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isArray(value?: any): value is T[]; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArray + */ + isArray(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArray + */ + isArray(): LoDashExplicitWrapper; + } + + //_.isBoolean + interface LoDashStatic { + /** + * Checks if value is classified as a boolean primitive or object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isBoolean(value?: any): value is boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): LoDashExplicitWrapper; + } + + //_.isDate + interface LoDashStatic { + /** + * Checks if value is classified as a Date object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isDate(value?: any): value is Date; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isDate + */ + isDate(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isDate + */ + isDate(): LoDashExplicitWrapper; + } + + //_.isElement + interface LoDashStatic { + /** + * Checks if value is a DOM element. + * + * @param value The value to check. + * @return Returns true if value is a DOM element, else false. + */ + isElement(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isElement + */ + isElement(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isElement + */ + isElement(): LoDashExplicitWrapper; + } + + //_.isEmpty + interface LoDashStatic { + /** + * Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string, or + * jQuery-like collection with a length greater than 0 or an object with own enumerable properties. + * + * @param value The value to inspect. + * @return Returns true if value is empty, else false. + */ + isEmpty(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEmpty + */ + isEmpty(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEmpty + */ + isEmpty(): LoDashExplicitWrapper; + } + + //_.isEqual + interface IsEqualCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * Performs a deep comparison between two values to determine if they are equivalent. If customizer is + * provided it’s invoked to compare values. If customizer returns undefined comparisons are handled by the + * method instead. The customizer is bound to thisArg and invoked with up to three arguments: (value, other + * [, index|key]). + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, + * and strings. Objects are compared by their own, not inherited, enumerable properties. Functions and DOM + * nodes are not supported. Provide a customizer function to extend support for comparing other values. + * + * @alias _.eq + * + * @param value The value to compare. + * @param other The other value to compare. + * @param customizer The function to customize value comparisons. + * @param thisArg The this binding of customizer. + * @return Returns true if the values are equivalent, else false. + */ + isEqual( + value: any, + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEqual + */ + isEqual( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEqual + */ + isEqual( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + } + + //_.isError + interface LoDashStatic { + /** + * Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError + * object. + * + * @param value The value to check. + * @return Returns true if value is an error object, else false. + */ + isError(value: any): value is Error; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isError + */ + isError(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isError + */ + isError(): LoDashExplicitWrapper; + } + + //_.isFinite + interface LoDashStatic { + /** + * Checks if value is a finite primitive number. + * + * Note: This method is based on Number.isFinite. + * + * @param value The value to check. + * @return Returns true if value is a finite number, else false. + */ + isFinite(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isFinite + */ + isFinite(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isFinite + */ + isFinite(): LoDashExplicitWrapper; + } + + //_.isFunction + interface LoDashStatic { + /** + * Checks if value is classified as a Function object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isFunction(value?: any): value is Function; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isFunction + */ + isFunction(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isFunction + */ + isFunction(): LoDashExplicitWrapper; + } + + //_.isMatch + interface isMatchCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * Performs a deep comparison between object and source to determine if object contains equivalent property + * values. If customizer is provided it’s invoked to compare values. If customizer returns undefined + * comparisons are handled by the method instead. The customizer is bound to thisArg and invoked with three + * arguments: (value, other, index|key). + * @param object The object to inspect. + * @param source The object of property values to match. + * @param customizer The function to customize value comparisons. + * @param thisArg The this binding of customizer. + * @return Returns true if object is a match, else false. + */ + isMatch(object: Object, source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.isMatch + */ + isMatch(source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + } + + //_.isNaN + interface LoDashStatic { + /** + * Checks if value is NaN. + * + * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values. + * + * @param value The value to check. + * @return Returns true if value is NaN, else false. + */ + isNaN(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isNaN + */ + isNaN(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isNaN + */ + isNaN(): LoDashExplicitWrapper; + } + + //_.isNative + interface LoDashStatic { + /** + * Checks if value is a native function. + * @param value The value to check. + * + * @retrun Returns true if value is a native function, else false. + */ + isNative(value: any): value is Function; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNative + */ + isNative(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNative + */ + isNative(): LoDashExplicitWrapper; + } + + //_.isNull + interface LoDashStatic { + /** + * Checks if value is null. + * + * @param value The value to check. + * @return Returns true if value is null, else false. + */ + isNull(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNull + */ + isNull(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNull + */ + isNull(): LoDashExplicitWrapper; + } + + //_.isNumber + interface LoDashStatic { + /** + * Checks if value is classified as a Number primitive or object. + * + * Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the _.isFinite method. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isNumber(value?: any): value is number; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNumber + */ + isNumber(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNumber + */ + isNumber(): LoDashExplicitWrapper; + } + + //_.isObject + interface LoDashStatic { + /** + * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), + * and new String('')) + * + * @param value The value to check. + * @return Returns true if value is an object, else false. + */ + isObject(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isObject + */ + isObject(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isObject + */ + isObject(): LoDashExplicitWrapper; + } + + //_.isPlainObject + interface LoDashStatic { + /** + * Checks if value is a plain object, that is, an object created by the Object constructor or one with a + * [[Prototype]] of null. + * + * Note: This method assumes objects created by the Object constructor have no inherited enumerable properties. + * + * @param value The value to check. + * @return Returns true if value is a plain object, else false. + */ + isPlainObject(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isPlainObject + */ + isPlainObject(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isPlainObject + */ + isPlainObject(): LoDashExplicitWrapper; + } + + //_.isRegExp + interface LoDashStatic { + /** + * Checks if value is classified as a RegExp object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isRegExp(value?: any): value is RegExp; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isRegExp + */ + isRegExp(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isRegExp + */ + isRegExp(): LoDashExplicitWrapper; + } + + //_.isString + interface LoDashStatic { + /** + * Checks if value is classified as a String primitive or object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isString(value?: any): value is string; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isString + */ + isString(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isString + */ + isString(): LoDashExplicitWrapper; + } + + //_.isTypedArray + interface LoDashStatic { + /** + * Checks if value is classified as a typed array. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isTypedArray(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isTypedArray + */ + isTypedArray(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isTypedArray + */ + isTypedArray(): LoDashExplicitWrapper; + } + + //_.isUndefined + interface LoDashStatic { + /** + * Checks if value is undefined. + * + * @param value The value to check. + * @return Returns true if value is undefined, else false. + */ + isUndefined(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isUndefined + */ + isUndefined(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isUndefined + */ + isUndefined(): LoDashExplicitWrapper; + } + + //_.lt + interface LoDashStatic { + /** + * Checks if value is less than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than other, else false. + */ + lt( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.lt + */ + lt(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.lt + */ + lt(other: any): LoDashExplicitWrapper; + } + + //_.lte + interface LoDashStatic { + /** + * Checks if value is less than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than or equal to other, else false. + */ + lte( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.lte + */ + lte(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.lte + */ + lte(other: any): LoDashExplicitWrapper; + } + + //_.toArray + interface LoDashStatic { + /** + * Converts value to an array. + * + * @param value The value to convert. + * @return Returns the converted array. + */ + toArray(value: List|Dictionary|NumericDictionary): T[]; + + /** + * @see _.toArray + */ + toArray(value: TValue): TResult[]; + + /** + * @see _.toArray + */ + toArray(value?: any): TResult[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + //_.toPlainObject + interface LoDashStatic { + /** + * Converts value to a plain object flattening inherited enumerable properties of value to own properties + * of the plain object. + * + * @param value The value to convert. + * @return Returns the converted plain object. + */ + toPlainObject(value?: any): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toPlainObject + */ + toPlainObject(): LoDashImplicitObjectWrapper; + } + + /******** + * Math * + ********/ + + //_.add + interface LoDashStatic { + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + add( + augend: number, + addend: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.add + */ + add(addend: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.add + */ + add(addend: number): LoDashExplicitWrapper; + } + + //_.ceil + interface LoDashStatic { + /** + * Calculates n rounded up to precision. + * + * @param n The number to round up. + * @param precision The precision to round up to. + * @return Returns the rounded up number. + */ + ceil( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.ceil + */ + ceil(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.ceil + */ + ceil(precision?: number): LoDashExplicitWrapper; + } + + //_.floor + interface LoDashStatic { + /** + * Calculates n rounded down to precision. + * + * @param n The number to round down. + * @param precision The precision to round down to. + * @return Returns the rounded down number. + */ + floor( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.floor + */ + floor(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.floor + */ + floor(precision?: number): LoDashExplicitWrapper; + } + + //_.max + interface LoDashStatic { + /** + * Gets the maximum value of collection. If collection is empty or falsey -Infinity is returned. If an iteratee + * function is provided it’s invoked for each value in collection to generate the criterion by which the value + * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the maximum value. + */ + max( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.max + */ + max( + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.max + */ + max( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + whereValue?: TObject + ): T; + } + + //_.min + interface LoDashStatic { + /** + * Gets the minimum value of collection. If collection is empty or falsey Infinity is returned. If an iteratee + * function is provided it’s invoked for each value in collection to generate the criterion by which the value + * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the minimum value. + */ + min( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.min + */ + min( + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.min + */ + min( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + whereValue?: TObject + ): T; + } + + //_.round + interface LoDashStatic { + /** + * Calculates n rounded to precision. + * + * @param n The number to round. + * @param precision The precision to round to. + * @return Returns the rounded number. + */ + round( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.round + */ + round(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.round + */ + round(precision?: number): LoDashExplicitWrapper; + } + + //_.sum + interface LoDashStatic { + /** + * Gets the sum of the values in collection. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the sum. + */ + sum( + collection: List, + iteratee: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + **/ + sum( + collection: Dictionary, + iteratee: DictionaryIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum( + collection: List|Dictionary, + iteratee: string + ): number; + + /** + * @see _.sum + */ + sum(collection: List|Dictionary): number; + + /** + * @see _.sum + */ + sum(collection: List|Dictionary): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum(iteratee: string): number; + + /** + * @see _.sum + */ + sum(): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sum + **/ + sum( + iteratee: ListIterator|DictionaryIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum(iteratee: string): number; + + /** + * @see _.sum + */ + sum(): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(): LoDashExplicitWrapper; + } + + /********** + * Number * + **********/ + + //_.inRange + interface LoDashStatic { + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + inRange( + n: number, + start: number, + end: number + ): boolean; + + + /** + * @see _.inRange + */ + inRange( + n: number, + end: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.inRange + */ + inRange( + start: number, + end: number + ): boolean; + + /** + * @see _.inRange + */ + inRange(end: number): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.inRange + */ + inRange( + start: number, + end: number + ): LoDashExplicitWrapper; + + /** + * @see _.inRange + */ + inRange(end: number): LoDashExplicitWrapper; + } + + //_.random + interface LoDashStatic { + /** + * Produces a random number between min and max (inclusive). If only one argument is provided a number between + * 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point + * number is returned instead of an integer. + * + * @param min The minimum possible value. + * @param max The maximum possible value. + * @param floating Specify returning a floating-point number. + * @return Returns the random number. + */ + random( + min?: number, + max?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random( + min?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random(floating?: boolean): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.random + */ + random( + max?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random(floating?: boolean): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.random + */ + random( + max?: number, + floating?: boolean + ): LoDashExplicitWrapper; + + /** + * @see _.random + */ + random(floating?: boolean): LoDashExplicitWrapper; + } + + /********** + * Object * + **********/ + + //_.assign + interface AssignCustomizer { + (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; + } + + interface LoDashStatic { + /** + * Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources + * overwrite property assignments of previous sources. If customizer is provided it’s invoked to produce the + * assigned values. The customizer is bound to thisArg and invoked with five arguments: + * (objectValue, sourceValue, key, object, source). + * + * Note: This method mutates object and is based on Object.assign. + * + * @alias _.extend + * + * @param object The destination object. + * @param source The source objects. + * @param customizer The function to customize assigned values. + * @param thisArg The this binding of callback. + * @return The destination object. + */ + assign( + object: TObject, + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.assign + */ + assign(object: TObject): TObject; + + /** + * @see _.assign + */ + assign( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assign + */ + assign( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assign + */ + assign( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + //_.create + interface LoDashStatic { + /** + * Creates an object that inherits from the given prototype object. If a properties object is provided its own + * enumerable properties are assigned to the created object. + * + * @param prototype The object to inherit from. + * @param properties The properties to assign to the object. + * @return Returns the new object. + */ + create( + prototype: T, + properties?: U + ): T & U; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.create + */ + create(properties?: U): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.create + */ + create(properties?: U): LoDashExplicitObjectWrapper; + } + + //_.defaults + interface LoDashStatic { + /** + * Assigns own enumerable properties of source object(s) to the destination object for all destination + * properties that resolve to undefined. Once a property is set, additional values of the same property are + * ignored. + * + * Note: This method mutates object. + * + * @param object The destination object. + * @param sources The source objects. + * @return The destination object. + */ + defaults( + object: Obj, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: {}, + ...sources: {}[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashExplicitObjectWrapper; + } + + //_.defaultsDeep + interface LoDashStatic { + /** + * This method is like _.defaults except that it recursively assigns default properties. + * @param object The destination object. + * @param sources The source objects. + * @return Returns object. + **/ + defaultsDeep( + object: T, + ...sources: any[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defaultsDeep + **/ + defaultsDeep(...sources: any[]): LoDashImplicitObjectWrapper + } + + //_.extend + interface LoDashStatic { + /** + * @see assign + */ + extend( + object: TObject, + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.assign + */ + extend(object: TObject): TObject; + + /** + * @see _.assign + */ + extend( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assign + */ + extend( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assign + */ + extend( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + //_.findKey + interface LoDashStatic { + /** + * This method is like _.find except that it returns the key of the first element predicate returns truthy for + * instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + findKey( + object: TObject, + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + object: TObject, + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + object: TObject, + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey, TObject>( + object: TObject, + predicate?: TWhere + ): string; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findKey + */ + findKey( + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey>( + predicate?: TWhere + ): string; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findKey + */ + findKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + + //_.findLastKey + interface LoDashStatic { + /** + * This method is like _.findKey except that it iterates over elements of a collection in the opposite order. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + findLastKey( + object: TObject, + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + object: TObject, + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + object: TObject, + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey, TObject>( + object: TObject, + predicate?: TWhere + ): string; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey>( + predicate?: TWhere + ): string; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + + //_.forIn + interface LoDashStatic { + /** + * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The + * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may + * exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forIn( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forIn + */ + forIn( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forIn + */ + forIn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forIn + */ + forIn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forInRight + interface LoDashStatic { + /** + * This method is like _.forIn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forInRight( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forInRight + */ + forInRight( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forOwn + interface LoDashStatic { + /** + * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is + * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forOwn( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forOwn + */ + forOwn( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forOwn + */ + forOwn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forOwn + */ + forOwn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forOwnRight + interface LoDashStatic { + /** + * This method is like _.forOwn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forOwnRight( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forOwnRight + */ + forOwnRight( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forOwnRight + */ + forOwnRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forOwnRight + */ + forOwnRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.functions + interface LoDashStatic { + /** + * Creates an array of function property names from all enumerable properties, own and inherited, of object. + * + * @alias _.methods + * + * @param object The object to inspect. + * @return Returns the new array of property names. + */ + functions(object: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.functions + */ + functions(): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.functions + */ + functions(): _.LoDashExplicitArrayWrapper; + } + + //_.get + interface LoDashStatic { + /** + * Gets the property value at path of object. If the resolved + * value is undefined the defaultValue is used in its place. + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + **/ + get(object: Object, + path: string|number|boolean|Array, + defaultValue?:TResult + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.get + **/ + get(path: string|number|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + //_.has + interface LoDashStatic { + /** + * Checks if path is a direct property. + * + * @param object The object to query. + * @param path The path to check. + * @return Returns true if path is a direct property, else false. + */ + has( + object: T, + path: StringRepresentable|StringRepresentable[] + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.has + */ + has(path: StringRepresentable|StringRepresentable[]): boolean; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.has + */ + has(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper; + } + + //_.invert + interface LoDashStatic { + /** + * Creates an object composed of the inverted keys and values of object. If object contains duplicate values, + * subsequent values overwrite property assignments of previous values unless multiValue is true. + * + * @param object The object to invert. + * @param multiValue Allow multiple values per key. + * @return Returns the new inverted object. + */ + invert( + object: T, + multiValue?: boolean + ): TResult; + + /** + * @see _.invert + */ + invert( + object: Object, + multiValue?: boolean + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.invert + */ + invert(multiValue?: boolean): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.invert + */ + invert(multiValue?: boolean): LoDashExplicitObjectWrapper; + } + + //_.keys + interface LoDashStatic { + /** + * Creates an array of the own enumerable property names of object. + * + * Note: Non-object values are coerced to objects. See the ES spec for more details. + * + * @param object The object to query. + * @return Returns the array of property names. + */ + keys(object?: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.keys + */ + keys(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.keys + */ + keys(): LoDashExplicitArrayWrapper; + } + + //_.keysIn + interface LoDashStatic { + /** + * Creates an array of the own and inherited enumerable property names of object. + * + * Note: Non-object values are coerced to objects. + * + * @param object The object to query. + * @return An array of property names. + */ + keysIn(object?: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.keysIn + */ + keysIn(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.keysIn + */ + keysIn(): LoDashExplicitArrayWrapper; + } + + //_.mapKeys + interface LoDashStatic { + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + mapKeys( + object: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: List|Dictionary, + iteratee?: TObject + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: List|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + //_.mapValues + interface LoDashStatic { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Object} [thisArg] The `this` binding of `iteratee`. + * @return {Object} Returns the new mapped object. + */ + mapValues(obj: Dictionary, callback: ObjectIterator, thisArg?: any): Dictionary; + mapValues(obj: Dictionary, where: Dictionary): Dictionary; + mapValues(obj: T, pluck: string): TMapped; + mapValues(obj: T, callback: ObjectIterator, thisArg?: any): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mapValues + * TValue is the type of the property values of T. + * TResult is the type output by the ObjectIterator function + */ + mapValues(callback: ObjectIterator, thisArg?: any): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the property specified by pluck. + * T should be a Dictionary> + */ + mapValues(pluck: string): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the properties on the object specified by pluck. + * T should be a Dictionary>> + */ + mapValues(pluck: string, where: Dictionary): LoDashImplicitArrayWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the properties of each object in the values of T + * T should be a Dictionary> + */ + mapValues(where: Dictionary): LoDashImplicitArrayWrapper; + } + + //_.merge + interface MergeCustomizer { + (value: any, srcValue: any, key?: string, object?: Object, source?: Object): any; + } + + interface LoDashStatic { + /** + * Recursively merges own enumerable properties of the source object(s), that don’t resolve to undefined into + * the destination object. Subsequent sources overwrite property assignments of previous sources. If customizer + * is provided it’s invoked to produce the merged values of the destination and source properties. If + * customizer returns undefined merging is handled by the method instead. The customizer is bound to thisArg + * and invoked with five arguments: (objectValue, sourceValue, key, object, source). + * + * @param object The destination object. + * @param source The source objects. + * @param customizer The function to customize assigned values. + * @param thisArg The this binding of customizer. + * @return Returns object. + */ + merge( + object: TObject, + source: TSource, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2 & TSource3; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2 & TSource3 & TSource4; + + /** + * @see _.merge + */ + merge( + object: any, + ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.merge + */ + merge( + source: TSource, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + ...otherArgs: any[] + ): LoDashImplicitObjectWrapper; + } + + //_.methods + interface LoDashStatic { + /** + * @see _.functions + */ + methods(object: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.functions + */ + methods(): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.functions + */ + methods(): _.LoDashExplicitArrayWrapper; + } + + //_.omit + interface LoDashStatic { + /** + * The opposite of _.pick; this method creates an object composed of the own and inherited enumerable + * properties of object that are not omitted. + * + * @param object The source object. + * @param predicate The function invoked per iteration or property names to omit, specified as individual + * property names or arrays of property names. + * @param thisArg The this binding of predicate. + * @return Returns the new object. + */ + omit( + object: T, + predicate: ObjectIterator, + thisArg?: any + ): TResult; + + /** + * @see _.omit + */ + omit( + object: T, + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; + } + + //_.pairs + interface LoDashStatic { + /** + * Creates a two dimensional array of the key-value pairs for object, e.g. [[key1, value1], [key2, value2]]. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + pairs(object?: T): any[][]; + + pairs(object?: T): TResult[][]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pairs + */ + pairs(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pairs + */ + pairs(): LoDashExplicitArrayWrapper; + } + + //_.pick + interface LoDashStatic { + /** + * Creates an object composed of the picked object properties. Property names may be specified as individual + * arguments or as arrays of property names. If predicate is provided it’s invoked for each property of object + * picking the properties predicate returns truthy for. The predicate is bound to thisArg and invoked with + * three arguments: (value, key, object). + * + * @param object The source object. + * @param predicate The function invoked per iteration or property names to pick, specified as individual + * property names or arrays of property names. + * @param thisArg The this binding of predicate. + * @return Returns the new object. + */ + pick( + object: T, + predicate: ObjectIterator, + thisArg?: any + ): TResult; + + /** + * @see _.pick + */ + pick( + object: T, + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pick + */ + pick( + predicate: ObjectIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.pick + */ + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pick + */ + pick( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.pick + */ + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; + } + + //_.result + interface LoDashStatic { + /** + * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding + * of its parent object and its result is returned. + * + * @param object The object to query. + * @param path The path of the property to resolve. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + result( + object: TObject, + path: number|string|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.result + */ + result( + path: number|string|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + //_.set + interface LoDashStatic { + /** + * Sets the property value of path on object. If a portion of path does not exist it’s created. + * + * @param object The object to augment. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + set( + object: Object, + path: StringRepresentable|StringRepresentable[], + value: any + ): TResult; + + /** + * @see _.set + */ + set( + object: Object, + path: StringRepresentable|StringRepresentable[], + value: V + ): TResult; + + /** + * @see _.set + */ + set( + object: O, + path: StringRepresentable|StringRepresentable[], + value: V + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: V + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: V + ): LoDashExplicitObjectWrapper; + } + + //_.transform + interface LoDashStatic { + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + transform( + object: T[], + iteratee?: MemoVoidArrayIterator, + accumulator?: TResult[], + thisArg?: any + ): TResult[]; + + /** + * @see _.transform + */ + transform( + object: T[], + iteratee?: MemoVoidArrayIterator>, + accumulator?: Dictionary, + thisArg?: any + ): Dictionary; + + /** + * @see _.transform + */ + transform( + object: Dictionary, + iteratee?: MemoVoidDictionaryIterator>, + accumulator?: Dictionary, + thisArg?: any + ): Dictionary; + + /** + * @see _.transform + */ + transform( + object: Dictionary, + iteratee?: MemoVoidDictionaryIterator, + accumulator?: TResult[], + thisArg?: any + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidArrayIterator, + accumulator?: TResult[], + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidArrayIterator>, + accumulator?: Dictionary, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidDictionaryIterator>, + accumulator?: Dictionary, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidDictionaryIterator, + accumulator?: TResult[], + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + //_.values + interface LoDashStatic { + /** + * Creates an array of the own enumerable property values of object. + * + * @param object The object to query. + * @return Returns an array of property values. + */ + values(object?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.values + */ + values(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.values + */ + values(): LoDashExplicitArrayWrapper; + } + + //_.valuesIn + interface LoDashStatic { + /** + * Creates an array of the own and inherited enumerable property values of object. + * + * @param object The object to query. + * @return Returns the array of property values. + */ + valuesIn(object?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.valuesIn + */ + valuesIn(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.valuesIn + */ + valuesIn(): LoDashExplicitArrayWrapper; + } + + /********** + * String * + **********/ + + //_.camelCase + interface LoDashStatic { + /** + * Converts string to camel case. + * + * @param string The string to convert. + * @return Returns the camel cased string. + */ + camelCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.camelCase + */ + camelCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.camelCase + */ + camelCase(): LoDashExplicitWrapper; + } + + //_.capitalize + interface LoDashStatic { + capitalize(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.capitalize + */ + capitalize(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.capitalize + */ + capitalize(): LoDashExplicitWrapper; + } + + //_.deburr + interface LoDashStatic { + /** + * Deburrs string by converting latin-1 supplementary letters to basic latin letters and removing combining + * diacritical marks. + * + * @param string The string to deburr. + * @return Returns the deburred string. + */ + deburr(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.deburr + */ + deburr(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.deburr + */ + deburr(): LoDashExplicitWrapper; + } + + //_.endsWith + interface LoDashStatic { + /** + * Checks if string ends with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string ends with target, else false. + */ + endsWith( + string?: string, + target?: string, + position?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.endsWith + */ + endsWith( + target?: string, + position?: number + ): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.endsWith + */ + endsWith( + target?: string, + position?: number + ): LoDashExplicitWrapper; + } + + // _.escape + interface LoDashStatic { + /** + * Converts the characters "&", "<", ">", '"', "'", and "`", in string to their corresponding HTML entities. + * + * Note: No other characters are escaped. To escape additional characters use a third-party library like he. + * + * Though the ">" character is escaped for symmetry, characters like ">" and "/" don’t need escaping in HTML + * and have no special meaning unless they're part of a tag or unquoted attribute value. See Mathias Bynens’s + * article (under "semi-related fun fact") for more details. + * + * Backticks are escaped because in Internet Explorer < 9, they can break out of attribute values or HTML + * comments. See #59, #102, #108, and #133 of the HTML5 Security Cheatsheet for more details. + * + * When working with HTML you should always quote attribute values to reduce XSS vectors. + * + * @param string The string to escape. + * @return Returns the escaped string. + */ + escape(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.escape + */ + escape(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.escape + */ + escape(): LoDashExplicitWrapper; + } + + // _.escapeRegExp + interface LoDashStatic { + /** + * Escapes the RegExp special characters "\", "/", "^", "$", ".", "|", "?", "*", "+", "(", ")", "[", "]", + * "{" and "}" in string. + * + * @param string The string to escape. + * @return Returns the escaped string. + */ + escapeRegExp(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.escapeRegExp + */ + escapeRegExp(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.escapeRegExp + */ + escapeRegExp(): LoDashExplicitWrapper; + } + + //_.kebabCase + interface LoDashStatic { + /** + * Converts string to kebab case. + * + * @param string The string to convert. + * @return Returns the kebab cased string. + */ + kebabCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.kebabCase + */ + kebabCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.kebabCase + */ + kebabCase(): LoDashExplicitWrapper; + } + + //_.pad + interface LoDashStatic { + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + pad( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.pad + */ + pad( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.pad + */ + pad( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.padLeft + interface LoDashStatic { + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + padLeft( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.padLeft + */ + padLeft( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.padLeft + */ + padLeft( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.padRight + interface LoDashStatic { + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + padRight( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.padRight + */ + padRight( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.padRight + */ + padRight( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.parseInt + interface LoDashStatic { + /** + * Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used + * unless value is a hexadecimal, in which case a radix of 16 is used. + * + * Note: This method aligns with the ES5 implementation of parseInt. + * + * @param string The string to convert. + * @param radix The radix to interpret value by. + * @return Returns the converted integer. + */ + parseInt( + string: string, + radix?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.parseInt + */ + parseInt(radix?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.parseInt + */ + parseInt(radix?: number): LoDashExplicitWrapper; + } + + //_.repeat + interface LoDashStatic { + /** + * Repeats the given string n times. + * + * @param string The string to repeat. + * @param n The number of times to repeat the string. + * @return Returns the repeated string. + */ + repeat( + string?: string, + n?: number + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.repeat + */ + repeat(n?: number): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.repeat + */ + repeat(n?: number): LoDashExplicitWrapper; + } + + //_.snakeCase + interface LoDashStatic { + /** + * Converts string to snake case. + * + * @param string The string to convert. + * @return Returns the snake cased string. + */ + snakeCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.snakeCase + */ + snakeCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.snakeCase + */ + snakeCase(): LoDashExplicitWrapper; + } + + //_.startCase + interface LoDashStatic { + /** + * Converts string to start case. + * + * @param string The string to convert. + * @return Returns the start cased string. + */ + startCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.startCase + */ + startCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.startCase + */ + startCase(): LoDashExplicitWrapper; + } + + //_.startsWith + interface LoDashStatic { + /** + * Checks if string starts with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string starts with target, else false. + */ + startsWith( + string?: string, + target?: string, + position?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.startsWith + */ + startsWith( + target?: string, + position?: number + ): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.startsWith + */ + startsWith( + target?: string, + position?: number + ): LoDashExplicitWrapper; + } + + //_.template + interface TemplateOptions extends TemplateSettings { + /** + * The sourceURL of the template's compiled source. + */ + sourceURL?: string; + } + + interface TemplateExecutor { + (data?: Object): string; + source: string; + } + + interface LoDashStatic { + /** + * Creates a compiled template function that can interpolate data properties in "interpolate" delimiters, + * HTML-escape interpolated data properties in "escape" delimiters, and execute JavaScript in "evaluate" + * delimiters. Data properties may be accessed as free variables in the template. If a setting object is + * provided it takes precedence over _.templateSettings values. + * + * Note: In the development build _.template utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier + * debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @param string The template string. + * @param options The options object. + * @param options.escape The HTML "escape" delimiter. + * @param options.evaluate The "evaluate" delimiter. + * @param options.imports An object to import into the template as free variables. + * @param options.interpolate The "interpolate" delimiter. + * @param options.sourceURL The sourceURL of the template's compiled source. + * @param options.variable The data object variable name. + * @return Returns the compiled template function. + */ + template( + string: string, + options?: TemplateOptions + ): TemplateExecutor; + } + + interface LoDashImplicitWrapper { + /** + * @see _.template + */ + template(options?: TemplateOptions): TemplateExecutor; + } + + interface LoDashExplicitWrapper { + /** + * @see _.template + */ + template(options?: TemplateOptions): LoDashExplicitObjectWrapper; + } + + //_.trim + interface LoDashStatic { + /** + * Removes leading and trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trim( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trim + */ + trim(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trim + */ + trim(chars?: string): LoDashExplicitWrapper; + } + + //_.trimLeft + interface LoDashStatic { + /** + * Removes leading whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trimLeft( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trimLeft + */ + trimLeft(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trimLeft + */ + trimLeft(chars?: string): LoDashExplicitWrapper; + } + + //_.trimRight + interface LoDashStatic { + /** + * Removes trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trimRight( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trimRight + */ + trimRight(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trimRight + */ + trimRight(chars?: string): LoDashExplicitWrapper; + } + + //_.trunc + interface TruncOptions { + /** The maximum string length. */ + length?: number; + /** The string to indicate text is omitted. */ + omission?: string; + /** The separator pattern to truncate to. */ + separator?: string|RegExp; + } + + interface LoDashStatic { + /** + * Truncates string if it’s longer than the given maximum string length. The last characters of the truncated + * string are replaced with the omission string which defaults to "…". + * + * @param string The string to truncate. + * @param options The options object or maximum string length. + * @return Returns the truncated string. + */ + trunc( + string?: string, + options?: TruncOptions|number + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trunc + */ + trunc(options?: TruncOptions|number): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trunc + */ + trunc(options?: TruncOptions|number): LoDashExplicitWrapper; + } + + //_.unescape + interface LoDashStatic { + /** + * The inverse of _.escape; this method converts the HTML entities &, <, >, ", ', and ` + * in string to their corresponding characters. + * + * @param string The string to unescape. + * @return Returns the unescaped string. + */ + unescape(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.unescape + */ + unescape(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.unescape + */ + unescape(): LoDashExplicitWrapper; + } + + //_.words + interface LoDashStatic { + /** + * Splits string into an array of its words. + * + * @param string The string to inspect. + * @param pattern The pattern to match words. + * @return Returns the words of string. + */ + words( + string?: string, + pattern?: string|RegExp + ): string[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.words + */ + words(pattern?: string|RegExp): string[]; + } + + interface LoDashExplicitWrapper { + /** + * @see _.words + */ + words(pattern?: string|RegExp): LoDashExplicitArrayWrapper; + } + + /*********** + * Utility * + ***********/ + + //_.attempt + interface LoDashStatic { + /** + * Attempts to invoke func, returning either the result or the caught error object. Any additional arguments + * are provided to func when it’s invoked. + * + * @param func The function to attempt. + * @return Returns the func result or error object. + */ + attempt(func: (...args: any[]) => TResult, ...args: any[]): TResult|Error; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.attempt + */ + attempt(...args: any[]): TResult|Error; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.attempt + */ + attempt(...args: any[]): LoDashExplicitObjectWrapper; + } + + //_.callback + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of thisArg and arguments of the created function. + * If func is a property name the created callback returns the property value for a given element. If func is + * an object the created callback returns true for elements that contain the equivalent object properties, + * otherwise it returns false. + * + * @param func The value to convert to a callback. + * @param thisArg The this binding of func. + * @result Returns the callback. + */ + callback( + func: Function, + thisArg?: any + ): (...args: any[]) => TResult; + + /** + * @see _.callback + */ + callback( + func: string, + thisArg?: any + ): (object: any) => TResult; + + /** + * @see _.callback + */ + callback( + func: Object, + thisArg?: any + ): (object: any) => boolean; + + /** + * @see _.callback + */ + callback(): (value: TResult) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + } + + //_.constant + interface LoDashStatic { + /** + * Creates a function that returns value. + * + * @param value The value to return from the new function. + * @return Returns the new function. + */ + constant(value: T): () => T; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.constant + */ + constant(): LoDashImplicitObjectWrapper<() => TResult>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.constant + */ + constant(): LoDashExplicitObjectWrapper<() => TResult>; + } + + //_.identity + interface LoDashStatic { + /** + * This method returns the first argument provided to it. + * @param value Any value. + * @return Returns value. + */ + identity(value?: T): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.identity + */ + identity(): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.identity + */ + identity(): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.identity + */ + identity(): T; + } + + //_.iteratee + interface LoDashStatic { + /** + * @see _.callback + */ + iteratee( + func: Function, + thisArg?: any + ): (...args: any[]) => TResult; + + /** + * @see _.callback + */ + iteratee( + func: string, + thisArg?: any + ): (object: any) => TResult; + + /** + * @see _.callback + */ + iteratee( + func: Object, + thisArg?: any + ): (object: any) => boolean; + + /** + * @see _.callback + */ + iteratee(): (value: TResult) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + } + + //_.matches + interface LoDashStatic { + /** + * Creates a function that performs a deep comparison between a given object and source, returning true if the + * given object has equivalent property values, else false. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. For comparing a single own + * or inherited property value see _.matchesProperty. + * + * @param source The object of property values to match. + * @return Returns the new function. + */ + matches(source: T): (value: any) => boolean; + + /** + * @see _.matches + */ + matches(source: T): (value: V) => boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.matches + */ + matches(): LoDashImplicitObjectWrapper<(value: V) => boolean>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.matches + */ + matches(): LoDashExplicitObjectWrapper<(value: V) => boolean>; + } + + //_.matchesProperty + interface LoDashStatic { + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + matchesProperty( + path: StringRepresentable|StringRepresentable[], + srcValue: T + ): (value: any) => boolean; + + /** + * @see _.matchesProperty + */ + matchesProperty( + path: StringRepresentable|StringRepresentable[], + srcValue: T + ): (value: V) => boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashImplicitObjectWrapper<(value: any) => boolean>; + + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashImplicitObjectWrapper<(value: Value) => boolean>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashExplicitObjectWrapper<(value: any) => boolean>; + + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashExplicitObjectWrapper<(value: Value) => boolean>; + } + + //_.method + interface LoDashStatic { + /** + * Creates a function that invokes the method at path on a given object. Any additional arguments are provided + * to the invoked method. + * + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + * @return Returns the new function. + */ + method( + path: string|StringRepresentable[], + ...args: any[] + ): (object: TObject) => TResult; + + /** + * @see _.method + */ + method( + path: string|StringRepresentable[], + ...args: any[] + ): (object: any) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + //_.methodOf + interface LoDashStatic { + /** + * The opposite of _.method; this method creates a function that invokes the method at a given path on object. + * Any additional arguments are provided to the invoked method. + * + * @param object The object to query. + * @param args The arguments to invoke the method with. + * @return Returns the new function. + */ + methodOf( + object: TObject, + ...args: any[] + ): (path: StringRepresentable|StringRepresentable[]) => TResult; + + /** + * @see _.methodOf + */ + methodOf( + object: {}, + ...args: any[] + ): (path: StringRepresentable|StringRepresentable[]) => TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.methodOf + */ + methodOf( + ...args: any[] + ): LoDashImplicitObjectWrapper<(path: StringRepresentable|StringRepresentable[]) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.methodOf + */ + methodOf( + ...args: any[] + ): LoDashExplicitObjectWrapper<(path: StringRepresentable|StringRepresentable[]) => TResult>; + } + + //_.mixin + interface MixinOptions { + chain?: boolean; + } + + interface LoDashStatic { + /** + * Adds all own enumerable function properties of a source object to the destination object. If object is a + * function then methods are added to its prototype as well. + * + * Note: Use _.runInContext to create a pristine lodash function to avoid conflicts caused by modifying + * the original. + * + * @param object The destination object. + * @param source The object of functions to add. + * @param options The options object. + * @param options.chain Specify whether the functions added are chainable. + * @return Returns object. + */ + mixin( + object: TObject, + source: Dictionary, + options?: MixinOptions + ): TResult; + + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashExplicitObjectWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashExplicitObjectWrapper; + } + + //_.noConflict + interface LoDashStatic { + /** + * Reverts the _ variable to its previous value and returns a reference to the lodash function. + * + * @return Returns the lodash function. + */ + noConflict(): typeof _; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.noConflict + */ + noConflict(): typeof _; + } + + //_.noop + interface LoDashStatic { + /** + * A no-operation function that returns undefined regardless of the arguments it receives. + * + * @return undefined + */ + noop(...args: any[]): void; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.noop + */ + noop(...args: any[]): void; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.noop + */ + noop(...args: any[]): _.LoDashExplicitWrapper; + } + + //_.property + interface LoDashStatic { + /** + * Creates a function that returns the property value at path on a given object. + * + * @param path The path of the property to get. + * @return Returns the new function. + */ + property(path: StringRepresentable|StringRepresentable[]): (obj: TObj) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.property + */ + property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.property + */ + property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.property + */ + property(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.property + */ + property(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; + } + + //_.propertyOf + interface LoDashStatic { + /** + * The opposite of _.property; this method creates a function that returns the property value at a given path + * on object. + * + * @param object The object to query. + * @return Returns the new function. + */ + propertyOf(object: T): (path: string|string[]) => any; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.propertyOf + */ + propertyOf(): LoDashImplicitObjectWrapper<(path: string|string[]) => any>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.propertyOf + */ + propertyOf(): LoDashExplicitObjectWrapper<(path: string|string[]) => any>; + } + + //_.range + interface LoDashStatic { + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + range( + start: number, + end: number, + step?: number + ): number[]; + + /** + * @see _.range + */ + range( + end: number, + step?: number + ): number[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashExplicitArrayWrapper; + } + + //_.runInContext + interface LoDashStatic { + /** + * Create a new pristine lodash function using the given context object. + * + * @param context The context object. + * @return Returns a new lodash function. + */ + runInContext(context?: Object): typeof _; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.runInContext + */ + runInContext(): typeof _; + } + + //_.times + interface LoDashStatic { + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee is + * bound to thisArg and invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the array of results. + */ + times( + n: number, + iteratee: (num: number) => TResult, + thisArg?: any + ): TResult[]; + + /** + * @see _.times + */ + times(n: number): number[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult, + thisArgs?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.times + */ + times(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult, + thisArgs?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.times + */ + times(): LoDashExplicitArrayWrapper; + } + + //_.uniqueId + interface LoDashStatic { + /** + * Generates a unique ID. If prefix is provided the ID is appended to it. + * + * @param prefix The value to prefix the ID with. + * @return Returns the unique ID. + */ + uniqueId(prefix?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniqueId + */ + uniqueId(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniqueId + */ + uniqueId(): LoDashExplicitWrapper; + } + + interface ListIterator { + (value: T, index: number, collection: List): TResult; + } + + interface DictionaryIterator { + (value: T, key?: string, collection?: Dictionary): TResult; + } + + interface NumericDictionaryIterator { + (value: T, key?: number, collection?: Dictionary): TResult; + } + + interface ObjectIterator { + (element: T, key?: string, collection?: any): TResult; + } + + interface StringIterator { + (char: string, index?: number, string?: string): TResult; + } + + interface MemoVoidIterator { + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): void; + } + interface MemoIterator { + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): TResult; + } + + interface MemoVoidArrayIterator { + (acc: TResult, curr: T, index?: number, arr?: T[]): void; + } + interface MemoVoidDictionaryIterator { + (acc: TResult, curr: T, key?: string, dict?: Dictionary): void; + } + + //interface Collection {} + + // Common interface between Arrays and jQuery objects + interface List { + [index: number]: T; + length: number; + } + + interface Dictionary { + [index: string]: T; + } + + interface NumericDictionary { + [index: number]: T; + } + + interface StringRepresentable { + toString(): string; + } + + interface Cancelable { + cancel(): void; + } +} + +declare module "lodash" { + export = _; +} \ No newline at end of file diff --git a/typings/browser/ambient/mocha-node/index.d.ts b/typings/browser/ambient/mocha-node/index.d.ts new file mode 100644 index 00000000..25b55951 --- /dev/null +++ b/typings/browser/ambient/mocha-node/index.d.ts @@ -0,0 +1,16 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/098def61bc44ee29dae7e7a5c719873195086ac2/mocha/mocha-node.d.ts +// Type definitions for mocha 2.2.5 +// Project: http://mochajs.org/ +// Definitions by: Vadim Macagon , vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module Mocha { + interface IRunnable extends NodeJS.EventEmitter { + } + interface ISuite extends NodeJS.EventEmitter { + } + interface IRunner extends NodeJS.EventEmitter { + } +} \ No newline at end of file diff --git a/typings/browser/ambient/mocha/index.d.ts b/typings/browser/ambient/mocha/index.d.ts new file mode 100644 index 00000000..851d48a8 --- /dev/null +++ b/typings/browser/ambient/mocha/index.d.ts @@ -0,0 +1,238 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/d6dd320291705694ba8e1a79497a908e9f5e6617/mocha/mocha.d.ts +// Type definitions for mocha 2.2.5 +// Project: http://mochajs.org/ +// Definitions by: Kazi Manzur Rashid , otiai10 , jt000 , Vadim Macagon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface MochaSetupOptions { + //milliseconds to wait before considering a test slow + slow?: number; + + // timeout in milliseconds + timeout?: number; + + // ui name "bdd", "tdd", "exports" etc + ui?: string; + + //array of accepted globals + globals?: any[]; + + // reporter instance (function or string), defaults to `mocha.reporters.Spec` + reporter?: any; + + // bail on the first test failure + bail?: boolean; + + // ignore global leaks + ignoreLeaks?: boolean; + + // grep string or regexp to filter tests with + grep?: any; +} + +interface MochaDone { + (error?: Error): void; +} + +declare var mocha: Mocha; +declare var describe: Mocha.IContextDefinition; +declare var xdescribe: Mocha.IContextDefinition; +// alias for `describe` +declare var context: Mocha.IContextDefinition; +// alias for `describe` +declare var suite: Mocha.IContextDefinition; +declare var it: Mocha.ITestDefinition; +declare var xit: Mocha.ITestDefinition; +// alias for `it` +declare var test: Mocha.ITestDefinition; + +declare function before(action: () => void): void; + +declare function before(action: (done: MochaDone) => void): void; + +declare function before(description: string, action: () => void): void; + +declare function before(description: string, action: (done: MochaDone) => void): void; + +declare function setup(action: () => void): void; + +declare function setup(action: (done: MochaDone) => void): void; + +declare function after(action: () => void): void; + +declare function after(action: (done: MochaDone) => void): void; + +declare function after(description: string, action: () => void): void; + +declare function after(description: string, action: (done: MochaDone) => void): void; + +declare function teardown(action: () => void): void; + +declare function teardown(action: (done: MochaDone) => void): void; + +declare function beforeEach(action: () => void): void; + +declare function beforeEach(action: (done: MochaDone) => void): void; + +declare function beforeEach(description: string, action: () => void): void; + +declare function beforeEach(description: string, action: (done: MochaDone) => void): void; + +declare function suiteSetup(action: () => void): void; + +declare function suiteSetup(action: (done: MochaDone) => void): void; + +declare function afterEach(action: () => void): void; + +declare function afterEach(action: (done: MochaDone) => void): void; + +declare function afterEach(description: string, action: () => void): void; + +declare function afterEach(description: string, action: (done: MochaDone) => void): void; + +declare function suiteTeardown(action: () => void): void; + +declare function suiteTeardown(action: (done: MochaDone) => void): void; + +declare class Mocha { + constructor(options?: { + grep?: RegExp; + ui?: string; + reporter?: string; + timeout?: number; + bail?: boolean; + }); + + /** Setup mocha with the given options. */ + setup(options: MochaSetupOptions): Mocha; + bail(value?: boolean): Mocha; + addFile(file: string): Mocha; + /** Sets reporter by name, defaults to "spec". */ + reporter(name: string): Mocha; + /** Sets reporter constructor, defaults to mocha.reporters.Spec. */ + reporter(reporter: (runner: Mocha.IRunner, options: any) => any): Mocha; + ui(value: string): Mocha; + grep(value: string): Mocha; + grep(value: RegExp): Mocha; + invert(): Mocha; + ignoreLeaks(value: boolean): Mocha; + checkLeaks(): Mocha; + /** + * Function to allow assertion libraries to throw errors directly into mocha. + * This is useful when running tests in a browser because window.onerror will + * only receive the 'message' attribute of the Error. + */ + throwError(error: Error): void; + /** Enables growl support. */ + growl(): Mocha; + globals(value: string): Mocha; + globals(values: string[]): Mocha; + useColors(value: boolean): Mocha; + useInlineDiffs(value: boolean): Mocha; + timeout(value: number): Mocha; + slow(value: number): Mocha; + enableTimeouts(value: boolean): Mocha; + asyncOnly(value: boolean): Mocha; + noHighlighting(value: boolean): Mocha; + /** Runs tests and invokes `onComplete()` when finished. */ + run(onComplete?: (failures: number) => void): Mocha.IRunner; +} + +// merge the Mocha class declaration with a module +declare module Mocha { + /** Partial interface for Mocha's `Runnable` class. */ + interface IRunnable { + title: string; + fn: Function; + async: boolean; + sync: boolean; + timedOut: boolean; + } + + /** Partial interface for Mocha's `Suite` class. */ + interface ISuite { + parent: ISuite; + title: string; + + fullTitle(): string; + } + + /** Partial interface for Mocha's `Test` class. */ + interface ITest extends IRunnable { + parent: ISuite; + pending: boolean; + + fullTitle(): string; + } + + /** Partial interface for Mocha's `Runner` class. */ + interface IRunner {} + + interface IContextDefinition { + (description: string, spec: () => void): ISuite; + only(description: string, spec: () => void): ISuite; + skip(description: string, spec: () => void): void; + timeout(ms: number): void; + } + + interface ITestDefinition { + (expectation: string, assertion?: () => void): ITest; + (expectation: string, assertion?: (done: MochaDone) => void): ITest; + only(expectation: string, assertion?: () => void): ITest; + only(expectation: string, assertion?: (done: MochaDone) => void): ITest; + skip(expectation: string, assertion?: () => void): void; + skip(expectation: string, assertion?: (done: MochaDone) => void): void; + timeout(ms: number): void; + } + + export module reporters { + export class Base { + stats: { + suites: number; + tests: number; + passes: number; + pending: number; + failures: number; + }; + + constructor(runner: IRunner); + } + + export class Doc extends Base {} + export class Dot extends Base {} + export class HTML extends Base {} + export class HTMLCov extends Base {} + export class JSON extends Base {} + export class JSONCov extends Base {} + export class JSONStream extends Base {} + export class Landing extends Base {} + export class List extends Base {} + export class Markdown extends Base {} + export class Min extends Base {} + export class Nyan extends Base {} + export class Progress extends Base { + /** + * @param options.open String used to indicate the start of the progress bar. + * @param options.complete String used to indicate a complete test on the progress bar. + * @param options.incomplete String used to indicate an incomplete test on the progress bar. + * @param options.close String used to indicate the end of the progress bar. + */ + constructor(runner: IRunner, options?: { + open?: string; + complete?: string; + incomplete?: string; + close?: string; + }); + } + export class Spec extends Base {} + export class TAP extends Base {} + export class XUnit extends Base { + constructor(runner: IRunner, options?: any); + } + } +} + +declare module "mocha" { + export = Mocha; +} \ No newline at end of file diff --git a/typings/browser/ambient/mongoose/index.d.ts b/typings/browser/ambient/mongoose/index.d.ts new file mode 100644 index 00000000..28c89c99 --- /dev/null +++ b/typings/browser/ambient/mongoose/index.d.ts @@ -0,0 +1,504 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/cebde64b3a1d63d07ee7c7dbc49b631ce220d027/mongoose/mongoose.d.ts +// Type definitions for Mongoose 3.8.5 +// Project: http://mongoosejs.com/ +// Definitions by: horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module "mongoose" { + function connect(uri: string, options?: ConnectionOptions , callback?: (err: any) => void): Mongoose; + function createConnection(): Connection; + function createConnection(uri: string, options?: ConnectionOptions): Connection; + function createConnection(host: string, database_name: string, port?: number, options?: ConnectionOptions): Connection; + function disconnect(callback?: (err?: any) => void): Mongoose; + + function model(name: string, schema?: Schema, collection?: string, skipInit?: boolean): Model; + function modelNames(): string[]; + function plugin(plugin: (schema: Schema, options?: Object) => void, options?: Object): Mongoose; + + function get(key: string): any; + function set(key: string, value: any): void; + + var mongo: any; + var mquery: any; + var version: string; + var connection: Connection; + + export class Mongoose { + connect(uri: string, options?: ConnectOpenOptionsBase, callback?: (err: any) => void): Mongoose; + createConnection(): Connection; + createConnection(uri: string, options?: Object): Connection; + createConnection(host: string, database_name: string, port?: number, options?: ConnectOpenOptionsBase): Connection; + disconnect(callback?: (err?: any) => void): Mongoose; + get(key: string): any; + model(name: string, schema?: Schema, collection?: string, skipInit?: boolean): Model; + modelNames(): string[]; + plugin(plugin: (schema: Schema, options?: Object) => void, options?: Object): Mongoose; + set(key: string, value: any): void; + + mongo: any; + mquery: any; + version: string; + connection: Connection; + } + + export interface Connection extends NodeJS.EventEmitter { + constructor(base: Mongoose): Connection; + + close(callback?: (err: any) => void): Connection; + collection(name: string, options?: Object): Collection; + model(name: string, schema?: Schema, collection?: string): Model; + modelNames(): string[]; + open(host: string, database?: string, port?: number, options?: OpenSetConnectionOptions, callback?: (err: any) => void): Connection; + openSet(uris: string, database?: string, options?: OpenSetConnectionOptions, callback?: (err: any) => void): Connection; + + db: any; + collections: {[index: string]: Collection}; + readyState: number; + } + + export interface ConnectOpenOptionsBase { + db?: any; + server?: any; + replset?: any; + /** Username for authentication if not supplied in the URI. */ + user?: string; + /** Password for authentication if not supplied in the URI. */ + pass?: string; + /** Options for authentication */ + auth?: any; + } + + export interface ConnectionOptions extends ConnectOpenOptionsBase { + /** Passed to the underlying driver's Mongos instance. */ + mongos?: MongosOptions; + } + + interface OpenSetConnectionOptions extends ConnectOpenOptionsBase { + /** If true, enables High Availability support for mongos */ + mongos?: boolean; + } + + interface MongosOptions { + /** Turn on high availability monitoring. (default: true) */ + ha?: boolean; + /** Time between each replicaset status check. (default: 5000) */ + haInterval?: number; + /** + * Number of connections in the connection pool for each + * server instance. (default: 5 (for legacy reasons)) */ + poolSize?: number; + /** + * Use ssl connection (needs to have a mongod server with + * ssl support). (default: false). + */ + ssl?: boolean; + /** + * Validate mongod server certificate against ca + * (needs to have a mongod server with ssl support, 2.4 or higher) + * (default: true) + */ + sslValidate?: boolean; + /** Turn on high availability monitoring. */ + sslCA?: (Buffer|string)[]; + sslKey?: Buffer|string; + sslPass?: Buffer|string; + socketOptions?: { + noDelay?: boolean; + keepAlive?: number; + connectionTimeoutMS?: number; + socketTimeoutMS?: number; + }; + } + + export interface Collection { + } + + + export class SchemaType { } + export class VirtualType { + get(fn: Function): VirtualType; + set(fn: Function): VirtualType; + } + export module Types { + export class ObjectId { + constructor(id?: string|number); + toHexString(): string; + equals(other: ObjectId): boolean; + getTimestamp(): Date; + isValid(): boolean; + static createFromTime(time: number): ObjectId; + static createFromHexString(hexString: string): ObjectId; + } + } + + export class Schema { + static Types: { + String: String; + ObjectId: Types.ObjectId; + OId: Types.ObjectId; + Mixed: any; + }; + constructor(schema?: Object, options?: Object); + + add(obj: Object, prefix?: string): void; + eachPath(fn: (path: string, type: any) => void): Schema; + get(key: string): any; + index(fields: Object, options?: Object): Schema; + indexes(): void; + method(name: string, fn: Function): Schema; + method(method: Object): Schema; + path(path: string): any; + path(path: string, constructor: any): Schema; + pathType(path: string): string; + plugin(plugin: (schema: Schema, options?: Object) => void, options?: Object): Schema; + post(method: string, fn: Function): Schema; + pre(method: string, callback: Function): Schema; + requiredPaths(): string[]; + set(key: string, value: any): void; + static(name: string, fn: Function): Schema; + virtual(name: string, options?: Object): VirtualType; + virtualpath(name: string): VirtualType; + } + export interface SchemaOption { + autoIndex?: boolean; + bufferCommands?: boolean; + capped?: boolean; + collection?: string; + id?: boolean; + _id?: boolean; + minimize?: boolean; + read?: string; + safe?: boolean; + shardKey?: boolean; + strict?: boolean; + toJSON?: Object; + toObject?: Object; + versionKey?: boolean; + } + + export interface Model extends NodeJS.EventEmitter { + new(doc?: Object, fields?: Object, skipInit?: boolean): T; + + aggregate(...aggregations: Object[]): Aggregate; + aggregate(aggregation: Object, callback: (err: any, res: T[]) => void): Promise; + aggregate(aggregation1: Object, aggregation2: Object, callback: (err: any, res: T[]) => void): Promise; + aggregate(aggregation1: Object, aggregation2: Object, aggregation3: Object, callback: (err: any, res: T[]) => void): Promise; + count(conditions: Object, callback?: (err: any, count: number) => void): Query; + + create(doc: Object, fn?: (err: any, res: T) => void): Promise; + create(doc1: Object, doc2: Object, fn?: (err: any, res1: T, res2: T) => void): Promise; + create(doc1: Object, doc2: Object, doc3: Object, fn?: (err: any, res1: T, res2: T, res3: T) => void): Promise; + discriminator(name: string, schema: Schema): Model; + distinct(field: string, callback?: (err: any, res: T[]) => void): Query; + distinct(field: string, conditions: Object, callback?: (err: any, res: T[]) => void): Query; + ensureIndexes(callback: (err: any) => void): Promise; + + find(cond: Object, callback?: (err: any, res: T[]) => void): Query; + find(cond: Object, fields: Object, callback?: (err: any, res: T[]) => void): Query; + find(cond: Object, fields: Object, options: Object, callback?: (err: any, res: T[]) => void): Query; + findById(id: string, callback?: (err: any, res: T) => void): Query; + findById(id: string, fields: Object, callback?: (err: any, res: T) => void): Query; + findById(id: string, fields: Object, options: Object, callback?: (err: any, res: T) => void): Query; + findByIdAndRemove(id: string, callback?: (err: any, res: T) => void): Query; + findByIdAndRemove(id: string, options: Object, callback?: (err: any, res: T) => void): Query; + findByIdAndUpdate(id: string, update: Object, callback?: (err: any, res: T) => void): Query; + findByIdAndUpdate(id: string, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query; + findOne(cond?: Object, callback?: (err: any, res: T) => void): Query; + findOne(cond: Object, fields: Object, callback?: (err: any, res: T) => void): Query; + findOne(cond: Object, fields: Object, options: Object, callback?: (err: any, res: T) => void): Query; + findOneAndRemove(cond: Object, callback?: (err: any, res: T) => void): Query; + findOneAndRemove(cond: Object, options: Object, callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(cond: Object, update: Object, callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(cond: Object, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query; + + geoNear(point: { type: string; coordinates: number[] }, options: Object, callback?: (err: any, res: T[], stats: any) => void): Query; + geoNear(point: number[], options: Object, callback?: (err: any, res: T[], stats: any) => void): Query; + geoSearch(cond: Object, options: GeoSearchOption, callback?: (err: any, res: T[]) => void): Query; + increment(): T; + mapReduce(options: MapReduceOption, callback?: (err: any, res: MapReduceResult[]) => void): Promise[]>; + mapReduce(options: MapReduceOption2, callback?: (err: any, res: MapReduceResult[]) => void): Promise[]>; + model(name: string): Model; + + populate(doc: U, options: Object, callback?: (err: any, res: U) => void): Promise; + populate(doc: U[], options: Object, callback?: (err: any, res: U[]) => void): Promise; + update(cond: Object, update: Object, callback?: (err: any, affectedRows: number, raw: any) => void): Query; + update(cond: Object, update: Object, options: Object, callback?: (err: any, affectedRows: number, raw: any) => void): Query; + remove(cond: Object, callback?: (err: any) => void): Query<{}>; + save(callback?: (err: any, result: T, numberAffected: number) => void): Query; + where(path: string, val?: Object): Query; + + $where(argument: string): Query; + $where(argument: Function): Query; + + base: Mongoose; + collection: Collection; + db: any; + discriminators: any; + modelName: string; + schema: Schema; + } + export interface FindAndUpdateOption { + new?: boolean; + upsert?: boolean; + sort?: Object; + select?: Object; + } + export interface GeoSearchOption { + near: number[]; + maxDistance: number; + limit?: number; + lean?: boolean; + } + export interface MapReduceOption { + map: () => void; + reduce: (key: Key, vals: T[]) => Val; + query?: Object; + limit?: number; + keeptemp?: boolean; + finalize?: (key: Key, val: Val) => Val; + scope?: Object; + jsMode?: boolean; + verbose?: boolean; + out?: { + inline?: number; + replace?: string; + reduce?: string; + merge?: string; + }; + } + export interface MapReduceOption2 { + map: string; + reduce: (key: Key, vals: T[]) => Val; + query?: Object; + limit?: number; + keeptemp?: boolean; + finalize?: (key: Key, val: Val) => Val; + scope?: Object; + jsMode?: boolean; + verbose?: boolean; + out?: { + inline?: number; + replace?: string; + reduce?: string; + merge?: string; + }; + } + export interface MapReduceResult { + _id: Key; + value: Val; + } + + export class Query { + exec(callback?: (err: any, res: T) => void): Promise; + exec(operation: string, callback?: (err: any, res: T) => void): Promise; + exec(operation: Function, callback?: (err: any, res: T) => void): Promise; + + all(val: number): Query; + all(path: string, val: number): Query; + and(array: Object[]): Query; + box(val: Object): Query; + box(a: number[], b: number[]): Query; + batchSize(val: number): Query; + cast(model: Model, obj: Object): U; + //center(): Query; + //centerSphere(path: string, val: Object): Query; + circle(area: Object): Query; + circle(path: string, area: Object): Query; + comment(val: any): Query; + count(callback?: (err: any, count: number) => void): Query; + count(criteria: Object, callback?: (err: any, count: number) => void): Query; + distinct(callback?: (err: any, res: T) => void): Query; + distinct(field: string, callback?: (err: any, res: T) => void): Query; + distinct(criteria: Object, field: string, callback?: (err: any, res: T) => void): Query; + distinct(criteria: Query, field: string, callback?: (err: any, res: T) => void): Query; + elemMatch(criteria: Object): Query; + elemMatch(criteria: (elem: Query) => void): Query; + elemMatch(path: string, criteria: Object): Query; + elemMatch(path: string, criteria: (elem: Query) => void): Query; + equals(val: Object): Query; + exists(val?: boolean): Query; + exists(path: string, val?: boolean): Query; + find(callback?: (err: any, res: T) => void): Query; + find(criteria: Object, callback?: (err: any, res: T) => void): Query; + findOne(callback?: (err: any, res: T) => void): Query; + findOne(criteria: Object, callback?: (err: any, res: T) => void): Query; + findOneAndRemove(callback?: (err: any, res: T) => void): Query; + findOneAndRemove(cond: Object, callback?: (err: any, res: T) => void): Query; + findOneAndRemove(cond: Object, options: Object, callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(update: Object, callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(cond: Object, update: Object, callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(cond: Object, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query; + geometry(object: Object): Query; + gt(val: number): Query; + gt(path: string, val: number): Query; + gte(val: number): Query; + gte(path: string, val: number): Query; + hint(val: Object): Query; + in(val: any[]): Query; + in(path: string, val: any[]): Query; + intersects(arg?: Object): Query; + lean(bool?: boolean): Query; + limit(val: number): Query; + lt(val: number): Query; + lt(path: string, val: number): Query; + lte(val: number): Query; + lte(path: string, val: number): Query; + maxDistance(val: number): Query; + maxDistance(path: string, val: number): Query; + maxScan(val: number): Query; + merge(source: Query): Query; + merge(source: Object): Query; + mod(val: number[]): Query; + mod(path: string, val: number[]): Query; + ne(val: any): Query; + ne(path: string, val: any): Query; + near(val: Object): Query; + near(path: string, val: Object): Query; + nearSphere(val: Object): Query; + nearSphere(path: string, val: Object): Query; + nin(val: any[]): Query; + nin(path: string, val: any[]): Query; + nor(array: Object[]): Query; + or(array: Object[]): Query; + polygon(...coordinatePairs: number[][]): Query; + polygon(path: string, ...coordinatePairs: number[][]): Query; + populate(path: string, select?: string, match?: Object, options?: Object): Query; + populate(path: string, select: string, model: string, match?: Object, options?: Object): Query; + populate(opt: PopulateOption): Query; + read(pref: string, tags?: Object[]): Query; + regex(val: RegExp): Query; + regex(path: string, val: RegExp): Query; + remove(callback?: (err: any, res: T) => void): Query; + remove(criteria: Object, callback?: (err: any, res: T) => void): Query; + select(arg: string): Query; + select(arg: Object): Query; + setOptions(options: Object): Query; + size(val: number): Query; + size(path: string, val: number): Query; + skip(val: number): Query; + slaveOk(v?: boolean): Query; + slice(val: number): Query; + slice(val: number[]): Query; + slice(path: string, val: number): Query; + slice(path: string, val: number[]): Query; + snapshot(v?: boolean): Query; + sort(arg: Object): Query; + sort(arg: string): Query; + stream(options?: { transform?: Function; }): QueryStream; + tailable(v?: boolean): Query; + toConstructor(): Query; + update(callback?: (err: any, affectedRows: number, doc: T) => void): Query; + update(doc: Object, callback?: (err: any, affectedRows: number, doc: T) => void): Query; + update(criteria: Object, doc: Object, callback?: (err: any, affectedRows: number, doc: T) => void): Query; + update(criteria: Object, doc: Object, options: Object, callback?: (err: any, affectedRows: number, doc: T) => void): Query; + where(path?: string, val?: any): Query; + where(path?: Object, val?: any): Query; + within(val?: Object): Query; + within(coordinate: number[], ...coordinatePairs: number[][]): Query; + + $where(argument: string): Query; + $where(argument: Function): Query; + + static use$geoWithin: boolean; + } + + export interface PopulateOption { + path: string; + select?: string; + model?: string; + match?: Object; + options?: Object; + } + + export interface QueryStream extends NodeJS.EventEmitter { + destory(err?: any): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + paused: number; + readable: boolean; + } + + export interface Document { + id?: string; + _id: any; + + equals(doc: Document): boolean; + get(path: string, type?: new(...args: any[]) => any): any; + inspect(options?: Object): string; + invalidate(path: string, errorMsg: string, value: any): void; + invalidate(path: string, error: Error, value: any): void; + isDirectModified(path: string): boolean; + isInit(path: string): boolean; + isModified(path?: string): boolean; + isSelected(path: string): boolean; + markModified(path: string): void; + modifiedPaths(): string[]; + populate(callback?: (err: any, res: T) => void): Document; + populate(path?: string, callback?: (err: any, res: T) => void): Document; + populate(opt: PopulateOption, callback?: (err: any, res: T) => void): Document; + populated(path: string): any; + remove(callback?: (err: any) => void): Query; + save(callback?: (err: any, res: T) => void): void; + set(path: string, val: any, type?: new(...args: any[]) => any, options?: Object): void; + set(path: string, val: any, options?: Object): void; + set(value: Object): void; + toJSON(options?: Object): Object; + toObject(options?: Object): Object; + toString(): string; + update(doc: Object, options: Object, callback: (err: any, affectedRows: number, raw: any) => void): Query; + validate(cb: (err: any) => void): void; + + isNew: boolean; + errors: Object; + schema: Object; + } + + + export class Aggregate { + constructor(...options: Object[]); + + append(...options: Object[]): Aggregate; + group(arg: Object): Aggregate; + limit(num: number): Aggregate; + match(arg: Object): Aggregate; + near(parameters: Object): Aggregate; + project(arg: string): Aggregate; + project(arg: Object): Aggregate; + select(filter: string): Aggregate; + skip(num: number): Aggregate; + sort(arg: string): Aggregate; + sort(arg: Object): Aggregate; + unwind(fiels: string, ...rest: string[]): Aggregate; + + exec(callback?: (err: any, result: T) => void): Promise; + read(pref: string, ...tags: Object[]): Aggregate; + } + + export class Promise { + constructor(fn?: (err: any, result: T) => void); + + then(onFulFill: (result: T) => void, onReject?: (err: any) => void): Promise; + end(): void; + + fulfill(result: T): Promise; + reject(err: any): Promise; + resolve(err: any, result: T): Promise; + + onFulfill(listener: (result: T) => void): Promise; + onReject(listener: (err: any) => void): Promise; + onResolve(listener: (err: any, result: T) => void): Promise; + on(event: string, listener: Function): Promise; + + // Deprecated methods. + addBack(listener: (err: any, result: T) => void): Promise; + addCallback(listener: (result: T) => void): Promise; + addErrback(listener: (err: any) => void): Promise; + complete(result: T): Promise; + error(err: any): Promise; + } + +} \ No newline at end of file diff --git a/typings/browser/ambient/node/index.d.ts b/typings/browser/ambient/node/index.d.ts new file mode 100644 index 00000000..4bea6186 --- /dev/null +++ b/typings/browser/ambient/node/index.d.ts @@ -0,0 +1,2219 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/48c1e3c1d6baefa4f1a126f188c27c4fefd36bff/node/node.d.ts +// Type definitions for Node.js v4.x +// Project: http://nodejs.org/ +// Definitions by: Microsoft TypeScript , DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/************************************************ +* * +* Node.js v4.x API * +* * +************************************************/ + +interface Error { + stack?: string; +} + + +// compat for TypeScript 1.5.3 +// if you use with --target es3 or --target es5 and use below definitions, +// use the lib.es6.d.ts that is bundled with TypeScript 1.5.3. +interface MapConstructor {} +interface WeakMapConstructor {} +interface SetConstructor {} +interface WeakSetConstructor {} + +/************************************************ +* * +* GLOBAL * +* * +************************************************/ +declare var process: NodeJS.Process; +declare var global: NodeJS.Global; + +declare var __filename: string; +declare var __dirname: string; + +declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; +declare function clearTimeout(timeoutId: NodeJS.Timer): void; +declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; +declare function clearInterval(intervalId: NodeJS.Timer): void; +declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; +declare function clearImmediate(immediateId: any): void; + +interface NodeRequireFunction { + (id: string): any; +} + +interface NodeRequire extends NodeRequireFunction { + resolve(id:string): string; + cache: any; + extensions: any; + main: any; +} + +declare var require: NodeRequire; + +interface NodeModule { + exports: any; + require: NodeRequireFunction; + id: string; + filename: string; + loaded: boolean; + parent: any; + children: any[]; +} + +declare var module: NodeModule; + +// Same as module.exports +declare var exports: any; +declare var SlowBuffer: { + new (str: string, encoding?: string): Buffer; + new (size: number): Buffer; + new (size: Uint8Array): Buffer; + new (array: any[]): Buffer; + prototype: Buffer; + isBuffer(obj: any): boolean; + byteLength(string: string, encoding?: string): number; + concat(list: Buffer[], totalLength?: number): Buffer; +}; + + +// Buffer class +interface Buffer extends NodeBuffer {} + +/** + * Raw data is stored in instances of the Buffer class. + * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. + * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' + */ +declare var Buffer: { + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + */ + new (str: string, encoding?: string): Buffer; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + */ + new (size: number): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + new (array: Uint8Array): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + new (array: any[]): Buffer; + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + */ + new (buffer: Buffer): Buffer; + prototype: Buffer; + /** + * Returns true if {obj} is a Buffer + * + * @param obj object to test. + */ + isBuffer(obj: any): obj is Buffer; + /** + * Returns true if {encoding} is a valid encoding argument. + * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' + * + * @param encoding string to test. + */ + isEncoding(encoding: string): boolean; + /** + * Gives the actual byte length of a string. encoding defaults to 'utf8'. + * This is not the same as String.prototype.length since that returns the number of characters in a string. + * + * @param string string to test. + * @param encoding encoding used to evaluate (defaults to 'utf8') + */ + byteLength(string: string, encoding?: string): number; + /** + * Returns a buffer which is the result of concatenating all the buffers in the list together. + * + * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. + * If the list has exactly one item, then the first item of the list is returned. + * If the list has more than one item, then a new Buffer is created. + * + * @param list An array of Buffer objects to concatenate + * @param totalLength Total length of the buffers when concatenated. + * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. + */ + concat(list: Buffer[], totalLength?: number): Buffer; + /** + * The same as buf1.compare(buf2). + */ + compare(buf1: Buffer, buf2: Buffer): number; +}; + +/************************************************ +* * +* GLOBAL INTERFACES * +* * +************************************************/ +declare module NodeJS { + export interface ErrnoException extends Error { + errno?: number; + code?: string; + path?: string; + syscall?: string; + stack?: string; + } + + export interface EventEmitter { + addListener(event: string, listener: Function): this; + on(event: string, listener: Function): this; + once(event: string, listener: Function): this; + removeListener(event: string, listener: Function): this; + removeAllListeners(event?: string): this; + setMaxListeners(n: number): this; + getMaxListeners(): number; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; + } + + export interface ReadableStream extends EventEmitter { + readable: boolean; + read(size?: number): string|Buffer; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: ReadableStream): ReadableStream; + } + + export interface WritableStream extends EventEmitter { + writable: boolean; + write(buffer: Buffer|string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface ReadWriteStream extends ReadableStream, WritableStream {} + + export interface Events extends EventEmitter { } + + export interface Domain extends Events { + run(fn: Function): void; + add(emitter: Events): void; + remove(emitter: Events): void; + bind(cb: (err: Error, data: any) => any): any; + intercept(cb: (data: any) => any): any; + dispose(): void; + + addListener(event: string, listener: Function): this; + on(event: string, listener: Function): this; + once(event: string, listener: Function): this; + removeListener(event: string, listener: Function): this; + removeAllListeners(event?: string): this; + } + + export interface Process extends EventEmitter { + stdout: WritableStream; + stderr: WritableStream; + stdin: ReadableStream; + argv: string[]; + execArgv: string[]; + execPath: string; + abort(): void; + chdir(directory: string): void; + cwd(): string; + env: any; + exit(code?: number): void; + getgid(): number; + setgid(id: number): void; + setgid(id: string): void; + getuid(): number; + setuid(id: number): void; + setuid(id: string): void; + version: string; + versions: { + http_parser: string; + node: string; + v8: string; + ares: string; + uv: string; + zlib: string; + openssl: string; + }; + config: { + target_defaults: { + cflags: any[]; + default_configuration: string; + defines: string[]; + include_dirs: string[]; + libraries: string[]; + }; + variables: { + clang: number; + host_arch: string; + node_install_npm: boolean; + node_install_waf: boolean; + node_prefix: string; + node_shared_openssl: boolean; + node_shared_v8: boolean; + node_shared_zlib: boolean; + node_use_dtrace: boolean; + node_use_etw: boolean; + node_use_openssl: boolean; + target_arch: string; + v8_no_strict_aliasing: number; + v8_use_snapshot: boolean; + visibility: string; + }; + }; + kill(pid:number, signal?: string|number): void; + pid: number; + title: string; + arch: string; + platform: string; + memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; }; + nextTick(callback: Function): void; + umask(mask?: number): number; + uptime(): number; + hrtime(time?:number[]): number[]; + domain: Domain; + + // Worker + send?(message: any, sendHandle?: any): void; + disconnect(): void; + connected: boolean; + } + + export interface Global { + Array: typeof Array; + ArrayBuffer: typeof ArrayBuffer; + Boolean: typeof Boolean; + Buffer: typeof Buffer; + DataView: typeof DataView; + Date: typeof Date; + Error: typeof Error; + EvalError: typeof EvalError; + Float32Array: typeof Float32Array; + Float64Array: typeof Float64Array; + Function: typeof Function; + GLOBAL: Global; + Infinity: typeof Infinity; + Int16Array: typeof Int16Array; + Int32Array: typeof Int32Array; + Int8Array: typeof Int8Array; + Intl: typeof Intl; + JSON: typeof JSON; + Map: MapConstructor; + Math: typeof Math; + NaN: typeof NaN; + Number: typeof Number; + Object: typeof Object; + Promise: Function; + RangeError: typeof RangeError; + ReferenceError: typeof ReferenceError; + RegExp: typeof RegExp; + Set: SetConstructor; + String: typeof String; + Symbol: Function; + SyntaxError: typeof SyntaxError; + TypeError: typeof TypeError; + URIError: typeof URIError; + Uint16Array: typeof Uint16Array; + Uint32Array: typeof Uint32Array; + Uint8Array: typeof Uint8Array; + Uint8ClampedArray: Function; + WeakMap: WeakMapConstructor; + WeakSet: WeakSetConstructor; + clearImmediate: (immediateId: any) => void; + clearInterval: (intervalId: NodeJS.Timer) => void; + clearTimeout: (timeoutId: NodeJS.Timer) => void; + console: typeof console; + decodeURI: typeof decodeURI; + decodeURIComponent: typeof decodeURIComponent; + encodeURI: typeof encodeURI; + encodeURIComponent: typeof encodeURIComponent; + escape: (str: string) => string; + eval: typeof eval; + global: Global; + isFinite: typeof isFinite; + isNaN: typeof isNaN; + parseFloat: typeof parseFloat; + parseInt: typeof parseInt; + process: Process; + root: Global; + setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => any; + setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; + setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; + undefined: typeof undefined; + unescape: (str: string) => string; + gc: () => void; + v8debug?: any; + } + + export interface Timer { + ref() : void; + unref() : void; + } +} + +/** + * @deprecated + */ +interface NodeBuffer { + [index: number]: number; + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + toJSON(): any; + length: number; + equals(otherBuffer: Buffer): boolean; + compare(otherBuffer: Buffer): number; + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + slice(start?: number, end?: number): Buffer; + writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readUInt8(offset: number, noAssert?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + writeUInt8(value: number, offset: number, noAssert?: boolean): number; + writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeInt8(value: number, offset: number, noAssert?: boolean): number; + writeInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeFloatLE(value: number, offset: number, noAssert?: boolean): number; + writeFloatBE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; + fill(value: any, offset?: number, end?: number): Buffer; + indexOf(value: string | number | Buffer, byteOffset?: number): number; +} + +/************************************************ +* * +* MODULES * +* * +************************************************/ +declare module "buffer" { + export var INSPECT_MAX_BYTES: number; + var BuffType: typeof Buffer; + var SlowBuffType: typeof SlowBuffer; + export { BuffType as Buffer, SlowBuffType as SlowBuffer }; +} + +declare module "querystring" { + export interface StringifyOptions { + encodeURIComponent?: Function; + } + + export interface ParseOptions { + maxKeys?: number; + decodeURIComponent?: Function; + } + + export function stringify(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string; + export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): any; + export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): T; + export function escape(str: string): string; + export function unescape(str: string): string; +} + +declare module "events" { + export class EventEmitter implements NodeJS.EventEmitter { + static EventEmitter: EventEmitter; + static listenerCount(emitter: EventEmitter, event: string): number; // deprecated + static defaultMaxListeners: number; + + addListener(event: string, listener: Function): this; + on(event: string, listener: Function): this; + once(event: string, listener: Function): this; + removeListener(event: string, listener: Function): this; + removeAllListeners(event?: string): this; + setMaxListeners(n: number): this; + getMaxListeners(): number; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; + } +} + +declare module "http" { + import * as events from "events"; + import * as net from "net"; + import * as stream from "stream"; + + export interface RequestOptions { + protocol?: string; + host?: string; + hostname?: string; + family?: number; + port?: number; + localAddress?: string; + socketPath?: string; + method?: string; + path?: string; + headers?: { [key: string]: any }; + auth?: string; + agent?: Agent|boolean; + } + + export interface Server extends events.EventEmitter { + listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server; + listen(port: number, hostname?: string, callback?: Function): Server; + listen(path: string, callback?: Function): Server; + listen(handle: any, listeningListener?: Function): Server; + close(cb?: any): Server; + address(): { port: number; family: string; address: string; }; + maxHeadersCount: number; + } + /** + * @deprecated Use IncomingMessage + */ + export interface ServerRequest extends IncomingMessage { + connection: net.Socket; + } + export interface ServerResponse extends events.EventEmitter, stream.Writable { + // Extended base methods + write(buffer: Buffer): boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + write(str: string, encoding?: string, fd?: string): boolean; + + writeContinue(): void; + writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void; + writeHead(statusCode: number, headers?: any): void; + statusCode: number; + statusMessage: string; + headersSent: boolean; + setHeader(name: string, value: string | string[]): void; + sendDate: boolean; + getHeader(name: string): string; + removeHeader(name: string): void; + write(chunk: any, encoding?: string): any; + addTrailers(headers: any): void; + + // Extended base methods + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + end(data?: any, encoding?: string): void; + } + export interface ClientRequest extends events.EventEmitter, stream.Writable { + // Extended base methods + write(buffer: Buffer): boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + write(str: string, encoding?: string, fd?: string): boolean; + + write(chunk: any, encoding?: string): void; + abort(): void; + setTimeout(timeout: number, callback?: Function): void; + setNoDelay(noDelay?: boolean): void; + setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; + + // Extended base methods + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + end(data?: any, encoding?: string): void; + } + export interface IncomingMessage extends events.EventEmitter, stream.Readable { + httpVersion: string; + headers: any; + rawHeaders: string[]; + trailers: any; + rawTrailers: any; + setTimeout(msecs: number, callback: Function): NodeJS.Timer; + /** + * Only valid for request obtained from http.Server. + */ + method?: string; + /** + * Only valid for request obtained from http.Server. + */ + url?: string; + /** + * Only valid for response obtained from http.ClientRequest. + */ + statusCode?: number; + /** + * Only valid for response obtained from http.ClientRequest. + */ + statusMessage?: string; + socket: net.Socket; + } + /** + * @deprecated Use IncomingMessage + */ + export interface ClientResponse extends IncomingMessage { } + + export interface AgentOptions { + /** + * Keep sockets around in a pool to be used by other requests in the future. Default = false + */ + keepAlive?: boolean; + /** + * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. + * Only relevant if keepAlive is set to true. + */ + keepAliveMsecs?: number; + /** + * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity + */ + maxSockets?: number; + /** + * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. + */ + maxFreeSockets?: number; + } + + export class Agent { + maxSockets: number; + sockets: any; + requests: any; + + constructor(opts?: AgentOptions); + + /** + * Destroy any sockets that are currently in use by the agent. + * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, + * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, + * sockets may hang open for quite a long time before the server terminates them. + */ + destroy(): void; + } + + export var METHODS: string[]; + + export var STATUS_CODES: { + [errorCode: number]: string; + [errorCode: string]: string; + }; + export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server; + export function createClient(port?: number, host?: string): any; + export function request(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; + export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest; + export var globalAgent: Agent; +} + +declare module "cluster" { + import * as child from "child_process"; + import * as events from "events"; + + export interface ClusterSettings { + exec?: string; + args?: string[]; + silent?: boolean; + } + + export interface Address { + address: string; + port: number; + addressType: string; + } + + export class Worker extends events.EventEmitter { + id: string; + process: child.ChildProcess; + suicide: boolean; + send(message: any, sendHandle?: any): void; + kill(signal?: string): void; + destroy(signal?: string): void; + disconnect(): void; + } + + export var settings: ClusterSettings; + export var isMaster: boolean; + export var isWorker: boolean; + export function setupMaster(settings?: ClusterSettings): void; + export function fork(env?: any): Worker; + export function disconnect(callback?: Function): void; + export var worker: Worker; + export var workers: Worker[]; + + // Event emitter + export function addListener(event: string, listener: Function): void; + export function on(event: "disconnect", listener: (worker: Worker) => void): void; + export function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): void; + export function on(event: "fork", listener: (worker: Worker) => void): void; + export function on(event: "listening", listener: (worker: Worker, address: any) => void): void; + export function on(event: "message", listener: (worker: Worker, message: any) => void): void; + export function on(event: "online", listener: (worker: Worker) => void): void; + export function on(event: "setup", listener: (settings: any) => void): void; + export function on(event: string, listener: Function): any; + export function once(event: string, listener: Function): void; + export function removeListener(event: string, listener: Function): void; + export function removeAllListeners(event?: string): void; + export function setMaxListeners(n: number): void; + export function listeners(event: string): Function[]; + export function emit(event: string, ...args: any[]): boolean; +} + +declare module "zlib" { + import * as stream from "stream"; + export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; } + + export interface Gzip extends stream.Transform { } + export interface Gunzip extends stream.Transform { } + export interface Deflate extends stream.Transform { } + export interface Inflate extends stream.Transform { } + export interface DeflateRaw extends stream.Transform { } + export interface InflateRaw extends stream.Transform { } + export interface Unzip extends stream.Transform { } + + export function createGzip(options?: ZlibOptions): Gzip; + export function createGunzip(options?: ZlibOptions): Gunzip; + export function createDeflate(options?: ZlibOptions): Deflate; + export function createInflate(options?: ZlibOptions): Inflate; + export function createDeflateRaw(options?: ZlibOptions): DeflateRaw; + export function createInflateRaw(options?: ZlibOptions): InflateRaw; + export function createUnzip(options?: ZlibOptions): Unzip; + + export function deflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function deflateSync(buf: Buffer, options?: ZlibOptions): any; + export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function deflateRawSync(buf: Buffer, options?: ZlibOptions): any; + export function gzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function gzipSync(buf: Buffer, options?: ZlibOptions): any; + export function gunzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function gunzipSync(buf: Buffer, options?: ZlibOptions): any; + export function inflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function inflateSync(buf: Buffer, options?: ZlibOptions): any; + export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function inflateRawSync(buf: Buffer, options?: ZlibOptions): any; + export function unzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function unzipSync(buf: Buffer, options?: ZlibOptions): any; + + // Constants + export var Z_NO_FLUSH: number; + export var Z_PARTIAL_FLUSH: number; + export var Z_SYNC_FLUSH: number; + export var Z_FULL_FLUSH: number; + export var Z_FINISH: number; + export var Z_BLOCK: number; + export var Z_TREES: number; + export var Z_OK: number; + export var Z_STREAM_END: number; + export var Z_NEED_DICT: number; + export var Z_ERRNO: number; + export var Z_STREAM_ERROR: number; + export var Z_DATA_ERROR: number; + export var Z_MEM_ERROR: number; + export var Z_BUF_ERROR: number; + export var Z_VERSION_ERROR: number; + export var Z_NO_COMPRESSION: number; + export var Z_BEST_SPEED: number; + export var Z_BEST_COMPRESSION: number; + export var Z_DEFAULT_COMPRESSION: number; + export var Z_FILTERED: number; + export var Z_HUFFMAN_ONLY: number; + export var Z_RLE: number; + export var Z_FIXED: number; + export var Z_DEFAULT_STRATEGY: number; + export var Z_BINARY: number; + export var Z_TEXT: number; + export var Z_ASCII: number; + export var Z_UNKNOWN: number; + export var Z_DEFLATED: number; + export var Z_NULL: number; +} + +declare module "os" { + export interface CpuInfo { + model: string; + speed: number; + times: { + user: number; + nice: number; + sys: number; + idle: number; + irq: number; + }; + } + + export interface NetworkInterfaceInfo { + address: string; + netmask: string; + family: string; + mac: string; + internal: boolean; + } + + export function tmpdir(): string; + export function homedir(): string; + export function endianness(): string; + export function hostname(): string; + export function type(): string; + export function platform(): string; + export function arch(): string; + export function release(): string; + export function uptime(): number; + export function loadavg(): number[]; + export function totalmem(): number; + export function freemem(): number; + export function cpus(): CpuInfo[]; + export function networkInterfaces(): {[index: string]: NetworkInterfaceInfo[]}; + export var EOL: string; +} + +declare module "https" { + import * as tls from "tls"; + import * as events from "events"; + import * as http from "http"; + + export interface ServerOptions { + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any; + crl?: any; + ciphers?: string; + honorCipherOrder?: boolean; + requestCert?: boolean; + rejectUnauthorized?: boolean; + NPNProtocols?: any; + SNICallback?: (servername: string) => any; + } + + export interface RequestOptions extends http.RequestOptions{ + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any; + ciphers?: string; + rejectUnauthorized?: boolean; + secureProtocol?: string; + } + + export interface Agent { + maxSockets: number; + sockets: any; + requests: any; + } + export var Agent: { + new (options?: RequestOptions): Agent; + }; + export interface Server extends tls.Server { } + export function createServer(options: ServerOptions, requestListener?: Function): Server; + export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest; + export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest; + export var globalAgent: Agent; +} + +declare module "punycode" { + export function decode(string: string): string; + export function encode(string: string): string; + export function toUnicode(domain: string): string; + export function toASCII(domain: string): string; + export var ucs2: ucs2; + interface ucs2 { + decode(string: string): number[]; + encode(codePoints: number[]): string; + } + export var version: any; +} + +declare module "repl" { + import * as stream from "stream"; + import * as events from "events"; + + export interface ReplOptions { + prompt?: string; + input?: NodeJS.ReadableStream; + output?: NodeJS.WritableStream; + terminal?: boolean; + eval?: Function; + useColors?: boolean; + useGlobal?: boolean; + ignoreUndefined?: boolean; + writer?: Function; + } + export function start(options: ReplOptions): events.EventEmitter; +} + +declare module "readline" { + import * as events from "events"; + import * as stream from "stream"; + + export interface Key { + sequence?: string; + name?: string; + ctrl?: boolean; + meta?: boolean; + shift?: boolean; + } + + export interface ReadLine extends events.EventEmitter { + setPrompt(prompt: string): void; + prompt(preserveCursor?: boolean): void; + question(query: string, callback: (answer: string) => void): void; + pause(): ReadLine; + resume(): ReadLine; + close(): void; + write(data: string|Buffer, key?: Key): void; + } + + export interface Completer { + (line: string): CompleterResult; + (line: string, callback: (err: any, result: CompleterResult) => void): any; + } + + export interface CompleterResult { + completions: string[]; + line: string; + } + + export interface ReadLineOptions { + input: NodeJS.ReadableStream; + output?: NodeJS.WritableStream; + completer?: Completer; + terminal?: boolean; + historySize?: number; + } + + export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer, terminal?: boolean): ReadLine; + export function createInterface(options: ReadLineOptions): ReadLine; + + export function cursorTo(stream: NodeJS.WritableStream, x: number, y: number): void; + export function moveCursor(stream: NodeJS.WritableStream, dx: number|string, dy: number|string): void; + export function clearLine(stream: NodeJS.WritableStream, dir: number): void; + export function clearScreenDown(stream: NodeJS.WritableStream): void; +} + +declare module "vm" { + export interface Context { } + export interface Script { + runInThisContext(): void; + runInNewContext(sandbox?: Context): void; + } + export function runInThisContext(code: string, filename?: string): void; + export function runInNewContext(code: string, sandbox?: Context, filename?: string): void; + export function runInContext(code: string, context: Context, filename?: string): void; + export function createContext(initSandbox?: Context): Context; + export function createScript(code: string, filename?: string): Script; +} + +declare module "child_process" { + import * as events from "events"; + import * as stream from "stream"; + + export interface ChildProcess extends events.EventEmitter { + stdin: stream.Writable; + stdout: stream.Readable; + stderr: stream.Readable; + stdio: (stream.Readable|stream.Writable)[]; + pid: number; + kill(signal?: string): void; + send(message: any, sendHandle?: any): void; + disconnect(): void; + unref(): void; + } + + export function spawn(command: string, args?: string[], options?: { + cwd?: string; + stdio?: any; + custom?: any; + env?: any; + detached?: boolean; + }): ChildProcess; + export function exec(command: string, options: { + cwd?: string; + stdio?: any; + customFds?: any; + env?: any; + encoding?: string; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function exec(command: string, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function execFile(file: string, + callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function execFile(file: string, args?: string[], + callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function execFile(file: string, args?: string[], options?: { + cwd?: string; + stdio?: any; + customFds?: any; + env?: any; + encoding?: string; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function fork(modulePath: string, args?: string[], options?: { + cwd?: string; + env?: any; + execPath?: string; + execArgv?: string[]; + silent?: boolean; + uid?: number; + gid?: number; + }): ChildProcess; + export function spawnSync(command: string, args?: string[], options?: { + cwd?: string; + input?: string | Buffer; + stdio?: any; + env?: any; + uid?: number; + gid?: number; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + encoding?: string; + }): { + pid: number; + output: string[]; + stdout: string | Buffer; + stderr: string | Buffer; + status: number; + signal: string; + error: Error; + }; + export function execSync(command: string, options?: { + cwd?: string; + input?: string|Buffer; + stdio?: any; + env?: any; + uid?: number; + gid?: number; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + encoding?: string; + }): string | Buffer; + export function execFileSync(command: string, args?: string[], options?: { + cwd?: string; + input?: string|Buffer; + stdio?: any; + env?: any; + uid?: number; + gid?: number; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + encoding?: string; + }): string | Buffer; +} + +declare module "url" { + export interface Url { + href?: string; + protocol?: string; + auth?: string; + hostname?: string; + port?: string; + host?: string; + pathname?: string; + search?: string; + query?: any; // string | Object + slashes?: boolean; + hash?: string; + path?: string; + } + + export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url; + export function format(url: Url): string; + export function resolve(from: string, to: string): string; +} + +declare module "dns" { + export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) =>void ): string; + export function lookup(domain: string, callback: (err: Error, address: string, family: number) =>void ): string; + export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[]; +} + +declare module "net" { + import * as stream from "stream"; + + export interface Socket extends stream.Duplex { + // Extended base methods + write(buffer: Buffer): boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + write(str: string, encoding?: string, fd?: string): boolean; + + connect(port: number, host?: string, connectionListener?: Function): void; + connect(path: string, connectionListener?: Function): void; + bufferSize: number; + setEncoding(encoding?: string): void; + write(data: any, encoding?: string, callback?: Function): void; + destroy(): void; + pause(): void; + resume(): void; + setTimeout(timeout: number, callback?: Function): void; + setNoDelay(noDelay?: boolean): void; + setKeepAlive(enable?: boolean, initialDelay?: number): void; + address(): { port: number; family: string; address: string; }; + unref(): void; + ref(): void; + + remoteAddress: string; + remoteFamily: string; + remotePort: number; + localAddress: string; + localPort: number; + bytesRead: number; + bytesWritten: number; + + // Extended base methods + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + end(data?: any, encoding?: string): void; + } + + export var Socket: { + new (options?: { fd?: string; type?: string; allowHalfOpen?: boolean; }): Socket; + }; + + export interface Server extends Socket { + listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server; + listen(path: string, listeningListener?: Function): Server; + listen(handle: any, listeningListener?: Function): Server; + close(callback?: Function): Server; + address(): { port: number; family: string; address: string; }; + maxConnections: number; + connections: number; + } + export function createServer(connectionListener?: (socket: Socket) =>void ): Server; + export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) =>void ): Server; + export function connect(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket; + export function connect(port: number, host?: string, connectionListener?: Function): Socket; + export function connect(path: string, connectionListener?: Function): Socket; + export function createConnection(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket; + export function createConnection(port: number, host?: string, connectionListener?: Function): Socket; + export function createConnection(path: string, connectionListener?: Function): Socket; + export function isIP(input: string): number; + export function isIPv4(input: string): boolean; + export function isIPv6(input: string): boolean; +} + +declare module "dgram" { + import * as events from "events"; + + interface RemoteInfo { + address: string; + port: number; + size: number; + } + + interface AddressInfo { + address: string; + family: string; + port: number; + } + + export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; + + interface Socket extends events.EventEmitter { + send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; + bind(port: number, address?: string, callback?: () => void): void; + close(): void; + address(): AddressInfo; + setBroadcast(flag: boolean): void; + setMulticastTTL(ttl: number): void; + setMulticastLoopback(flag: boolean): void; + addMembership(multicastAddress: string, multicastInterface?: string): void; + dropMembership(multicastAddress: string, multicastInterface?: string): void; + } +} + +declare module "fs" { + import * as stream from "stream"; + import * as events from "events"; + + interface Stats { + isFile(): boolean; + isDirectory(): boolean; + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isSymbolicLink(): boolean; + isFIFO(): boolean; + isSocket(): boolean; + dev: number; + ino: number; + mode: number; + nlink: number; + uid: number; + gid: number; + rdev: number; + size: number; + blksize: number; + blocks: number; + atime: Date; + mtime: Date; + ctime: Date; + birthtime: Date; + } + + interface FSWatcher extends events.EventEmitter { + close(): void; + } + + export interface ReadStream extends stream.Readable { + close(): void; + } + export interface WriteStream extends stream.Writable { + close(): void; + bytesWritten: number; + } + + /** + * Asynchronous rename. + * @param oldPath + * @param newPath + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /** + * Synchronous rename + * @param oldPath + * @param newPath + */ + export function renameSync(oldPath: string, newPath: string): void; + export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function truncateSync(path: string, len?: number): void; + export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function ftruncateSync(fd: number, len?: number): void; + export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chownSync(path: string, uid: number, gid: number): void; + export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchownSync(fd: number, uid: number, gid: number): void; + export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchownSync(path: string, uid: number, gid: number): void; + export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chmodSync(path: string, mode: number): void; + export function chmodSync(path: string, mode: string): void; + export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchmodSync(fd: number, mode: number): void; + export function fchmodSync(fd: number, mode: string): void; + export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchmodSync(path: string, mode: number): void; + export function lchmodSync(path: string, mode: string): void; + export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function statSync(path: string): Stats; + export function lstatSync(path: string): Stats; + export function fstatSync(fd: number): Stats; + export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function linkSync(srcpath: string, dstpath: string): void; + export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; + export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void; + export function readlinkSync(path: string): string; + export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; + export function realpath(path: string, cache: {[path: string]: string}, callback: (err: NodeJS.ErrnoException, resolvedPath: string) =>any): void; + export function realpathSync(path: string, cache?: { [path: string]: string }): string; + /* + * Asynchronous unlink - deletes the file specified in {path} + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Synchronous unlink - deletes the file specified in {path} + * + * @param path + */ + export function unlinkSync(path: string): void; + /* + * Asynchronous rmdir - removes the directory specified in {path} + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Synchronous rmdir - removes the directory specified in {path} + * + * @param path + */ + export function rmdirSync(path: string): void; + /* + * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function mkdirSync(path: string, mode?: number): void; + /* + * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function mkdirSync(path: string, mode?: string): void; + export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; + export function readdirSync(path: string): string[]; + export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function closeSync(fd: number): void; + export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function openSync(path: string, flags: string, mode?: number): number; + export function openSync(path: string, flags: string, mode?: string): number; + export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimesSync(path: string, atime: number, mtime: number): void; + export function utimesSync(path: string, atime: Date, mtime: Date): void; + export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimesSync(fd: number, atime: number, mtime: number): void; + export function futimesSync(fd: number, atime: Date, mtime: Date): void; + export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fsyncSync(fd: number): void; + export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; + export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; + export function write(fd: number, data: any, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, data: any, offset: number, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; + export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param encoding + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ + export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ + export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ + export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ + export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + /* + * Synchronous readFile - Synchronously reads the entire contents of a file. + * + * @param fileName + * @param encoding + */ + export function readFileSync(filename: string, encoding: string): string; + /* + * Synchronous readFile - Synchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer. + */ + export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; + /* + * Synchronous readFile - Synchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer. + */ + export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; + export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; + export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void; + export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void; + export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher; + export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; + export function exists(path: string, callback?: (exists: boolean) => void): void; + export function existsSync(path: string): boolean; + /** Constant for fs.access(). File is visible to the calling process. */ + export var F_OK: number; + /** Constant for fs.access(). File can be read by the calling process. */ + export var R_OK: number; + /** Constant for fs.access(). File can be written by the calling process. */ + export var W_OK: number; + /** Constant for fs.access(). File can be executed by the calling process. */ + export var X_OK: number; + /** Tests a user's permissions for the file specified by path. */ + export function access(path: string, callback: (err: NodeJS.ErrnoException) => void): void; + export function access(path: string, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; + /** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */ + export function accessSync(path: string, mode ?: number): void; + export function createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: number; + mode?: number; + autoClose?: boolean; + }): ReadStream; + export function createWriteStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: number; + mode?: number; + }): WriteStream; +} + +declare module "path" { + + /** + * A parsed path object generated by path.parse() or consumed by path.format(). + */ + export interface ParsedPath { + /** + * The root of the path such as '/' or 'c:\' + */ + root: string; + /** + * The full directory path such as '/home/user/dir' or 'c:\path\dir' + */ + dir: string; + /** + * The file name including extension (if any) such as 'index.html' + */ + base: string; + /** + * The file extension (if any) such as '.html' + */ + ext: string; + /** + * The file name without extension (if any) such as 'index' + */ + name: string; + } + + /** + * Normalize a string path, reducing '..' and '.' parts. + * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. + * + * @param p string path to normalize. + */ + export function normalize(p: string): string; + /** + * Join all arguments together and normalize the resulting path. + * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. + * + * @param paths string paths to join. + */ + export function join(...paths: any[]): string; + /** + * Join all arguments together and normalize the resulting path. + * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. + * + * @param paths string paths to join. + */ + export function join(...paths: string[]): string; + /** + * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. + * + * Starting from leftmost {from} paramter, resolves {to} to an absolute path. + * + * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. + * + * @param pathSegments string paths to join. Non-string arguments are ignored. + */ + export function resolve(...pathSegments: any[]): string; + /** + * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. + * + * @param path path to test. + */ + export function isAbsolute(path: string): boolean; + /** + * Solve the relative path from {from} to {to}. + * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. + * + * @param from + * @param to + */ + export function relative(from: string, to: string): string; + /** + * Return the directory name of a path. Similar to the Unix dirname command. + * + * @param p the path to evaluate. + */ + export function dirname(p: string): string; + /** + * Return the last portion of a path. Similar to the Unix basename command. + * Often used to extract the file name from a fully qualified path. + * + * @param p the path to evaluate. + * @param ext optionally, an extension to remove from the result. + */ + export function basename(p: string, ext?: string): string; + /** + * Return the extension of the path, from the last '.' to end of string in the last portion of the path. + * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string + * + * @param p the path to evaluate. + */ + export function extname(p: string): string; + /** + * The platform-specific file separator. '\\' or '/'. + */ + export var sep: string; + /** + * The platform-specific file delimiter. ';' or ':'. + */ + export var delimiter: string; + /** + * Returns an object from a path string - the opposite of format(). + * + * @param pathString path to evaluate. + */ + export function parse(pathString: string): ParsedPath; + /** + * Returns a path string from an object - the opposite of parse(). + * + * @param pathString path to evaluate. + */ + export function format(pathObject: ParsedPath): string; + + export module posix { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function isAbsolute(p: string): boolean; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; + export var delimiter: string; + export function parse(p: string): ParsedPath; + export function format(pP: ParsedPath): string; + } + + export module win32 { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function isAbsolute(p: string): boolean; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; + export var delimiter: string; + export function parse(p: string): ParsedPath; + export function format(pP: ParsedPath): string; + } +} + +declare module "string_decoder" { + export interface NodeStringDecoder { + write(buffer: Buffer): string; + detectIncompleteChar(buffer: Buffer): number; + } + export var StringDecoder: { + new (encoding: string): NodeStringDecoder; + }; +} + +declare module "tls" { + import * as crypto from "crypto"; + import * as net from "net"; + import * as stream from "stream"; + + var CLIENT_RENEG_LIMIT: number; + var CLIENT_RENEG_WINDOW: number; + + export interface TlsOptions { + host?: string; + port?: number; + pfx?: any; //string or buffer + key?: any; //string or buffer + passphrase?: string; + cert?: any; + ca?: any; //string or buffer + crl?: any; //string or string array + ciphers?: string; + honorCipherOrder?: any; + requestCert?: boolean; + rejectUnauthorized?: boolean; + NPNProtocols?: any; //array or Buffer; + SNICallback?: (servername: string) => any; + } + + export interface ConnectionOptions { + host?: string; + port?: number; + socket?: net.Socket; + pfx?: any; //string | Buffer + key?: any; //string | Buffer + passphrase?: string; + cert?: any; //string | Buffer + ca?: any; //Array of string | Buffer + rejectUnauthorized?: boolean; + NPNProtocols?: any; //Array of string | Buffer + servername?: string; + } + + export interface Server extends net.Server { + // Extended base methods + listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server; + listen(path: string, listeningListener?: Function): Server; + listen(handle: any, listeningListener?: Function): Server; + + listen(port: number, host?: string, callback?: Function): Server; + close(): Server; + address(): { port: number; family: string; address: string; }; + addContext(hostName: string, credentials: { + key: string; + cert: string; + ca: string; + }): void; + maxConnections: number; + connections: number; + } + + export interface ClearTextStream extends stream.Duplex { + authorized: boolean; + authorizationError: Error; + getPeerCertificate(): any; + getCipher: { + name: string; + version: string; + }; + address: { + port: number; + family: string; + address: string; + }; + remoteAddress: string; + remotePort: number; + } + + export interface SecurePair { + encrypted: any; + cleartext: any; + } + + export interface SecureContextOptions { + pfx?: any; //string | buffer + key?: any; //string | buffer + passphrase?: string; + cert?: any; // string | buffer + ca?: any; // string | buffer + crl?: any; // string | string[] + ciphers?: string; + honorCipherOrder?: boolean; + } + + export interface SecureContext { + context: any; + } + + export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server; + export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream; + export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; + export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; + export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; + export function createSecureContext(details: SecureContextOptions): SecureContext; +} + +declare module "crypto" { + export interface CredentialDetails { + pfx: string; + key: string; + passphrase: string; + cert: string; + ca: any; //string | string array + crl: any; //string | string array + ciphers: string; + } + export interface Credentials { context?: any; } + export function createCredentials(details: CredentialDetails): Credentials; + export function createHash(algorithm: string): Hash; + export function createHmac(algorithm: string, key: string): Hmac; + export function createHmac(algorithm: string, key: Buffer): Hmac; + export interface Hash { + update(data: any, input_encoding?: string): Hash; + digest(encoding: 'buffer'): Buffer; + digest(encoding: string): any; + digest(): Buffer; + } + export interface Hmac extends NodeJS.ReadWriteStream { + update(data: any, input_encoding?: string): Hmac; + digest(encoding: 'buffer'): Buffer; + digest(encoding: string): any; + digest(): Buffer; + } + export function createCipher(algorithm: string, password: any): Cipher; + export function createCipheriv(algorithm: string, key: any, iv: any): Cipher; + export interface Cipher { + update(data: Buffer): Buffer; + update(data: string, input_encoding?: string, output_encoding?: string): string; + final(): Buffer; + final(output_encoding: string): string; + setAutoPadding(auto_padding: boolean): void; + getAuthTag(): Buffer; + } + export function createDecipher(algorithm: string, password: any): Decipher; + export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher; + export interface Decipher { + update(data: Buffer): Buffer; + update(data: string|Buffer, input_encoding?: string, output_encoding?: string): string; + update(data: string|Buffer, input_encoding?: string, output_encoding?: string): Buffer; + final(): Buffer; + final(output_encoding: string): string; + setAutoPadding(auto_padding: boolean): void; + setAuthTag(tag: Buffer): void; + } + export function createSign(algorithm: string): Signer; + export interface Signer extends NodeJS.WritableStream { + update(data: any): void; + sign(private_key: string, output_format: string): string; + } + export function createVerify(algorith: string): Verify; + export interface Verify extends NodeJS.WritableStream { + update(data: any): void; + verify(object: string, signature: string, signature_format?: string): boolean; + } + export function createDiffieHellman(prime_length: number): DiffieHellman; + export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman; + export interface DiffieHellman { + generateKeys(encoding?: string): string; + computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string; + getPrime(encoding?: string): string; + getGenerator(encoding: string): string; + getPublicKey(encoding?: string): string; + getPrivateKey(encoding?: string): string; + setPublicKey(public_key: string, encoding?: string): void; + setPrivateKey(public_key: string, encoding?: string): void; + } + export function getDiffieHellman(group_name: string): DiffieHellman; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string) : Buffer; + export function randomBytes(size: number): Buffer; + export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; + export function pseudoRandomBytes(size: number): Buffer; + export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; + export interface RsaPublicKey { + key: string; + padding?: any; + } + export interface RsaPrivateKey { + key: string; + passphrase?: string, + padding?: any; + } + export function publicEncrypt(public_key: string|RsaPublicKey, buffer: Buffer): Buffer + export function privateDecrypt(private_key: string|RsaPrivateKey, buffer: Buffer): Buffer +} + +declare module "stream" { + import * as events from "events"; + + export class Stream extends events.EventEmitter { + pipe(destination: T, options?: { end?: boolean; }): T; + } + + export interface ReadableOptions { + highWaterMark?: number; + encoding?: string; + objectMode?: boolean; + } + + export class Readable extends events.EventEmitter implements NodeJS.ReadableStream { + readable: boolean; + constructor(opts?: ReadableOptions); + _read(size: number): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: any): void; + wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; + push(chunk: any, encoding?: string): boolean; + } + + export interface WritableOptions { + highWaterMark?: number; + decodeStrings?: boolean; + objectMode?: boolean; + } + + export class Writable extends events.EventEmitter implements NodeJS.WritableStream { + writable: boolean; + constructor(opts?: WritableOptions); + _write(chunk: any, encoding: string, callback: Function): void; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; + end(): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; + } + + export interface DuplexOptions extends ReadableOptions, WritableOptions { + allowHalfOpen?: boolean; + } + + // Note: Duplex extends both Readable and Writable. + export class Duplex extends Readable implements NodeJS.ReadWriteStream { + writable: boolean; + constructor(opts?: DuplexOptions); + _write(chunk: any, encoding: string, callback: Function): void; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; + end(): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; + } + + export interface TransformOptions extends ReadableOptions, WritableOptions {} + + // Note: Transform lacks the _read and _write methods of Readable/Writable. + export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream { + readable: boolean; + writable: boolean; + constructor(opts?: TransformOptions); + _transform(chunk: any, encoding: string, callback: Function): void; + _flush(callback: Function): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: any): void; + wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; + push(chunk: any, encoding?: string): boolean; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; + end(): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; + } + + export class PassThrough extends Transform {} +} + +declare module "util" { + export interface InspectOptions { + showHidden?: boolean; + depth?: number; + colors?: boolean; + customInspect?: boolean; + } + + export function format(format: any, ...param: any[]): string; + export function debug(string: string): void; + export function error(...param: any[]): void; + export function puts(...param: any[]): void; + export function print(...param: any[]): void; + export function log(string: string): void; + export function inspect(object: any, showHidden?: boolean, depth?: number, color?: boolean): string; + export function inspect(object: any, options: InspectOptions): string; + export function isArray(object: any): boolean; + export function isRegExp(object: any): boolean; + export function isDate(object: any): boolean; + export function isError(object: any): boolean; + export function inherits(constructor: any, superConstructor: any): void; + export function debuglog(key:string): (msg:string,...param: any[])=>void; +} + +declare module "assert" { + function internal (value: any, message?: string): void; + module internal { + export class AssertionError implements Error { + name: string; + message: string; + actual: any; + expected: any; + operator: string; + generatedMessage: boolean; + + constructor(options?: {message?: string; actual?: any; expected?: any; + operator?: string; stackStartFunction?: Function}); + } + + export function fail(actual?: any, expected?: any, message?: string, operator?: string): void; + export function ok(value: any, message?: string): void; + export function equal(actual: any, expected: any, message?: string): void; + export function notEqual(actual: any, expected: any, message?: string): void; + export function deepEqual(actual: any, expected: any, message?: string): void; + export function notDeepEqual(acutal: any, expected: any, message?: string): void; + export function strictEqual(actual: any, expected: any, message?: string): void; + export function notStrictEqual(actual: any, expected: any, message?: string): void; + export function deepStrictEqual(actual: any, expected: any, message?: string): void; + export function notDeepStrictEqual(actual: any, expected: any, message?: string): void; + export var throws: { + (block: Function, message?: string): void; + (block: Function, error: Function, message?: string): void; + (block: Function, error: RegExp, message?: string): void; + (block: Function, error: (err: any) => boolean, message?: string): void; + }; + + export var doesNotThrow: { + (block: Function, message?: string): void; + (block: Function, error: Function, message?: string): void; + (block: Function, error: RegExp, message?: string): void; + (block: Function, error: (err: any) => boolean, message?: string): void; + }; + + export function ifError(value: any): void; + } + + export = internal; +} + +declare module "tty" { + import * as net from "net"; + + export function isatty(fd: number): boolean; + export interface ReadStream extends net.Socket { + isRaw: boolean; + setRawMode(mode: boolean): void; + isTTY: boolean; + } + export interface WriteStream extends net.Socket { + columns: number; + rows: number; + isTTY: boolean; + } +} + +declare module "domain" { + import * as events from "events"; + + export class Domain extends events.EventEmitter implements NodeJS.Domain { + run(fn: Function): void; + add(emitter: events.EventEmitter): void; + remove(emitter: events.EventEmitter): void; + bind(cb: (err: Error, data: any) => any): any; + intercept(cb: (data: any) => any): any; + dispose(): void; + } + + export function create(): Domain; +} + +declare module "constants" { + export var E2BIG: number; + export var EACCES: number; + export var EADDRINUSE: number; + export var EADDRNOTAVAIL: number; + export var EAFNOSUPPORT: number; + export var EAGAIN: number; + export var EALREADY: number; + export var EBADF: number; + export var EBADMSG: number; + export var EBUSY: number; + export var ECANCELED: number; + export var ECHILD: number; + export var ECONNABORTED: number; + export var ECONNREFUSED: number; + export var ECONNRESET: number; + export var EDEADLK: number; + export var EDESTADDRREQ: number; + export var EDOM: number; + export var EEXIST: number; + export var EFAULT: number; + export var EFBIG: number; + export var EHOSTUNREACH: number; + export var EIDRM: number; + export var EILSEQ: number; + export var EINPROGRESS: number; + export var EINTR: number; + export var EINVAL: number; + export var EIO: number; + export var EISCONN: number; + export var EISDIR: number; + export var ELOOP: number; + export var EMFILE: number; + export var EMLINK: number; + export var EMSGSIZE: number; + export var ENAMETOOLONG: number; + export var ENETDOWN: number; + export var ENETRESET: number; + export var ENETUNREACH: number; + export var ENFILE: number; + export var ENOBUFS: number; + export var ENODATA: number; + export var ENODEV: number; + export var ENOENT: number; + export var ENOEXEC: number; + export var ENOLCK: number; + export var ENOLINK: number; + export var ENOMEM: number; + export var ENOMSG: number; + export var ENOPROTOOPT: number; + export var ENOSPC: number; + export var ENOSR: number; + export var ENOSTR: number; + export var ENOSYS: number; + export var ENOTCONN: number; + export var ENOTDIR: number; + export var ENOTEMPTY: number; + export var ENOTSOCK: number; + export var ENOTSUP: number; + export var ENOTTY: number; + export var ENXIO: number; + export var EOPNOTSUPP: number; + export var EOVERFLOW: number; + export var EPERM: number; + export var EPIPE: number; + export var EPROTO: number; + export var EPROTONOSUPPORT: number; + export var EPROTOTYPE: number; + export var ERANGE: number; + export var EROFS: number; + export var ESPIPE: number; + export var ESRCH: number; + export var ETIME: number; + export var ETIMEDOUT: number; + export var ETXTBSY: number; + export var EWOULDBLOCK: number; + export var EXDEV: number; + export var WSAEINTR: number; + export var WSAEBADF: number; + export var WSAEACCES: number; + export var WSAEFAULT: number; + export var WSAEINVAL: number; + export var WSAEMFILE: number; + export var WSAEWOULDBLOCK: number; + export var WSAEINPROGRESS: number; + export var WSAEALREADY: number; + export var WSAENOTSOCK: number; + export var WSAEDESTADDRREQ: number; + export var WSAEMSGSIZE: number; + export var WSAEPROTOTYPE: number; + export var WSAENOPROTOOPT: number; + export var WSAEPROTONOSUPPORT: number; + export var WSAESOCKTNOSUPPORT: number; + export var WSAEOPNOTSUPP: number; + export var WSAEPFNOSUPPORT: number; + export var WSAEAFNOSUPPORT: number; + export var WSAEADDRINUSE: number; + export var WSAEADDRNOTAVAIL: number; + export var WSAENETDOWN: number; + export var WSAENETUNREACH: number; + export var WSAENETRESET: number; + export var WSAECONNABORTED: number; + export var WSAECONNRESET: number; + export var WSAENOBUFS: number; + export var WSAEISCONN: number; + export var WSAENOTCONN: number; + export var WSAESHUTDOWN: number; + export var WSAETOOMANYREFS: number; + export var WSAETIMEDOUT: number; + export var WSAECONNREFUSED: number; + export var WSAELOOP: number; + export var WSAENAMETOOLONG: number; + export var WSAEHOSTDOWN: number; + export var WSAEHOSTUNREACH: number; + export var WSAENOTEMPTY: number; + export var WSAEPROCLIM: number; + export var WSAEUSERS: number; + export var WSAEDQUOT: number; + export var WSAESTALE: number; + export var WSAEREMOTE: number; + export var WSASYSNOTREADY: number; + export var WSAVERNOTSUPPORTED: number; + export var WSANOTINITIALISED: number; + export var WSAEDISCON: number; + export var WSAENOMORE: number; + export var WSAECANCELLED: number; + export var WSAEINVALIDPROCTABLE: number; + export var WSAEINVALIDPROVIDER: number; + export var WSAEPROVIDERFAILEDINIT: number; + export var WSASYSCALLFAILURE: number; + export var WSASERVICE_NOT_FOUND: number; + export var WSATYPE_NOT_FOUND: number; + export var WSA_E_NO_MORE: number; + export var WSA_E_CANCELLED: number; + export var WSAEREFUSED: number; + export var SIGHUP: number; + export var SIGINT: number; + export var SIGILL: number; + export var SIGABRT: number; + export var SIGFPE: number; + export var SIGKILL: number; + export var SIGSEGV: number; + export var SIGTERM: number; + export var SIGBREAK: number; + export var SIGWINCH: number; + export var SSL_OP_ALL: number; + export var SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; + export var SSL_OP_CIPHER_SERVER_PREFERENCE: number; + export var SSL_OP_CISCO_ANYCONNECT: number; + export var SSL_OP_COOKIE_EXCHANGE: number; + export var SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; + export var SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; + export var SSL_OP_EPHEMERAL_RSA: number; + export var SSL_OP_LEGACY_SERVER_CONNECT: number; + export var SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number; + export var SSL_OP_MICROSOFT_SESS_ID_BUG: number; + export var SSL_OP_MSIE_SSLV2_RSA_PADDING: number; + export var SSL_OP_NETSCAPE_CA_DN_BUG: number; + export var SSL_OP_NETSCAPE_CHALLENGE_BUG: number; + export var SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number; + export var SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number; + export var SSL_OP_NO_COMPRESSION: number; + export var SSL_OP_NO_QUERY_MTU: number; + export var SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; + export var SSL_OP_NO_SSLv2: number; + export var SSL_OP_NO_SSLv3: number; + export var SSL_OP_NO_TICKET: number; + export var SSL_OP_NO_TLSv1: number; + export var SSL_OP_NO_TLSv1_1: number; + export var SSL_OP_NO_TLSv1_2: number; + export var SSL_OP_PKCS1_CHECK_1: number; + export var SSL_OP_PKCS1_CHECK_2: number; + export var SSL_OP_SINGLE_DH_USE: number; + export var SSL_OP_SINGLE_ECDH_USE: number; + export var SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number; + export var SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number; + export var SSL_OP_TLS_BLOCK_PADDING_BUG: number; + export var SSL_OP_TLS_D5_BUG: number; + export var SSL_OP_TLS_ROLLBACK_BUG: number; + export var ENGINE_METHOD_DSA: number; + export var ENGINE_METHOD_DH: number; + export var ENGINE_METHOD_RAND: number; + export var ENGINE_METHOD_ECDH: number; + export var ENGINE_METHOD_ECDSA: number; + export var ENGINE_METHOD_CIPHERS: number; + export var ENGINE_METHOD_DIGESTS: number; + export var ENGINE_METHOD_STORE: number; + export var ENGINE_METHOD_PKEY_METHS: number; + export var ENGINE_METHOD_PKEY_ASN1_METHS: number; + export var ENGINE_METHOD_ALL: number; + export var ENGINE_METHOD_NONE: number; + export var DH_CHECK_P_NOT_SAFE_PRIME: number; + export var DH_CHECK_P_NOT_PRIME: number; + export var DH_UNABLE_TO_CHECK_GENERATOR: number; + export var DH_NOT_SUITABLE_GENERATOR: number; + export var NPN_ENABLED: number; + export var RSA_PKCS1_PADDING: number; + export var RSA_SSLV23_PADDING: number; + export var RSA_NO_PADDING: number; + export var RSA_PKCS1_OAEP_PADDING: number; + export var RSA_X931_PADDING: number; + export var RSA_PKCS1_PSS_PADDING: number; + export var POINT_CONVERSION_COMPRESSED: number; + export var POINT_CONVERSION_UNCOMPRESSED: number; + export var POINT_CONVERSION_HYBRID: number; + export var O_RDONLY: number; + export var O_WRONLY: number; + export var O_RDWR: number; + export var S_IFMT: number; + export var S_IFREG: number; + export var S_IFDIR: number; + export var S_IFCHR: number; + export var S_IFLNK: number; + export var O_CREAT: number; + export var O_EXCL: number; + export var O_TRUNC: number; + export var O_APPEND: number; + export var F_OK: number; + export var R_OK: number; + export var W_OK: number; + export var X_OK: number; + export var UV_UDP_REUSEADDR: number; +} \ No newline at end of file diff --git a/typings/browser/ambient/react/index.d.ts b/typings/browser/ambient/react/index.d.ts new file mode 100644 index 00000000..052450e0 --- /dev/null +++ b/typings/browser/ambient/react/index.d.ts @@ -0,0 +1,2407 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/945ebfe049964e429c2530971b9081f3c0f611df/react/react.d.ts +// Type definitions for React v0.14 +// Project: http://facebook.github.io/react/ +// Definitions by: Asana , AssureSign , Microsoft +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace __React { + + // + // React Elements + // ---------------------------------------------------------------------- + + type ReactType = string | ComponentClass | StatelessComponent; + type Key = string | number; + type Ref = string | ((instance: T) => any); + + interface ReactElement

> { + type: string | ComponentClass

| StatelessComponent

; + props: P; + key: Key; + ref: Ref | Element>; + } + + interface ClassicElement

extends ReactElement

{ + type: ClassicComponentClass

; + ref: Ref>; + } + + interface DOMElement

> extends ReactElement

{ + type: string; + ref: Ref; + } + + interface ReactHTMLElement extends DOMElement> { + ref: Ref; + } + + interface ReactSVGElement extends DOMElement { + ref: Ref; + } + + // + // Factories + // ---------------------------------------------------------------------- + + interface Factory

{ + (props?: P, ...children: ReactNode[]): ReactElement

; + } + + interface ClassicFactory

extends Factory

{ + (props?: P, ...children: ReactNode[]): ClassicElement

; + } + + interface DOMFactory

> extends Factory

{ + (props?: P, ...children: ReactNode[]): DOMElement

; + } + + type HTMLFactory = DOMFactory>; + type SVGFactory = DOMFactory; + + // + // React Nodes + // http://facebook.github.io/react/docs/glossary.html + // ---------------------------------------------------------------------- + + type ReactText = string | number; + type ReactChild = ReactElement | ReactText; + + // Should be Array but type aliases cannot be recursive + type ReactFragment = {} | Array; + type ReactNode = ReactChild | ReactFragment | boolean; + + // + // Top Level API + // ---------------------------------------------------------------------- + + function createClass(spec: ComponentSpec): ClassicComponentClass

; + + function createFactory

(type: string): DOMFactory

; + function createFactory

(type: ClassicComponentClass

): ClassicFactory

; + function createFactory

(type: ComponentClass

| StatelessComponent

): Factory

; + + function createElement

( + type: string, + props?: P, + ...children: ReactNode[]): DOMElement

; + function createElement

( + type: ClassicComponentClass

, + props?: P, + ...children: ReactNode[]): ClassicElement

; + function createElement

( + type: ComponentClass

| StatelessComponent

, + props?: P, + ...children: ReactNode[]): ReactElement

; + + function cloneElement( + element: ReactHTMLElement, + props?: HTMLProps, + ...children: ReactNode[]): ReactHTMLElement; + function cloneElement( + element: ReactSVGElement, + props?: SVGProps, + ...children: ReactNode[]): ReactSVGElement; + function cloneElement

( + element: ClassicElement

, + props?: Q, + ...children: ReactNode[]): ClassicElement

; + function cloneElement

( + element: ReactElement

, + props?: Q, + ...children: ReactNode[]): ReactElement

; + + function isValidElement(object: {}): boolean; + + var DOM: ReactDOM; + var PropTypes: ReactPropTypes; + var Children: ReactChildren; + + // + // Component API + // ---------------------------------------------------------------------- + + type ReactInstance = Component | Element; + + // Base component for plain JS classes + class Component implements ComponentLifecycle { + constructor(props?: P, context?: any); + setState(f: (prevState: S, props: P) => S, callback?: () => any): void; + setState(state: S, callback?: () => any): void; + forceUpdate(callBack?: () => any): void; + render(): JSX.Element; + props: P; + state: S; + context: {}; + refs: { + [key: string]: ReactInstance + }; + } + + interface ClassicComponent extends Component { + replaceState(nextState: S, callback?: () => any): void; + isMounted(): boolean; + getInitialState?(): S; + } + + interface ChildContextProvider { + getChildContext(): CC; + } + + // + // Class Interfaces + // ---------------------------------------------------------------------- + + interface StatelessComponent

{ + (props?: P, context?: any): ReactElement; + propTypes?: ValidationMap

; + contextTypes?: ValidationMap; + defaultProps?: P; + displayName?: string; + } + + interface ComponentClass

{ + new(props?: P, context?: any): Component; + propTypes?: ValidationMap

; + contextTypes?: ValidationMap; + childContextTypes?: ValidationMap; + defaultProps?: P; + } + + interface ClassicComponentClass

extends ComponentClass

> { + type: string | ComponentClass

| StatelessComponent

; + props: P; + key: Key; + ref: Ref | Element>; + } + + interface ClassicElement

extends ReactElement

{ + type: ClassicComponentClass

; + ref: Ref>; + } + + interface DOMElement

> extends ReactElement

{ + type: string; + ref: Ref; + } + + interface ReactHTMLElement extends DOMElement> { + ref: Ref; + } + + interface ReactSVGElement extends DOMElement { + ref: Ref; + } + + // + // Factories + // ---------------------------------------------------------------------- + + interface Factory

{ + (props?: P, ...children: ReactNode[]): ReactElement

; + } + + interface ClassicFactory

extends Factory

{ + (props?: P, ...children: ReactNode[]): ClassicElement

; + } + + interface DOMFactory

> extends Factory

{ + (props?: P, ...children: ReactNode[]): DOMElement

; + } + + type HTMLFactory = DOMFactory>; + type SVGFactory = DOMFactory; + + // + // React Nodes + // http://facebook.github.io/react/docs/glossary.html + // ---------------------------------------------------------------------- + + type ReactText = string | number; + type ReactChild = ReactElement | ReactText; + + // Should be Array but type aliases cannot be recursive + type ReactFragment = {} | Array; + type ReactNode = ReactChild | ReactFragment | boolean; + + // + // Top Level API + // ---------------------------------------------------------------------- + + function createClass(spec: ComponentSpec): ClassicComponentClass

; + + function createFactory

(type: string): DOMFactory

; + function createFactory

(type: ClassicComponentClass

): ClassicFactory

; + function createFactory

(type: ComponentClass

| StatelessComponent

): Factory

; + + function createElement

( + type: string, + props?: P, + ...children: ReactNode[]): DOMElement

; + function createElement

( + type: ClassicComponentClass

, + props?: P, + ...children: ReactNode[]): ClassicElement

; + function createElement

( + type: ComponentClass

| StatelessComponent

, + props?: P, + ...children: ReactNode[]): ReactElement

; + + function cloneElement( + element: ReactHTMLElement, + props?: HTMLProps, + ...children: ReactNode[]): ReactHTMLElement; + function cloneElement( + element: ReactSVGElement, + props?: SVGProps, + ...children: ReactNode[]): ReactSVGElement; + function cloneElement

( + element: ClassicElement

, + props?: Q, + ...children: ReactNode[]): ClassicElement

; + function cloneElement

( + element: ReactElement

, + props?: Q, + ...children: ReactNode[]): ReactElement

; + + function isValidElement(object: {}): boolean; + + var DOM: ReactDOM; + var PropTypes: ReactPropTypes; + var Children: ReactChildren; + + // + // Component API + // ---------------------------------------------------------------------- + + type ReactInstance = Component | Element; + + // Base component for plain JS classes + class Component implements ComponentLifecycle { + constructor(props?: P, context?: any); + setState(f: (prevState: S, props: P) => S, callback?: () => any): void; + setState(state: S, callback?: () => any): void; + forceUpdate(callBack?: () => any): void; + render(): JSX.Element; + props: P; + state: S; + context: {}; + refs: { + [key: string]: ReactInstance + }; + } + + interface ClassicComponent extends Component { + replaceState(nextState: S, callback?: () => any): void; + isMounted(): boolean; + getInitialState?(): S; + } + + interface ChildContextProvider { + getChildContext(): CC; + } + + // + // Class Interfaces + // ---------------------------------------------------------------------- + + interface StatelessComponent

{ + (props?: P, context?: any): ReactElement; + propTypes?: ValidationMap

; + contextTypes?: ValidationMap; + defaultProps?: P; + displayName?: string; + } + + interface ComponentClass

{ + new(props?: P, context?: any): Component; + propTypes?: ValidationMap

; + contextTypes?: ValidationMap; + childContextTypes?: ValidationMap; + defaultProps?: P; + } + + interface ClassicComponentClass

extends ComponentClass

{ + new(props?: P, context?: any): ClassicComponent; + getDefaultProps?(): P; + displayName?: string; + } + + // + // Component Specs and Lifecycle + // ---------------------------------------------------------------------- + + interface ComponentLifecycle { + componentWillMount?(): void; + componentDidMount?(): void; + componentWillReceiveProps?(nextProps: P, nextContext: any): void; + shouldComponentUpdate?(nextProps: P, nextState: S, nextContext: any): boolean; + componentWillUpdate?(nextProps: P, nextState: S, nextContext: any): void; + componentDidUpdate?(prevProps: P, prevState: S, prevContext: any): void; + componentWillUnmount?(): void; + } + + interface Mixin extends ComponentLifecycle { + mixins?: Mixin; + statics?: { + [key: string]: any; + }; + + displayName?: string; + propTypes?: ValidationMap; + contextTypes?: ValidationMap; + childContextTypes?: ValidationMap; + + getDefaultProps?(): P; + getInitialState?(): S; + } + + interface ComponentSpec extends Mixin { + render(): ReactElement; + + [propertyName: string]: any; + } + + // + // Event System + // ---------------------------------------------------------------------- + + interface SyntheticEvent { + bubbles: boolean; + cancelable: boolean; + currentTarget: EventTarget; + defaultPrevented: boolean; + eventPhase: number; + isTrusted: boolean; + nativeEvent: Event; + preventDefault(): void; + stopPropagation(): void; + target: EventTarget; + timeStamp: Date; + type: string; + } + + interface ClipboardEvent extends SyntheticEvent { + clipboardData: DataTransfer; + } + + interface CompositionEvent extends SyntheticEvent { + data: string; + } + + interface DragEvent extends SyntheticEvent { + dataTransfer: DataTransfer; + } + + interface FocusEvent extends SyntheticEvent { + relatedTarget: EventTarget; + } + + interface FormEvent extends SyntheticEvent { + } + + interface KeyboardEvent extends SyntheticEvent { + altKey: boolean; + charCode: number; + ctrlKey: boolean; + getModifierState(key: string): boolean; + key: string; + keyCode: number; + locale: string; + location: number; + metaKey: boolean; + repeat: boolean; + shiftKey: boolean; + which: number; + } + + interface MouseEvent extends SyntheticEvent { + altKey: boolean; + button: number; + buttons: number; + clientX: number; + clientY: number; + ctrlKey: boolean; + getModifierState(key: string): boolean; + metaKey: boolean; + pageX: number; + pageY: number; + relatedTarget: EventTarget; + screenX: number; + screenY: number; + shiftKey: boolean; + } + + interface TouchEvent extends SyntheticEvent { + altKey: boolean; + changedTouches: TouchList; + ctrlKey: boolean; + getModifierState(key: string): boolean; + metaKey: boolean; + shiftKey: boolean; + targetTouches: TouchList; + touches: TouchList; + } + + interface UIEvent extends SyntheticEvent { + detail: number; + view: AbstractView; + } + + interface WheelEvent extends SyntheticEvent { + deltaMode: number; + deltaX: number; + deltaY: number; + deltaZ: number; + } + + // + // Event Handler Types + // ---------------------------------------------------------------------- + + interface EventHandler { + (event: E): void; + } + + type ReactEventHandler = EventHandler; + + type ClipboardEventHandler = EventHandler; + type CompositionEventHandler = EventHandler; + type DragEventHandler = EventHandler; + type FocusEventHandler = EventHandler; + type FormEventHandler = EventHandler; + type KeyboardEventHandler = EventHandler; + type MouseEventHandler = EventHandler; + type TouchEventHandler = EventHandler; + type UIEventHandler = EventHandler; + type WheelEventHandler = EventHandler; + + // + // Props / DOM Attributes + // ---------------------------------------------------------------------- + + interface Props { + children?: ReactNode; + key?: Key; + ref?: Ref; + } + + interface HTMLProps extends HTMLAttributes, Props { + } + + interface SVGProps extends SVGAttributes, Props { + } + + interface DOMAttributes { + dangerouslySetInnerHTML?: { + __html: string; + }; + + // Clipboard Events + onCopy?: ClipboardEventHandler; + onCut?: ClipboardEventHandler; + onPaste?: ClipboardEventHandler; + + // Composition Events + onCompositionEnd?: CompositionEventHandler; + onCompositionStart?: CompositionEventHandler; + onCompositionUpdate?: CompositionEventHandler; + + // Focus Events + onFocus?: FocusEventHandler; + onBlur?: FocusEventHandler; + + // Form Events + onChange?: FormEventHandler; + onInput?: FormEventHandler; + onSubmit?: FormEventHandler; + + // Image Events + onLoad?: ReactEventHandler; + onError?: ReactEventHandler; // also a Media Event + + // Keyboard Events + onKeyDown?: KeyboardEventHandler; + onKeyPress?: KeyboardEventHandler; + onKeyUp?: KeyboardEventHandler; + + // Media Events + onAbort?: ReactEventHandler; + onCanPlay?: ReactEventHandler; + onCanPlayThrough?: ReactEventHandler; + onDurationChange?: ReactEventHandler; + onEmptied?: ReactEventHandler; + onEncrypted?: ReactEventHandler; + onEnded?: ReactEventHandler; + onLoadedData?: ReactEventHandler; + onLoadedMetadata?: ReactEventHandler; + onLoadStart?: ReactEventHandler; + onPause?: ReactEventHandler; + onPlay?: ReactEventHandler; + onPlaying?: ReactEventHandler; + onProgress?: ReactEventHandler; + onRateChange?: ReactEventHandler; + onSeeked?: ReactEventHandler; + onSeeking?: ReactEventHandler; + onStalled?: ReactEventHandler; + onSuspend?: ReactEventHandler; + onTimeUpdate?: ReactEventHandler; + onVolumeChange?: ReactEventHandler; + onWaiting?: ReactEventHandler; + + // MouseEvents + onClick?: MouseEventHandler; + onContextMenu?: MouseEventHandler; + onDoubleClick?: MouseEventHandler; + onDrag?: DragEventHandler; + onDragEnd?: DragEventHandler; + onDragEnter?: DragEventHandler; + onDragExit?: DragEventHandler; + onDragLeave?: DragEventHandler; + onDragOver?: DragEventHandler; + onDragStart?: DragEventHandler; + onDrop?: DragEventHandler; + onMouseDown?: MouseEventHandler; + onMouseEnter?: MouseEventHandler; + onMouseLeave?: MouseEventHandler; + onMouseMove?: MouseEventHandler; + onMouseOut?: MouseEventHandler; + onMouseOver?: MouseEventHandler; + onMouseUp?: MouseEventHandler; + + // Selection Events + onSelect?: ReactEventHandler; + + // Touch Events + onTouchCancel?: TouchEventHandler; + onTouchEnd?: TouchEventHandler; + onTouchMove?: TouchEventHandler; + onTouchStart?: TouchEventHandler; + + // UI Events + onScroll?: UIEventHandler; + + // Wheel Events + onWheel?: WheelEventHandler; + } + + // This interface is not complete. Only properties accepting + // unitless numbers are listed here (see CSSProperty.js in React) + interface CSSProperties { + + /** + * Aligns a flex container's lines within the flex container when there is extra space in the cross-axis, similar to how justify-content aligns individual items within the main-axis. + */ + alignContent?: any; + + /** + * Sets the default alignment in the cross axis for all of the flex container's items, including anonymous flex items, similarly to how justify-content aligns items along the main axis. + */ + alignItems?: any; + + /** + * Allows the default alignment to be overridden for individual flex items. + */ + alignSelf?: any; + + /** + * This property allows precise alignment of elements, such as graphics, that do not have a baseline-table or lack the desired baseline in their baseline-table. With the alignment-adjust property, the position of the baseline identified by the alignment-baseline can be explicitly determined. It also determines precisely the alignment point for each glyph within a textual element. + */ + alignmentAdjust?: any; + + alignmentBaseline?: any; + + /** + * Defines a length of time to elapse before an animation starts, allowing an animation to begin execution some time after it is applied. + */ + animationDelay?: any; + + /** + * Defines whether an animation should run in reverse on some or all cycles. + */ + animationDirection?: any; + + /** + * Specifies how many times an animation cycle should play. + */ + animationIterationCount?: any; + + /** + * Defines the list of animations that apply to the element. + */ + animationName?: any; + + /** + * Defines whether an animation is running or paused. + */ + animationPlayState?: any; + + /** + * Allows changing the style of any element to platform-based interface elements or vice versa. + */ + appearance?: any; + + /** + * Determines whether or not the “back” side of a transformed element is visible when facing the viewer. + */ + backfaceVisibility?: any; + + /** + * Shorthand property to set the values for one or more of: + * background-clip, background-color, background-image, + * background-origin, background-position, background-repeat, + * background-size, and background-attachment. + */ + background?: any; + + /** + * If a background-image is specified, this property determines + * whether that image's position is fixed within the viewport, + * or scrolls along with its containing block. + */ + backgroundAttachment?: "scroll" | "fixed" | "local"; + + /** + * This property describes how the element's background images should blend with each other and the element's background color. + * The value is a list of blend modes that corresponds to each background image. Each element in the list will apply to the corresponding element of background-image. If a property doesn’t have enough comma-separated values to match the number of layers, the UA must calculate its used value by repeating the list of values until there are enough. + */ + backgroundBlendMode?: any; + + /** + * Sets the background color of an element. + */ + backgroundColor?: any; + + backgroundComposite?: any; + + /** + * Applies one or more background images to an element. These can be any valid CSS image, including url() paths to image files or CSS gradients. + */ + backgroundImage?: any; + + /** + * Specifies what the background-position property is relative to. + */ + backgroundOrigin?: any; + + /** + * Sets the position of a background image. + */ + backgroundPosition?: any; + + /** + * Background-repeat defines if and how background images will be repeated after they have been sized and positioned + */ + backgroundRepeat?: any; + + /** + * Obsolete - spec retired, not implemented. + */ + baselineShift?: any; + + /** + * Non standard. Sets or retrieves the location of the Dynamic HTML (DHTML) behavior. + */ + behavior?: any; + + /** + * Shorthand property that defines the different properties of all four sides of an element's border in a single declaration. It can be used to set border-width, border-style and border-color, or a subset of these. + */ + border?: any; + + /** + * Shorthand that sets the values of border-bottom-color, + * border-bottom-style, and border-bottom-width. + */ + borderBottom?: any; + + /** + * Sets the color of the bottom border of an element. + */ + borderBottomColor?: any; + + /** + * Defines the shape of the border of the bottom-left corner. + */ + borderBottomLeftRadius?: any; + + /** + * Defines the shape of the border of the bottom-right corner. + */ + borderBottomRightRadius?: any; + + /** + * Sets the line style of the bottom border of a box. + */ + borderBottomStyle?: any; + + /** + * Sets the width of an element's bottom border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderBottomWidth?: any; + + /** + * Border-collapse can be used for collapsing the borders between table cells + */ + borderCollapse?: any; + + /** + * The CSS border-color property sets the color of an element's four borders. This property can have from one to four values, made up of the elementary properties: • border-top-color + * • border-right-color + * • border-bottom-color + * • border-left-color The default color is the currentColor of each of these values. + * If you provide one value, it sets the color for the element. Two values set the horizontal and vertical values, respectively. Providing three values sets the top, vertical, and bottom values, in that order. Four values set all for sides: top, right, bottom, and left, in that order. + */ + borderColor?: any; + + /** + * Specifies different corner clipping effects, such as scoop (inner curves), bevel (straight cuts) or notch (cut-off rectangles). Works along with border-radius to specify the size of each corner effect. + */ + borderCornerShape?: any; + + /** + * The property border-image-source is used to set the image to be used instead of the border style. If this is set to none the border-style is used instead. + */ + borderImageSource?: any; + + /** + * The border-image-width CSS property defines the offset to use for dividing the border image in nine parts, the top-left corner, central top edge, top-right-corner, central right edge, bottom-right corner, central bottom edge, bottom-left corner, and central right edge. They represent inward distance from the top, right, bottom, and left edges. + */ + borderImageWidth?: any; + + /** + * Shorthand property that defines the border-width, border-style and border-color of an element's left border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the left border — border-left-width, border-left-style and border-left-color. + */ + borderLeft?: any; + + /** + * The CSS border-left-color property sets the color of an element's left border. This page explains the border-left-color value, but often you will find it more convenient to fix the border's left color as part of a shorthand set, either border-left or border-color. + * Colors can be defined several ways. For more information, see Usage. + */ + borderLeftColor?: any; + + /** + * Sets the style of an element's left border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. + */ + borderLeftStyle?: any; + + /** + * Sets the width of an element's left border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderLeftWidth?: any; + + /** + * Shorthand property that defines the border-width, border-style and border-color of an element's right border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the right border — border-right-width, border-right-style and border-right-color. + */ + borderRight?: any; + + /** + * Sets the color of an element's right border. This page explains the border-right-color value, but often you will find it more convenient to fix the border's right color as part of a shorthand set, either border-right or border-color. + * Colors can be defined several ways. For more information, see Usage. + */ + borderRightColor?: any; + + /** + * Sets the style of an element's right border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. + */ + borderRightStyle?: any; + + /** + * Sets the width of an element's right border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderRightWidth?: any; + + /** + * Specifies the distance between the borders of adjacent cells. + */ + borderSpacing?: any; + + /** + * Sets the style of an element's four borders. This property can have from one to four values. With only one value, the value will be applied to all four borders; otherwise, this works as a shorthand property for each of border-top-style, border-right-style, border-bottom-style, border-left-style, where each border style may be assigned a separate value. + */ + borderStyle?: any; + + /** + * Shorthand property that defines the border-width, border-style and border-color of an element's top border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the top border — border-top-width, border-top-style and border-top-color. + */ + borderTop?: any; + + /** + * Sets the color of an element's top border. This page explains the border-top-color value, but often you will find it more convenient to fix the border's top color as part of a shorthand set, either border-top or border-color. + * Colors can be defined several ways. For more information, see Usage. + */ + borderTopColor?: any; + + /** + * Sets the rounding of the top-left corner of the element. + */ + borderTopLeftRadius?: any; + + /** + * Sets the rounding of the top-right corner of the element. + */ + borderTopRightRadius?: any; + + /** + * Sets the style of an element's top border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. + */ + borderTopStyle?: any; + + /** + * Sets the width of an element's top border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderTopWidth?: any; + + /** + * Sets the width of an element's four borders. This property can have from one to four values. This is a shorthand property for setting values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderWidth?: any; + + /** + * This property specifies how far an absolutely positioned box's bottom margin edge is offset above the bottom edge of the box's containing block. For relatively positioned boxes, the offset is with respect to the bottom edges of the box itself (i.e., the box is given a position in the normal flow, then offset from that position according to these properties). + */ + bottom?: any; + + /** + * Obsolete. + */ + boxAlign?: any; + + /** + * Breaks a box into fragments creating new borders, padding and repeating backgrounds or lets it stay as a continuous box on a page break, column break, or, for inline elements, at a line break. + */ + boxDecorationBreak?: any; + + /** + * Deprecated + */ + boxDirection?: any; + + /** + * Do not use. This property has been replaced by the flex-wrap property. + * Gets or sets a value that specifies the direction to add successive rows or columns when the value of box-lines is set to multiple. + */ + boxLineProgression?: any; + + /** + * Do not use. This property has been replaced by the flex-wrap property. + * Gets or sets a value that specifies whether child elements wrap onto multiple lines or columns based on the space available in the object. + */ + boxLines?: any; + + /** + * Do not use. This property has been replaced by flex-order. + * Specifies the ordinal group that a child element of the object belongs to. This ordinal value identifies the display order (along the axis defined by the box-orient property) for the group. + */ + boxOrdinalGroup?: any; + + /** + * Deprecated. + */ + boxFlex?: number; + + /** + * Deprecated. + */ + boxFlexGroup?: number; + + /** + * The CSS break-after property allows you to force a break on multi-column layouts. More specifically, it allows you to force a break after an element. It allows you to determine if a break should occur, and what type of break it should be. The break-after CSS property describes how the page, column or region break behaves after the generated box. If there is no generated box, the property is ignored. + */ + breakAfter?: any; + + /** + * Control page/column/region breaks that fall above a block of content + */ + breakBefore?: any; + + /** + * Control page/column/region breaks that fall within a block of content + */ + breakInside?: any; + + /** + * The clear CSS property specifies if an element can be positioned next to or must be positioned below the floating elements that precede it in the markup. + */ + clear?: any; + + /** + * Deprecated; see clip-path. + * Lets you specify the dimensions of an absolutely positioned element that should be visible, and the element is clipped into this shape, and displayed. + */ + clip?: any; + + /** + * Clipping crops an graphic, so that only a portion of the graphic is rendered, or filled. This clip-rule property, when used with the clip-path property, defines which clip rule, or algorithm, to use when filling the different parts of a graphics. + */ + clipRule?: any; + + /** + * The color property sets the color of an element's foreground content (usually text), accepting any standard CSS color from keywords and hex values to RGB(a) and HSL(a). + */ + color?: any; + + /** + * Describes the number of columns of the element. + */ + columnCount?: number; + + /** + * Specifies how to fill columns (balanced or sequential). + */ + columnFill?: any; + + /** + * The column-gap property controls the width of the gap between columns in multi-column elements. + */ + columnGap?: any; + + /** + * Sets the width, style, and color of the rule between columns. + */ + columnRule?: any; + + /** + * Specifies the color of the rule between columns. + */ + columnRuleColor?: any; + + /** + * Specifies the width of the rule between columns. + */ + columnRuleWidth?: any; + + /** + * The column-span CSS property makes it possible for an element to span across all columns when its value is set to all. An element that spans more than one column is called a spanning element. + */ + columnSpan?: any; + + /** + * Specifies the width of columns in multi-column elements. + */ + columnWidth?: any; + + /** + * This property is a shorthand property for setting column-width and/or column-count. + */ + columns?: any; + + /** + * The counter-increment property accepts one or more names of counters (identifiers), each one optionally followed by an integer which specifies the value by which the counter should be incremented (e.g. if the value is 2, the counter increases by 2 each time it is invoked). + */ + counterIncrement?: any; + + /** + * The counter-reset property contains a list of one or more names of counters, each one optionally followed by an integer (otherwise, the integer defaults to 0.) Each time the given element is invoked, the counters specified by the property are set to the given integer. + */ + counterReset?: any; + + /** + * The cue property specifies sound files (known as an "auditory icon") to be played by speech media agents before and after presenting an element's content; if only one file is specified, it is played both before and after. The volume at which the file(s) should be played, relative to the volume of the main element, may also be specified. The icon files may also be set separately with the cue-before and cue-after properties. + */ + cue?: any; + + /** + * The cue-after property specifies a sound file (known as an "auditory icon") to be played by speech media agents after presenting an element's content; the volume at which the file should be played may also be specified. The shorthand property cue sets cue sounds for both before and after the element is presented. + */ + cueAfter?: any; + + /** + * Specifies the mouse cursor displayed when the mouse pointer is over an element. + */ + cursor?: any; + + /** + * The direction CSS property specifies the text direction/writing direction. The rtl is used for Hebrew or Arabic text, the ltr is for other languages. + */ + direction?: any; + + /** + * This property specifies the type of rendering box used for an element. It is a shorthand property for many other display properties. + */ + display?: any; + + /** + * The ‘fill’ property paints the interior of the given graphical element. The area to be painted consists of any areas inside the outline of the shape. To determine the inside of the shape, all subpaths are considered, and the interior is determined according to the rules associated with the current value of the ‘fill-rule’ property. The zero-width geometric outline of a shape is included in the area to be painted. + */ + fill?: any; + + /** + * SVG: Specifies the opacity of the color or the content the current object is filled with. + */ + fillOpacity?: number; + + /** + * The ‘fill-rule’ property indicates the algorithm which is to be used to determine what parts of the canvas are included inside the shape. For a simple, non-intersecting path, it is intuitively clear what region lies "inside"; however, for a more complex path, such as a path that intersects itself or where one subpath encloses another, the interpretation of "inside" is not so obvious. + * The ‘fill-rule’ property provides two options for how the inside of a shape is determined: + */ + fillRule?: any; + + /** + * Applies various image processing effects. This property is largely unsupported. See Compatibility section for more information. + */ + filter?: any; + + /** + * Shorthand for `flex-grow`, `flex-shrink`, and `flex-basis`. + */ + flex?: number | string; + + /** + * Obsolete, do not use. This property has been renamed to align-items. + * Specifies the alignment (perpendicular to the layout axis defined by the flex-direction property) of child elements of the object. + */ + flexAlign?: any; + + /** + * The flex-basis CSS property describes the initial main size of the flex item before any free space is distributed according to the flex factors described in the flex property (flex-grow and flex-shrink). + */ + flexBasis?: any; + + /** + * The flex-direction CSS property describes how flex items are placed in the flex container, by setting the direction of the flex container's main axis. + */ + flexDirection?: any; + + /** + * The flex-flow CSS property defines the flex container's main and cross axis. It is a shorthand property for the flex-direction and flex-wrap properties. + */ + flexFlow?: any; + + /** + * Specifies the flex grow factor of a flex item. + */ + flexGrow?: number; + + /** + * Do not use. This property has been renamed to align-self + * Specifies the alignment (perpendicular to the layout axis defined by flex-direction) of child elements of the object. + */ + flexItemAlign?: any; + + /** + * Do not use. This property has been renamed to align-content. + * Specifies how a flexbox's lines align within the flexbox when there is extra space along the axis that is perpendicular to the axis defined by the flex-direction property. + */ + flexLinePack?: any; + + /** + * Gets or sets a value that specifies the ordinal group that a flexbox element belongs to. This ordinal value identifies the display order for the group. + */ + flexOrder?: any; + + /** + * Specifies the flex shrink factor of a flex item. + */ + flexShrink?: number; + + /** + * Elements which have the style float are floated horizontally. These elements can move as far to the left or right of the containing element. All elements after the floating element will flow around it, but elements before the floating element are not impacted. If several floating elements are placed after each other, they will float next to each other as long as there is room. + */ + float?: any; + + /** + * Flows content from a named flow (specified by a corresponding flow-into) through selected elements to form a dynamic chain of layout regions. + */ + flowFrom?: any; + + /** + * The font property is shorthand that allows you to do one of two things: you can either set up six of the most mature font properties in one line, or you can set one of a choice of keywords to adopt a system font setting. + */ + font?: any; + + /** + * The font-family property allows one or more font family names and/or generic family names to be specified for usage on the selected element(s)' text. The browser then goes through the list; for each character in the selection it applies the first font family that has an available glyph for that character. + */ + fontFamily?: any; + + /** + * The font-kerning property allows contextual adjustment of inter-glyph spacing, i.e. the spaces between the characters in text. This property controls metric kerning - that utilizes adjustment data contained in the font. Optical Kerning is not supported as yet. + */ + fontKerning?: any; + + /** + * Specifies the size of the font. Used to compute em and ex units. + */ + fontSize?: number | string; + + /** + * The font-size-adjust property adjusts the font-size of the fallback fonts defined with font-family, so that the x-height is the same no matter what font is used. This preserves the readability of the text when fallback happens. + */ + fontSizeAdjust?: any; + + /** + * Allows you to expand or condense the widths for a normal, condensed, or expanded font face. + */ + fontStretch?: any; + + /** + * The font-style property allows normal, italic, or oblique faces to be selected. Italic forms are generally cursive in nature while oblique faces are typically sloped versions of the regular face. Oblique faces can be simulated by artificially sloping the glyphs of the regular face. + */ + fontStyle?: any; + + /** + * This value specifies whether the user agent is allowed to synthesize bold or oblique font faces when a font family lacks bold or italic faces. + */ + fontSynthesis?: any; + + /** + * The font-variant property enables you to select the small-caps font within a font family. + */ + fontVariant?: any; + + /** + * Fonts can provide alternate glyphs in addition to default glyph for a character. This property provides control over the selection of these alternate glyphs. + */ + fontVariantAlternates?: any; + + /** + * Specifies the weight or boldness of the font. + */ + fontWeight?: "normal" | "bold" | "lighter" | "bolder" | number; + + /** + * Lays out one or more grid items bound by 4 grid lines. Shorthand for setting grid-column-start, grid-column-end, grid-row-start, and grid-row-end in a single declaration. + */ + gridArea?: any; + + /** + * Controls a grid item's placement in a grid area, particularly grid position and a grid span. Shorthand for setting grid-column-start and grid-column-end in a single declaration. + */ + gridColumn?: any; + + /** + * Controls a grid item's placement in a grid area as well as grid position and a grid span. The grid-column-end property (with grid-row-start, grid-row-end, and grid-column-start) determines a grid item's placement by specifying the grid lines of a grid item's grid area. + */ + gridColumnEnd?: any; + + /** + * Determines a grid item's placement by specifying the starting grid lines of a grid item's grid area . A grid item's placement in a grid area consists of a grid position and a grid span. See also ( grid-row-start, grid-row-end, and grid-column-end) + */ + gridColumnStart?: any; + + /** + * Gets or sets a value that indicates which row an element within a Grid should appear in. Shorthand for setting grid-row-start and grid-row-end in a single declaration. + */ + gridRow?: any; + + /** + * Determines a grid item’s placement by specifying the block-end. A grid item's placement in a grid area consists of a grid position and a grid span. The grid-row-end property (with grid-row-start, grid-column-start, and grid-column-end) determines a grid item's placement by specifying the grid lines of a grid item's grid area. + */ + gridRowEnd?: any; + + /** + * Specifies a row position based upon an integer location, string value, or desired row size. + * css/properties/grid-row is used as short-hand for grid-row-position and grid-row-position + */ + gridRowPosition?: any; + + gridRowSpan?: any; + + /** + * Specifies named grid areas which are not associated with any particular grid item, but can be referenced from the grid-placement properties. The syntax of the grid-template-areas property also provides a visualization of the structure of the grid, making the overall layout of the grid container easier to understand. + */ + gridTemplateAreas?: any; + + /** + * Specifies (with grid-template-rows) the line names and track sizing functions of the grid. Each sizing function can be specified as a length, a percentage of the grid container’s size, a measurement of the contents occupying the column or row, or a fraction of the free space in the grid. + */ + gridTemplateColumns?: any; + + /** + * Specifies (with grid-template-columns) the line names and track sizing functions of the grid. Each sizing function can be specified as a length, a percentage of the grid container’s size, a measurement of the contents occupying the column or row, or a fraction of the free space in the grid. + */ + gridTemplateRows?: any; + + /** + * Sets the height of an element. The content area of the element height does not include the padding, border, and margin of the element. + */ + height?: any; + + /** + * Specifies the minimum number of characters in a hyphenated word + */ + hyphenateLimitChars?: any; + + /** + * Indicates the maximum number of successive hyphenated lines in an element. The ‘no-limit’ value means that there is no limit. + */ + hyphenateLimitLines?: any; + + /** + * Specifies the maximum amount of trailing whitespace (before justification) that may be left in a line before hyphenation is triggered to pull part of a word from the next line back up into the current one. + */ + hyphenateLimitZone?: any; + + /** + * Specifies whether or not words in a sentence can be split by the use of a manual or automatic hyphenation mechanism. + */ + hyphens?: any; + + imeMode?: any; + + layoutGrid?: any; + + layoutGridChar?: any; + + layoutGridLine?: any; + + layoutGridMode?: any; + + layoutGridType?: any; + + /** + * Sets the left edge of an element + */ + left?: any; + + /** + * The letter-spacing CSS property specifies the spacing behavior between text characters. + */ + letterSpacing?: any; + + /** + * Deprecated. Gets or sets line-breaking rules for text in selected languages such as Japanese, Chinese, and Korean. + */ + lineBreak?: any; + + lineClamp?: number; + + /** + * Specifies the height of an inline block level element. + */ + lineHeight?: number | string; + + /** + * Shorthand property that sets the list-style-type, list-style-position and list-style-image properties in one declaration. + */ + listStyle?: any; + + /** + * This property sets the image that will be used as the list item marker. When the image is available, it will replace the marker set with the 'list-style-type' marker. That also means that if the image is not available, it will show the style specified by list-style-property + */ + listStyleImage?: any; + + /** + * Specifies if the list-item markers should appear inside or outside the content flow. + */ + listStylePosition?: any; + + /** + * Specifies the type of list-item marker in a list. + */ + listStyleType?: any; + + /** + * The margin property is shorthand to allow you to set all four margins of an element at once. Its equivalent longhand properties are margin-top, margin-right, margin-bottom and margin-left. Negative values are also allowed. + */ + margin?: any; + + /** + * margin-bottom sets the bottom margin of an element. + */ + marginBottom?: any; + + /** + * margin-left sets the left margin of an element. + */ + marginLeft?: any; + + /** + * margin-right sets the right margin of an element. + */ + marginRight?: any; + + /** + * margin-top sets the top margin of an element. + */ + marginTop?: any; + + /** + * The marquee-direction determines the initial direction in which the marquee content moves. + */ + marqueeDirection?: any; + + /** + * The 'marquee-style' property determines a marquee's scrolling behavior. + */ + marqueeStyle?: any; + + /** + * This property is shorthand for setting mask-image, mask-mode, mask-repeat, mask-position, mask-clip, mask-origin, mask-composite and mask-size. Omitted values are set to their original properties' initial values. + */ + mask?: any; + + /** + * This property is shorthand for setting mask-border-source, mask-border-slice, mask-border-width, mask-border-outset, and mask-border-repeat. Omitted values are set to their original properties' initial values. + */ + maskBorder?: any; + + /** + * This property specifies how the images for the sides and the middle part of the mask image are scaled and tiled. The first keyword applies to the horizontal sides, the second one applies to the vertical ones. If the second keyword is absent, it is assumed to be the same as the first, similar to the CSS border-image-repeat property. + */ + maskBorderRepeat?: any; + + /** + * This property specifies inward offsets from the top, right, bottom, and left edges of the mask image, dividing it into nine regions: four corners, four edges, and a middle. The middle image part is discarded and treated as fully transparent black unless the fill keyword is present. The four values set the top, right, bottom and left offsets in that order, similar to the CSS border-image-slice property. + */ + maskBorderSlice?: any; + + /** + * Specifies an image to be used as a mask. An image that is empty, fails to download, is non-existent, or cannot be displayed is ignored and does not mask the element. + */ + maskBorderSource?: any; + + /** + * This property sets the width of the mask box image, similar to the CSS border-image-width property. + */ + maskBorderWidth?: any; + + /** + * Determines the mask painting area, which defines the area that is affected by the mask. The painted content of an element may be restricted to this area. + */ + maskClip?: any; + + /** + * For elements rendered as a single box, specifies the mask positioning area. For elements rendered as multiple boxes (e.g., inline boxes on several lines, boxes on several pages) specifies which boxes box-decoration-break operates on to determine the mask positioning area(s). + */ + maskOrigin?: any; + + /** + * This property must not be used. It is no longer included in any standard or standard track specification, nor is it implemented in any browser. It is only used when the text-align-last property is set to size. It controls allowed adjustments of font-size to fit line content. + */ + maxFontSize?: any; + + /** + * Sets the maximum height for an element. It prevents the height of the element to exceed the specified value. If min-height is specified and is greater than max-height, max-height is overridden. + */ + maxHeight?: any; + + /** + * Sets the maximum width for an element. It limits the width property to be larger than the value specified in max-width. + */ + maxWidth?: any; + + /** + * Sets the minimum height for an element. It prevents the height of the element to be smaller than the specified value. The value of min-height overrides both max-height and height. + */ + minHeight?: any; + + /** + * Sets the minimum width of an element. It limits the width property to be not smaller than the value specified in min-width. + */ + minWidth?: any; + + /** + * Specifies the transparency of an element. + */ + opacity?: number; + + /** + * Specifies the order used to lay out flex items in their flex container. + * Elements are laid out in the ascending order of the order value. + */ + order?: number; + + /** + * In paged media, this property defines the minimum number of lines in + * a block container that must be left at the bottom of the page. + */ + orphans?: number; + + /** + * The CSS outline property is a shorthand property for setting one or more of the individual outline properties outline-style, outline-width and outline-color in a single rule. In most cases the use of this shortcut is preferable and more convenient. + * Outlines differ from borders in the following ways: • Outlines do not take up space, they are drawn above the content. + * • Outlines may be non-rectangular. They are rectangular in Gecko/Firefox. Internet Explorer attempts to place the smallest contiguous outline around all elements or shapes that are indicated to have an outline. Opera draws a non-rectangular shape around a construct. + */ + outline?: any; + + /** + * The outline-color property sets the color of the outline of an element. An outline is a line that is drawn around elements, outside the border edge, to make the element stand out. + */ + outlineColor?: any; + + /** + * The outline-offset property offsets the outline and draw it beyond the border edge. + */ + outlineOffset?: any; + + /** + * The overflow property controls how extra content exceeding the bounding box of an element is rendered. It can be used in conjunction with an element that has a fixed width and height, to eliminate text-induced page distortion. + */ + overflow?: any; + + /** + * Specifies the preferred scrolling methods for elements that overflow. + */ + overflowStyle?: any; + + /** + * Controls how extra content exceeding the x-axis of the bounding box of an element is rendered. + */ + overflowX?: any; + + /** + * Controls how extra content exceeding the y-axis of the bounding box of an element is rendered. + */ + overflowY?: any; + + /** + * The padding optional CSS property sets the required padding space on one to four sides of an element. The padding area is the space between an element and its border. Negative values are not allowed but decimal values are permitted. The element size is treated as fixed, and the content of the element shifts toward the center as padding is increased. + * The padding property is a shorthand to avoid setting each side separately (padding-top, padding-right, padding-bottom, padding-left). + */ + padding?: any; + + /** + * The padding-bottom CSS property of an element sets the padding space required on the bottom of an element. The padding area is the space between the content of the element and its border. Contrary to margin-bottom values, negative values of padding-bottom are invalid. + */ + paddingBottom?: any; + + /** + * The padding-left CSS property of an element sets the padding space required on the left side of an element. The padding area is the space between the content of the element and its border. Contrary to margin-left values, negative values of padding-left are invalid. + */ + paddingLeft?: any; + + /** + * The padding-right CSS property of an element sets the padding space required on the right side of an element. The padding area is the space between the content of the element and its border. Contrary to margin-right values, negative values of padding-right are invalid. + */ + paddingRight?: any; + + /** + * The padding-top CSS property of an element sets the padding space required on the top of an element. The padding area is the space between the content of the element and its border. Contrary to margin-top values, negative values of padding-top are invalid. + */ + paddingTop?: any; + + /** + * The page-break-after property is supported in all major browsers. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. + */ + pageBreakAfter?: any; + + /** + * The page-break-before property sets the page-breaking behavior before an element. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. + */ + pageBreakBefore?: any; + + /** + * Sets the page-breaking behavior inside an element. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. + */ + pageBreakInside?: any; + + /** + * The pause property determines how long a speech media agent should pause before and after presenting an element. It is a shorthand for the pause-before and pause-after properties. + */ + pause?: any; + + /** + * The pause-after property determines how long a speech media agent should pause after presenting an element. It may be replaced by the shorthand property pause, which sets pause time before and after. + */ + pauseAfter?: any; + + /** + * The pause-before property determines how long a speech media agent should pause before presenting an element. It may be replaced by the shorthand property pause, which sets pause time before and after. + */ + pauseBefore?: any; + + /** + * The perspective property defines how far an element is placed from the view on the z-axis, from the screen to the viewer. + * Perspective defines how an object is viewed. In graphic arts, perspective is the representation on a flat surface of what the viewer's eye would see in a 3D space. (See Wikipedia for more information about graphical perspective and for related illustrations.) + * The illusion of perspective on a flat surface, such as a computer screen, is created by projecting points on the flat surface as they would appear if the flat surface were a window through which the viewer was looking at the object. In discussion of virtual environments, this flat surface is called a projection plane. + */ + perspective?: any; + + /** + * The perspective-origin property establishes the origin for the perspective property. It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element. + * When used with perspective, perspective-origin changes the appearance of an object, as if a viewer were looking at it from a different origin. An object appears differently if a viewer is looking directly at it versus looking at it from below, above, or from the side. Thus, the perspective-origin is like a vanishing point. + * The default value of perspective-origin is 50% 50%. This displays an object as if the viewer's eye were positioned directly at the center of the screen, both top-to-bottom and left-to-right. A value of 0% 0% changes the object as if the viewer was looking toward the top left angle. A value of 100% 100% changes the appearance as if viewed toward the bottom right angle. + */ + perspectiveOrigin?: any; + + /** + * The pointer-events property allows you to control whether an element can be the target for the pointing device (e.g, mouse, pen) events. + */ + pointerEvents?: any; + + /** + * The position property controls the type of positioning used by an element within its parent elements. The effect of the position property depends on a lot of factors, for example the position property of parent elements. + */ + position?: any; + + /** + * Obsolete: unsupported. + * This property determines whether or not a full-width punctuation mark character should be trimmed if it appears at the beginning of a line, so that its "ink" lines up with the first glyph in the line above and below. + */ + punctuationTrim?: any; + + /** + * Sets the type of quotation marks for embedded quotations. + */ + quotes?: any; + + /** + * Controls whether the last region in a chain displays additional 'overset' content according its default overflow property, or if it displays a fragment of content as if it were flowing into a subsequent region. + */ + regionFragment?: any; + + /** + * The rest-after property determines how long a speech media agent should pause after presenting an element's main content, before presenting that element's exit cue sound. It may be replaced by the shorthand property rest, which sets rest time before and after. + */ + restAfter?: any; + + /** + * The rest-before property determines how long a speech media agent should pause after presenting an intro cue sound for an element, before presenting that element's main content. It may be replaced by the shorthand property rest, which sets rest time before and after. + */ + restBefore?: any; + + /** + * Specifies the position an element in relation to the right side of the containing element. + */ + right?: any; + + rubyAlign?: any; + + rubyPosition?: any; + + /** + * Defines the alpha channel threshold used to extract a shape from an image. Can be thought of as a "minimum opacity" threshold; that is, a value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque. + */ + shapeImageThreshold?: any; + + /** + * A future level of CSS Shapes will define a shape-inside property, which will define a shape to wrap content within the element. See Editor's Draft and CSSWG wiki page on next-level plans + */ + shapeInside?: any; + + /** + * Adds a margin to a shape-outside. In effect, defines a new shape that is the smallest contour around all the points that are the shape-margin distance outward perpendicular to each point on the underlying shape. For points where a perpendicular direction is not defined (e.g., a triangle corner), takes all points on a circle centered at the point and with a radius of the shape-margin distance. This property accepts only non-negative values. + */ + shapeMargin?: any; + + /** + * Declares a shape around which text should be wrapped, with possible modifications from the shape-margin property. The shape defined by shape-outside and shape-margin changes the geometry of a float element's float area. + */ + shapeOutside?: any; + + /** + * The speak property determines whether or not a speech synthesizer will read aloud the contents of an element. + */ + speak?: any; + + /** + * The speak-as property determines how the speech synthesizer interprets the content: words as whole words or as a sequence of letters, numbers as a numerical value or a sequence of digits, punctuation as pauses in speech or named punctuation characters. + */ + speakAs?: any; + + /** + * SVG: Specifies the opacity of the outline on the current object. + */ + strokeOpacity?: number; + + /** + * SVG: Specifies the width of the outline on the current object. + */ + strokeWidth?: number; + + /** + * The tab-size CSS property is used to customise the width of a tab (U+0009) character. + */ + tabSize?: any; + + /** + * The 'table-layout' property controls the algorithm used to lay out the table cells, rows, and columns. + */ + tableLayout?: any; + + /** + * The text-align CSS property describes how inline content like text is aligned in its parent block element. text-align does not control the alignment of block elements itself, only their inline content. + */ + textAlign?: any; + + /** + * The text-align-last CSS property describes how the last line of a block element or a line before line break is aligned in its parent block element. + */ + textAlignLast?: any; + + /** + * The text-decoration CSS property is used to set the text formatting to underline, overline, line-through or blink. + * underline and overline decorations are positioned under the text, line-through over it. + */ + textDecoration?: any; + + /** + * Sets the color of any text decoration, such as underlines, overlines, and strike throughs. + */ + textDecorationColor?: any; + + /** + * Sets what kind of line decorations are added to an element, such as underlines, overlines, etc. + */ + textDecorationLine?: any; + + textDecorationLineThrough?: any; + + textDecorationNone?: any; + + textDecorationOverline?: any; + + /** + * Specifies what parts of an element’s content are skipped over when applying any text decoration. + */ + textDecorationSkip?: any; + + /** + * This property specifies the style of the text decoration line drawn on the specified element. The intended meaning for the values are the same as those of the border-style-properties. + */ + textDecorationStyle?: any; + + textDecorationUnderline?: any; + + /** + * The text-emphasis property will apply special emphasis marks to the elements text. Slightly similar to the text-decoration property only that this property can have affect on the line-height. It also is noted that this is shorthand for text-emphasis-style and for text-emphasis-color. + */ + textEmphasis?: any; + + /** + * The text-emphasis-color property specifies the foreground color of the emphasis marks. + */ + textEmphasisColor?: any; + + /** + * The text-emphasis-style property applies special emphasis marks to an element's text. + */ + textEmphasisStyle?: any; + + /** + * This property helps determine an inline box's block-progression dimension, derived from the text-height and font-size properties for non-replaced elements, the height or the width for replaced elements, and the stacked block-progression dimension for inline-block elements. The block-progression dimension determines the position of the padding, border and margin for the element. + */ + textHeight?: any; + + /** + * Specifies the amount of space horizontally that should be left on the first line of the text of an element. This horizontal spacing is at the beginning of the first line and is in respect to the left edge of the containing block box. + */ + textIndent?: any; + + textJustifyTrim?: any; + + textKashidaSpace?: any; + + /** + * The text-line-through property is a shorthand property for text-line-through-style, text-line-through-color and text-line-through-mode. (Considered obsolete; use text-decoration instead.) + */ + textLineThrough?: any; + + /** + * Specifies the line colors for the line-through text decoration. + * (Considered obsolete; use text-decoration-color instead.) + */ + textLineThroughColor?: any; + + /** + * Sets the mode for the line-through text decoration, determining whether the text decoration affects the space characters or not. + * (Considered obsolete; use text-decoration-skip instead.) + */ + textLineThroughMode?: any; + + /** + * Specifies the line style for line-through text decoration. + * (Considered obsolete; use text-decoration-style instead.) + */ + textLineThroughStyle?: any; + + /** + * Specifies the line width for the line-through text decoration. + */ + textLineThroughWidth?: any; + + /** + * The text-overflow shorthand CSS property determines how overflowed content that is not displayed is signaled to the users. It can be clipped, display an ellipsis ('…', U+2026 HORIZONTAL ELLIPSIS) or a Web author-defined string. It covers the two long-hand properties text-overflow-mode and text-overflow-ellipsis + */ + textOverflow?: any; + + /** + * The text-overline property is the shorthand for the text-overline-style, text-overline-width, text-overline-color, and text-overline-mode properties. + */ + textOverline?: any; + + /** + * Specifies the line color for the overline text decoration. + */ + textOverlineColor?: any; + + /** + * Sets the mode for the overline text decoration, determining whether the text decoration affects the space characters or not. + */ + textOverlineMode?: any; + + /** + * Specifies the line style for overline text decoration. + */ + textOverlineStyle?: any; + + /** + * Specifies the line width for the overline text decoration. + */ + textOverlineWidth?: any; + + /** + * The text-rendering CSS property provides information to the browser about how to optimize when rendering text. Options are: legibility, speed or geometric precision. + */ + textRendering?: any; + + /** + * Obsolete: unsupported. + */ + textScript?: any; + + /** + * The CSS text-shadow property applies one or more drop shadows to the text and of an element. Each shadow is specified as an offset from the text, along with optional color and blur radius values. + */ + textShadow?: any; + + /** + * This property transforms text for styling purposes. (It has no effect on the underlying content.) + */ + textTransform?: any; + + /** + * Unsupported. + * This property will add a underline position value to the element that has an underline defined. + */ + textUnderlinePosition?: any; + + /** + * After review this should be replaced by text-decoration should it not? + * This property will set the underline style for text with a line value for underline, overline, and line-through. + */ + textUnderlineStyle?: any; + + /** + * This property specifies how far an absolutely positioned box's top margin edge is offset below the top edge of the box's containing block. For relatively positioned boxes, the offset is with respect to the top edges of the box itself (i.e., the box is given a position in the normal flow, then offset from that position according to these properties). + */ + top?: any; + + /** + * Determines whether touch input may trigger default behavior supplied by the user agent, such as panning or zooming. + */ + touchAction?: any; + + /** + * CSS transforms allow elements styled with CSS to be transformed in two-dimensional or three-dimensional space. Using this property, elements can be translated, rotated, scaled, and skewed. The value list may consist of 2D and/or 3D transform values. + */ + transform?: any; + + /** + * This property defines the origin of the transformation axes relative to the element to which the transformation is applied. + */ + transformOrigin?: any; + + /** + * This property allows you to define the relative position of the origin of the transformation grid along the z-axis. + */ + transformOriginZ?: any; + + /** + * This property specifies how nested elements are rendered in 3D space relative to their parent. + */ + transformStyle?: any; + + /** + * The transition CSS property is a shorthand property for transition-property, transition-duration, transition-timing-function, and transition-delay. It allows to define the transition between two states of an element. + */ + transition?: any; + + /** + * Defines when the transition will start. A value of ‘0s’ means the transition will execute as soon as the property is changed. Otherwise, the value specifies an offset from the moment the property is changed, and the transition will delay execution by that offset. + */ + transitionDelay?: any; + + /** + * The 'transition-duration' property specifies the length of time a transition animation takes to complete. + */ + transitionDuration?: any; + + /** + * The 'transition-property' property specifies the name of the CSS property to which the transition is applied. + */ + transitionProperty?: any; + + /** + * Sets the pace of action within a transition + */ + transitionTimingFunction?: any; + + /** + * The unicode-bidi CSS property specifies the level of embedding with respect to the bidirectional algorithm. + */ + unicodeBidi?: any; + + /** + * unicode-range allows you to set a specific range of characters to be downloaded from a font (embedded using @font-face) and made available for use on the current page. + */ + unicodeRange?: any; + + /** + * This is for all the high level UX stuff. + */ + userFocus?: any; + + /** + * For inputing user content + */ + userInput?: any; + + /** + * The vertical-align property controls how inline elements or text are vertically aligned compared to the baseline. If this property is used on table-cells it controls the vertical alignment of content of the table cell. + */ + verticalAlign?: any; + + /** + * The visibility property specifies whether the boxes generated by an element are rendered. + */ + visibility?: any; + + /** + * The voice-balance property sets the apparent position (in stereo sound) of the synthesized voice for spoken media. + */ + voiceBalance?: any; + + /** + * The voice-duration property allows the author to explicitly set the amount of time it should take a speech synthesizer to read an element's content, for example to allow the speech to be synchronized with other media. With a value of auto (the default) the length of time it takes to read the content is determined by the content itself and the voice-rate property. + */ + voiceDuration?: any; + + /** + * The voice-family property sets the speaker's voice used by a speech media agent to read an element. The speaker may be specified as a named character (to match a voice option in the speech reading software) or as a generic description of the age and gender of the voice. Similar to the font-family property for visual media, a comma-separated list of fallback options may be given in case the speech reader does not recognize the character name or cannot synthesize the requested combination of generic properties. + */ + voiceFamily?: any; + + /** + * The voice-pitch property sets pitch or tone (high or low) for the synthesized speech when reading an element; the pitch may be specified absolutely or relative to the normal pitch for the voice-family used to read the text. + */ + voicePitch?: any; + + /** + * The voice-range property determines how much variation in pitch or tone will be created by the speech synthesize when reading an element. Emphasized text, grammatical structures and punctuation may all be rendered as changes in pitch, this property determines how strong or obvious those changes are; large ranges are associated with enthusiastic or emotional speech, while small ranges are associated with flat or mechanical speech. + */ + voiceRange?: any; + + /** + * The voice-rate property sets the speed at which the voice synthesized by a speech media agent will read content. + */ + voiceRate?: any; + + /** + * The voice-stress property sets the level of vocal emphasis to be used for synthesized speech reading the element. + */ + voiceStress?: any; + + /** + * The voice-volume property sets the volume for spoken content in speech media. It replaces the deprecated volume property. + */ + voiceVolume?: any; + + /** + * The white-space property controls whether and how white space inside the element is collapsed, and whether lines may wrap at unforced "soft wrap" opportunities. + */ + whiteSpace?: any; + + /** + * Obsolete: unsupported. + */ + whiteSpaceTreatment?: any; + + /** + * In paged media, this property defines the mimimum number of lines + * that must be left at the top of the second page. + */ + widows?: number; + + /** + * Specifies the width of the content area of an element. The content area of the element width does not include the padding, border, and margin of the element. + */ + width?: any; + + /** + * The word-break property is often used when there is long generated content that is strung together without and spaces or hyphens to beak apart. A common case of this is when there is a long URL that does not have any hyphens. This case could potentially cause the breaking of the layout as it could extend past the parent element. + */ + wordBreak?: any; + + /** + * The word-spacing CSS property specifies the spacing behavior between "words". + */ + wordSpacing?: any; + + /** + * An alias of css/properties/overflow-wrap, word-wrap defines whether to break words when the content exceeds the boundaries of its container. + */ + wordWrap?: any; + + /** + * Specifies how exclusions affect inline content within block-level elements. Elements lay out their inline content in their content area but wrap around exclusion areas. + */ + wrapFlow?: any; + + /** + * Set the value that is used to offset the inner wrap shape from other shapes. Inline content that intersects a shape with this property will be pushed by this shape's margin. + */ + wrapMargin?: any; + + /** + * Obsolete and unsupported. Do not use. + * This CSS property controls the text when it reaches the end of the block in which it is enclosed. + */ + wrapOption?: any; + + /** + * writing-mode specifies if lines of text are laid out horizontally or vertically, and the direction which lines of text and blocks progress. + */ + writingMode?: any; + + /** + * The z-index property specifies the z-order of an element and its descendants. + * When elements overlap, z-order determines which one covers the other. + */ + zIndex?: "auto" | number; + + /** + * Sets the initial zoom factor of a document defined by @viewport. + */ + zoom?: "auto" | number; + + [propertyName: string]: any; + } + + interface HTMLAttributes extends DOMAttributes { + // React-specific Attributes + defaultChecked?: boolean; + defaultValue?: string | string[]; + + // Standard HTML Attributes + accept?: string; + acceptCharset?: string; + accessKey?: string; + action?: string; + allowFullScreen?: boolean; + allowTransparency?: boolean; + alt?: string; + async?: boolean; + autoComplete?: string; + autoFocus?: boolean; + autoPlay?: boolean; + capture?: boolean; + cellPadding?: number | string; + cellSpacing?: number | string; + charSet?: string; + challenge?: string; + checked?: boolean; + classID?: string; + className?: string; + cols?: number; + colSpan?: number; + content?: string; + contentEditable?: boolean; + contextMenu?: string; + controls?: boolean; + coords?: string; + crossOrigin?: string; + data?: string; + dateTime?: string; + default?: boolean; + defer?: boolean; + dir?: string; + disabled?: boolean; + download?: any; + draggable?: boolean; + encType?: string; + form?: string; + formAction?: string; + formEncType?: string; + formMethod?: string; + formNoValidate?: boolean; + formTarget?: string; + frameBorder?: number | string; + headers?: string; + height?: number | string; + hidden?: boolean; + high?: number; + href?: string; + hrefLang?: string; + htmlFor?: string; + httpEquiv?: string; + icon?: string; + id?: string; + inputMode?: string; + integrity?: string; + is?: string; + keyParams?: string; + keyType?: string; + kind?: string; + label?: string; + lang?: string; + list?: string; + loop?: boolean; + low?: number; + manifest?: string; + marginHeight?: number; + marginWidth?: number; + max?: number | string; + maxLength?: number; + media?: string; + mediaGroup?: string; + method?: string; + min?: number | string; + minLength?: number; + multiple?: boolean; + muted?: boolean; + name?: string; + noValidate?: boolean; + open?: boolean; + optimum?: number; + pattern?: string; + placeholder?: string; + poster?: string; + preload?: string; + radioGroup?: string; + readOnly?: boolean; + rel?: string; + required?: boolean; + role?: string; + rows?: number; + rowSpan?: number; + sandbox?: string; + scope?: string; + scoped?: boolean; + scrolling?: string; + seamless?: boolean; + selected?: boolean; + shape?: string; + size?: number; + sizes?: string; + span?: number; + spellCheck?: boolean; + src?: string; + srcDoc?: string; + srcLang?: string; + srcSet?: string; + start?: number; + step?: number | string; + style?: CSSProperties; + summary?: string; + tabIndex?: number; + target?: string; + title?: string; + type?: string; + useMap?: string; + value?: string | string[]; + width?: number | string; + wmode?: string; + wrap?: string; + + // RDFa Attributes + about?: string; + datatype?: string; + inlist?: any; + prefix?: string; + property?: string; + resource?: string; + typeof?: string; + vocab?: string; + + // Non-standard Attributes + autoCapitalize?: string; + autoCorrect?: string; + autoSave?: string; + color?: string; + itemProp?: string; + itemScope?: boolean; + itemType?: string; + itemID?: string; + itemRef?: string; + results?: number; + security?: string; + unselectable?: boolean; + + // Allows aria- and data- Attributes + [key: string]: any; + } + + interface SVGAttributes extends HTMLAttributes { + clipPath?: string; + cx?: number | string; + cy?: number | string; + d?: string; + dx?: number | string; + dy?: number | string; + fill?: string; + fillOpacity?: number | string; + fontFamily?: string; + fontSize?: number | string; + fx?: number | string; + fy?: number | string; + gradientTransform?: string; + gradientUnits?: string; + markerEnd?: string; + markerMid?: string; + markerStart?: string; + offset?: number | string; + opacity?: number | string; + patternContentUnits?: string; + patternUnits?: string; + points?: string; + preserveAspectRatio?: string; + r?: number | string; + rx?: number | string; + ry?: number | string; + spreadMethod?: string; + stopColor?: string; + stopOpacity?: number | string; + stroke?: string; + strokeDasharray?: string; + strokeLinecap?: string; + strokeMiterlimit?: string; + strokeOpacity?: number | string; + strokeWidth?: number | string; + textAnchor?: string; + transform?: string; + version?: string; + viewBox?: string; + x1?: number | string; + x2?: number | string; + x?: number | string; + xlinkActuate?: string; + xlinkArcrole?: string; + xlinkHref?: string; + xlinkRole?: string; + xlinkShow?: string; + xlinkTitle?: string; + xlinkType?: string; + xmlBase?: string; + xmlLang?: string; + xmlSpace?: string; + y1?: number | string; + y2?: number | string; + y?: number | string; + } + + // + // React.DOM + // ---------------------------------------------------------------------- + + interface ReactDOM { + // HTML + a: HTMLFactory; + abbr: HTMLFactory; + address: HTMLFactory; + area: HTMLFactory; + article: HTMLFactory; + aside: HTMLFactory; + audio: HTMLFactory; + b: HTMLFactory; + base: HTMLFactory; + bdi: HTMLFactory; + bdo: HTMLFactory; + big: HTMLFactory; + blockquote: HTMLFactory; + body: HTMLFactory; + br: HTMLFactory; + button: HTMLFactory; + canvas: HTMLFactory; + caption: HTMLFactory; + cite: HTMLFactory; + code: HTMLFactory; + col: HTMLFactory; + colgroup: HTMLFactory; + data: HTMLFactory; + datalist: HTMLFactory; + dd: HTMLFactory; + del: HTMLFactory; + details: HTMLFactory; + dfn: HTMLFactory; + dialog: HTMLFactory; + div: HTMLFactory; + dl: HTMLFactory; + dt: HTMLFactory; + em: HTMLFactory; + embed: HTMLFactory; + fieldset: HTMLFactory; + figcaption: HTMLFactory; + figure: HTMLFactory; + footer: HTMLFactory; + form: HTMLFactory; + h1: HTMLFactory; + h2: HTMLFactory; + h3: HTMLFactory; + h4: HTMLFactory; + h5: HTMLFactory; + h6: HTMLFactory; + head: HTMLFactory; + header: HTMLFactory; + hgroup: HTMLFactory; + hr: HTMLFactory; + html: HTMLFactory; + i: HTMLFactory; + iframe: HTMLFactory; + img: HTMLFactory; + input: HTMLFactory; + ins: HTMLFactory; + kbd: HTMLFactory; + keygen: HTMLFactory; + label: HTMLFactory; + legend: HTMLFactory; + li: HTMLFactory; + link: HTMLFactory; + main: HTMLFactory; + map: HTMLFactory; + mark: HTMLFactory; + menu: HTMLFactory; + menuitem: HTMLFactory; + meta: HTMLFactory; + meter: HTMLFactory; + nav: HTMLFactory; + noscript: HTMLFactory; + object: HTMLFactory; + ol: HTMLFactory; + optgroup: HTMLFactory; + option: HTMLFactory; + output: HTMLFactory; + p: HTMLFactory; + param: HTMLFactory; + picture: HTMLFactory; + pre: HTMLFactory; + progress: HTMLFactory; + q: HTMLFactory; + rp: HTMLFactory; + rt: HTMLFactory; + ruby: HTMLFactory; + s: HTMLFactory; + samp: HTMLFactory; + script: HTMLFactory; + section: HTMLFactory; + select: HTMLFactory; + small: HTMLFactory; + source: HTMLFactory; + span: HTMLFactory; + strong: HTMLFactory; + style: HTMLFactory; + sub: HTMLFactory; + summary: HTMLFactory; + sup: HTMLFactory; + table: HTMLFactory; + tbody: HTMLFactory; + td: HTMLFactory; + textarea: HTMLFactory; + tfoot: HTMLFactory; + th: HTMLFactory; + thead: HTMLFactory; + time: HTMLFactory; + title: HTMLFactory; + tr: HTMLFactory; + track: HTMLFactory; + u: HTMLFactory; + ul: HTMLFactory; + "var": HTMLFactory; + video: HTMLFactory; + wbr: HTMLFactory; + + // SVG + svg: SVGFactory; + circle: SVGFactory; + defs: SVGFactory; + ellipse: SVGFactory; + g: SVGFactory; + image: SVGFactory; + line: SVGFactory; + linearGradient: SVGFactory; + mask: SVGFactory; + path: SVGFactory; + pattern: SVGFactory; + polygon: SVGFactory; + polyline: SVGFactory; + radialGradient: SVGFactory; + rect: SVGFactory; + stop: SVGFactory; + text: SVGFactory; + tspan: SVGFactory; + } + + // + // React.PropTypes + // ---------------------------------------------------------------------- + + interface Validator { + (object: T, key: string, componentName: string): Error; + } + + interface Requireable extends Validator { + isRequired: Validator; + } + + interface ValidationMap { + [key: string]: Validator; + } + + interface ReactPropTypes { + any: Requireable; + array: Requireable; + bool: Requireable; + func: Requireable; + number: Requireable; + object: Requireable; + string: Requireable; + node: Requireable; + element: Requireable; + instanceOf(expectedClass: {}): Requireable; + oneOf(types: any[]): Requireable; + oneOfType(types: Validator[]): Requireable; + arrayOf(type: Validator): Requireable; + objectOf(type: Validator): Requireable; + shape(type: ValidationMap): Requireable; + } + + // + // React.Children + // ---------------------------------------------------------------------- + + interface ReactChildren { + map(children: ReactNode, fn: (child: ReactChild, index: number) => T): T[]; + forEach(children: ReactNode, fn: (child: ReactChild, index: number) => any): void; + count(children: ReactNode): number; + only(children: ReactNode): ReactElement; + toArray(children: ReactNode): ReactChild[]; + } + + // + // Browser Interfaces + // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts + // ---------------------------------------------------------------------- + + interface AbstractView { + styleMedia: StyleMedia; + document: Document; + } + + interface Touch { + identifier: number; + target: EventTarget; + screenX: number; + screenY: number; + clientX: number; + clientY: number; + pageX: number; + pageY: number; + } + + interface TouchList { + [index: number]: Touch; + length: number; + item(index: number): Touch; + identifiedTouch(identifier: number): Touch; + } +} + +declare module "react" { + export = __React; +} + +declare namespace JSX { + import React = __React; + + interface Element extends React.ReactElement { } + interface ElementClass extends React.Component { + render(): JSX.Element; + } + interface ElementAttributesProperty { props: {}; } + + interface IntrinsicAttributes { + key?: React.Key; + } + + interface IntrinsicClassAttributes { + ref?: React.Ref; + } + + interface IntrinsicElements { + // HTML + a: React.HTMLProps; + abbr: React.HTMLProps; + address: React.HTMLProps; + area: React.HTMLProps; + article: React.HTMLProps; + aside: React.HTMLProps; + audio: React.HTMLProps; + b: React.HTMLProps; + base: React.HTMLProps; + bdi: React.HTMLProps; + bdo: React.HTMLProps; + big: React.HTMLProps; + blockquote: React.HTMLProps; + body: React.HTMLProps; + br: React.HTMLProps; + button: React.HTMLProps; + canvas: React.HTMLProps; + caption: React.HTMLProps; + cite: React.HTMLProps; + code: React.HTMLProps; + col: React.HTMLProps; + colgroup: React.HTMLProps; + data: React.HTMLProps; + datalist: React.HTMLProps; + dd: React.HTMLProps; + del: React.HTMLProps; + details: React.HTMLProps; + dfn: React.HTMLProps; + dialog: React.HTMLProps; + div: React.HTMLProps; + dl: React.HTMLProps; + dt: React.HTMLProps; + em: React.HTMLProps; + embed: React.HTMLProps; + fieldset: React.HTMLProps; + figcaption: React.HTMLProps; + figure: React.HTMLProps; + footer: React.HTMLProps; + form: React.HTMLProps; + h1: React.HTMLProps; + h2: React.HTMLProps; + h3: React.HTMLProps; + h4: React.HTMLProps; + h5: React.HTMLProps; + h6: React.HTMLProps; + head: React.HTMLProps; + header: React.HTMLProps; + hgroup: React.HTMLProps; + hr: React.HTMLProps; + html: React.HTMLProps; + i: React.HTMLProps; + iframe: React.HTMLProps; + img: React.HTMLProps; + input: React.HTMLProps; + ins: React.HTMLProps; + kbd: React.HTMLProps; + keygen: React.HTMLProps; + label: React.HTMLProps; + legend: React.HTMLProps; + li: React.HTMLProps; + link: React.HTMLProps; + main: React.HTMLProps; + map: React.HTMLProps; + mark: React.HTMLProps; + menu: React.HTMLProps; + menuitem: React.HTMLProps; + meta: React.HTMLProps; + meter: React.HTMLProps; + nav: React.HTMLProps; + noscript: React.HTMLProps; + object: React.HTMLProps; + ol: React.HTMLProps; + optgroup: React.HTMLProps; + option: React.HTMLProps; + output: React.HTMLProps; + p: React.HTMLProps; + param: React.HTMLProps; + picture: React.HTMLProps; + pre: React.HTMLProps; + progress: React.HTMLProps; + q: React.HTMLProps; + rp: React.HTMLProps; + rt: React.HTMLProps; + ruby: React.HTMLProps; + s: React.HTMLProps; + samp: React.HTMLProps; + script: React.HTMLProps; + section: React.HTMLProps; + select: React.HTMLProps; + small: React.HTMLProps; + source: React.HTMLProps; + span: React.HTMLProps; + strong: React.HTMLProps; + style: React.HTMLProps; + sub: React.HTMLProps; + summary: React.HTMLProps; + sup: React.HTMLProps; + table: React.HTMLProps; + tbody: React.HTMLProps; + td: React.HTMLProps; + textarea: React.HTMLProps; + tfoot: React.HTMLProps; + th: React.HTMLProps; + thead: React.HTMLProps; + time: React.HTMLProps; + title: React.HTMLProps; + tr: React.HTMLProps; + track: React.HTMLProps; + u: React.HTMLProps; + ul: React.HTMLProps; + "var": React.HTMLProps; + video: React.HTMLProps; + wbr: React.HTMLProps; + + // SVG + svg: React.SVGProps; + + circle: React.SVGProps; + clipPath: React.SVGProps; + defs: React.SVGProps; + ellipse: React.SVGProps; + g: React.SVGProps; + image: React.SVGProps; + line: React.SVGProps; + linearGradient: React.SVGProps; + mask: React.SVGProps; + path: React.SVGProps; + pattern: React.SVGProps; + polygon: React.SVGProps; + polyline: React.SVGProps; + radialGradient: React.SVGProps; + rect: React.SVGProps; + stop: React.SVGProps; + text: React.SVGProps; + tspan: React.SVGProps; + } +} \ No newline at end of file diff --git a/typings/main/ambient/redis/index.d.ts b/typings/main/ambient/redis/index.d.ts new file mode 100644 index 00000000..bbe2d198 --- /dev/null +++ b/typings/main/ambient/redis/index.d.ts @@ -0,0 +1,643 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/99564d906102e30a5a472cb3527f93bf82982673/redis/redis.d.ts +// Type definitions for redis 0.12.1 +// Project: https://github.com/mranney/node_redis +// Definitions by: Carlos Ballesteros Velasco , Peter Harris , TANAKA Koichi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// Imported from: https://github.com/soywiz/typescript-node-definitions/redis.d.ts + + +declare module "redis" { + export function createClient(port_arg:number, host_arg?:string, options?:ClientOpts):RedisClient; + export function createClient(unix_socket:string, options?:ClientOpts):RedisClient; + export function createClient(options?:ClientOpts):RedisClient; + + export function print(err:Error, reply:any):void; + + export var debug_mode:boolean; + + export interface MessageHandler { + (channel:string, message:M): void; + } + + export interface CommandT { //This is a placeholder to be used eventually, to not have to define each command twice, or four times if all caps versions are to be implemented. + (args:any[], callback?:ResCallbackT): void; + (...args:any[]): void; + } + + export interface ResCallbackT { + (err:Error, res:R): void; + } + + export interface ServerInfo { + redis_version: string; + versions: number[]; + } + + export interface ClientOpts { + parser?: string; + return_buffers?: boolean; + detect_buffers?: boolean; + socket_nodelay?: boolean; + socket_keepalive?: boolean; + no_ready_check?: boolean; + enable_offline_queue?: boolean; + retry_max_delay?: number; + connect_timeout?: number; + max_attempts?: number; + auth_pass?: string; + password?: string; + family?: string; + command_queue_high_water?: number; + command_queue_low_water?: number; + } + + export interface RedisClient extends NodeJS.EventEmitter { + // event: connect + // event: error + // event: message + // event: pmessage + // event: subscribe + // event: psubscribe + // event: unsubscribe + // event: punsubscribe + + connected: boolean; + retry_delay: number; + retry_backoff: number; + command_queue: any[]; + offline_queue: any[]; + server_info: ServerInfo; + + end(): void; + unref(): void; + + // Low level command execution + send_command(command:string, ...args:any[]): boolean; + + // Connection (http://redis.io/commands#connection) + auth(password:string, callback?:ResCallbackT): boolean; + ping(callback?:ResCallbackT): boolean; + + // Strings (http://redis.io/commands#strings) + append(key:string, value:string, callback?:ResCallbackT): boolean; + bitcount(key:string, callback?:ResCallbackT): boolean; + bitcount(key:string, start:number, end:number, callback?:ResCallbackT): boolean; + set(key:string, value:string, callback?:ResCallbackT): boolean; + get(key:string, callback?:ResCallbackT): boolean; + exists(key:string, value:string, callback?:ResCallbackT): boolean; + + publish(channel:string, value:any): boolean; + subscribe(channel:string): boolean; + + /* + commands = set_union([ + "get", "set", "setnx", "setex", "append", "strlen", "del", "exists", "setbit", "getbit", "setrange", "getrange", "substr", + "incr", "decr", "mget", "rpush", "lpush", "rpushx", "lpushx", "linsert", "rpop", "lpop", "brpop", "brpoplpush", "blpop", "llen", "lindex", + "lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore", + "sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore", + "zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx", + "hget", "hmset", "hmget", "hincrby", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx", + "randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave", + "bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl", + "persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster", + "restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands")); + */ + + get(args:any[], callback?:ResCallbackT): boolean; + get(...args:any[]): boolean; + set(args:any[], callback?:ResCallbackT): boolean; + set(...args:any[]): boolean; + setnx(args:any[], callback?:ResCallbackT): boolean; + setnx(...args:any[]): boolean; + setex(args:any[], callback?:ResCallbackT): boolean; + setex(...args:any[]): boolean; + append(args:any[], callback?:ResCallbackT): boolean; + append(...args:any[]): boolean; + strlen(args:any[], callback?:ResCallbackT): boolean; + strlen(...args:any[]): boolean; + del(args:any[], callback?:ResCallbackT): boolean; + del(...args:any[]): boolean; + exists(args:any[], callback?:ResCallbackT): boolean; + exists(...args:any[]): boolean; + setbit(args:any[], callback?:ResCallbackT): boolean; + setbit(...args:any[]): boolean; + getbit(args:any[], callback?:ResCallbackT): boolean; + getbit(...args:any[]): boolean; + setrange(args:any[], callback?:ResCallbackT): boolean; + setrange(...args:any[]): boolean; + getrange(args:any[], callback?:ResCallbackT): boolean; + getrange(...args:any[]): boolean; + substr(args:any[], callback?:ResCallbackT): boolean; + substr(...args:any[]): boolean; + incr(args:any[], callback?:ResCallbackT): boolean; + incr(...args:any[]): boolean; + decr(args:any[], callback?:ResCallbackT): boolean; + decr(...args:any[]): boolean; + mget(args:any[], callback?:ResCallbackT): boolean; + mget(...args:any[]): boolean; + rpush(...args:any[]): boolean; + lpush(args:any[], callback?:ResCallbackT): boolean; + lpush(...args:any[]): boolean; + rpushx(args:any[], callback?:ResCallbackT): boolean; + rpushx(...args:any[]): boolean; + lpushx(args:any[], callback?:ResCallbackT): boolean; + lpushx(...args:any[]): boolean; + linsert(args:any[], callback?:ResCallbackT): boolean; + linsert(...args:any[]): boolean; + rpop(args:any[], callback?:ResCallbackT): boolean; + rpop(...args:any[]): boolean; + lpop(args:any[], callback?:ResCallbackT): boolean; + lpop(...args:any[]): boolean; + brpop(args:any[], callback?:ResCallbackT): boolean; + brpop(...args:any[]): boolean; + brpoplpush(args:any[], callback?:ResCallbackT): boolean; + brpoplpush(...args:any[]): boolean; + blpop(args:any[], callback?:ResCallbackT): boolean; + blpop(...args:any[]): boolean; + llen(args:any[], callback?:ResCallbackT): boolean; + llen(...args:any[]): boolean; + lindex(args:any[], callback?:ResCallbackT): boolean; + lindex(...args:any[]): boolean; + lset(args:any[], callback?:ResCallbackT): boolean; + lset(...args:any[]): boolean; + lrange(args:any[], callback?:ResCallbackT): boolean; + lrange(...args:any[]): boolean; + ltrim(args:any[], callback?:ResCallbackT): boolean; + ltrim(...args:any[]): boolean; + lrem(args:any[], callback?:ResCallbackT): boolean; + lrem(...args:any[]): boolean; + rpoplpush(args:any[], callback?:ResCallbackT): boolean; + rpoplpush(...args:any[]): boolean; + sadd(args:any[], callback?:ResCallbackT): boolean; + sadd(...args:any[]): boolean; + srem(args:any[], callback?:ResCallbackT): boolean; + srem(...args:any[]): boolean; + smove(args:any[], callback?:ResCallbackT): boolean; + smove(...args:any[]): boolean; + sismember(args:any[], callback?:ResCallbackT): boolean; + sismember(...args:any[]): boolean; + scard(args:any[], callback?:ResCallbackT): boolean; + scard(...args:any[]): boolean; + spop(args:any[], callback?:ResCallbackT): boolean; + spop(...args:any[]): boolean; + srandmember(args:any[], callback?:ResCallbackT): boolean; + srandmember(...args:any[]): boolean; + sinter(args:any[], callback?:ResCallbackT): boolean; + sinter(...args:any[]): boolean; + sinterstore(args:any[], callback?:ResCallbackT): boolean; + sinterstore(...args:any[]): boolean; + sunion(args:any[], callback?:ResCallbackT): boolean; + sunion(...args:any[]): boolean; + sunionstore(args:any[], callback?:ResCallbackT): boolean; + sunionstore(...args:any[]): boolean; + sdiff(args:any[], callback?:ResCallbackT): boolean; + sdiff(...args:any[]): boolean; + sdiffstore(args:any[], callback?:ResCallbackT): boolean; + sdiffstore(...args:any[]): boolean; + smembers(args:any[], callback?:ResCallbackT): boolean; + smembers(...args:any[]): boolean; + zadd(args:any[], callback?:ResCallbackT): boolean; + zadd(...args:any[]): boolean; + zincrby(args:any[], callback?:ResCallbackT): boolean; + zincrby(...args:any[]): boolean; + zrem(args:any[], callback?:ResCallbackT): boolean; + zrem(...args:any[]): boolean; + zremrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zremrangebyscore(...args:any[]): boolean; + zremrangebyrank(args:any[], callback?:ResCallbackT): boolean; + zremrangebyrank(...args:any[]): boolean; + zunionstore(args:any[], callback?:ResCallbackT): boolean; + zunionstore(...args:any[]): boolean; + zinterstore(args:any[], callback?:ResCallbackT): boolean; + zinterstore(...args:any[]): boolean; + zrange(args:any[], callback?:ResCallbackT): boolean; + zrange(...args:any[]): boolean; + zrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zrangebyscore(...args:any[]): boolean; + zrevrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zrevrangebyscore(...args:any[]): boolean; + zcount(args:any[], callback?:ResCallbackT): boolean; + zcount(...args:any[]): boolean; + zrevrange(args:any[], callback?:ResCallbackT): boolean; + zrevrange(...args:any[]): boolean; + zcard(args:any[], callback?:ResCallbackT): boolean; + zcard(...args:any[]): boolean; + zscore(args:any[], callback?:ResCallbackT): boolean; + zscore(...args:any[]): boolean; + zrank(args:any[], callback?:ResCallbackT): boolean; + zrank(...args:any[]): boolean; + zrevrank(args:any[], callback?:ResCallbackT): boolean; + zrevrank(...args:any[]): boolean; + hset(args:any[], callback?:ResCallbackT): boolean; + hset(...args:any[]): boolean; + hsetnx(args:any[], callback?:ResCallbackT): boolean; + hsetnx(...args:any[]): boolean; + hget(args:any[], callback?:ResCallbackT): boolean; + hget(...args:any[]): boolean; + hmset(args:any[], callback?:ResCallbackT): boolean; + hmset(key:string, hash:any, callback?:ResCallbackT): boolean; + hmset(...args:any[]): boolean; + hmget(args:any[], callback?:ResCallbackT): boolean; + hmget(...args:any[]): boolean; + hincrby(args:any[], callback?:ResCallbackT): boolean; + hincrby(...args:any[]): boolean; + hdel(args:any[], callback?:ResCallbackT): boolean; + hdel(...args:any[]): boolean; + hlen(args:any[], callback?:ResCallbackT): boolean; + hlen(...args:any[]): boolean; + hkeys(args:any[], callback?:ResCallbackT): boolean; + hkeys(...args:any[]): boolean; + hvals(args:any[], callback?:ResCallbackT): boolean; + hvals(...args:any[]): boolean; + hgetall(args:any[], callback?:ResCallbackT): boolean; + hgetall(...args:any[]): boolean; + hgetall(key:string, callback?:ResCallbackT): boolean; + hexists(args:any[], callback?:ResCallbackT): boolean; + hexists(...args:any[]): boolean; + incrby(args:any[], callback?:ResCallbackT): boolean; + incrby(...args:any[]): boolean; + decrby(args:any[], callback?:ResCallbackT): boolean; + decrby(...args:any[]): boolean; + getset(args:any[], callback?:ResCallbackT): boolean; + getset(...args:any[]): boolean; + mset(args:any[], callback?:ResCallbackT): boolean; + mset(...args:any[]): boolean; + msetnx(args:any[], callback?:ResCallbackT): boolean; + msetnx(...args:any[]): boolean; + randomkey(args:any[], callback?:ResCallbackT): boolean; + randomkey(...args:any[]): boolean; + select(args:any[], callback?:ResCallbackT): void; + select(...args:any[]): void; + move(args:any[], callback?:ResCallbackT): boolean; + move(...args:any[]): boolean; + rename(args:any[], callback?:ResCallbackT): boolean; + rename(...args:any[]): boolean; + renamenx(args:any[], callback?:ResCallbackT): boolean; + renamenx(...args:any[]): boolean; + expire(args:any[], callback?:ResCallbackT): boolean; + expire(...args:any[]): boolean; + expireat(args:any[], callback?:ResCallbackT): boolean; + expireat(...args:any[]): boolean; + keys(args:any[], callback?:ResCallbackT): boolean; + keys(...args:any[]): boolean; + dbsize(args:any[], callback?:ResCallbackT): boolean; + dbsize(...args:any[]): boolean; + auth(args:any[], callback?:ResCallbackT): void; + auth(...args:any[]): void; + ping(args:any[], callback?:ResCallbackT): boolean; + ping(...args:any[]): boolean; + echo(args:any[], callback?:ResCallbackT): boolean; + echo(...args:any[]): boolean; + save(args:any[], callback?:ResCallbackT): boolean; + save(...args:any[]): boolean; + bgsave(args:any[], callback?:ResCallbackT): boolean; + bgsave(...args:any[]): boolean; + bgrewriteaof(args:any[], callback?:ResCallbackT): boolean; + bgrewriteaof(...args:any[]): boolean; + shutdown(args:any[], callback?:ResCallbackT): boolean; + shutdown(...args:any[]): boolean; + lastsave(args:any[], callback?:ResCallbackT): boolean; + lastsave(...args:any[]): boolean; + type(args:any[], callback?:ResCallbackT): boolean; + type(...args:any[]): boolean; + multi(args:any[], callback?:ResCallbackT): Multi; + multi(...args:any[]): Multi; + exec(args:any[], callback?:ResCallbackT): boolean; + exec(...args:any[]): boolean; + discard(args:any[], callback?:ResCallbackT): boolean; + discard(...args:any[]): boolean; + sync(args:any[], callback?:ResCallbackT): boolean; + sync(...args:any[]): boolean; + flushdb(args:any[], callback?:ResCallbackT): boolean; + flushdb(...args:any[]): boolean; + flushall(args:any[], callback?:ResCallbackT): boolean; + flushall(...args:any[]): boolean; + sort(args:any[], callback?:ResCallbackT): boolean; + sort(...args:any[]): boolean; + info(args:any[], callback?:ResCallbackT): boolean; + info(...args:any[]): boolean; + monitor(args:any[], callback?:ResCallbackT): boolean; + monitor(...args:any[]): boolean; + ttl(args:any[], callback?:ResCallbackT): boolean; + ttl(...args:any[]): boolean; + persist(args:any[], callback?:ResCallbackT): boolean; + persist(...args:any[]): boolean; + slaveof(args:any[], callback?:ResCallbackT): boolean; + slaveof(...args:any[]): boolean; + debug(args:any[], callback?:ResCallbackT): boolean; + debug(...args:any[]): boolean; + config(args:any[], callback?:ResCallbackT): boolean; + config(...args:any[]): boolean; + subscribe(args:any[], callback?:ResCallbackT): boolean; + subscribe(...args:any[]): boolean; + unsubscribe(args:any[], callback?:ResCallbackT): boolean; + unsubscribe(...args:any[]): boolean; + psubscribe(args:any[], callback?:ResCallbackT): boolean; + psubscribe(...args:any[]): boolean; + punsubscribe(args:any[], callback?:ResCallbackT): boolean; + punsubscribe(...args:any[]): boolean; + publish(args:any[], callback?:ResCallbackT): boolean; + publish(...args:any[]): boolean; + watch(args:any[], callback?:ResCallbackT): boolean; + watch(...args:any[]): boolean; + unwatch(args:any[], callback?:ResCallbackT): boolean; + unwatch(...args:any[]): boolean; + cluster(args:any[], callback?:ResCallbackT): boolean; + cluster(...args:any[]): boolean; + restore(args:any[], callback?:ResCallbackT): boolean; + restore(...args:any[]): boolean; + migrate(args:any[], callback?:ResCallbackT): boolean; + migrate(...args:any[]): boolean; + dump(args:any[], callback?:ResCallbackT): boolean; + dump(...args:any[]): boolean; + object(args:any[], callback?:ResCallbackT): boolean; + object(...args:any[]): boolean; + client(args:any[], callback?:ResCallbackT): boolean; + client(...args:any[]): boolean; + eval(args:any[], callback?:ResCallbackT): boolean; + eval(...args:any[]): boolean; + evalsha(args:any[], callback?:ResCallbackT): boolean; + evalsha(...args:any[]): boolean; + script(args:any[], callback?:ResCallbackT): boolean; + script(...args: any[]): boolean; + script(key: string, callback?: ResCallbackT): boolean; + quit(args:any[], callback?:ResCallbackT): boolean; + quit(...args:any[]): boolean; + scan(...args:any[]): boolean; + scan(args:any[], callback?:ResCallbackT): boolean; + hscan(...args:any[]): boolean; + hscan(args:any[], callback?:ResCallbackT): boolean; + zscan(...args:any[]): boolean; + zscan(args:any[], callback?:ResCallbackT): boolean; + } + + export interface Multi { + exec(callback?:ResCallbackT): boolean; + + get(args:any[], callback?:ResCallbackT): Multi; + get(...args:any[]): Multi; + set(args:any[], callback?:ResCallbackT): Multi; + set(...args:any[]): Multi; + setnx(args:any[], callback?:ResCallbackT): Multi; + setnx(...args:any[]): Multi; + setex(args:any[], callback?:ResCallbackT): Multi; + setex(...args:any[]): Multi; + append(args:any[], callback?:ResCallbackT): Multi; + append(...args:any[]): Multi; + strlen(args:any[], callback?:ResCallbackT): Multi; + strlen(...args:any[]): Multi; + del(args:any[], callback?:ResCallbackT): Multi; + del(...args:any[]): Multi; + exists(args:any[], callback?:ResCallbackT): Multi; + exists(...args:any[]): Multi; + setbit(args:any[], callback?:ResCallbackT): Multi; + setbit(...args:any[]): Multi; + getbit(args:any[], callback?:ResCallbackT): Multi; + getbit(...args:any[]): Multi; + setrange(args:any[], callback?:ResCallbackT): Multi; + setrange(...args:any[]): Multi; + getrange(args:any[], callback?:ResCallbackT): Multi; + getrange(...args:any[]): Multi; + substr(args:any[], callback?:ResCallbackT): Multi; + substr(...args:any[]): Multi; + incr(args:any[], callback?:ResCallbackT): Multi; + incr(...args:any[]): Multi; + decr(args:any[], callback?:ResCallbackT): Multi; + decr(...args:any[]): Multi; + mget(args:any[], callback?:ResCallbackT): Multi; + mget(...args:any[]): Multi; + rpush(...args:any[]): Multi; + lpush(args:any[], callback?:ResCallbackT): Multi; + lpush(...args:any[]): Multi; + rpushx(args:any[], callback?:ResCallbackT): Multi; + rpushx(...args:any[]): Multi; + lpushx(args:any[], callback?:ResCallbackT): Multi; + lpushx(...args:any[]): Multi; + linsert(args:any[], callback?:ResCallbackT): Multi; + linsert(...args:any[]): Multi; + rpop(args:any[], callback?:ResCallbackT): Multi; + rpop(...args:any[]): Multi; + lpop(args:any[], callback?:ResCallbackT): Multi; + lpop(...args:any[]): Multi; + brpop(args:any[], callback?:ResCallbackT): Multi; + brpop(...args:any[]): Multi; + brpoplpush(args:any[], callback?:ResCallbackT): Multi; + brpoplpush(...args:any[]): Multi; + blpop(args:any[], callback?:ResCallbackT): Multi; + blpop(...args:any[]): Multi; + llen(args:any[], callback?:ResCallbackT): Multi; + llen(...args:any[]): Multi; + lindex(args:any[], callback?:ResCallbackT): Multi; + lindex(...args:any[]): Multi; + lset(args:any[], callback?:ResCallbackT): Multi; + lset(...args:any[]): Multi; + lrange(args:any[], callback?:ResCallbackT): Multi; + lrange(...args:any[]): Multi; + ltrim(args:any[], callback?:ResCallbackT): Multi; + ltrim(...args:any[]): Multi; + lrem(args:any[], callback?:ResCallbackT): Multi; + lrem(...args:any[]): Multi; + rpoplpush(args:any[], callback?:ResCallbackT): Multi; + rpoplpush(...args:any[]): Multi; + sadd(args:any[], callback?:ResCallbackT): Multi; + sadd(...args:any[]): Multi; + srem(args:any[], callback?:ResCallbackT): Multi; + srem(...args:any[]): Multi; + smove(args:any[], callback?:ResCallbackT): Multi; + smove(...args:any[]): Multi; + sismember(args:any[], callback?:ResCallbackT): Multi; + sismember(...args:any[]): Multi; + scard(args:any[], callback?:ResCallbackT): Multi; + scard(...args:any[]): Multi; + spop(args:any[], callback?:ResCallbackT): Multi; + spop(...args:any[]): Multi; + srandmember(args:any[], callback?:ResCallbackT): Multi; + srandmember(...args:any[]): Multi; + sinter(args:any[], callback?:ResCallbackT): Multi; + sinter(...args:any[]): Multi; + sinterstore(args:any[], callback?:ResCallbackT): Multi; + sinterstore(...args:any[]): Multi; + sunion(args:any[], callback?:ResCallbackT): Multi; + sunion(...args:any[]): Multi; + sunionstore(args:any[], callback?:ResCallbackT): Multi; + sunionstore(...args:any[]): Multi; + sdiff(args:any[], callback?:ResCallbackT): Multi; + sdiff(...args:any[]): Multi; + sdiffstore(args:any[], callback?:ResCallbackT): Multi; + sdiffstore(...args:any[]): Multi; + smembers(args:any[], callback?:ResCallbackT): Multi; + smembers(...args:any[]): Multi; + zadd(args:any[], callback?:ResCallbackT): Multi; + zadd(...args:any[]): Multi; + zincrby(args:any[], callback?:ResCallbackT): Multi; + zincrby(...args:any[]): Multi; + zrem(args:any[], callback?:ResCallbackT): Multi; + zrem(...args:any[]): Multi; + zremrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zremrangebyscore(...args:any[]): Multi; + zremrangebyrank(args:any[], callback?:ResCallbackT): Multi; + zremrangebyrank(...args:any[]): Multi; + zunionstore(args:any[], callback?:ResCallbackT): Multi; + zunionstore(...args:any[]): Multi; + zinterstore(args:any[], callback?:ResCallbackT): Multi; + zinterstore(...args:any[]): Multi; + zrange(args:any[], callback?:ResCallbackT): Multi; + zrange(...args:any[]): Multi; + zrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zrangebyscore(...args:any[]): Multi; + zrevrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zrevrangebyscore(...args:any[]): Multi; + zcount(args:any[], callback?:ResCallbackT): Multi; + zcount(...args:any[]): Multi; + zrevrange(args:any[], callback?:ResCallbackT): Multi; + zrevrange(...args:any[]): Multi; + zcard(args:any[], callback?:ResCallbackT): Multi; + zcard(...args:any[]): Multi; + zscore(args:any[], callback?:ResCallbackT): Multi; + zscore(...args:any[]): Multi; + zrank(args:any[], callback?:ResCallbackT): Multi; + zrank(...args:any[]): Multi; + zrevrank(args:any[], callback?:ResCallbackT): Multi; + zrevrank(...args:any[]): Multi; + hset(args:any[], callback?:ResCallbackT): Multi; + hset(...args:any[]): Multi; + hsetnx(args:any[], callback?:ResCallbackT): Multi; + hsetnx(...args:any[]): Multi; + hget(args:any[], callback?:ResCallbackT): Multi; + hget(...args:any[]): Multi; + hmset(args:any[], callback?:ResCallbackT): Multi; + hmset(key:string, hash:any, callback?:ResCallbackT): Multi; + hmset(...args:any[]): Multi; + hmget(args:any[], callback?:ResCallbackT): Multi; + hmget(...args:any[]): Multi; + hincrby(args:any[], callback?:ResCallbackT): Multi; + hincrby(...args:any[]): Multi; + hdel(args:any[], callback?:ResCallbackT): Multi; + hdel(...args:any[]): Multi; + hlen(args:any[], callback?:ResCallbackT): Multi; + hlen(...args:any[]): Multi; + hkeys(args:any[], callback?:ResCallbackT): Multi; + hkeys(...args:any[]): Multi; + hvals(args:any[], callback?:ResCallbackT): Multi; + hvals(...args:any[]): Multi; + hgetall(args:any[], callback?:ResCallbackT): Multi; + hgetall(...args:any[]): Multi; + hgetall(key:string, callback?:ResCallbackT): Multi; + hexists(args:any[], callback?:ResCallbackT): Multi; + hexists(...args:any[]): Multi; + incrby(args:any[], callback?:ResCallbackT): Multi; + incrby(...args:any[]): Multi; + decrby(args:any[], callback?:ResCallbackT): Multi; + decrby(...args:any[]): Multi; + getset(args:any[], callback?:ResCallbackT): Multi; + getset(...args:any[]): Multi; + mset(args:any[], callback?:ResCallbackT): Multi; + mset(...args:any[]): Multi; + msetnx(args:any[], callback?:ResCallbackT): Multi; + msetnx(...args:any[]): Multi; + randomkey(args:any[], callback?:ResCallbackT): Multi; + randomkey(...args:any[]): Multi; + select(args:any[], callback?:ResCallbackT): void; + select(...args:any[]): Multi; + move(args:any[], callback?:ResCallbackT): Multi; + move(...args:any[]): Multi; + rename(args:any[], callback?:ResCallbackT): Multi; + rename(...args:any[]): Multi; + renamenx(args:any[], callback?:ResCallbackT): Multi; + renamenx(...args:any[]): Multi; + expire(args:any[], callback?:ResCallbackT): Multi; + expire(...args:any[]): Multi; + expireat(args:any[], callback?:ResCallbackT): Multi; + expireat(...args:any[]): Multi; + keys(args:any[], callback?:ResCallbackT): Multi; + keys(...args:any[]): Multi; + dbsize(args:any[], callback?:ResCallbackT): Multi; + dbsize(...args:any[]): Multi; + auth(args:any[], callback?:ResCallbackT): void; + auth(...args:any[]): void; + ping(args:any[], callback?:ResCallbackT): Multi; + ping(...args:any[]): Multi; + echo(args:any[], callback?:ResCallbackT): Multi; + echo(...args:any[]): Multi; + save(args:any[], callback?:ResCallbackT): Multi; + save(...args:any[]): Multi; + bgsave(args:any[], callback?:ResCallbackT): Multi; + bgsave(...args:any[]): Multi; + bgrewriteaof(args:any[], callback?:ResCallbackT): Multi; + bgrewriteaof(...args:any[]): Multi; + shutdown(args:any[], callback?:ResCallbackT): Multi; + shutdown(...args:any[]): Multi; + lastsave(args:any[], callback?:ResCallbackT): Multi; + lastsave(...args:any[]): Multi; + type(args:any[], callback?:ResCallbackT): Multi; + type(...args:any[]): Multi; + multi(args:any[], callback?:ResCallbackT): Multi; + multi(...args:any[]): Multi; + exec(args:any[], callback?:ResCallbackT): Multi; + exec(...args:any[]): Multi; + discard(args:any[], callback?:ResCallbackT): Multi; + discard(...args:any[]): Multi; + sync(args:any[], callback?:ResCallbackT): Multi; + sync(...args:any[]): Multi; + flushdb(args:any[], callback?:ResCallbackT): Multi; + flushdb(...args:any[]): Multi; + flushall(args:any[], callback?:ResCallbackT): Multi; + flushall(...args:any[]): Multi; + sort(args:any[], callback?:ResCallbackT): Multi; + sort(...args:any[]): Multi; + info(args:any[], callback?:ResCallbackT): Multi; + info(...args:any[]): Multi; + monitor(args:any[], callback?:ResCallbackT): Multi; + monitor(...args:any[]): Multi; + ttl(args:any[], callback?:ResCallbackT): Multi; + ttl(...args:any[]): Multi; + persist(args:any[], callback?:ResCallbackT): Multi; + persist(...args:any[]): Multi; + slaveof(args:any[], callback?:ResCallbackT): Multi; + slaveof(...args:any[]): Multi; + debug(args:any[], callback?:ResCallbackT): Multi; + debug(...args:any[]): Multi; + config(args:any[], callback?:ResCallbackT): Multi; + config(...args:any[]): Multi; + subscribe(args:any[], callback?:ResCallbackT): Multi; + subscribe(...args:any[]): Multi; + unsubscribe(args:any[], callback?:ResCallbackT): Multi; + unsubscribe(...args:any[]): Multi; + psubscribe(args:any[], callback?:ResCallbackT): Multi; + psubscribe(...args:any[]): Multi; + punsubscribe(args:any[], callback?:ResCallbackT): Multi; + punsubscribe(...args:any[]): Multi; + publish(args:any[], callback?:ResCallbackT): Multi; + publish(...args:any[]): Multi; + watch(args:any[], callback?:ResCallbackT): Multi; + watch(...args:any[]): Multi; + unwatch(args:any[], callback?:ResCallbackT): Multi; + unwatch(...args:any[]): Multi; + cluster(args:any[], callback?:ResCallbackT): Multi; + cluster(...args:any[]): Multi; + restore(args:any[], callback?:ResCallbackT): Multi; + restore(...args:any[]): Multi; + migrate(args:any[], callback?:ResCallbackT): Multi; + migrate(...args:any[]): Multi; + dump(args:any[], callback?:ResCallbackT): Multi; + dump(...args:any[]): Multi; + object(args:any[], callback?:ResCallbackT): Multi; + object(...args:any[]): Multi; + client(args:any[], callback?:ResCallbackT): Multi; + client(...args:any[]): Multi; + eval(args:any[], callback?:ResCallbackT): Multi; + eval(...args:any[]): Multi; + evalsha(args:any[], callback?:ResCallbackT): Multi; + evalsha(...args:any[]): Multi; + quit(args:any[], callback?:ResCallbackT): Multi; + quit(...args:any[]): Multi; + scan(...args:any[]): Multi; + scan(args:any[], callback?:ResCallbackT): Multi; + hscan(...args:any[]): Multi; + hscan(args:any[], callback?:ResCallbackT): Multi; + zscan(...args:any[]): Multi; + zscan(args:any[], callback?:ResCallbackT): Multi; + } +} \ No newline at end of file diff --git a/typings/main/ambient/rx/index.d.ts b/typings/main/ambient/rx/index.d.ts new file mode 100644 index 00000000..2da285b1 --- /dev/null +++ b/typings/main/ambient/rx/index.d.ts @@ -0,0 +1,68 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/4d86cc24082d6703ecaee46ecc970bd0ac744236/rx/rx.d.ts +// Type definitions for RxJS v2.5.3 +// Project: http://rx.codeplex.com/ +// Definitions by: gsino , Igor Oleinikov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module Rx { + export interface IScheduler { + catch(handler: (exception: any) => boolean): IScheduler; + catchException(handler: (exception: any) => boolean): IScheduler; + } + + // Observer + export interface Observer { + checked(): Observer; + } + + interface ObserverStatic { + /** + * Schedules the invocation of observer methods on the given scheduler. + * @param scheduler Scheduler to schedule observer messages on. + * @returns Observer whose messages are scheduled on the given scheduler. + */ + notifyOn(scheduler: IScheduler): Observer; + } + + export interface Observable { + observeOn(scheduler: IScheduler): Observable; + subscribeOn(scheduler: IScheduler): Observable; + + amb(rightSource: Observable): Observable; + amb(rightSource: IPromise): Observable; + onErrorResumeNext(second: Observable): Observable; + onErrorResumeNext(second: IPromise): Observable; + bufferWithCount(count: number, skip?: number): Observable; + windowWithCount(count: number, skip?: number): Observable>; + defaultIfEmpty(defaultValue?: T): Observable; + distinct(skipParameter: boolean, valueSerializer: (value: T) => string): Observable; + distinct(keySelector?: (value: T) => TKey, keySerializer?: (key: TKey) => string): Observable; + groupBy(keySelector: (value: T) => TKey, skipElementSelector?: boolean, keySerializer?: (key: TKey) => string): Observable>; + groupBy(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, keySerializer?: (key: TKey) => string): Observable>; + groupByUntil(keySelector: (value: T) => TKey, skipElementSelector: boolean, durationSelector: (group: GroupedObservable) => Observable, keySerializer?: (key: TKey) => string): Observable>; + groupByUntil(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, durationSelector: (group: GroupedObservable) => Observable, keySerializer?: (key: TKey) => string): Observable>; + } + + interface ObservableStatic { + using(resourceFactory: () => TResource, observableFactory: (resource: TResource) => Observable): Observable; + amb(...sources: Observable[]): Observable; + amb(...sources: IPromise[]): Observable; + amb(sources: Observable[]): Observable; + amb(sources: IPromise[]): Observable; + onErrorResumeNext(...sources: Observable[]): Observable; + onErrorResumeNext(...sources: IPromise[]): Observable; + onErrorResumeNext(sources: Observable[]): Observable; + onErrorResumeNext(sources: IPromise[]): Observable; + } + + interface GroupedObservable extends Observable { + key: TKey; + underlyingObservable: Observable; + } +} + +declare module "rx" { + export = Rx +} \ No newline at end of file

{ + new(props?: P, context?: any): ClassicComponent; + getDefaultProps?(): P; + displayName?: string; + } + + // + // Component Specs and Lifecycle + // ---------------------------------------------------------------------- + + interface ComponentLifecycle { + componentWillMount?(): void; + componentDidMount?(): void; + componentWillReceiveProps?(nextProps: P, nextContext: any): void; + shouldComponentUpdate?(nextProps: P, nextState: S, nextContext: any): boolean; + componentWillUpdate?(nextProps: P, nextState: S, nextContext: any): void; + componentDidUpdate?(prevProps: P, prevState: S, prevContext: any): void; + componentWillUnmount?(): void; + } + + interface Mixin extends ComponentLifecycle { + mixins?: Mixin; + statics?: { + [key: string]: any; + }; + + displayName?: string; + propTypes?: ValidationMap; + contextTypes?: ValidationMap; + childContextTypes?: ValidationMap; + + getDefaultProps?(): P; + getInitialState?(): S; + } + + interface ComponentSpec extends Mixin { + render(): ReactElement; + + [propertyName: string]: any; + } + + // + // Event System + // ---------------------------------------------------------------------- + + interface SyntheticEvent { + bubbles: boolean; + cancelable: boolean; + currentTarget: EventTarget; + defaultPrevented: boolean; + eventPhase: number; + isTrusted: boolean; + nativeEvent: Event; + preventDefault(): void; + stopPropagation(): void; + target: EventTarget; + timeStamp: Date; + type: string; + } + + interface ClipboardEvent extends SyntheticEvent { + clipboardData: DataTransfer; + } + + interface CompositionEvent extends SyntheticEvent { + data: string; + } + + interface DragEvent extends SyntheticEvent { + dataTransfer: DataTransfer; + } + + interface FocusEvent extends SyntheticEvent { + relatedTarget: EventTarget; + } + + interface FormEvent extends SyntheticEvent { + } + + interface KeyboardEvent extends SyntheticEvent { + altKey: boolean; + charCode: number; + ctrlKey: boolean; + getModifierState(key: string): boolean; + key: string; + keyCode: number; + locale: string; + location: number; + metaKey: boolean; + repeat: boolean; + shiftKey: boolean; + which: number; + } + + interface MouseEvent extends SyntheticEvent { + altKey: boolean; + button: number; + buttons: number; + clientX: number; + clientY: number; + ctrlKey: boolean; + getModifierState(key: string): boolean; + metaKey: boolean; + pageX: number; + pageY: number; + relatedTarget: EventTarget; + screenX: number; + screenY: number; + shiftKey: boolean; + } + + interface TouchEvent extends SyntheticEvent { + altKey: boolean; + changedTouches: TouchList; + ctrlKey: boolean; + getModifierState(key: string): boolean; + metaKey: boolean; + shiftKey: boolean; + targetTouches: TouchList; + touches: TouchList; + } + + interface UIEvent extends SyntheticEvent { + detail: number; + view: AbstractView; + } + + interface WheelEvent extends SyntheticEvent { + deltaMode: number; + deltaX: number; + deltaY: number; + deltaZ: number; + } + + // + // Event Handler Types + // ---------------------------------------------------------------------- + + interface EventHandler { + (event: E): void; + } + + type ReactEventHandler = EventHandler; + + type ClipboardEventHandler = EventHandler; + type CompositionEventHandler = EventHandler; + type DragEventHandler = EventHandler; + type FocusEventHandler = EventHandler; + type FormEventHandler = EventHandler; + type KeyboardEventHandler = EventHandler; + type MouseEventHandler = EventHandler; + type TouchEventHandler = EventHandler; + type UIEventHandler = EventHandler; + type WheelEventHandler = EventHandler; + + // + // Props / DOM Attributes + // ---------------------------------------------------------------------- + + interface Props { + children?: ReactNode; + key?: Key; + ref?: Ref; + } + + interface HTMLProps extends HTMLAttributes, Props { + } + + interface SVGProps extends SVGAttributes, Props { + } + + interface DOMAttributes { + dangerouslySetInnerHTML?: { + __html: string; + }; + + // Clipboard Events + onCopy?: ClipboardEventHandler; + onCut?: ClipboardEventHandler; + onPaste?: ClipboardEventHandler; + + // Composition Events + onCompositionEnd?: CompositionEventHandler; + onCompositionStart?: CompositionEventHandler; + onCompositionUpdate?: CompositionEventHandler; + + // Focus Events + onFocus?: FocusEventHandler; + onBlur?: FocusEventHandler; + + // Form Events + onChange?: FormEventHandler; + onInput?: FormEventHandler; + onSubmit?: FormEventHandler; + + // Image Events + onLoad?: ReactEventHandler; + onError?: ReactEventHandler; // also a Media Event + + // Keyboard Events + onKeyDown?: KeyboardEventHandler; + onKeyPress?: KeyboardEventHandler; + onKeyUp?: KeyboardEventHandler; + + // Media Events + onAbort?: ReactEventHandler; + onCanPlay?: ReactEventHandler; + onCanPlayThrough?: ReactEventHandler; + onDurationChange?: ReactEventHandler; + onEmptied?: ReactEventHandler; + onEncrypted?: ReactEventHandler; + onEnded?: ReactEventHandler; + onLoadedData?: ReactEventHandler; + onLoadedMetadata?: ReactEventHandler; + onLoadStart?: ReactEventHandler; + onPause?: ReactEventHandler; + onPlay?: ReactEventHandler; + onPlaying?: ReactEventHandler; + onProgress?: ReactEventHandler; + onRateChange?: ReactEventHandler; + onSeeked?: ReactEventHandler; + onSeeking?: ReactEventHandler; + onStalled?: ReactEventHandler; + onSuspend?: ReactEventHandler; + onTimeUpdate?: ReactEventHandler; + onVolumeChange?: ReactEventHandler; + onWaiting?: ReactEventHandler; + + // MouseEvents + onClick?: MouseEventHandler; + onContextMenu?: MouseEventHandler; + onDoubleClick?: MouseEventHandler; + onDrag?: DragEventHandler; + onDragEnd?: DragEventHandler; + onDragEnter?: DragEventHandler; + onDragExit?: DragEventHandler; + onDragLeave?: DragEventHandler; + onDragOver?: DragEventHandler; + onDragStart?: DragEventHandler; + onDrop?: DragEventHandler; + onMouseDown?: MouseEventHandler; + onMouseEnter?: MouseEventHandler; + onMouseLeave?: MouseEventHandler; + onMouseMove?: MouseEventHandler; + onMouseOut?: MouseEventHandler; + onMouseOver?: MouseEventHandler; + onMouseUp?: MouseEventHandler; + + // Selection Events + onSelect?: ReactEventHandler; + + // Touch Events + onTouchCancel?: TouchEventHandler; + onTouchEnd?: TouchEventHandler; + onTouchMove?: TouchEventHandler; + onTouchStart?: TouchEventHandler; + + // UI Events + onScroll?: UIEventHandler; + + // Wheel Events + onWheel?: WheelEventHandler; + } + + // This interface is not complete. Only properties accepting + // unitless numbers are listed here (see CSSProperty.js in React) + interface CSSProperties { + + /** + * Aligns a flex container's lines within the flex container when there is extra space in the cross-axis, similar to how justify-content aligns individual items within the main-axis. + */ + alignContent?: any; + + /** + * Sets the default alignment in the cross axis for all of the flex container's items, including anonymous flex items, similarly to how justify-content aligns items along the main axis. + */ + alignItems?: any; + + /** + * Allows the default alignment to be overridden for individual flex items. + */ + alignSelf?: any; + + /** + * This property allows precise alignment of elements, such as graphics, that do not have a baseline-table or lack the desired baseline in their baseline-table. With the alignment-adjust property, the position of the baseline identified by the alignment-baseline can be explicitly determined. It also determines precisely the alignment point for each glyph within a textual element. + */ + alignmentAdjust?: any; + + alignmentBaseline?: any; + + /** + * Defines a length of time to elapse before an animation starts, allowing an animation to begin execution some time after it is applied. + */ + animationDelay?: any; + + /** + * Defines whether an animation should run in reverse on some or all cycles. + */ + animationDirection?: any; + + /** + * Specifies how many times an animation cycle should play. + */ + animationIterationCount?: any; + + /** + * Defines the list of animations that apply to the element. + */ + animationName?: any; + + /** + * Defines whether an animation is running or paused. + */ + animationPlayState?: any; + + /** + * Allows changing the style of any element to platform-based interface elements or vice versa. + */ + appearance?: any; + + /** + * Determines whether or not the “back” side of a transformed element is visible when facing the viewer. + */ + backfaceVisibility?: any; + + /** + * Shorthand property to set the values for one or more of: + * background-clip, background-color, background-image, + * background-origin, background-position, background-repeat, + * background-size, and background-attachment. + */ + background?: any; + + /** + * If a background-image is specified, this property determines + * whether that image's position is fixed within the viewport, + * or scrolls along with its containing block. + */ + backgroundAttachment?: "scroll" | "fixed" | "local"; + + /** + * This property describes how the element's background images should blend with each other and the element's background color. + * The value is a list of blend modes that corresponds to each background image. Each element in the list will apply to the corresponding element of background-image. If a property doesn’t have enough comma-separated values to match the number of layers, the UA must calculate its used value by repeating the list of values until there are enough. + */ + backgroundBlendMode?: any; + + /** + * Sets the background color of an element. + */ + backgroundColor?: any; + + backgroundComposite?: any; + + /** + * Applies one or more background images to an element. These can be any valid CSS image, including url() paths to image files or CSS gradients. + */ + backgroundImage?: any; + + /** + * Specifies what the background-position property is relative to. + */ + backgroundOrigin?: any; + + /** + * Sets the position of a background image. + */ + backgroundPosition?: any; + + /** + * Background-repeat defines if and how background images will be repeated after they have been sized and positioned + */ + backgroundRepeat?: any; + + /** + * Obsolete - spec retired, not implemented. + */ + baselineShift?: any; + + /** + * Non standard. Sets or retrieves the location of the Dynamic HTML (DHTML) behavior. + */ + behavior?: any; + + /** + * Shorthand property that defines the different properties of all four sides of an element's border in a single declaration. It can be used to set border-width, border-style and border-color, or a subset of these. + */ + border?: any; + + /** + * Shorthand that sets the values of border-bottom-color, + * border-bottom-style, and border-bottom-width. + */ + borderBottom?: any; + + /** + * Sets the color of the bottom border of an element. + */ + borderBottomColor?: any; + + /** + * Defines the shape of the border of the bottom-left corner. + */ + borderBottomLeftRadius?: any; + + /** + * Defines the shape of the border of the bottom-right corner. + */ + borderBottomRightRadius?: any; + + /** + * Sets the line style of the bottom border of a box. + */ + borderBottomStyle?: any; + + /** + * Sets the width of an element's bottom border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderBottomWidth?: any; + + /** + * Border-collapse can be used for collapsing the borders between table cells + */ + borderCollapse?: any; + + /** + * The CSS border-color property sets the color of an element's four borders. This property can have from one to four values, made up of the elementary properties: • border-top-color + * • border-right-color + * • border-bottom-color + * • border-left-color The default color is the currentColor of each of these values. + * If you provide one value, it sets the color for the element. Two values set the horizontal and vertical values, respectively. Providing three values sets the top, vertical, and bottom values, in that order. Four values set all for sides: top, right, bottom, and left, in that order. + */ + borderColor?: any; + + /** + * Specifies different corner clipping effects, such as scoop (inner curves), bevel (straight cuts) or notch (cut-off rectangles). Works along with border-radius to specify the size of each corner effect. + */ + borderCornerShape?: any; + + /** + * The property border-image-source is used to set the image to be used instead of the border style. If this is set to none the border-style is used instead. + */ + borderImageSource?: any; + + /** + * The border-image-width CSS property defines the offset to use for dividing the border image in nine parts, the top-left corner, central top edge, top-right-corner, central right edge, bottom-right corner, central bottom edge, bottom-left corner, and central right edge. They represent inward distance from the top, right, bottom, and left edges. + */ + borderImageWidth?: any; + + /** + * Shorthand property that defines the border-width, border-style and border-color of an element's left border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the left border — border-left-width, border-left-style and border-left-color. + */ + borderLeft?: any; + + /** + * The CSS border-left-color property sets the color of an element's left border. This page explains the border-left-color value, but often you will find it more convenient to fix the border's left color as part of a shorthand set, either border-left or border-color. + * Colors can be defined several ways. For more information, see Usage. + */ + borderLeftColor?: any; + + /** + * Sets the style of an element's left border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. + */ + borderLeftStyle?: any; + + /** + * Sets the width of an element's left border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderLeftWidth?: any; + + /** + * Shorthand property that defines the border-width, border-style and border-color of an element's right border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the right border — border-right-width, border-right-style and border-right-color. + */ + borderRight?: any; + + /** + * Sets the color of an element's right border. This page explains the border-right-color value, but often you will find it more convenient to fix the border's right color as part of a shorthand set, either border-right or border-color. + * Colors can be defined several ways. For more information, see Usage. + */ + borderRightColor?: any; + + /** + * Sets the style of an element's right border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. + */ + borderRightStyle?: any; + + /** + * Sets the width of an element's right border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderRightWidth?: any; + + /** + * Specifies the distance between the borders of adjacent cells. + */ + borderSpacing?: any; + + /** + * Sets the style of an element's four borders. This property can have from one to four values. With only one value, the value will be applied to all four borders; otherwise, this works as a shorthand property for each of border-top-style, border-right-style, border-bottom-style, border-left-style, where each border style may be assigned a separate value. + */ + borderStyle?: any; + + /** + * Shorthand property that defines the border-width, border-style and border-color of an element's top border in a single declaration. Note that you can use the corresponding longhand properties to set specific individual properties of the top border — border-top-width, border-top-style and border-top-color. + */ + borderTop?: any; + + /** + * Sets the color of an element's top border. This page explains the border-top-color value, but often you will find it more convenient to fix the border's top color as part of a shorthand set, either border-top or border-color. + * Colors can be defined several ways. For more information, see Usage. + */ + borderTopColor?: any; + + /** + * Sets the rounding of the top-left corner of the element. + */ + borderTopLeftRadius?: any; + + /** + * Sets the rounding of the top-right corner of the element. + */ + borderTopRightRadius?: any; + + /** + * Sets the style of an element's top border. To set all four borders, use the shorthand property, border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style. + */ + borderTopStyle?: any; + + /** + * Sets the width of an element's top border. To set all four borders, use the border-width shorthand property which sets the values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderTopWidth?: any; + + /** + * Sets the width of an element's four borders. This property can have from one to four values. This is a shorthand property for setting values simultaneously for border-top-width, border-right-width, border-bottom-width, and border-left-width. + */ + borderWidth?: any; + + /** + * This property specifies how far an absolutely positioned box's bottom margin edge is offset above the bottom edge of the box's containing block. For relatively positioned boxes, the offset is with respect to the bottom edges of the box itself (i.e., the box is given a position in the normal flow, then offset from that position according to these properties). + */ + bottom?: any; + + /** + * Obsolete. + */ + boxAlign?: any; + + /** + * Breaks a box into fragments creating new borders, padding and repeating backgrounds or lets it stay as a continuous box on a page break, column break, or, for inline elements, at a line break. + */ + boxDecorationBreak?: any; + + /** + * Deprecated + */ + boxDirection?: any; + + /** + * Do not use. This property has been replaced by the flex-wrap property. + * Gets or sets a value that specifies the direction to add successive rows or columns when the value of box-lines is set to multiple. + */ + boxLineProgression?: any; + + /** + * Do not use. This property has been replaced by the flex-wrap property. + * Gets or sets a value that specifies whether child elements wrap onto multiple lines or columns based on the space available in the object. + */ + boxLines?: any; + + /** + * Do not use. This property has been replaced by flex-order. + * Specifies the ordinal group that a child element of the object belongs to. This ordinal value identifies the display order (along the axis defined by the box-orient property) for the group. + */ + boxOrdinalGroup?: any; + + /** + * Deprecated. + */ + boxFlex?: number; + + /** + * Deprecated. + */ + boxFlexGroup?: number; + + /** + * The CSS break-after property allows you to force a break on multi-column layouts. More specifically, it allows you to force a break after an element. It allows you to determine if a break should occur, and what type of break it should be. The break-after CSS property describes how the page, column or region break behaves after the generated box. If there is no generated box, the property is ignored. + */ + breakAfter?: any; + + /** + * Control page/column/region breaks that fall above a block of content + */ + breakBefore?: any; + + /** + * Control page/column/region breaks that fall within a block of content + */ + breakInside?: any; + + /** + * The clear CSS property specifies if an element can be positioned next to or must be positioned below the floating elements that precede it in the markup. + */ + clear?: any; + + /** + * Deprecated; see clip-path. + * Lets you specify the dimensions of an absolutely positioned element that should be visible, and the element is clipped into this shape, and displayed. + */ + clip?: any; + + /** + * Clipping crops an graphic, so that only a portion of the graphic is rendered, or filled. This clip-rule property, when used with the clip-path property, defines which clip rule, or algorithm, to use when filling the different parts of a graphics. + */ + clipRule?: any; + + /** + * The color property sets the color of an element's foreground content (usually text), accepting any standard CSS color from keywords and hex values to RGB(a) and HSL(a). + */ + color?: any; + + /** + * Describes the number of columns of the element. + */ + columnCount?: number; + + /** + * Specifies how to fill columns (balanced or sequential). + */ + columnFill?: any; + + /** + * The column-gap property controls the width of the gap between columns in multi-column elements. + */ + columnGap?: any; + + /** + * Sets the width, style, and color of the rule between columns. + */ + columnRule?: any; + + /** + * Specifies the color of the rule between columns. + */ + columnRuleColor?: any; + + /** + * Specifies the width of the rule between columns. + */ + columnRuleWidth?: any; + + /** + * The column-span CSS property makes it possible for an element to span across all columns when its value is set to all. An element that spans more than one column is called a spanning element. + */ + columnSpan?: any; + + /** + * Specifies the width of columns in multi-column elements. + */ + columnWidth?: any; + + /** + * This property is a shorthand property for setting column-width and/or column-count. + */ + columns?: any; + + /** + * The counter-increment property accepts one or more names of counters (identifiers), each one optionally followed by an integer which specifies the value by which the counter should be incremented (e.g. if the value is 2, the counter increases by 2 each time it is invoked). + */ + counterIncrement?: any; + + /** + * The counter-reset property contains a list of one or more names of counters, each one optionally followed by an integer (otherwise, the integer defaults to 0.) Each time the given element is invoked, the counters specified by the property are set to the given integer. + */ + counterReset?: any; + + /** + * The cue property specifies sound files (known as an "auditory icon") to be played by speech media agents before and after presenting an element's content; if only one file is specified, it is played both before and after. The volume at which the file(s) should be played, relative to the volume of the main element, may also be specified. The icon files may also be set separately with the cue-before and cue-after properties. + */ + cue?: any; + + /** + * The cue-after property specifies a sound file (known as an "auditory icon") to be played by speech media agents after presenting an element's content; the volume at which the file should be played may also be specified. The shorthand property cue sets cue sounds for both before and after the element is presented. + */ + cueAfter?: any; + + /** + * Specifies the mouse cursor displayed when the mouse pointer is over an element. + */ + cursor?: any; + + /** + * The direction CSS property specifies the text direction/writing direction. The rtl is used for Hebrew or Arabic text, the ltr is for other languages. + */ + direction?: any; + + /** + * This property specifies the type of rendering box used for an element. It is a shorthand property for many other display properties. + */ + display?: any; + + /** + * The ‘fill’ property paints the interior of the given graphical element. The area to be painted consists of any areas inside the outline of the shape. To determine the inside of the shape, all subpaths are considered, and the interior is determined according to the rules associated with the current value of the ‘fill-rule’ property. The zero-width geometric outline of a shape is included in the area to be painted. + */ + fill?: any; + + /** + * SVG: Specifies the opacity of the color or the content the current object is filled with. + */ + fillOpacity?: number; + + /** + * The ‘fill-rule’ property indicates the algorithm which is to be used to determine what parts of the canvas are included inside the shape. For a simple, non-intersecting path, it is intuitively clear what region lies "inside"; however, for a more complex path, such as a path that intersects itself or where one subpath encloses another, the interpretation of "inside" is not so obvious. + * The ‘fill-rule’ property provides two options for how the inside of a shape is determined: + */ + fillRule?: any; + + /** + * Applies various image processing effects. This property is largely unsupported. See Compatibility section for more information. + */ + filter?: any; + + /** + * Shorthand for `flex-grow`, `flex-shrink`, and `flex-basis`. + */ + flex?: number | string; + + /** + * Obsolete, do not use. This property has been renamed to align-items. + * Specifies the alignment (perpendicular to the layout axis defined by the flex-direction property) of child elements of the object. + */ + flexAlign?: any; + + /** + * The flex-basis CSS property describes the initial main size of the flex item before any free space is distributed according to the flex factors described in the flex property (flex-grow and flex-shrink). + */ + flexBasis?: any; + + /** + * The flex-direction CSS property describes how flex items are placed in the flex container, by setting the direction of the flex container's main axis. + */ + flexDirection?: any; + + /** + * The flex-flow CSS property defines the flex container's main and cross axis. It is a shorthand property for the flex-direction and flex-wrap properties. + */ + flexFlow?: any; + + /** + * Specifies the flex grow factor of a flex item. + */ + flexGrow?: number; + + /** + * Do not use. This property has been renamed to align-self + * Specifies the alignment (perpendicular to the layout axis defined by flex-direction) of child elements of the object. + */ + flexItemAlign?: any; + + /** + * Do not use. This property has been renamed to align-content. + * Specifies how a flexbox's lines align within the flexbox when there is extra space along the axis that is perpendicular to the axis defined by the flex-direction property. + */ + flexLinePack?: any; + + /** + * Gets or sets a value that specifies the ordinal group that a flexbox element belongs to. This ordinal value identifies the display order for the group. + */ + flexOrder?: any; + + /** + * Specifies the flex shrink factor of a flex item. + */ + flexShrink?: number; + + /** + * Elements which have the style float are floated horizontally. These elements can move as far to the left or right of the containing element. All elements after the floating element will flow around it, but elements before the floating element are not impacted. If several floating elements are placed after each other, they will float next to each other as long as there is room. + */ + float?: any; + + /** + * Flows content from a named flow (specified by a corresponding flow-into) through selected elements to form a dynamic chain of layout regions. + */ + flowFrom?: any; + + /** + * The font property is shorthand that allows you to do one of two things: you can either set up six of the most mature font properties in one line, or you can set one of a choice of keywords to adopt a system font setting. + */ + font?: any; + + /** + * The font-family property allows one or more font family names and/or generic family names to be specified for usage on the selected element(s)' text. The browser then goes through the list; for each character in the selection it applies the first font family that has an available glyph for that character. + */ + fontFamily?: any; + + /** + * The font-kerning property allows contextual adjustment of inter-glyph spacing, i.e. the spaces between the characters in text. This property controls metric kerning - that utilizes adjustment data contained in the font. Optical Kerning is not supported as yet. + */ + fontKerning?: any; + + /** + * Specifies the size of the font. Used to compute em and ex units. + */ + fontSize?: number | string; + + /** + * The font-size-adjust property adjusts the font-size of the fallback fonts defined with font-family, so that the x-height is the same no matter what font is used. This preserves the readability of the text when fallback happens. + */ + fontSizeAdjust?: any; + + /** + * Allows you to expand or condense the widths for a normal, condensed, or expanded font face. + */ + fontStretch?: any; + + /** + * The font-style property allows normal, italic, or oblique faces to be selected. Italic forms are generally cursive in nature while oblique faces are typically sloped versions of the regular face. Oblique faces can be simulated by artificially sloping the glyphs of the regular face. + */ + fontStyle?: any; + + /** + * This value specifies whether the user agent is allowed to synthesize bold or oblique font faces when a font family lacks bold or italic faces. + */ + fontSynthesis?: any; + + /** + * The font-variant property enables you to select the small-caps font within a font family. + */ + fontVariant?: any; + + /** + * Fonts can provide alternate glyphs in addition to default glyph for a character. This property provides control over the selection of these alternate glyphs. + */ + fontVariantAlternates?: any; + + /** + * Specifies the weight or boldness of the font. + */ + fontWeight?: "normal" | "bold" | "lighter" | "bolder" | number; + + /** + * Lays out one or more grid items bound by 4 grid lines. Shorthand for setting grid-column-start, grid-column-end, grid-row-start, and grid-row-end in a single declaration. + */ + gridArea?: any; + + /** + * Controls a grid item's placement in a grid area, particularly grid position and a grid span. Shorthand for setting grid-column-start and grid-column-end in a single declaration. + */ + gridColumn?: any; + + /** + * Controls a grid item's placement in a grid area as well as grid position and a grid span. The grid-column-end property (with grid-row-start, grid-row-end, and grid-column-start) determines a grid item's placement by specifying the grid lines of a grid item's grid area. + */ + gridColumnEnd?: any; + + /** + * Determines a grid item's placement by specifying the starting grid lines of a grid item's grid area . A grid item's placement in a grid area consists of a grid position and a grid span. See also ( grid-row-start, grid-row-end, and grid-column-end) + */ + gridColumnStart?: any; + + /** + * Gets or sets a value that indicates which row an element within a Grid should appear in. Shorthand for setting grid-row-start and grid-row-end in a single declaration. + */ + gridRow?: any; + + /** + * Determines a grid item’s placement by specifying the block-end. A grid item's placement in a grid area consists of a grid position and a grid span. The grid-row-end property (with grid-row-start, grid-column-start, and grid-column-end) determines a grid item's placement by specifying the grid lines of a grid item's grid area. + */ + gridRowEnd?: any; + + /** + * Specifies a row position based upon an integer location, string value, or desired row size. + * css/properties/grid-row is used as short-hand for grid-row-position and grid-row-position + */ + gridRowPosition?: any; + + gridRowSpan?: any; + + /** + * Specifies named grid areas which are not associated with any particular grid item, but can be referenced from the grid-placement properties. The syntax of the grid-template-areas property also provides a visualization of the structure of the grid, making the overall layout of the grid container easier to understand. + */ + gridTemplateAreas?: any; + + /** + * Specifies (with grid-template-rows) the line names and track sizing functions of the grid. Each sizing function can be specified as a length, a percentage of the grid container’s size, a measurement of the contents occupying the column or row, or a fraction of the free space in the grid. + */ + gridTemplateColumns?: any; + + /** + * Specifies (with grid-template-columns) the line names and track sizing functions of the grid. Each sizing function can be specified as a length, a percentage of the grid container’s size, a measurement of the contents occupying the column or row, or a fraction of the free space in the grid. + */ + gridTemplateRows?: any; + + /** + * Sets the height of an element. The content area of the element height does not include the padding, border, and margin of the element. + */ + height?: any; + + /** + * Specifies the minimum number of characters in a hyphenated word + */ + hyphenateLimitChars?: any; + + /** + * Indicates the maximum number of successive hyphenated lines in an element. The ‘no-limit’ value means that there is no limit. + */ + hyphenateLimitLines?: any; + + /** + * Specifies the maximum amount of trailing whitespace (before justification) that may be left in a line before hyphenation is triggered to pull part of a word from the next line back up into the current one. + */ + hyphenateLimitZone?: any; + + /** + * Specifies whether or not words in a sentence can be split by the use of a manual or automatic hyphenation mechanism. + */ + hyphens?: any; + + imeMode?: any; + + layoutGrid?: any; + + layoutGridChar?: any; + + layoutGridLine?: any; + + layoutGridMode?: any; + + layoutGridType?: any; + + /** + * Sets the left edge of an element + */ + left?: any; + + /** + * The letter-spacing CSS property specifies the spacing behavior between text characters. + */ + letterSpacing?: any; + + /** + * Deprecated. Gets or sets line-breaking rules for text in selected languages such as Japanese, Chinese, and Korean. + */ + lineBreak?: any; + + lineClamp?: number; + + /** + * Specifies the height of an inline block level element. + */ + lineHeight?: number | string; + + /** + * Shorthand property that sets the list-style-type, list-style-position and list-style-image properties in one declaration. + */ + listStyle?: any; + + /** + * This property sets the image that will be used as the list item marker. When the image is available, it will replace the marker set with the 'list-style-type' marker. That also means that if the image is not available, it will show the style specified by list-style-property + */ + listStyleImage?: any; + + /** + * Specifies if the list-item markers should appear inside or outside the content flow. + */ + listStylePosition?: any; + + /** + * Specifies the type of list-item marker in a list. + */ + listStyleType?: any; + + /** + * The margin property is shorthand to allow you to set all four margins of an element at once. Its equivalent longhand properties are margin-top, margin-right, margin-bottom and margin-left. Negative values are also allowed. + */ + margin?: any; + + /** + * margin-bottom sets the bottom margin of an element. + */ + marginBottom?: any; + + /** + * margin-left sets the left margin of an element. + */ + marginLeft?: any; + + /** + * margin-right sets the right margin of an element. + */ + marginRight?: any; + + /** + * margin-top sets the top margin of an element. + */ + marginTop?: any; + + /** + * The marquee-direction determines the initial direction in which the marquee content moves. + */ + marqueeDirection?: any; + + /** + * The 'marquee-style' property determines a marquee's scrolling behavior. + */ + marqueeStyle?: any; + + /** + * This property is shorthand for setting mask-image, mask-mode, mask-repeat, mask-position, mask-clip, mask-origin, mask-composite and mask-size. Omitted values are set to their original properties' initial values. + */ + mask?: any; + + /** + * This property is shorthand for setting mask-border-source, mask-border-slice, mask-border-width, mask-border-outset, and mask-border-repeat. Omitted values are set to their original properties' initial values. + */ + maskBorder?: any; + + /** + * This property specifies how the images for the sides and the middle part of the mask image are scaled and tiled. The first keyword applies to the horizontal sides, the second one applies to the vertical ones. If the second keyword is absent, it is assumed to be the same as the first, similar to the CSS border-image-repeat property. + */ + maskBorderRepeat?: any; + + /** + * This property specifies inward offsets from the top, right, bottom, and left edges of the mask image, dividing it into nine regions: four corners, four edges, and a middle. The middle image part is discarded and treated as fully transparent black unless the fill keyword is present. The four values set the top, right, bottom and left offsets in that order, similar to the CSS border-image-slice property. + */ + maskBorderSlice?: any; + + /** + * Specifies an image to be used as a mask. An image that is empty, fails to download, is non-existent, or cannot be displayed is ignored and does not mask the element. + */ + maskBorderSource?: any; + + /** + * This property sets the width of the mask box image, similar to the CSS border-image-width property. + */ + maskBorderWidth?: any; + + /** + * Determines the mask painting area, which defines the area that is affected by the mask. The painted content of an element may be restricted to this area. + */ + maskClip?: any; + + /** + * For elements rendered as a single box, specifies the mask positioning area. For elements rendered as multiple boxes (e.g., inline boxes on several lines, boxes on several pages) specifies which boxes box-decoration-break operates on to determine the mask positioning area(s). + */ + maskOrigin?: any; + + /** + * This property must not be used. It is no longer included in any standard or standard track specification, nor is it implemented in any browser. It is only used when the text-align-last property is set to size. It controls allowed adjustments of font-size to fit line content. + */ + maxFontSize?: any; + + /** + * Sets the maximum height for an element. It prevents the height of the element to exceed the specified value. If min-height is specified and is greater than max-height, max-height is overridden. + */ + maxHeight?: any; + + /** + * Sets the maximum width for an element. It limits the width property to be larger than the value specified in max-width. + */ + maxWidth?: any; + + /** + * Sets the minimum height for an element. It prevents the height of the element to be smaller than the specified value. The value of min-height overrides both max-height and height. + */ + minHeight?: any; + + /** + * Sets the minimum width of an element. It limits the width property to be not smaller than the value specified in min-width. + */ + minWidth?: any; + + /** + * Specifies the transparency of an element. + */ + opacity?: number; + + /** + * Specifies the order used to lay out flex items in their flex container. + * Elements are laid out in the ascending order of the order value. + */ + order?: number; + + /** + * In paged media, this property defines the minimum number of lines in + * a block container that must be left at the bottom of the page. + */ + orphans?: number; + + /** + * The CSS outline property is a shorthand property for setting one or more of the individual outline properties outline-style, outline-width and outline-color in a single rule. In most cases the use of this shortcut is preferable and more convenient. + * Outlines differ from borders in the following ways: • Outlines do not take up space, they are drawn above the content. + * • Outlines may be non-rectangular. They are rectangular in Gecko/Firefox. Internet Explorer attempts to place the smallest contiguous outline around all elements or shapes that are indicated to have an outline. Opera draws a non-rectangular shape around a construct. + */ + outline?: any; + + /** + * The outline-color property sets the color of the outline of an element. An outline is a line that is drawn around elements, outside the border edge, to make the element stand out. + */ + outlineColor?: any; + + /** + * The outline-offset property offsets the outline and draw it beyond the border edge. + */ + outlineOffset?: any; + + /** + * The overflow property controls how extra content exceeding the bounding box of an element is rendered. It can be used in conjunction with an element that has a fixed width and height, to eliminate text-induced page distortion. + */ + overflow?: any; + + /** + * Specifies the preferred scrolling methods for elements that overflow. + */ + overflowStyle?: any; + + /** + * Controls how extra content exceeding the x-axis of the bounding box of an element is rendered. + */ + overflowX?: any; + + /** + * Controls how extra content exceeding the y-axis of the bounding box of an element is rendered. + */ + overflowY?: any; + + /** + * The padding optional CSS property sets the required padding space on one to four sides of an element. The padding area is the space between an element and its border. Negative values are not allowed but decimal values are permitted. The element size is treated as fixed, and the content of the element shifts toward the center as padding is increased. + * The padding property is a shorthand to avoid setting each side separately (padding-top, padding-right, padding-bottom, padding-left). + */ + padding?: any; + + /** + * The padding-bottom CSS property of an element sets the padding space required on the bottom of an element. The padding area is the space between the content of the element and its border. Contrary to margin-bottom values, negative values of padding-bottom are invalid. + */ + paddingBottom?: any; + + /** + * The padding-left CSS property of an element sets the padding space required on the left side of an element. The padding area is the space between the content of the element and its border. Contrary to margin-left values, negative values of padding-left are invalid. + */ + paddingLeft?: any; + + /** + * The padding-right CSS property of an element sets the padding space required on the right side of an element. The padding area is the space between the content of the element and its border. Contrary to margin-right values, negative values of padding-right are invalid. + */ + paddingRight?: any; + + /** + * The padding-top CSS property of an element sets the padding space required on the top of an element. The padding area is the space between the content of the element and its border. Contrary to margin-top values, negative values of padding-top are invalid. + */ + paddingTop?: any; + + /** + * The page-break-after property is supported in all major browsers. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. + */ + pageBreakAfter?: any; + + /** + * The page-break-before property sets the page-breaking behavior before an element. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. + */ + pageBreakBefore?: any; + + /** + * Sets the page-breaking behavior inside an element. With CSS3, page-break-* properties are only aliases of the break-* properties. The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation. + */ + pageBreakInside?: any; + + /** + * The pause property determines how long a speech media agent should pause before and after presenting an element. It is a shorthand for the pause-before and pause-after properties. + */ + pause?: any; + + /** + * The pause-after property determines how long a speech media agent should pause after presenting an element. It may be replaced by the shorthand property pause, which sets pause time before and after. + */ + pauseAfter?: any; + + /** + * The pause-before property determines how long a speech media agent should pause before presenting an element. It may be replaced by the shorthand property pause, which sets pause time before and after. + */ + pauseBefore?: any; + + /** + * The perspective property defines how far an element is placed from the view on the z-axis, from the screen to the viewer. + * Perspective defines how an object is viewed. In graphic arts, perspective is the representation on a flat surface of what the viewer's eye would see in a 3D space. (See Wikipedia for more information about graphical perspective and for related illustrations.) + * The illusion of perspective on a flat surface, such as a computer screen, is created by projecting points on the flat surface as they would appear if the flat surface were a window through which the viewer was looking at the object. In discussion of virtual environments, this flat surface is called a projection plane. + */ + perspective?: any; + + /** + * The perspective-origin property establishes the origin for the perspective property. It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element. + * When used with perspective, perspective-origin changes the appearance of an object, as if a viewer were looking at it from a different origin. An object appears differently if a viewer is looking directly at it versus looking at it from below, above, or from the side. Thus, the perspective-origin is like a vanishing point. + * The default value of perspective-origin is 50% 50%. This displays an object as if the viewer's eye were positioned directly at the center of the screen, both top-to-bottom and left-to-right. A value of 0% 0% changes the object as if the viewer was looking toward the top left angle. A value of 100% 100% changes the appearance as if viewed toward the bottom right angle. + */ + perspectiveOrigin?: any; + + /** + * The pointer-events property allows you to control whether an element can be the target for the pointing device (e.g, mouse, pen) events. + */ + pointerEvents?: any; + + /** + * The position property controls the type of positioning used by an element within its parent elements. The effect of the position property depends on a lot of factors, for example the position property of parent elements. + */ + position?: any; + + /** + * Obsolete: unsupported. + * This property determines whether or not a full-width punctuation mark character should be trimmed if it appears at the beginning of a line, so that its "ink" lines up with the first glyph in the line above and below. + */ + punctuationTrim?: any; + + /** + * Sets the type of quotation marks for embedded quotations. + */ + quotes?: any; + + /** + * Controls whether the last region in a chain displays additional 'overset' content according its default overflow property, or if it displays a fragment of content as if it were flowing into a subsequent region. + */ + regionFragment?: any; + + /** + * The rest-after property determines how long a speech media agent should pause after presenting an element's main content, before presenting that element's exit cue sound. It may be replaced by the shorthand property rest, which sets rest time before and after. + */ + restAfter?: any; + + /** + * The rest-before property determines how long a speech media agent should pause after presenting an intro cue sound for an element, before presenting that element's main content. It may be replaced by the shorthand property rest, which sets rest time before and after. + */ + restBefore?: any; + + /** + * Specifies the position an element in relation to the right side of the containing element. + */ + right?: any; + + rubyAlign?: any; + + rubyPosition?: any; + + /** + * Defines the alpha channel threshold used to extract a shape from an image. Can be thought of as a "minimum opacity" threshold; that is, a value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque. + */ + shapeImageThreshold?: any; + + /** + * A future level of CSS Shapes will define a shape-inside property, which will define a shape to wrap content within the element. See Editor's Draft and CSSWG wiki page on next-level plans + */ + shapeInside?: any; + + /** + * Adds a margin to a shape-outside. In effect, defines a new shape that is the smallest contour around all the points that are the shape-margin distance outward perpendicular to each point on the underlying shape. For points where a perpendicular direction is not defined (e.g., a triangle corner), takes all points on a circle centered at the point and with a radius of the shape-margin distance. This property accepts only non-negative values. + */ + shapeMargin?: any; + + /** + * Declares a shape around which text should be wrapped, with possible modifications from the shape-margin property. The shape defined by shape-outside and shape-margin changes the geometry of a float element's float area. + */ + shapeOutside?: any; + + /** + * The speak property determines whether or not a speech synthesizer will read aloud the contents of an element. + */ + speak?: any; + + /** + * The speak-as property determines how the speech synthesizer interprets the content: words as whole words or as a sequence of letters, numbers as a numerical value or a sequence of digits, punctuation as pauses in speech or named punctuation characters. + */ + speakAs?: any; + + /** + * SVG: Specifies the opacity of the outline on the current object. + */ + strokeOpacity?: number; + + /** + * SVG: Specifies the width of the outline on the current object. + */ + strokeWidth?: number; + + /** + * The tab-size CSS property is used to customise the width of a tab (U+0009) character. + */ + tabSize?: any; + + /** + * The 'table-layout' property controls the algorithm used to lay out the table cells, rows, and columns. + */ + tableLayout?: any; + + /** + * The text-align CSS property describes how inline content like text is aligned in its parent block element. text-align does not control the alignment of block elements itself, only their inline content. + */ + textAlign?: any; + + /** + * The text-align-last CSS property describes how the last line of a block element or a line before line break is aligned in its parent block element. + */ + textAlignLast?: any; + + /** + * The text-decoration CSS property is used to set the text formatting to underline, overline, line-through or blink. + * underline and overline decorations are positioned under the text, line-through over it. + */ + textDecoration?: any; + + /** + * Sets the color of any text decoration, such as underlines, overlines, and strike throughs. + */ + textDecorationColor?: any; + + /** + * Sets what kind of line decorations are added to an element, such as underlines, overlines, etc. + */ + textDecorationLine?: any; + + textDecorationLineThrough?: any; + + textDecorationNone?: any; + + textDecorationOverline?: any; + + /** + * Specifies what parts of an element’s content are skipped over when applying any text decoration. + */ + textDecorationSkip?: any; + + /** + * This property specifies the style of the text decoration line drawn on the specified element. The intended meaning for the values are the same as those of the border-style-properties. + */ + textDecorationStyle?: any; + + textDecorationUnderline?: any; + + /** + * The text-emphasis property will apply special emphasis marks to the elements text. Slightly similar to the text-decoration property only that this property can have affect on the line-height. It also is noted that this is shorthand for text-emphasis-style and for text-emphasis-color. + */ + textEmphasis?: any; + + /** + * The text-emphasis-color property specifies the foreground color of the emphasis marks. + */ + textEmphasisColor?: any; + + /** + * The text-emphasis-style property applies special emphasis marks to an element's text. + */ + textEmphasisStyle?: any; + + /** + * This property helps determine an inline box's block-progression dimension, derived from the text-height and font-size properties for non-replaced elements, the height or the width for replaced elements, and the stacked block-progression dimension for inline-block elements. The block-progression dimension determines the position of the padding, border and margin for the element. + */ + textHeight?: any; + + /** + * Specifies the amount of space horizontally that should be left on the first line of the text of an element. This horizontal spacing is at the beginning of the first line and is in respect to the left edge of the containing block box. + */ + textIndent?: any; + + textJustifyTrim?: any; + + textKashidaSpace?: any; + + /** + * The text-line-through property is a shorthand property for text-line-through-style, text-line-through-color and text-line-through-mode. (Considered obsolete; use text-decoration instead.) + */ + textLineThrough?: any; + + /** + * Specifies the line colors for the line-through text decoration. + * (Considered obsolete; use text-decoration-color instead.) + */ + textLineThroughColor?: any; + + /** + * Sets the mode for the line-through text decoration, determining whether the text decoration affects the space characters or not. + * (Considered obsolete; use text-decoration-skip instead.) + */ + textLineThroughMode?: any; + + /** + * Specifies the line style for line-through text decoration. + * (Considered obsolete; use text-decoration-style instead.) + */ + textLineThroughStyle?: any; + + /** + * Specifies the line width for the line-through text decoration. + */ + textLineThroughWidth?: any; + + /** + * The text-overflow shorthand CSS property determines how overflowed content that is not displayed is signaled to the users. It can be clipped, display an ellipsis ('…', U+2026 HORIZONTAL ELLIPSIS) or a Web author-defined string. It covers the two long-hand properties text-overflow-mode and text-overflow-ellipsis + */ + textOverflow?: any; + + /** + * The text-overline property is the shorthand for the text-overline-style, text-overline-width, text-overline-color, and text-overline-mode properties. + */ + textOverline?: any; + + /** + * Specifies the line color for the overline text decoration. + */ + textOverlineColor?: any; + + /** + * Sets the mode for the overline text decoration, determining whether the text decoration affects the space characters or not. + */ + textOverlineMode?: any; + + /** + * Specifies the line style for overline text decoration. + */ + textOverlineStyle?: any; + + /** + * Specifies the line width for the overline text decoration. + */ + textOverlineWidth?: any; + + /** + * The text-rendering CSS property provides information to the browser about how to optimize when rendering text. Options are: legibility, speed or geometric precision. + */ + textRendering?: any; + + /** + * Obsolete: unsupported. + */ + textScript?: any; + + /** + * The CSS text-shadow property applies one or more drop shadows to the text and of an element. Each shadow is specified as an offset from the text, along with optional color and blur radius values. + */ + textShadow?: any; + + /** + * This property transforms text for styling purposes. (It has no effect on the underlying content.) + */ + textTransform?: any; + + /** + * Unsupported. + * This property will add a underline position value to the element that has an underline defined. + */ + textUnderlinePosition?: any; + + /** + * After review this should be replaced by text-decoration should it not? + * This property will set the underline style for text with a line value for underline, overline, and line-through. + */ + textUnderlineStyle?: any; + + /** + * This property specifies how far an absolutely positioned box's top margin edge is offset below the top edge of the box's containing block. For relatively positioned boxes, the offset is with respect to the top edges of the box itself (i.e., the box is given a position in the normal flow, then offset from that position according to these properties). + */ + top?: any; + + /** + * Determines whether touch input may trigger default behavior supplied by the user agent, such as panning or zooming. + */ + touchAction?: any; + + /** + * CSS transforms allow elements styled with CSS to be transformed in two-dimensional or three-dimensional space. Using this property, elements can be translated, rotated, scaled, and skewed. The value list may consist of 2D and/or 3D transform values. + */ + transform?: any; + + /** + * This property defines the origin of the transformation axes relative to the element to which the transformation is applied. + */ + transformOrigin?: any; + + /** + * This property allows you to define the relative position of the origin of the transformation grid along the z-axis. + */ + transformOriginZ?: any; + + /** + * This property specifies how nested elements are rendered in 3D space relative to their parent. + */ + transformStyle?: any; + + /** + * The transition CSS property is a shorthand property for transition-property, transition-duration, transition-timing-function, and transition-delay. It allows to define the transition between two states of an element. + */ + transition?: any; + + /** + * Defines when the transition will start. A value of ‘0s’ means the transition will execute as soon as the property is changed. Otherwise, the value specifies an offset from the moment the property is changed, and the transition will delay execution by that offset. + */ + transitionDelay?: any; + + /** + * The 'transition-duration' property specifies the length of time a transition animation takes to complete. + */ + transitionDuration?: any; + + /** + * The 'transition-property' property specifies the name of the CSS property to which the transition is applied. + */ + transitionProperty?: any; + + /** + * Sets the pace of action within a transition + */ + transitionTimingFunction?: any; + + /** + * The unicode-bidi CSS property specifies the level of embedding with respect to the bidirectional algorithm. + */ + unicodeBidi?: any; + + /** + * unicode-range allows you to set a specific range of characters to be downloaded from a font (embedded using @font-face) and made available for use on the current page. + */ + unicodeRange?: any; + + /** + * This is for all the high level UX stuff. + */ + userFocus?: any; + + /** + * For inputing user content + */ + userInput?: any; + + /** + * The vertical-align property controls how inline elements or text are vertically aligned compared to the baseline. If this property is used on table-cells it controls the vertical alignment of content of the table cell. + */ + verticalAlign?: any; + + /** + * The visibility property specifies whether the boxes generated by an element are rendered. + */ + visibility?: any; + + /** + * The voice-balance property sets the apparent position (in stereo sound) of the synthesized voice for spoken media. + */ + voiceBalance?: any; + + /** + * The voice-duration property allows the author to explicitly set the amount of time it should take a speech synthesizer to read an element's content, for example to allow the speech to be synchronized with other media. With a value of auto (the default) the length of time it takes to read the content is determined by the content itself and the voice-rate property. + */ + voiceDuration?: any; + + /** + * The voice-family property sets the speaker's voice used by a speech media agent to read an element. The speaker may be specified as a named character (to match a voice option in the speech reading software) or as a generic description of the age and gender of the voice. Similar to the font-family property for visual media, a comma-separated list of fallback options may be given in case the speech reader does not recognize the character name or cannot synthesize the requested combination of generic properties. + */ + voiceFamily?: any; + + /** + * The voice-pitch property sets pitch or tone (high or low) for the synthesized speech when reading an element; the pitch may be specified absolutely or relative to the normal pitch for the voice-family used to read the text. + */ + voicePitch?: any; + + /** + * The voice-range property determines how much variation in pitch or tone will be created by the speech synthesize when reading an element. Emphasized text, grammatical structures and punctuation may all be rendered as changes in pitch, this property determines how strong or obvious those changes are; large ranges are associated with enthusiastic or emotional speech, while small ranges are associated with flat or mechanical speech. + */ + voiceRange?: any; + + /** + * The voice-rate property sets the speed at which the voice synthesized by a speech media agent will read content. + */ + voiceRate?: any; + + /** + * The voice-stress property sets the level of vocal emphasis to be used for synthesized speech reading the element. + */ + voiceStress?: any; + + /** + * The voice-volume property sets the volume for spoken content in speech media. It replaces the deprecated volume property. + */ + voiceVolume?: any; + + /** + * The white-space property controls whether and how white space inside the element is collapsed, and whether lines may wrap at unforced "soft wrap" opportunities. + */ + whiteSpace?: any; + + /** + * Obsolete: unsupported. + */ + whiteSpaceTreatment?: any; + + /** + * In paged media, this property defines the mimimum number of lines + * that must be left at the top of the second page. + */ + widows?: number; + + /** + * Specifies the width of the content area of an element. The content area of the element width does not include the padding, border, and margin of the element. + */ + width?: any; + + /** + * The word-break property is often used when there is long generated content that is strung together without and spaces or hyphens to beak apart. A common case of this is when there is a long URL that does not have any hyphens. This case could potentially cause the breaking of the layout as it could extend past the parent element. + */ + wordBreak?: any; + + /** + * The word-spacing CSS property specifies the spacing behavior between "words". + */ + wordSpacing?: any; + + /** + * An alias of css/properties/overflow-wrap, word-wrap defines whether to break words when the content exceeds the boundaries of its container. + */ + wordWrap?: any; + + /** + * Specifies how exclusions affect inline content within block-level elements. Elements lay out their inline content in their content area but wrap around exclusion areas. + */ + wrapFlow?: any; + + /** + * Set the value that is used to offset the inner wrap shape from other shapes. Inline content that intersects a shape with this property will be pushed by this shape's margin. + */ + wrapMargin?: any; + + /** + * Obsolete and unsupported. Do not use. + * This CSS property controls the text when it reaches the end of the block in which it is enclosed. + */ + wrapOption?: any; + + /** + * writing-mode specifies if lines of text are laid out horizontally or vertically, and the direction which lines of text and blocks progress. + */ + writingMode?: any; + + /** + * The z-index property specifies the z-order of an element and its descendants. + * When elements overlap, z-order determines which one covers the other. + */ + zIndex?: "auto" | number; + + /** + * Sets the initial zoom factor of a document defined by @viewport. + */ + zoom?: "auto" | number; + + [propertyName: string]: any; + } + + interface HTMLAttributes extends DOMAttributes { + // React-specific Attributes + defaultChecked?: boolean; + defaultValue?: string | string[]; + + // Standard HTML Attributes + accept?: string; + acceptCharset?: string; + accessKey?: string; + action?: string; + allowFullScreen?: boolean; + allowTransparency?: boolean; + alt?: string; + async?: boolean; + autoComplete?: string; + autoFocus?: boolean; + autoPlay?: boolean; + capture?: boolean; + cellPadding?: number | string; + cellSpacing?: number | string; + charSet?: string; + challenge?: string; + checked?: boolean; + classID?: string; + className?: string; + cols?: number; + colSpan?: number; + content?: string; + contentEditable?: boolean; + contextMenu?: string; + controls?: boolean; + coords?: string; + crossOrigin?: string; + data?: string; + dateTime?: string; + default?: boolean; + defer?: boolean; + dir?: string; + disabled?: boolean; + download?: any; + draggable?: boolean; + encType?: string; + form?: string; + formAction?: string; + formEncType?: string; + formMethod?: string; + formNoValidate?: boolean; + formTarget?: string; + frameBorder?: number | string; + headers?: string; + height?: number | string; + hidden?: boolean; + high?: number; + href?: string; + hrefLang?: string; + htmlFor?: string; + httpEquiv?: string; + icon?: string; + id?: string; + inputMode?: string; + integrity?: string; + is?: string; + keyParams?: string; + keyType?: string; + kind?: string; + label?: string; + lang?: string; + list?: string; + loop?: boolean; + low?: number; + manifest?: string; + marginHeight?: number; + marginWidth?: number; + max?: number | string; + maxLength?: number; + media?: string; + mediaGroup?: string; + method?: string; + min?: number | string; + minLength?: number; + multiple?: boolean; + muted?: boolean; + name?: string; + noValidate?: boolean; + open?: boolean; + optimum?: number; + pattern?: string; + placeholder?: string; + poster?: string; + preload?: string; + radioGroup?: string; + readOnly?: boolean; + rel?: string; + required?: boolean; + role?: string; + rows?: number; + rowSpan?: number; + sandbox?: string; + scope?: string; + scoped?: boolean; + scrolling?: string; + seamless?: boolean; + selected?: boolean; + shape?: string; + size?: number; + sizes?: string; + span?: number; + spellCheck?: boolean; + src?: string; + srcDoc?: string; + srcLang?: string; + srcSet?: string; + start?: number; + step?: number | string; + style?: CSSProperties; + summary?: string; + tabIndex?: number; + target?: string; + title?: string; + type?: string; + useMap?: string; + value?: string | string[]; + width?: number | string; + wmode?: string; + wrap?: string; + + // RDFa Attributes + about?: string; + datatype?: string; + inlist?: any; + prefix?: string; + property?: string; + resource?: string; + typeof?: string; + vocab?: string; + + // Non-standard Attributes + autoCapitalize?: string; + autoCorrect?: string; + autoSave?: string; + color?: string; + itemProp?: string; + itemScope?: boolean; + itemType?: string; + itemID?: string; + itemRef?: string; + results?: number; + security?: string; + unselectable?: boolean; + + // Allows aria- and data- Attributes + [key: string]: any; + } + + interface SVGAttributes extends HTMLAttributes { + clipPath?: string; + cx?: number | string; + cy?: number | string; + d?: string; + dx?: number | string; + dy?: number | string; + fill?: string; + fillOpacity?: number | string; + fontFamily?: string; + fontSize?: number | string; + fx?: number | string; + fy?: number | string; + gradientTransform?: string; + gradientUnits?: string; + markerEnd?: string; + markerMid?: string; + markerStart?: string; + offset?: number | string; + opacity?: number | string; + patternContentUnits?: string; + patternUnits?: string; + points?: string; + preserveAspectRatio?: string; + r?: number | string; + rx?: number | string; + ry?: number | string; + spreadMethod?: string; + stopColor?: string; + stopOpacity?: number | string; + stroke?: string; + strokeDasharray?: string; + strokeLinecap?: string; + strokeMiterlimit?: string; + strokeOpacity?: number | string; + strokeWidth?: number | string; + textAnchor?: string; + transform?: string; + version?: string; + viewBox?: string; + x1?: number | string; + x2?: number | string; + x?: number | string; + xlinkActuate?: string; + xlinkArcrole?: string; + xlinkHref?: string; + xlinkRole?: string; + xlinkShow?: string; + xlinkTitle?: string; + xlinkType?: string; + xmlBase?: string; + xmlLang?: string; + xmlSpace?: string; + y1?: number | string; + y2?: number | string; + y?: number | string; + } + + // + // React.DOM + // ---------------------------------------------------------------------- + + interface ReactDOM { + // HTML + a: HTMLFactory; + abbr: HTMLFactory; + address: HTMLFactory; + area: HTMLFactory; + article: HTMLFactory; + aside: HTMLFactory; + audio: HTMLFactory; + b: HTMLFactory; + base: HTMLFactory; + bdi: HTMLFactory; + bdo: HTMLFactory; + big: HTMLFactory; + blockquote: HTMLFactory; + body: HTMLFactory; + br: HTMLFactory; + button: HTMLFactory; + canvas: HTMLFactory; + caption: HTMLFactory; + cite: HTMLFactory; + code: HTMLFactory; + col: HTMLFactory; + colgroup: HTMLFactory; + data: HTMLFactory; + datalist: HTMLFactory; + dd: HTMLFactory; + del: HTMLFactory; + details: HTMLFactory; + dfn: HTMLFactory; + dialog: HTMLFactory; + div: HTMLFactory; + dl: HTMLFactory; + dt: HTMLFactory; + em: HTMLFactory; + embed: HTMLFactory; + fieldset: HTMLFactory; + figcaption: HTMLFactory; + figure: HTMLFactory; + footer: HTMLFactory; + form: HTMLFactory; + h1: HTMLFactory; + h2: HTMLFactory; + h3: HTMLFactory; + h4: HTMLFactory; + h5: HTMLFactory; + h6: HTMLFactory; + head: HTMLFactory; + header: HTMLFactory; + hgroup: HTMLFactory; + hr: HTMLFactory; + html: HTMLFactory; + i: HTMLFactory; + iframe: HTMLFactory; + img: HTMLFactory; + input: HTMLFactory; + ins: HTMLFactory; + kbd: HTMLFactory; + keygen: HTMLFactory; + label: HTMLFactory; + legend: HTMLFactory; + li: HTMLFactory; + link: HTMLFactory; + main: HTMLFactory; + map: HTMLFactory; + mark: HTMLFactory; + menu: HTMLFactory; + menuitem: HTMLFactory; + meta: HTMLFactory; + meter: HTMLFactory; + nav: HTMLFactory; + noscript: HTMLFactory; + object: HTMLFactory; + ol: HTMLFactory; + optgroup: HTMLFactory; + option: HTMLFactory; + output: HTMLFactory; + p: HTMLFactory; + param: HTMLFactory; + picture: HTMLFactory; + pre: HTMLFactory; + progress: HTMLFactory; + q: HTMLFactory; + rp: HTMLFactory; + rt: HTMLFactory; + ruby: HTMLFactory; + s: HTMLFactory; + samp: HTMLFactory; + script: HTMLFactory; + section: HTMLFactory; + select: HTMLFactory; + small: HTMLFactory; + source: HTMLFactory; + span: HTMLFactory; + strong: HTMLFactory; + style: HTMLFactory; + sub: HTMLFactory; + summary: HTMLFactory; + sup: HTMLFactory; + table: HTMLFactory; + tbody: HTMLFactory; + td: HTMLFactory; + textarea: HTMLFactory; + tfoot: HTMLFactory; + th: HTMLFactory; + thead: HTMLFactory; + time: HTMLFactory; + title: HTMLFactory; + tr: HTMLFactory; + track: HTMLFactory; + u: HTMLFactory; + ul: HTMLFactory; + "var": HTMLFactory; + video: HTMLFactory; + wbr: HTMLFactory; + + // SVG + svg: SVGFactory; + circle: SVGFactory; + defs: SVGFactory; + ellipse: SVGFactory; + g: SVGFactory; + image: SVGFactory; + line: SVGFactory; + linearGradient: SVGFactory; + mask: SVGFactory; + path: SVGFactory; + pattern: SVGFactory; + polygon: SVGFactory; + polyline: SVGFactory; + radialGradient: SVGFactory; + rect: SVGFactory; + stop: SVGFactory; + text: SVGFactory; + tspan: SVGFactory; + } + + // + // React.PropTypes + // ---------------------------------------------------------------------- + + interface Validator { + (object: T, key: string, componentName: string): Error; + } + + interface Requireable extends Validator { + isRequired: Validator; + } + + interface ValidationMap { + [key: string]: Validator; + } + + interface ReactPropTypes { + any: Requireable; + array: Requireable; + bool: Requireable; + func: Requireable; + number: Requireable; + object: Requireable; + string: Requireable; + node: Requireable; + element: Requireable; + instanceOf(expectedClass: {}): Requireable; + oneOf(types: any[]): Requireable; + oneOfType(types: Validator[]): Requireable; + arrayOf(type: Validator): Requireable; + objectOf(type: Validator): Requireable; + shape(type: ValidationMap): Requireable; + } + + // + // React.Children + // ---------------------------------------------------------------------- + + interface ReactChildren { + map(children: ReactNode, fn: (child: ReactChild, index: number) => T): T[]; + forEach(children: ReactNode, fn: (child: ReactChild, index: number) => any): void; + count(children: ReactNode): number; + only(children: ReactNode): ReactElement; + toArray(children: ReactNode): ReactChild[]; + } + + // + // Browser Interfaces + // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts + // ---------------------------------------------------------------------- + + interface AbstractView { + styleMedia: StyleMedia; + document: Document; + } + + interface Touch { + identifier: number; + target: EventTarget; + screenX: number; + screenY: number; + clientX: number; + clientY: number; + pageX: number; + pageY: number; + } + + interface TouchList { + [index: number]: Touch; + length: number; + item(index: number): Touch; + identifiedTouch(identifier: number): Touch; + } +} + +declare module "react" { + export = __React; +} + +declare namespace JSX { + import React = __React; + + interface Element extends React.ReactElement { } + interface ElementClass extends React.Component { + render(): JSX.Element; + } + interface ElementAttributesProperty { props: {}; } + + interface IntrinsicAttributes { + key?: React.Key; + } + + interface IntrinsicClassAttributes { + ref?: React.Ref; + } + + interface IntrinsicElements { + // HTML + a: React.HTMLProps; + abbr: React.HTMLProps; + address: React.HTMLProps; + area: React.HTMLProps; + article: React.HTMLProps; + aside: React.HTMLProps; + audio: React.HTMLProps; + b: React.HTMLProps; + base: React.HTMLProps; + bdi: React.HTMLProps; + bdo: React.HTMLProps; + big: React.HTMLProps; + blockquote: React.HTMLProps; + body: React.HTMLProps; + br: React.HTMLProps; + button: React.HTMLProps; + canvas: React.HTMLProps; + caption: React.HTMLProps; + cite: React.HTMLProps; + code: React.HTMLProps; + col: React.HTMLProps; + colgroup: React.HTMLProps; + data: React.HTMLProps; + datalist: React.HTMLProps; + dd: React.HTMLProps; + del: React.HTMLProps; + details: React.HTMLProps; + dfn: React.HTMLProps; + dialog: React.HTMLProps; + div: React.HTMLProps; + dl: React.HTMLProps; + dt: React.HTMLProps; + em: React.HTMLProps; + embed: React.HTMLProps; + fieldset: React.HTMLProps; + figcaption: React.HTMLProps; + figure: React.HTMLProps; + footer: React.HTMLProps; + form: React.HTMLProps; + h1: React.HTMLProps; + h2: React.HTMLProps; + h3: React.HTMLProps; + h4: React.HTMLProps; + h5: React.HTMLProps; + h6: React.HTMLProps; + head: React.HTMLProps; + header: React.HTMLProps; + hgroup: React.HTMLProps; + hr: React.HTMLProps; + html: React.HTMLProps; + i: React.HTMLProps; + iframe: React.HTMLProps; + img: React.HTMLProps; + input: React.HTMLProps; + ins: React.HTMLProps; + kbd: React.HTMLProps; + keygen: React.HTMLProps; + label: React.HTMLProps; + legend: React.HTMLProps; + li: React.HTMLProps; + link: React.HTMLProps; + main: React.HTMLProps; + map: React.HTMLProps; + mark: React.HTMLProps; + menu: React.HTMLProps; + menuitem: React.HTMLProps; + meta: React.HTMLProps; + meter: React.HTMLProps; + nav: React.HTMLProps; + noscript: React.HTMLProps; + object: React.HTMLProps; + ol: React.HTMLProps; + optgroup: React.HTMLProps; + option: React.HTMLProps; + output: React.HTMLProps; + p: React.HTMLProps; + param: React.HTMLProps; + picture: React.HTMLProps; + pre: React.HTMLProps; + progress: React.HTMLProps; + q: React.HTMLProps; + rp: React.HTMLProps; + rt: React.HTMLProps; + ruby: React.HTMLProps; + s: React.HTMLProps; + samp: React.HTMLProps; + script: React.HTMLProps; + section: React.HTMLProps; + select: React.HTMLProps; + small: React.HTMLProps; + source: React.HTMLProps; + span: React.HTMLProps; + strong: React.HTMLProps; + style: React.HTMLProps; + sub: React.HTMLProps; + summary: React.HTMLProps; + sup: React.HTMLProps; + table: React.HTMLProps; + tbody: React.HTMLProps; + td: React.HTMLProps; + textarea: React.HTMLProps; + tfoot: React.HTMLProps; + th: React.HTMLProps; + thead: React.HTMLProps; + time: React.HTMLProps; + title: React.HTMLProps; + tr: React.HTMLProps; + track: React.HTMLProps; + u: React.HTMLProps; + ul: React.HTMLProps; + "var": React.HTMLProps; + video: React.HTMLProps; + wbr: React.HTMLProps; + + // SVG + svg: React.SVGProps; + + circle: React.SVGProps; + clipPath: React.SVGProps; + defs: React.SVGProps; + ellipse: React.SVGProps; + g: React.SVGProps; + image: React.SVGProps; + line: React.SVGProps; + linearGradient: React.SVGProps; + mask: React.SVGProps; + path: React.SVGProps; + pattern: React.SVGProps; + polygon: React.SVGProps; + polyline: React.SVGProps; + radialGradient: React.SVGProps; + rect: React.SVGProps; + stop: React.SVGProps; + text: React.SVGProps; + tspan: React.SVGProps; + } +} \ No newline at end of file diff --git a/typings/browser/ambient/redis/index.d.ts b/typings/browser/ambient/redis/index.d.ts new file mode 100644 index 00000000..bbe2d198 --- /dev/null +++ b/typings/browser/ambient/redis/index.d.ts @@ -0,0 +1,643 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/99564d906102e30a5a472cb3527f93bf82982673/redis/redis.d.ts +// Type definitions for redis 0.12.1 +// Project: https://github.com/mranney/node_redis +// Definitions by: Carlos Ballesteros Velasco , Peter Harris , TANAKA Koichi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// Imported from: https://github.com/soywiz/typescript-node-definitions/redis.d.ts + + +declare module "redis" { + export function createClient(port_arg:number, host_arg?:string, options?:ClientOpts):RedisClient; + export function createClient(unix_socket:string, options?:ClientOpts):RedisClient; + export function createClient(options?:ClientOpts):RedisClient; + + export function print(err:Error, reply:any):void; + + export var debug_mode:boolean; + + export interface MessageHandler { + (channel:string, message:M): void; + } + + export interface CommandT { //This is a placeholder to be used eventually, to not have to define each command twice, or four times if all caps versions are to be implemented. + (args:any[], callback?:ResCallbackT): void; + (...args:any[]): void; + } + + export interface ResCallbackT { + (err:Error, res:R): void; + } + + export interface ServerInfo { + redis_version: string; + versions: number[]; + } + + export interface ClientOpts { + parser?: string; + return_buffers?: boolean; + detect_buffers?: boolean; + socket_nodelay?: boolean; + socket_keepalive?: boolean; + no_ready_check?: boolean; + enable_offline_queue?: boolean; + retry_max_delay?: number; + connect_timeout?: number; + max_attempts?: number; + auth_pass?: string; + password?: string; + family?: string; + command_queue_high_water?: number; + command_queue_low_water?: number; + } + + export interface RedisClient extends NodeJS.EventEmitter { + // event: connect + // event: error + // event: message + // event: pmessage + // event: subscribe + // event: psubscribe + // event: unsubscribe + // event: punsubscribe + + connected: boolean; + retry_delay: number; + retry_backoff: number; + command_queue: any[]; + offline_queue: any[]; + server_info: ServerInfo; + + end(): void; + unref(): void; + + // Low level command execution + send_command(command:string, ...args:any[]): boolean; + + // Connection (http://redis.io/commands#connection) + auth(password:string, callback?:ResCallbackT): boolean; + ping(callback?:ResCallbackT): boolean; + + // Strings (http://redis.io/commands#strings) + append(key:string, value:string, callback?:ResCallbackT): boolean; + bitcount(key:string, callback?:ResCallbackT): boolean; + bitcount(key:string, start:number, end:number, callback?:ResCallbackT): boolean; + set(key:string, value:string, callback?:ResCallbackT): boolean; + get(key:string, callback?:ResCallbackT): boolean; + exists(key:string, value:string, callback?:ResCallbackT): boolean; + + publish(channel:string, value:any): boolean; + subscribe(channel:string): boolean; + + /* + commands = set_union([ + "get", "set", "setnx", "setex", "append", "strlen", "del", "exists", "setbit", "getbit", "setrange", "getrange", "substr", + "incr", "decr", "mget", "rpush", "lpush", "rpushx", "lpushx", "linsert", "rpop", "lpop", "brpop", "brpoplpush", "blpop", "llen", "lindex", + "lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore", + "sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore", + "zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx", + "hget", "hmset", "hmget", "hincrby", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx", + "randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave", + "bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl", + "persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster", + "restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands")); + */ + + get(args:any[], callback?:ResCallbackT): boolean; + get(...args:any[]): boolean; + set(args:any[], callback?:ResCallbackT): boolean; + set(...args:any[]): boolean; + setnx(args:any[], callback?:ResCallbackT): boolean; + setnx(...args:any[]): boolean; + setex(args:any[], callback?:ResCallbackT): boolean; + setex(...args:any[]): boolean; + append(args:any[], callback?:ResCallbackT): boolean; + append(...args:any[]): boolean; + strlen(args:any[], callback?:ResCallbackT): boolean; + strlen(...args:any[]): boolean; + del(args:any[], callback?:ResCallbackT): boolean; + del(...args:any[]): boolean; + exists(args:any[], callback?:ResCallbackT): boolean; + exists(...args:any[]): boolean; + setbit(args:any[], callback?:ResCallbackT): boolean; + setbit(...args:any[]): boolean; + getbit(args:any[], callback?:ResCallbackT): boolean; + getbit(...args:any[]): boolean; + setrange(args:any[], callback?:ResCallbackT): boolean; + setrange(...args:any[]): boolean; + getrange(args:any[], callback?:ResCallbackT): boolean; + getrange(...args:any[]): boolean; + substr(args:any[], callback?:ResCallbackT): boolean; + substr(...args:any[]): boolean; + incr(args:any[], callback?:ResCallbackT): boolean; + incr(...args:any[]): boolean; + decr(args:any[], callback?:ResCallbackT): boolean; + decr(...args:any[]): boolean; + mget(args:any[], callback?:ResCallbackT): boolean; + mget(...args:any[]): boolean; + rpush(...args:any[]): boolean; + lpush(args:any[], callback?:ResCallbackT): boolean; + lpush(...args:any[]): boolean; + rpushx(args:any[], callback?:ResCallbackT): boolean; + rpushx(...args:any[]): boolean; + lpushx(args:any[], callback?:ResCallbackT): boolean; + lpushx(...args:any[]): boolean; + linsert(args:any[], callback?:ResCallbackT): boolean; + linsert(...args:any[]): boolean; + rpop(args:any[], callback?:ResCallbackT): boolean; + rpop(...args:any[]): boolean; + lpop(args:any[], callback?:ResCallbackT): boolean; + lpop(...args:any[]): boolean; + brpop(args:any[], callback?:ResCallbackT): boolean; + brpop(...args:any[]): boolean; + brpoplpush(args:any[], callback?:ResCallbackT): boolean; + brpoplpush(...args:any[]): boolean; + blpop(args:any[], callback?:ResCallbackT): boolean; + blpop(...args:any[]): boolean; + llen(args:any[], callback?:ResCallbackT): boolean; + llen(...args:any[]): boolean; + lindex(args:any[], callback?:ResCallbackT): boolean; + lindex(...args:any[]): boolean; + lset(args:any[], callback?:ResCallbackT): boolean; + lset(...args:any[]): boolean; + lrange(args:any[], callback?:ResCallbackT): boolean; + lrange(...args:any[]): boolean; + ltrim(args:any[], callback?:ResCallbackT): boolean; + ltrim(...args:any[]): boolean; + lrem(args:any[], callback?:ResCallbackT): boolean; + lrem(...args:any[]): boolean; + rpoplpush(args:any[], callback?:ResCallbackT): boolean; + rpoplpush(...args:any[]): boolean; + sadd(args:any[], callback?:ResCallbackT): boolean; + sadd(...args:any[]): boolean; + srem(args:any[], callback?:ResCallbackT): boolean; + srem(...args:any[]): boolean; + smove(args:any[], callback?:ResCallbackT): boolean; + smove(...args:any[]): boolean; + sismember(args:any[], callback?:ResCallbackT): boolean; + sismember(...args:any[]): boolean; + scard(args:any[], callback?:ResCallbackT): boolean; + scard(...args:any[]): boolean; + spop(args:any[], callback?:ResCallbackT): boolean; + spop(...args:any[]): boolean; + srandmember(args:any[], callback?:ResCallbackT): boolean; + srandmember(...args:any[]): boolean; + sinter(args:any[], callback?:ResCallbackT): boolean; + sinter(...args:any[]): boolean; + sinterstore(args:any[], callback?:ResCallbackT): boolean; + sinterstore(...args:any[]): boolean; + sunion(args:any[], callback?:ResCallbackT): boolean; + sunion(...args:any[]): boolean; + sunionstore(args:any[], callback?:ResCallbackT): boolean; + sunionstore(...args:any[]): boolean; + sdiff(args:any[], callback?:ResCallbackT): boolean; + sdiff(...args:any[]): boolean; + sdiffstore(args:any[], callback?:ResCallbackT): boolean; + sdiffstore(...args:any[]): boolean; + smembers(args:any[], callback?:ResCallbackT): boolean; + smembers(...args:any[]): boolean; + zadd(args:any[], callback?:ResCallbackT): boolean; + zadd(...args:any[]): boolean; + zincrby(args:any[], callback?:ResCallbackT): boolean; + zincrby(...args:any[]): boolean; + zrem(args:any[], callback?:ResCallbackT): boolean; + zrem(...args:any[]): boolean; + zremrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zremrangebyscore(...args:any[]): boolean; + zremrangebyrank(args:any[], callback?:ResCallbackT): boolean; + zremrangebyrank(...args:any[]): boolean; + zunionstore(args:any[], callback?:ResCallbackT): boolean; + zunionstore(...args:any[]): boolean; + zinterstore(args:any[], callback?:ResCallbackT): boolean; + zinterstore(...args:any[]): boolean; + zrange(args:any[], callback?:ResCallbackT): boolean; + zrange(...args:any[]): boolean; + zrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zrangebyscore(...args:any[]): boolean; + zrevrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zrevrangebyscore(...args:any[]): boolean; + zcount(args:any[], callback?:ResCallbackT): boolean; + zcount(...args:any[]): boolean; + zrevrange(args:any[], callback?:ResCallbackT): boolean; + zrevrange(...args:any[]): boolean; + zcard(args:any[], callback?:ResCallbackT): boolean; + zcard(...args:any[]): boolean; + zscore(args:any[], callback?:ResCallbackT): boolean; + zscore(...args:any[]): boolean; + zrank(args:any[], callback?:ResCallbackT): boolean; + zrank(...args:any[]): boolean; + zrevrank(args:any[], callback?:ResCallbackT): boolean; + zrevrank(...args:any[]): boolean; + hset(args:any[], callback?:ResCallbackT): boolean; + hset(...args:any[]): boolean; + hsetnx(args:any[], callback?:ResCallbackT): boolean; + hsetnx(...args:any[]): boolean; + hget(args:any[], callback?:ResCallbackT): boolean; + hget(...args:any[]): boolean; + hmset(args:any[], callback?:ResCallbackT): boolean; + hmset(key:string, hash:any, callback?:ResCallbackT): boolean; + hmset(...args:any[]): boolean; + hmget(args:any[], callback?:ResCallbackT): boolean; + hmget(...args:any[]): boolean; + hincrby(args:any[], callback?:ResCallbackT): boolean; + hincrby(...args:any[]): boolean; + hdel(args:any[], callback?:ResCallbackT): boolean; + hdel(...args:any[]): boolean; + hlen(args:any[], callback?:ResCallbackT): boolean; + hlen(...args:any[]): boolean; + hkeys(args:any[], callback?:ResCallbackT): boolean; + hkeys(...args:any[]): boolean; + hvals(args:any[], callback?:ResCallbackT): boolean; + hvals(...args:any[]): boolean; + hgetall(args:any[], callback?:ResCallbackT): boolean; + hgetall(...args:any[]): boolean; + hgetall(key:string, callback?:ResCallbackT): boolean; + hexists(args:any[], callback?:ResCallbackT): boolean; + hexists(...args:any[]): boolean; + incrby(args:any[], callback?:ResCallbackT): boolean; + incrby(...args:any[]): boolean; + decrby(args:any[], callback?:ResCallbackT): boolean; + decrby(...args:any[]): boolean; + getset(args:any[], callback?:ResCallbackT): boolean; + getset(...args:any[]): boolean; + mset(args:any[], callback?:ResCallbackT): boolean; + mset(...args:any[]): boolean; + msetnx(args:any[], callback?:ResCallbackT): boolean; + msetnx(...args:any[]): boolean; + randomkey(args:any[], callback?:ResCallbackT): boolean; + randomkey(...args:any[]): boolean; + select(args:any[], callback?:ResCallbackT): void; + select(...args:any[]): void; + move(args:any[], callback?:ResCallbackT): boolean; + move(...args:any[]): boolean; + rename(args:any[], callback?:ResCallbackT): boolean; + rename(...args:any[]): boolean; + renamenx(args:any[], callback?:ResCallbackT): boolean; + renamenx(...args:any[]): boolean; + expire(args:any[], callback?:ResCallbackT): boolean; + expire(...args:any[]): boolean; + expireat(args:any[], callback?:ResCallbackT): boolean; + expireat(...args:any[]): boolean; + keys(args:any[], callback?:ResCallbackT): boolean; + keys(...args:any[]): boolean; + dbsize(args:any[], callback?:ResCallbackT): boolean; + dbsize(...args:any[]): boolean; + auth(args:any[], callback?:ResCallbackT): void; + auth(...args:any[]): void; + ping(args:any[], callback?:ResCallbackT): boolean; + ping(...args:any[]): boolean; + echo(args:any[], callback?:ResCallbackT): boolean; + echo(...args:any[]): boolean; + save(args:any[], callback?:ResCallbackT): boolean; + save(...args:any[]): boolean; + bgsave(args:any[], callback?:ResCallbackT): boolean; + bgsave(...args:any[]): boolean; + bgrewriteaof(args:any[], callback?:ResCallbackT): boolean; + bgrewriteaof(...args:any[]): boolean; + shutdown(args:any[], callback?:ResCallbackT): boolean; + shutdown(...args:any[]): boolean; + lastsave(args:any[], callback?:ResCallbackT): boolean; + lastsave(...args:any[]): boolean; + type(args:any[], callback?:ResCallbackT): boolean; + type(...args:any[]): boolean; + multi(args:any[], callback?:ResCallbackT): Multi; + multi(...args:any[]): Multi; + exec(args:any[], callback?:ResCallbackT): boolean; + exec(...args:any[]): boolean; + discard(args:any[], callback?:ResCallbackT): boolean; + discard(...args:any[]): boolean; + sync(args:any[], callback?:ResCallbackT): boolean; + sync(...args:any[]): boolean; + flushdb(args:any[], callback?:ResCallbackT): boolean; + flushdb(...args:any[]): boolean; + flushall(args:any[], callback?:ResCallbackT): boolean; + flushall(...args:any[]): boolean; + sort(args:any[], callback?:ResCallbackT): boolean; + sort(...args:any[]): boolean; + info(args:any[], callback?:ResCallbackT): boolean; + info(...args:any[]): boolean; + monitor(args:any[], callback?:ResCallbackT): boolean; + monitor(...args:any[]): boolean; + ttl(args:any[], callback?:ResCallbackT): boolean; + ttl(...args:any[]): boolean; + persist(args:any[], callback?:ResCallbackT): boolean; + persist(...args:any[]): boolean; + slaveof(args:any[], callback?:ResCallbackT): boolean; + slaveof(...args:any[]): boolean; + debug(args:any[], callback?:ResCallbackT): boolean; + debug(...args:any[]): boolean; + config(args:any[], callback?:ResCallbackT): boolean; + config(...args:any[]): boolean; + subscribe(args:any[], callback?:ResCallbackT): boolean; + subscribe(...args:any[]): boolean; + unsubscribe(args:any[], callback?:ResCallbackT): boolean; + unsubscribe(...args:any[]): boolean; + psubscribe(args:any[], callback?:ResCallbackT): boolean; + psubscribe(...args:any[]): boolean; + punsubscribe(args:any[], callback?:ResCallbackT): boolean; + punsubscribe(...args:any[]): boolean; + publish(args:any[], callback?:ResCallbackT): boolean; + publish(...args:any[]): boolean; + watch(args:any[], callback?:ResCallbackT): boolean; + watch(...args:any[]): boolean; + unwatch(args:any[], callback?:ResCallbackT): boolean; + unwatch(...args:any[]): boolean; + cluster(args:any[], callback?:ResCallbackT): boolean; + cluster(...args:any[]): boolean; + restore(args:any[], callback?:ResCallbackT): boolean; + restore(...args:any[]): boolean; + migrate(args:any[], callback?:ResCallbackT): boolean; + migrate(...args:any[]): boolean; + dump(args:any[], callback?:ResCallbackT): boolean; + dump(...args:any[]): boolean; + object(args:any[], callback?:ResCallbackT): boolean; + object(...args:any[]): boolean; + client(args:any[], callback?:ResCallbackT): boolean; + client(...args:any[]): boolean; + eval(args:any[], callback?:ResCallbackT): boolean; + eval(...args:any[]): boolean; + evalsha(args:any[], callback?:ResCallbackT): boolean; + evalsha(...args:any[]): boolean; + script(args:any[], callback?:ResCallbackT): boolean; + script(...args: any[]): boolean; + script(key: string, callback?: ResCallbackT): boolean; + quit(args:any[], callback?:ResCallbackT): boolean; + quit(...args:any[]): boolean; + scan(...args:any[]): boolean; + scan(args:any[], callback?:ResCallbackT): boolean; + hscan(...args:any[]): boolean; + hscan(args:any[], callback?:ResCallbackT): boolean; + zscan(...args:any[]): boolean; + zscan(args:any[], callback?:ResCallbackT): boolean; + } + + export interface Multi { + exec(callback?:ResCallbackT): boolean; + + get(args:any[], callback?:ResCallbackT): Multi; + get(...args:any[]): Multi; + set(args:any[], callback?:ResCallbackT): Multi; + set(...args:any[]): Multi; + setnx(args:any[], callback?:ResCallbackT): Multi; + setnx(...args:any[]): Multi; + setex(args:any[], callback?:ResCallbackT): Multi; + setex(...args:any[]): Multi; + append(args:any[], callback?:ResCallbackT): Multi; + append(...args:any[]): Multi; + strlen(args:any[], callback?:ResCallbackT): Multi; + strlen(...args:any[]): Multi; + del(args:any[], callback?:ResCallbackT): Multi; + del(...args:any[]): Multi; + exists(args:any[], callback?:ResCallbackT): Multi; + exists(...args:any[]): Multi; + setbit(args:any[], callback?:ResCallbackT): Multi; + setbit(...args:any[]): Multi; + getbit(args:any[], callback?:ResCallbackT): Multi; + getbit(...args:any[]): Multi; + setrange(args:any[], callback?:ResCallbackT): Multi; + setrange(...args:any[]): Multi; + getrange(args:any[], callback?:ResCallbackT): Multi; + getrange(...args:any[]): Multi; + substr(args:any[], callback?:ResCallbackT): Multi; + substr(...args:any[]): Multi; + incr(args:any[], callback?:ResCallbackT): Multi; + incr(...args:any[]): Multi; + decr(args:any[], callback?:ResCallbackT): Multi; + decr(...args:any[]): Multi; + mget(args:any[], callback?:ResCallbackT): Multi; + mget(...args:any[]): Multi; + rpush(...args:any[]): Multi; + lpush(args:any[], callback?:ResCallbackT): Multi; + lpush(...args:any[]): Multi; + rpushx(args:any[], callback?:ResCallbackT): Multi; + rpushx(...args:any[]): Multi; + lpushx(args:any[], callback?:ResCallbackT): Multi; + lpushx(...args:any[]): Multi; + linsert(args:any[], callback?:ResCallbackT): Multi; + linsert(...args:any[]): Multi; + rpop(args:any[], callback?:ResCallbackT): Multi; + rpop(...args:any[]): Multi; + lpop(args:any[], callback?:ResCallbackT): Multi; + lpop(...args:any[]): Multi; + brpop(args:any[], callback?:ResCallbackT): Multi; + brpop(...args:any[]): Multi; + brpoplpush(args:any[], callback?:ResCallbackT): Multi; + brpoplpush(...args:any[]): Multi; + blpop(args:any[], callback?:ResCallbackT): Multi; + blpop(...args:any[]): Multi; + llen(args:any[], callback?:ResCallbackT): Multi; + llen(...args:any[]): Multi; + lindex(args:any[], callback?:ResCallbackT): Multi; + lindex(...args:any[]): Multi; + lset(args:any[], callback?:ResCallbackT): Multi; + lset(...args:any[]): Multi; + lrange(args:any[], callback?:ResCallbackT): Multi; + lrange(...args:any[]): Multi; + ltrim(args:any[], callback?:ResCallbackT): Multi; + ltrim(...args:any[]): Multi; + lrem(args:any[], callback?:ResCallbackT): Multi; + lrem(...args:any[]): Multi; + rpoplpush(args:any[], callback?:ResCallbackT): Multi; + rpoplpush(...args:any[]): Multi; + sadd(args:any[], callback?:ResCallbackT): Multi; + sadd(...args:any[]): Multi; + srem(args:any[], callback?:ResCallbackT): Multi; + srem(...args:any[]): Multi; + smove(args:any[], callback?:ResCallbackT): Multi; + smove(...args:any[]): Multi; + sismember(args:any[], callback?:ResCallbackT): Multi; + sismember(...args:any[]): Multi; + scard(args:any[], callback?:ResCallbackT): Multi; + scard(...args:any[]): Multi; + spop(args:any[], callback?:ResCallbackT): Multi; + spop(...args:any[]): Multi; + srandmember(args:any[], callback?:ResCallbackT): Multi; + srandmember(...args:any[]): Multi; + sinter(args:any[], callback?:ResCallbackT): Multi; + sinter(...args:any[]): Multi; + sinterstore(args:any[], callback?:ResCallbackT): Multi; + sinterstore(...args:any[]): Multi; + sunion(args:any[], callback?:ResCallbackT): Multi; + sunion(...args:any[]): Multi; + sunionstore(args:any[], callback?:ResCallbackT): Multi; + sunionstore(...args:any[]): Multi; + sdiff(args:any[], callback?:ResCallbackT): Multi; + sdiff(...args:any[]): Multi; + sdiffstore(args:any[], callback?:ResCallbackT): Multi; + sdiffstore(...args:any[]): Multi; + smembers(args:any[], callback?:ResCallbackT): Multi; + smembers(...args:any[]): Multi; + zadd(args:any[], callback?:ResCallbackT): Multi; + zadd(...args:any[]): Multi; + zincrby(args:any[], callback?:ResCallbackT): Multi; + zincrby(...args:any[]): Multi; + zrem(args:any[], callback?:ResCallbackT): Multi; + zrem(...args:any[]): Multi; + zremrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zremrangebyscore(...args:any[]): Multi; + zremrangebyrank(args:any[], callback?:ResCallbackT): Multi; + zremrangebyrank(...args:any[]): Multi; + zunionstore(args:any[], callback?:ResCallbackT): Multi; + zunionstore(...args:any[]): Multi; + zinterstore(args:any[], callback?:ResCallbackT): Multi; + zinterstore(...args:any[]): Multi; + zrange(args:any[], callback?:ResCallbackT): Multi; + zrange(...args:any[]): Multi; + zrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zrangebyscore(...args:any[]): Multi; + zrevrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zrevrangebyscore(...args:any[]): Multi; + zcount(args:any[], callback?:ResCallbackT): Multi; + zcount(...args:any[]): Multi; + zrevrange(args:any[], callback?:ResCallbackT): Multi; + zrevrange(...args:any[]): Multi; + zcard(args:any[], callback?:ResCallbackT): Multi; + zcard(...args:any[]): Multi; + zscore(args:any[], callback?:ResCallbackT): Multi; + zscore(...args:any[]): Multi; + zrank(args:any[], callback?:ResCallbackT): Multi; + zrank(...args:any[]): Multi; + zrevrank(args:any[], callback?:ResCallbackT): Multi; + zrevrank(...args:any[]): Multi; + hset(args:any[], callback?:ResCallbackT): Multi; + hset(...args:any[]): Multi; + hsetnx(args:any[], callback?:ResCallbackT): Multi; + hsetnx(...args:any[]): Multi; + hget(args:any[], callback?:ResCallbackT): Multi; + hget(...args:any[]): Multi; + hmset(args:any[], callback?:ResCallbackT): Multi; + hmset(key:string, hash:any, callback?:ResCallbackT): Multi; + hmset(...args:any[]): Multi; + hmget(args:any[], callback?:ResCallbackT): Multi; + hmget(...args:any[]): Multi; + hincrby(args:any[], callback?:ResCallbackT): Multi; + hincrby(...args:any[]): Multi; + hdel(args:any[], callback?:ResCallbackT): Multi; + hdel(...args:any[]): Multi; + hlen(args:any[], callback?:ResCallbackT): Multi; + hlen(...args:any[]): Multi; + hkeys(args:any[], callback?:ResCallbackT): Multi; + hkeys(...args:any[]): Multi; + hvals(args:any[], callback?:ResCallbackT): Multi; + hvals(...args:any[]): Multi; + hgetall(args:any[], callback?:ResCallbackT): Multi; + hgetall(...args:any[]): Multi; + hgetall(key:string, callback?:ResCallbackT): Multi; + hexists(args:any[], callback?:ResCallbackT): Multi; + hexists(...args:any[]): Multi; + incrby(args:any[], callback?:ResCallbackT): Multi; + incrby(...args:any[]): Multi; + decrby(args:any[], callback?:ResCallbackT): Multi; + decrby(...args:any[]): Multi; + getset(args:any[], callback?:ResCallbackT): Multi; + getset(...args:any[]): Multi; + mset(args:any[], callback?:ResCallbackT): Multi; + mset(...args:any[]): Multi; + msetnx(args:any[], callback?:ResCallbackT): Multi; + msetnx(...args:any[]): Multi; + randomkey(args:any[], callback?:ResCallbackT): Multi; + randomkey(...args:any[]): Multi; + select(args:any[], callback?:ResCallbackT): void; + select(...args:any[]): Multi; + move(args:any[], callback?:ResCallbackT): Multi; + move(...args:any[]): Multi; + rename(args:any[], callback?:ResCallbackT): Multi; + rename(...args:any[]): Multi; + renamenx(args:any[], callback?:ResCallbackT): Multi; + renamenx(...args:any[]): Multi; + expire(args:any[], callback?:ResCallbackT): Multi; + expire(...args:any[]): Multi; + expireat(args:any[], callback?:ResCallbackT): Multi; + expireat(...args:any[]): Multi; + keys(args:any[], callback?:ResCallbackT): Multi; + keys(...args:any[]): Multi; + dbsize(args:any[], callback?:ResCallbackT): Multi; + dbsize(...args:any[]): Multi; + auth(args:any[], callback?:ResCallbackT): void; + auth(...args:any[]): void; + ping(args:any[], callback?:ResCallbackT): Multi; + ping(...args:any[]): Multi; + echo(args:any[], callback?:ResCallbackT): Multi; + echo(...args:any[]): Multi; + save(args:any[], callback?:ResCallbackT): Multi; + save(...args:any[]): Multi; + bgsave(args:any[], callback?:ResCallbackT): Multi; + bgsave(...args:any[]): Multi; + bgrewriteaof(args:any[], callback?:ResCallbackT): Multi; + bgrewriteaof(...args:any[]): Multi; + shutdown(args:any[], callback?:ResCallbackT): Multi; + shutdown(...args:any[]): Multi; + lastsave(args:any[], callback?:ResCallbackT): Multi; + lastsave(...args:any[]): Multi; + type(args:any[], callback?:ResCallbackT): Multi; + type(...args:any[]): Multi; + multi(args:any[], callback?:ResCallbackT): Multi; + multi(...args:any[]): Multi; + exec(args:any[], callback?:ResCallbackT): Multi; + exec(...args:any[]): Multi; + discard(args:any[], callback?:ResCallbackT): Multi; + discard(...args:any[]): Multi; + sync(args:any[], callback?:ResCallbackT): Multi; + sync(...args:any[]): Multi; + flushdb(args:any[], callback?:ResCallbackT): Multi; + flushdb(...args:any[]): Multi; + flushall(args:any[], callback?:ResCallbackT): Multi; + flushall(...args:any[]): Multi; + sort(args:any[], callback?:ResCallbackT): Multi; + sort(...args:any[]): Multi; + info(args:any[], callback?:ResCallbackT): Multi; + info(...args:any[]): Multi; + monitor(args:any[], callback?:ResCallbackT): Multi; + monitor(...args:any[]): Multi; + ttl(args:any[], callback?:ResCallbackT): Multi; + ttl(...args:any[]): Multi; + persist(args:any[], callback?:ResCallbackT): Multi; + persist(...args:any[]): Multi; + slaveof(args:any[], callback?:ResCallbackT): Multi; + slaveof(...args:any[]): Multi; + debug(args:any[], callback?:ResCallbackT): Multi; + debug(...args:any[]): Multi; + config(args:any[], callback?:ResCallbackT): Multi; + config(...args:any[]): Multi; + subscribe(args:any[], callback?:ResCallbackT): Multi; + subscribe(...args:any[]): Multi; + unsubscribe(args:any[], callback?:ResCallbackT): Multi; + unsubscribe(...args:any[]): Multi; + psubscribe(args:any[], callback?:ResCallbackT): Multi; + psubscribe(...args:any[]): Multi; + punsubscribe(args:any[], callback?:ResCallbackT): Multi; + punsubscribe(...args:any[]): Multi; + publish(args:any[], callback?:ResCallbackT): Multi; + publish(...args:any[]): Multi; + watch(args:any[], callback?:ResCallbackT): Multi; + watch(...args:any[]): Multi; + unwatch(args:any[], callback?:ResCallbackT): Multi; + unwatch(...args:any[]): Multi; + cluster(args:any[], callback?:ResCallbackT): Multi; + cluster(...args:any[]): Multi; + restore(args:any[], callback?:ResCallbackT): Multi; + restore(...args:any[]): Multi; + migrate(args:any[], callback?:ResCallbackT): Multi; + migrate(...args:any[]): Multi; + dump(args:any[], callback?:ResCallbackT): Multi; + dump(...args:any[]): Multi; + object(args:any[], callback?:ResCallbackT): Multi; + object(...args:any[]): Multi; + client(args:any[], callback?:ResCallbackT): Multi; + client(...args:any[]): Multi; + eval(args:any[], callback?:ResCallbackT): Multi; + eval(...args:any[]): Multi; + evalsha(args:any[], callback?:ResCallbackT): Multi; + evalsha(...args:any[]): Multi; + quit(args:any[], callback?:ResCallbackT): Multi; + quit(...args:any[]): Multi; + scan(...args:any[]): Multi; + scan(args:any[], callback?:ResCallbackT): Multi; + hscan(...args:any[]): Multi; + hscan(args:any[], callback?:ResCallbackT): Multi; + zscan(...args:any[]): Multi; + zscan(args:any[], callback?:ResCallbackT): Multi; + } +} \ No newline at end of file diff --git a/typings/browser/ambient/rx/index.d.ts b/typings/browser/ambient/rx/index.d.ts new file mode 100644 index 00000000..2da285b1 --- /dev/null +++ b/typings/browser/ambient/rx/index.d.ts @@ -0,0 +1,68 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/4d86cc24082d6703ecaee46ecc970bd0ac744236/rx/rx.d.ts +// Type definitions for RxJS v2.5.3 +// Project: http://rx.codeplex.com/ +// Definitions by: gsino , Igor Oleinikov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module Rx { + export interface IScheduler { + catch(handler: (exception: any) => boolean): IScheduler; + catchException(handler: (exception: any) => boolean): IScheduler; + } + + // Observer + export interface Observer { + checked(): Observer; + } + + interface ObserverStatic { + /** + * Schedules the invocation of observer methods on the given scheduler. + * @param scheduler Scheduler to schedule observer messages on. + * @returns Observer whose messages are scheduled on the given scheduler. + */ + notifyOn(scheduler: IScheduler): Observer; + } + + export interface Observable { + observeOn(scheduler: IScheduler): Observable; + subscribeOn(scheduler: IScheduler): Observable; + + amb(rightSource: Observable): Observable; + amb(rightSource: IPromise): Observable; + onErrorResumeNext(second: Observable): Observable; + onErrorResumeNext(second: IPromise): Observable; + bufferWithCount(count: number, skip?: number): Observable; + windowWithCount(count: number, skip?: number): Observable>; + defaultIfEmpty(defaultValue?: T): Observable; + distinct(skipParameter: boolean, valueSerializer: (value: T) => string): Observable; + distinct(keySelector?: (value: T) => TKey, keySerializer?: (key: TKey) => string): Observable; + groupBy(keySelector: (value: T) => TKey, skipElementSelector?: boolean, keySerializer?: (key: TKey) => string): Observable>; + groupBy(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, keySerializer?: (key: TKey) => string): Observable>; + groupByUntil(keySelector: (value: T) => TKey, skipElementSelector: boolean, durationSelector: (group: GroupedObservable) => Observable, keySerializer?: (key: TKey) => string): Observable>; + groupByUntil(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, durationSelector: (group: GroupedObservable) => Observable, keySerializer?: (key: TKey) => string): Observable>; + } + + interface ObservableStatic { + using(resourceFactory: () => TResource, observableFactory: (resource: TResource) => Observable): Observable; + amb(...sources: Observable[]): Observable; + amb(...sources: IPromise[]): Observable; + amb(sources: Observable[]): Observable; + amb(sources: IPromise[]): Observable; + onErrorResumeNext(...sources: Observable[]): Observable; + onErrorResumeNext(...sources: IPromise[]): Observable; + onErrorResumeNext(sources: Observable[]): Observable; + onErrorResumeNext(sources: IPromise[]): Observable; + } + + interface GroupedObservable extends Observable { + key: TKey; + underlyingObservable: Observable; + } +} + +declare module "rx" { + export = Rx +} \ No newline at end of file diff --git a/typings/main.d.ts b/typings/main.d.ts new file mode 100644 index 00000000..36172a03 --- /dev/null +++ b/typings/main.d.ts @@ -0,0 +1,10 @@ +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// diff --git a/typings/main/ambient/baconjs/index.d.ts b/typings/main/ambient/baconjs/index.d.ts new file mode 100644 index 00000000..13d19349 --- /dev/null +++ b/typings/main/ambient/baconjs/index.d.ts @@ -0,0 +1,3132 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9027703c0bd831319dcdf7f3169f7a468537f448/baconjs/baconjs.d.ts +// Type definitions for Bacon.js 0.7.0 +// Project: https://baconjs.github.io/ +// Definitions by: Alexander Matsievsky +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface JQuery { + /** + * @method + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a jQuery or Zepto.js object. + * @param {string} eventName + * @returns {EventStream} + * @example + * $("#my-div").asEventStream("click"); + */ + asEventStream(eventName:string):Bacon.EventStream; + + /** + * @method + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a jQuery or Zepto.js object. You can pass an argument to add a jQuery live `selector`. + * @param {string} eventName + * @param {string} selector + * @returns {EventStream} + * @example + * $("#my-div").asEventStream("click", ".more-specific-selector"); + */ + asEventStream(eventName:string, selector:string):Bacon.EventStream; + + /** + * @callback JQuery#asEventStream1~f + * @param {JQueryEventObject} event + * @param {*[]} args + * @returns {A} + */ + /** + * @method JQuery#asEventStream1 + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a jQuery or Zepto.js object. You can pass an argument to add a function `f` that processes the jQuery event and its parameters. + * @param {string} eventName + * @param {JQuery#asEventStream1~f} f + * @returns {EventStream} + * @example + * $("#my-div").asEventStream("click", (event, args) => args[0]); + */ + asEventStream(eventName:string, f:(event:JQueryEventObject, args:any[]) => A):Bacon.EventStream; + + /** + * @callback JQuery#asEventStream2~f + * @param {JQueryEventObject} event + * @param {*[]} args + * @returns {A} + */ + /** + * @method JQuery#asEventStream2 + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a jQuery or Zepto.js object. You can pass an argument to add a jQuery live `selector` and a function `f` that processes the jQuery event and its parameters. + * @param {string} eventName + * @param {string} selector + * @param {JQuery#asEventStream2~f} f + * @returns {Bacon.EventStream} + * @example + * $("#my-div").asEventStream("click", ".more-specific-selector", (event, args) => args[0]); + */ + asEventStream(eventName:string, selector:string, f:(event:JQueryEventObject, args:any[]) => A):Bacon.EventStream; +} + +/** @module Bacon */ +declare module Bacon { + /** + * @function + * @description Creates an [EventStream]{@link Bacon.EventStream} from a `promise` Promise object such as JQuery Ajax. This stream will contain a single value or an error, followed immediately by stream end. You can use the optional `abort` flag (i.e. ´Bacon.fromPromise(p, true)´ to have the `abort` method of the given promise be called when all subscribers have been removed from the created stream. + * @param {Promise|JQueryXHR} promise + * @param {boolean} [abort] + * @returns {EventStream} + * @example + * Bacon.fromPromise($.ajax("https://baconjs.github.io/")); + * Bacon.fromPromise(Promise.resolve(1)); + * Bacon.fromPromise($.ajax("https://baconjs.github.io/"), true); + * Bacon.fromPromise(Promise.resolve(1), false); + */ + function fromPromise(promise:Promise|JQueryXHR, abort?:boolean):EventStream; + + /** + * @callback Bacon.fromPromise~eventTransformer + * @param {A} value + * @returns {(Initial|Next|End|Error)[]} + */ + /** + * @function Bacon.fromPromise + * @description Creates an [EventStream]{@link Bacon.EventStream} from a `promise` Promise object such as JQuery Ajax. This stream will contain a single value or an error, followed immediately by stream end. You can use the `abort` flag (i.e. ´Bacon.fromPromise(p, true)´ to have the `abort` method of the given promise be called when all subscribers have been removed from the created stream, and also pass a function `eventTransformer` that transforms the promise value into Events. The default is to transform the value into `[new Bacon.Next(value), new Bacon.End()]`. + * @param {Promise|JQueryXHR} promise + * @param {boolean} abort + * @param {Bacon.fromPromise~eventTransformer} eventTransformer + * @returns {EventStream} + * @example + * Bacon.fromPromise($.ajax("https://baconjs.github.io/"), true, (n:string) => { + * return [new Bacon.Next(n), new Bacon.Next(() => n), new Bacon.End()]; + * }); + * Bacon.fromPromise(Promise.resolve(1), false, n => { + * return [new Bacon.Next(n), new Bacon.Next(() => n), new Bacon.End()]; + * }); + */ + function fromPromise(promise:Promise|JQueryXHR, abort:boolean, eventTransformer:(value:A) => (Initial|Next|End|Error)[]):EventStream; + + /** + * @function + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a DOM EventTarget or Node.JS EventEmitter object, or an object that supports event listeners using `on`/`off` methods. + * @param {EventTarget|NodeJS.EventEmitter|JQuery} target + * @param {string} eventName + * @returns {EventStream} + * @example + * Bacon.fromEvent(document.body, "click").onValue(() => { + * alert("Bacon!"); + * }); + * Bacon.fromEvent(process.stdin, "readable", () => { + * alert("Bacon!"); + * }); + * Bacon.fromEvent($("body"), "click").onValue(() => { + * alert("Bacon!"); + * }); + */ + function fromEvent(target:EventTarget|NodeJS.EventEmitter|JQuery, eventName:string):EventStream; + + /** + * @callback Bacon.fromEvent~eventTransformer + * @param {A} event + * @returns {B} + */ + /** + * @function Bacon.fromEvent + * @description Creates an [EventStream]{@link Bacon.EventStream} from events on a DOM EventTarget or Node.JS EventEmitter object, or an object that supports event listeners using `on`/`off` methods. You can pass a function `eventTransformer` that transforms the emitted events' parameters. + * @param {EventTarget|NodeJS.EventEmitter|JQuery} target + * @param {string} eventName + * @param {Bacon.fromEvent~eventTransformer} eventTransformer + * @returns {EventStream} + * @example + * Bacon.fromEvent(document.body, "click", (event:MouseEvent) => event.clientX).onValue(clientX => { + * alert("Bacon!"); + * }); + */ + function fromEvent(target:EventTarget|NodeJS.EventEmitter|JQuery, eventName:string, eventTransformer:(event:A) => B):EventStream; + + /** + * @callback Bacon.fromCallback1~f + * @param {Bacon.fromCallback1~callback} callback + * @returns {void} + */ + /** + * @callback Bacon.fromCallback1~callback + * @param {...*} args + * @returns {void} + */ + /** + * @function Bacon.fromCallback1 + * @description Creates an [EventStream]{@link Bacon.EventStream} from a function `f` that accepts a `callback`. The function is supposed to call its callback just once. + * @param {Bacon.fromCallback1~f} f + * @returns {EventStream} + * @example + * // This would create a stream that outputs a single value "Bacon!" and ends after that. The use of setTimeout causes the value to be delayed by 1 second. + * Bacon.fromCallback(callback => { + * setTimeout(() => { + * callback("Bacon!"); + * }, 1000); + * }); + */ + function fromCallback(f:(callback:(...args:any[]) => void) => void):EventStream; + + /** + * @callback Bacon.fromCallback2~f + * @param {...*} args + * @returns {void} + */ + /** + * @function Bacon.fromCallback2 + * @description Creates an [EventStream]{@link Bacon.EventStream} from a function `f` that accepts a `callback`. The function is supposed to call its callback just once. + * @param {Bacon.fromCallback2~f} f + * @param {...*} args + * @returns {EventStream} + * @example + * // You can also give any number of arguments to `fromCallback`, which will be passed to the function. These arguments can be simple variables, Bacon EventStreams or Properties. For example the following will output "Bacon rules": + * Bacon.fromCallback((a, b, callback) => { + * callback(a + " " + b); + * }, Bacon.constant("bacon"), "rules").log(); + */ + function fromCallback(f:(...args:any[]) => void, ...args:any[]):EventStream; + + /** + * @function + * @description Creates an [EventStream]{@link Bacon.EventStream} from a `methodName` method of a given `object`. The function is supposed to call its callback just once. + * @param {Object} object + * @param {string} methodName + * @param {...*} args + * @returns {EventStream} + */ + function fromCallback(object:Object, methodName:string, ...args:any[]):EventStream; + + /** + * @callback Bacon.fromNodeCallback~f + * @param {Bacon.fromNodeCallback~callback} callback + * @returns {void} + */ + /** + * @callback Bacon.fromNodeCallback~callback + * @param {E} error + * @param {A} data + * @returns {void} + */ + /** + * @function Bacon.fromNodeCallback + * @description Creates an [EventStream]{@link Bacon.EventStream} from a function `f` that accepts a Node.js `callback`: callback(error, data), where error is `null` if everything is fine. The function is supposed to call its callback just once. + * @param {Bacon.fromNodeCallback~f} f + * @param {...*} args + * @returns {EventStream} + * @example + * { + * let fs = require("fs"), + * read = Bacon.fromNodeCallback(fs.readFile, "input.txt"); + * read.onError(error => { + * console.log("Reading failed: " + error); + * }); + * read.onValue(value => { + * console.log("Read contents: " + value); + * }); + * } + */ + function fromNodeCallback(f:(callback:(error:E, data:A) => void) => void, ...args:any[]):EventStream; + + /** + * @function + * @description Creates an [EventStream]{@link Bacon.EventStream} from a `methodName` method of a given `object`. + * @param {Object} object + * @param {string} methodName + * @param {...*} args + * @returns {EventStream} + */ + function fromNodeCallback(object:Object, methodName:string, ...args:any[]):EventStream; + + /** + * @callback Bacon.fromPoll~f + * @returns {Next|End} + */ + /** + * @function Bacon.fromPoll + * @description Polls given function `f` with given `interval`. Function should return events: either [Next]{@link Bacon.Next} or [End]{@link Bacon.End}. Polling occurs only when there are subscribers to the stream. Polling ends permanently when `f` returns [End]{@link Bacon.End}. + * @param {number} interval + * @param {Bacon.fromPoll~f} f + * @returns {EventStream} + */ + function fromPoll(interval:number, f:() => Next|End):EventStream; + + /** + * @function Bacon.once + * @description Creates an [EventStream]{@link Bacon.EventStream} that delivers the given single `value` for the first subscriber. The stream will end immediately after this value. You can also send an [Error]{@link Bacon.Error} event instead of a `value`. + * @param {A|Error} value + * @returns {EventStream} + * @example + * Bacon.once(new Bacon.Error("fail")); + */ + function once(value:A|Error):EventStream; + + /** + * @function + * @description Creates an [EventStream]{@link Bacon.EventStream} that delivers the given series of `values` (given as array) to the first subscriber. The stream ends after these values have been delivered. You can also send [Error]{@link Bacon.Error} events, or any combination of pure values and error events. + * @param {(A|Error)[]} values + * @returns {EventStream} + * @example + * Bacon.fromArray([1, new Bacon.Error("")]); + */ + function fromArray(values:(A|Error)[]):EventStream; + + /** + * @function + * @description Repeats the single `value` indefinitely with the given `interval` (in milliseconds). + * @param {number} interval + * @param {A} value + * @returns {EventStream} + */ + function interval(interval:number, value:A):EventStream; + + /** + * @function + * @description Creates a [EventStream]{@link Bacon.EventStream} containing given `values` (given as array) with the given `interval` (in milliseconds). + * @param {number} interval + * @param {A[]} values + * @returns {EventStream} + */ + function sequentially(interval:number, values:A[]):EventStream; + + /** + * @function + * @description Repeats given `values` indefinitely with then given `interval` (in milliseconds). + * @param {number} interval + * @param {A[]} values + * @returns {EventStream} + * @example + * // The following would lead to `1,2,3,1,2,3...` to be repeated indefinitely: + * Bacon.fromArray([1, new Bacon.Error("")]); + */ + function repeatedly(interval:number, values:A[]):EventStream; + + /** + * @callback Bacon.repeat~f + * @param {number} iteration + * @returns {boolean|Observable} + */ + /** + * @function Bacon.repeat + * @description Calls generator function `f` which is expected to return an [Observable]{@link Bacon.Observable}. The returned [EventStream]{@link Bacon.EventStream} contains values and errors from the spawned observable. When the spawned Observable ends, the generator `f` is called again to spawn a new Observable. This is repeated until the generator `f` returns a falsy value (such as `undefined` or `false`). The generator `f` is called with one argument — `iteration` number starting from `0`. + * @param {Bacon.repeat~f} f + * @returns {EventStream} + * @example + * // The following will produce values `0,1,2`. + * Bacon.repeat(i => { + * if (i < 3) { + * return Bacon.once(i); + * } else { + * return false; + * } + * }).log(); + */ + function repeat(f:(iteration:number) => boolean|Observable):EventStream; + + /** + * @function Bacon.never + * @description Creates an [EventStream]{@link Bacon.EventStream} that immediately ends. + * @returns {EventStream} + */ + function never():EventStream; + + /** + * @function + * @description Creates a single-element [EventStream]{@link Bacon.EventStream} that produces given `value` after a given `delay` (in milliseconds). + * @param {number} delay + * @param {A} value + * @returns {EventStream} + */ + function later(delay:number, value:A):EventStream; + + /** + * @function + * @description Creates a constant [Property]{@link Bacon.Property} with value `x`. + * @param {A} x + * @returns {Property} + */ + function constant(x:A):Property; + + /** + * @callback Bacon.fromBinder~subscribe + * @param {Bacon.fromBinder~sink} sink + * @returns {Bacon.fromBinder~unsubscribe} + */ + /** + * @callback Bacon.fromBinder~sink + * @param {More|NoMore|(A|Initial|Next|End|Error)|(A|Initial|Next|End|Error)[]} value + * @returns {void} + */ + /** + * @callback Bacon.fromBinder~unsubscribe + * @returns {void} + */ + /** + * @function Bacon.fromBinder + * @description Creates an [EventStream]{@link Bacon.EventStream} with the given [subscribe]{@link Bacon.fromBinder~subscribe} function. The parameter `subscribe` is a function that accepts a [sink]{@link Bacon.fromBinder~sink} which is a function that your `subscribe` function can "push" events to. You can push: a plain value, like `"first value"`; an [Event]{@link Bacon.Event} object including [Error]{@link Bacon.Error} (wraps an error) and [End]{@link Bacon.End} (indicates stream end); an array of event objects at once. The `subscribe` function must return a function. Let's call that function [unsubscribe]{@link Bacon.fromBinder~unsubscribe}. The returned function can be used by the subscriber (directly or indirectly) to unsubscribe from the EventStream. It should release all resources that the `subscribe` function reserved. The `sink` function may return [noMore]{@link Bacon.noMore} (as well as [more]{@link Bacon.more} or any other value). If it returns `noMore`, no further events will be consumed by the subscriber. The `subscribe` function may choose to clean up all resources at this point (e.g., by calling `unsubscribe`). This is usually not necessary, because further calls to `sink` are ignored, but doing so can increase performance in rare cases. The EventStream will wrap your `subscribe` function so that it will only be called when the first stream listener is added, and the `unsubscribe` function is called only after the last listener has been removed. The subscribe-unsubscribe cycle may of course be repeated indefinitely, so prepare for multiple calls to the `subscribe` function. + * @param {Bacon.fromBinder~subscribe} subscribe + * @returns {EventStream} + * @example + * let stream = Bacon.fromBinder(sink => { + * sink("first value"); + * sink([new Bacon.Next("2nd"), new Bacon.Next("3rd")]); + * sink(new Bacon.Next(() => { + * return "This one will be evaluated lazily" + * })); + * sink(new Bacon.Error("oops, an error")); + * sink(new Bacon.End()); + * return () => { + * // unsub functionality here, this one's a no-op + * }; + * }); + * stream.log(); + */ + function fromBinder(subscribe:(sink:(value:More|NoMore|(A|Initial|Next|End|Error)|(A|Initial|Next|End|Error)[]) => void) => (() => void)):EventStream; + + /** + * @interface + * @see Bacon.more + */ + interface More { + } + /** + * @property more + * @constant + * @description The opaque value `sink` function may return. See [Bacon.fromBinder]{@link Bacon.fromBinder}. + */ + var more:More; + + /** + * @interface + * @see Bacon.noMore + */ + interface NoMore { + } + /** + * @property noMore + * @constant + * @description The opaque value `sink` function may return. See [Bacon.fromBinder]{@link Bacon.fromBinder}. + */ + var noMore:NoMore; + + /** + * @class Observable + * @description A superclass for [EventStream]{@link Bacon.EventStream} and [Property]{@link Bacon.Property}. + * */ + interface Observable { + /** + * @callback Observable#onValue~f + * @param {A} value + * @returns {void} + */ + /** + * @callback Observable#onValue~unsubscribe + * @returns {void} + */ + /** + * @method Observable#onValue + * @description Subscribes a given handler function `f` to the [Observable]{@link Bacon.Observable}. Function will be called for each new value. This is the simplest way to assign a side-effect to an Observable. The difference to the [EventStream.subscribe]{@link Bacon.EventStream#subscribe} and [Property.subscribe]{@link Bacon.Property#subscribe} methods is that the actual stream `value`s are received, instead of [Event]{@link Bacon.Event} objects. [EventStream.onValue]{@link Bacon.EventStream#onValue} and [Property.onValue]{@link Bacon.Property#onValue} behave similarly, except that the latter also pushes the initial value of the Property, in case there is one. + * @param {Observable#onValue~f} f + * @returns {Observable#onValue~unsubscribe} + */ + onValue(f:(value:A) => void):() => void; + + /** + * @callback Observable#onError~f + * @param {E} error + * @returns {void} + */ + /** + * @callback Observable#onError~unsubscribe + * @returns {void} + */ + /** + * @method Observable#onError + * @description Subscribes a given handler function `f` to [Error]{@link Bacon.Error} events. The function `f` will be called for each error in the [Observable]{@link Bacon.Observable}. + * @param {Observable#onError~f} f + * @returns {Observable#onError~unsubscribe} + */ + onError(f:(error:E) => void):() => void; + + /** + * @callback Observable#onEnd~f + * @returns {void} + */ + /** + * @callback Observable#onEnd~unsubscribe + * @returns {void} + */ + /** + * @method Observable#onEnd + * @description Subscribes a given handler function `f` to [End]{@link Bacon.End} event. The function `f` will be called when the [Observable]{@link Bacon.Observable} ends. Just like [EventStream.subscribe]{@link Bacon.EventStream#subscribe} and [Property.subscribe]{@link Bacon.Property#subscribe}, this method returns a function for `unsubscribe`ing. + * @param {Observable#onEnd~f} f + * @returns {Observable#onEnd~unsubscribe} + */ + onEnd(f:() => void):() => void; + + /** + * @callback Observable#toPromise~promiseCtr + * @param {A} value + * @returns {Promise} + */ + /** + * @method Observable#toPromise + * @description Returns a Promise which will be resolved with the last event coming from an [Observable]{@link Bacon.Observable}. The global ES6 promise implementation will be used unless a promise constructor `promiseCtr` is given. Use a shim if you need to support legacy browsers or platforms. + * @param {Observable#toPromise~promiseCtr} [promiseCtr] + * @returns {Promise} + */ + toPromise(promiseCtr?:(value:A) => Promise):Promise; + + /** + * @callback Observable#firstToPromise~promiseCtr + * @param {A} value + * @returns {Promise} + */ + /** + * @method Observable#firstToPromise + * @description Returns a Promise which will be resolved with the first event coming from an [Observable]{@link Bacon.Observable}. Like [Observable.toPromise]{@link Bacon.Observable#toPromise}, the global ES6 promise implementation will be used unless a promise constructor `promiseCtr` is given. + * @param {Observable#firstToPromise~promiseCtr} [promiseCtr] + * @returns {Promise} + */ + firstToPromise(promiseCtr?:(value:A) => Promise):Promise; + + /** + * @method + * @description Throttles the [Observable]{@link Bacon.Observable} using a buffer so that at most one value event in `minimumInteval` is issued. Unlike [EventStream.throttle]{@link Bacon.EventStream#throttle} and [Property.throttle]{@link Bacon.Property#throttle}, it doesn't discard the excessive events but buffers them instead, outputting them with a rate of at most one value per `minimumInterval`. + * @param {number} minimumInterval + * @returns {EventStream} + */ + bufferingThrottle(minimumInterval:number):EventStream; + + /** + * @callback Observable#flatMap~f + * @param {A} value + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMap + * @description For each element in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f`, and collect events from each of the spawned streams into the result [EventStream]{@link Bacon.EventStream}. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. The result of [flatMap]{@link Bacon.Observable#flatMap} is always an EventStream. The "Function Construction rules" apply here. `flatMap` can be used conveniently with [Bacon.once]{@link Bacon.once} and [Bacon.never]{@link Bacon.never} for converting and filtering at the same time, including only some of the results. + * @param {Observable#flatMap~f} f + * @returns {EventStream} + * @example + * // Converting strings to integers, skipping empty values: + * Bacon.once("").flatMap(text => { + * return text != "" ? parseInt(text) : Bacon.never(); + * }); + */ + flatMap(f:(value:A) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#flatMapLatest~f + * @param {A} value + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMapLatest + * @description For each element in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f`, but instead of including events from all spawned streams, only includes them from the latest spawned stream into the result [EventStream]{@link Bacon.EventStream}. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. The result of [flatMapLatest]{@link Bacon.Observable#flatMapLatest} is always an EventStream. + * @param {Observable#flatMapLatest~f} f + * @returns {EventStream} + */ + flatMapLatest(f:(value:A) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#flatMapFirst~f + * @param {A} value + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMapFirst + * @description For each element in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f` only if the previously spawned stream has ended, and collect events from each of the spawned streams into the result [EventStream]{@link Bacon.EventStream}. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. The result of [flatMapFirst]{@link Bacon.Observable#flatMapFirst} is always an EventStream. + * @param {Observable#flatMapFirst~f} f + * @returns {EventStream} + */ + flatMapFirst(f:(value:A) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#flatMapError~f + * @param {E} error + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMapError + * @description For each [Error]{@link Bacon.Error} event in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f`, and collect events from each of the spawned streams into the result [EventStream]{@link Bacon.EventStream}. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. The result of [flatMapError]{@link Bacon.Observable#flatMapError} is always an EventStream. + * @param {Observable#flatMapError~f} f + * @returns {EventStream} + */ + flatMapError(f:(error:E) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#flatMapWithConcurrencyLimit~f + * @param {A} value + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMapWithConcurrencyLimit + * @description For each element in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f`, and collect events from each of the spawned streams into the result [EventStream]{@link Bacon.EventStream}, but limit the number of open spawned streams and buffers incoming events by `limit` amount. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. [flatMapConcat]{@link Bacon.Observable#flatMapConcat} is [flatMapWithConcurrencyLimit]{@link Bacon.Observable#flatMapWithConcurrencyLimit}(1) (only one input active), and [flatMap]{@link Bacon.Observable#flatMap} is [flatMapWithConcurrencyLimit]{@link Bacon.Observable#flatMapWithConcurrencyLimit}(∞) (all inputs are piped to output). The result of `flatMapWithConcurrencyLimit` is always an EventStream. + * @param {number} limit + * @param {Observable#flatMapWithConcurrencyLimit~f} f + * @returns {EventStream} + */ + flatMapWithConcurrencyLimit(limit:number, f:(value:A) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#flatMapConcat~f + * @param {A} value + * @returns {B|Initial|Next|End|Error|Observable} + */ + /** + * @method Observable#flatMapConcat + * @description For each element in the source [Observable]{@link Bacon.Observable}, spawn a new stream using the function `f`, and collect events from each of the spawned streams into the result [EventStream]{@link Bacon.EventStream}, but limit the number of open spawned streams and buffers incoming events to 1. The return value of function `f` can be either an Observable (EventStream/[Property]{@link Bacon.Property}) or a constant value. The result of `flatMapConcat` is always an EventStream. + * @param {Observable#flatMapConcat~f} f + * @returns {EventStream} + */ + flatMapConcat(f:(value:A) => B|Initial|Next|End|Error|Observable):EventStream; + + /** + * @callback Observable#scan~f + * @param {B} acc + * @param {A} next + * @returns {B} + */ + /** + * @method Observable#scan + * @description Scans [Observable]{@link Bacon.Observable} with given `seed` value and accumulator function `f`, resulting to a [Property]{@link Bacon.Property}. For example, you might use zero as `seed` and a "plus" function as the accumulator to create an "integral" Property. When applied to a Property as in `r = p.scan(seed, f)`, there's a (hopefully insignificant) catch: the starting value for `r` depends on whether `p` has an initial value when `scan` is applied. If there's no initial value, this works identically to `[EventStream]{@link Bacon.EventStream}.scan`: the `seed` will be the initial value of `r`. However, if `r` already has a current/initial value `x`, the seed won't be output as is. Instead, the initial value of `r` will be `f(seed, x)`. This makes sense, because there can only be 1 initial value for a Property at a time. + * @param {B} seed + * @param {Observable#scan~f} f + * @returns {Property} + * @example + * Bacon.sequentially(1, [1, 2, 3]).scan(0, (a, b) => a + b); + */ + scan(seed:B, f:(acc:B, next:A) => B):Property; + + /** + * @callback Observable#fold~f + * @param {B} acc + * @param {A} next + * @returns {B} + */ + /** + * @method Observable#fold + * @description Scans [Observable]{@link Bacon.Observable} with given `seed` value and accumulator function `f`, but only emits the final value, i.e. the value just before the Observable ends. Returns a [Property]{@link Bacon.Property}. + * @param {B} seed + * @param {Observable#fold~f} f + * @returns {Property} + */ + fold(seed:B, f:(acc:B, next:A) => B):Property; + + /** + * @callback Observable#reduce~f + * @param {B} acc + * @param {A} next + * @returns {B} + */ + /** + * @method Observable#reduce + * @description Scans [Observable]{@link Bacon.Observable} with given `seed` value and accumulator function `f`, but only emits the final value, i.e. the value just before the Observable ends. Returns a [Property]{@link Bacon.Property}. + * @param {B} seed + * @param {Observable#reduce~f} f + * @returns {Property} + */ + reduce(seed:B, f:(acc:B, next:A) => B):Property; + + /** + * @callback Observable#diff~f + * @param {A} a + * @param {B} b + * @returns {B} + */ + /** + * @method Observable#diff + * @description Returns a [Property]{@link Bacon.Property} that represents the result of a comparison `f` between the previous and current value of the [Observable]{@link Bacon.Observable}. For the initial value of the Observable, the previous value will be the given `start`. + * @param {A} start + * @param {Observable#diff~f} f + * @returns {Property} + * @example + * Bacon.sequentially(1, [1, 2, 3]).diff(0, (a, b) => Math.abs(b - a)); + */ + diff(start:A, f:(a:A, b:A) => B):Property; + + /** + * @callback Observable#zip~f + * @param {A} a + * @param {B} b + * @returns {C} + */ + /** + * @method Observable#zip + * @description Returns an [EventStream]{@link Bacon.EventStream} with elements pair-wise lined up with events from this and the `other` EventStream. A zipped EventStream will publish only when it has a value from each EventStream and will only produce values up to when any single EventStream ends. The given function `f` is used to create the result value from value in the two source EventStream. If no function `f` is given, the values are zipped into an array. Be careful not to have too much "drift" between streams. If one stream produces many more values than some other excessive buffering will occur inside the zipped observable. + * @param {EventStream} other + * @param {Observable#zip~f} f + * @returns {EventStream} + * @example + * { + * let x = Bacon.fromArray([1, 2]), + * y = Bacon.fromArray([3, 4]); + * x.zip(y, (x, y) => x + y); + * } + */ + zip(other:EventStream, f:(a:A, b:B) => C):EventStream; + + /** + * @method + * @description Returns a [Property]{@link Bacon.Property} that represents a "sliding window" into the history of the values of the [Observable]{@link Bacon.Observable}. The resulting Property will have a value that is an array containing the last `n` values of the original Observable, where `n` is at most the value of the `max` argument, and at least the value of the `min` argument. If the `min` argument is omitted, there's no lower limit of values. + * @param {number} max + * @param {number} [min] + * @returns {Property} + * @example + * // If you have a EventStream `s` with a value sequence `1,2,3,4,5`, the respective values in `s.slidingWindow(2)` would be `[],[1],[1,2],[2,3],[3,4],[4,5]`: + * Bacon.fromArray([1, 2, 3, 4, 5]).slidingWindow(2); + * // The values of `s.slidingWindow(2,2)`would be `[1,2],[2,3],[3,4],[4,5]`: + * Bacon.fromArray([1, 2, 3, 4, 5]).slidingWindow(2, 2); + */ + slidingWindow(max:number, min?:number):Property; + + /** + * @callback Observable#combine~f + * @param {A} a + * @param {B} b + * @returns {C} + */ + /** + * @method Observable#combine + * @description Combines the latest values of the two [EventStream]{@link Bacon.EventStream}s or [Property]{@link Bacon.Property}s using a two-arg function `f`. The result is a Property. + * @param {Property} property2 + * @param {Observable#combine~f} f + * @returns {Property} + */ + combine(property2:Property, f:(a:A, b:B) => C):Property; + + /** + * @callback Observable#withStateMachine~f + * @param {B} state + * @param {Initial|Next|End|Error} event + * @returns {[B, (Initial|Next|End|Error)[]]} + */ + /** + * @method Observable#withStateMachine + * @description Lets you run a state machine on an [Observable]{@link Bacon.Observable}. Give it an initial state `initState` object and a state transformation function `f` that processes each incoming [Event]{@link Bacon.Event} and returns and array containing the next `state` and an array of output Event's. + * @param {B} initState + * @param {Observable#withStateMachine~f} f + * @returns {EventStream} + * @example + * // Calculate the total sum of all numbers in the stream and output the value on stream end: + * Bacon.fromArray([1, 2, 3]).withStateMachine(0, (sum, event) => { + * if (event.hasValue()) { + * // had to cast to `number` because event:Bacon.Next|Bacon.Error<{}> + * return [sum + event.value(), []]; + * } else if (event.isEnd()) { + * return [undefined, [new Bacon.Next(sum), event]]; + * } else { + * return [sum, [event]]; + * } + * }); + */ + withStateMachine(initState:B, f:(state:B, event:Initial|Next|End|Error) => [B, (Initial|Next|End|Error)[]]):EventStream; + + /** + * @method + * @description Decodes input [Observable]{@link Bacon.Observable} using the given `mapping`. Is a bit like a switch-case or the decode function in Oracle SQL. The return value of `decode` is always a [Property]{@link Bacon.Property}. + * @param {Object} mapping + * @returns {Property} + * @example + * { + * let property = Bacon.fromArray([1, 2, 3]).toProperty(), + * who = Bacon.fromArray(["A", "B", "C"]).toProperty(); + * // The following would map the value 1 into the string "mike" and the value 2 into the value of the `who` property: + * property.decode({1: "mike", 2: who}); + * // You can compose static and dynamic data quite freely, as in: + * property.decode({1: {type: "mike"}, 2: {type: "other", whoThen: who}}); + * } + */ + decode(mapping:Object):Property; + + /** + * @method + * @description Creates a [Property]{@link Bacon.Property} that indicates whether Observable is awaiting `otherObservable`, i.e. has produced a value after the latest value from `otherObservable`. + * @param {Observable} otherObservable + * @returns {Property} + * @example + * { + * // This is handy for keeping track whether we are currently awaiting an AJAX response: + * let ajaxRequest = >{}, + * ajaxResponse = >{}, + * showAjaxIndicator = ajaxRequest.awaiting(ajaxResponse); + * } + */ + awaiting(otherObservable:Observable):Property; + } + + /** + * @class EventStream + * @augments Bacon.Observable + * @description A stream of events. + * */ + interface EventStream extends Observable { + /** + * @callback EventStream#map~f + * @param {A} value + * @returns {B} + */ + /** + * @method EventStream#map + * @description Maps [EventStream]{@link Bacon.EventStream} values using given function `f`, returning a new EventStream. The `map` method, among many others, uses lazy evaluation. + * @param {EventStream#map~f} f + * @returns {EventStream} + * */ + map(f:(value:A) => B):EventStream; + + /** + * @method + * @description Maps [EventStream]{@link Bacon.EventStream} values using given `constant` value, returning a new EventStream. The `map` method, among many others, uses lazy evaluation. + * @param {B} constant + * @returns {EventStream} + * */ + map(constant:B):EventStream; + + /** + * @method + * @description Maps [EventStream]{@link Bacon.EventStream} values using given `propertyExtractor` string like ".keyCode", returning a new EventStream. So, if `propertyExtractor` is a string starting with a dot, the elements will be mapped to the corresponding field/function in the event value. For instance map(".keyCode") will pluck the keyCode field from the input values. If `keyCode` was a function, the result EventStream would contain the values returned by the function. The "Function Construction rules" apply here. The `map` method, among many others, uses lazy evaluation. + * @param {string} propertyExtractor + * @returns {EventStream} + * */ + map(propertyExtractor:string):EventStream; + + /** + * @method + * @description Maps [EventStream]{@link Bacon.EventStream} events to the current value of the given [Property]{@link Bacon.Property} `property`. This is equivalent to [Property.sampledBy]{@link Bacon.Property#sampledBy}. + * @param {Property} property + * @returns {EventStream} + */ + map(property:Property):EventStream; + + /** + * @callback EventStream#mapError~f + * @param {E} error + * @returns {B} + */ + /** + * @method EventStream#mapError + * @description Maps [EventStream]{@link Bacon.EventStream} [Error]{@link Bacon.Error}s using given function `f`. More specifically, feeds the "error" field of the Error event to the function and produces a [Next]{@link Bacon.Next} event based on the return value. The "Function Construction rules" apply here. + * @param {EventStream#mapError~f} f + * @returns {EventStream} + */ + mapError(f:(error:E) => B):EventStream; + + /** + * @method + * @description Returns an [EventStream]{@link Bacon.EventStream} containing [Error]{@link Bacon.Error} events only. Same as filtering with a function that always returns `false`. + * @returns {EventStream} + */ + errors():EventStream; + + /** + * @method + * @description Skips all [Error]{@link Bacon.Error}s. + * @returns {EventStream} + */ + skipErrors():EventStream; + + /** + * @callback EventStream#mapEnd~f + * @returns {A} + */ + /** + * @method EventStream#mapEnd + * @description Adds an extra [Next]{@link Bacon.Next} event just before [End]{@link Bacon.End} to [EventStream]{@link Bacon.EventStream}. The value is created by calling the given function `f` when the source [EventStream]{@link Bacon.EventStream} ends. + * @param {EventStream#mapEnd~f} f + * @returns {EventStream} + */ + mapEnd(f:() => A):EventStream; + + /** + * @method + * @description Adds an extra [Next]{@link Bacon.Next} event just before [End]{@link Bacon.End} to [EventStream]{@link Bacon.EventStream}. A static `value` is used. + * @param {A} value + * @returns {EventStream} + */ + mapEnd(value:A):EventStream; + + /** + * @callback EventStream#filter~f + * @param {A} value + * @returns {boolean} + */ + /** + * @method EventStream#filter + * @description Filters [EventStream]{@link Bacon.EventStream} `value`s using a given predicate function `f`. + * @param {EventStream#filter~f} f + * @returns {EventStream} + */ + filter(f:(value:A) => boolean):EventStream; + + /** + * @method + * @description Filters [EventStream]{@link Bacon.EventStream} values using a given `constant` value (`true` to include all, `false` to exclude all). + * @param {boolean} bool + * @returns {EventStream} + */ + filter(bool:boolean):EventStream; + + /** + * @method + * @description Filters [EventStream]{@link Bacon.EventStream} values using a given `propertyExtractor` string (like ".isValuable"). + * @param {string} propertyExtractor + * @returns {EventStream} + */ + filter(propertyExtractor:string):EventStream; + + /** + * @method + * @description Filters [EventStream]{@link Bacon.EventStream} values based on the value of a [Property]{@link Bacon.Property} `property`. [Event]{@link Bacon.Event} will be included in output IF AND ONLY IF the `property` holds `true` at the time of the event. + * @param {Property} property + * @returns {EventStream} + */ + filter(property:Property):EventStream; + + /** + * @callback EventStream#takeWhile~f + * @param {A} value + * @returns {boolean} + */ + /** + * @method EventStream#takeWhile + * @description Takes [EventStream]{@link Bacon.EventStream} values while given predicate function `f` holds `true`, and then ends. + * @param {EventStream#takeWhile} f + * @returns {EventStream} + */ + takeWhile(f:(value:A) => boolean):EventStream; + + /** + * @method + * @description Takes [EventStream]{@link Bacon.EventStream} values while the value of a `property` holds `true`, and then ends. + * @param {Property} property + * @returns {EventStream} + */ + takeWhile(property:Property):EventStream; + + /** + * @method + * @description Takes at most n elements from the [EventStream]{@link Bacon.EventStream}. Equal to `Bacon.never()` if `n <= 0`. + * @param {number} n + * @returns {EventStream} + */ + take(n:number):EventStream; + + /** + * @method + * @description Takes elements from [EventStream]{@link Bacon.EventStream} until a [Next]{@link Bacon.Next} event appears in the EventStream `stream`. If `stream` ends without value, it is ignored. + * @param {EventStream} stream + * @returns {EventStream} + */ + takeUntil(stream:EventStream):EventStream; + + /** + * @method + * @description Takes the first element from the [EventStream]{@link Bacon.EventStream}. Essentially [Observable.take]{@link Bacon.EventStream#take}(1). + * @returns {EventStream} + */ + first():EventStream; + + /** + * @method + * @description Takes the last element from the [EventStream]{@link Bacon.EventStream}. None, if EventStream is empty. + * @returns {EventStream} + * @example + * // This creates the stream which doesn't produce any events and never ends: + * Bacon.interval(1e1, 0).last(); + */ + last():EventStream; + + /** + * @method + * @description Skips the first `n` elements from the [EventStream]{@link Bacon.EventStream}. + * @param {number} n + * @returns {EventStream} + */ + skip(n:number):EventStream; + + /** + * @method + * @description Delays the [EventStream]{@link Bacon.EventStream} by given `delay` (in milliseconds). + * @param {number} delay + * @returns {EventStream} + */ + delay(delay:number):EventStream; + + /** + * @method EventStream#throttle + * @description Throttles the [EventStream]{@link Bacon.EventStream} by given `delay` (in milliseconds). Events are emitted with the minimum interval of `delay`. The implementation is based on [EventStream.bufferWithTime]{@link Bacon.EventStream#bufferWithTime}. + * @param {number} delay + * @returns {EventStream} + */ + throttle(delay:number):EventStream; + + /** + * @method EventStream#debounce + * @description Throttles the [EventStream]{@link Bacon.EventStream} by given `delay` (in milliseconds), but so that event is only emitted after the given "quiet period". The difference of [throttle]{@link Bacon.EventStream#throttle} and [debounce]{@link Bacon.EventStream#debounce} is the same as it is in the same methods in jQuery. + * @param {number} delay + * @returns {EventStream} + */ + debounce(delay:number):EventStream; + + /** + * @method + * @description Passes the first event in the [EventStream]{@link Bacon.EventStream} through, but after that, only passes events after a given `delay` (in milliseconds) have passed since previous output. + * @param {number} delay + * @returns {EventStream} + */ + debounceImmediate(delay:number):EventStream; + + /** + * @callback EventStream#doAction~f + * @param {A} value + * @returns {void} + */ + /** + * @method EventStream#doAction + * @description Returns an [EventStream]{@link Bacon.EventStream} where the function `f` is executed for each value, before dispatching to subscribers. This is useful for debugging, but also for stuff like calling the `preventDefault()` method for events. + * @param {EventStream#doAction~f} f + * @returns {EventStream} + */ + doAction(f:(value:A) => void):EventStream; + + /** + * @method + * @description Returns an [EventStream]{@link Bacon.EventStream} where the `propertyExtractor` string is applied to each value, before dispatching to subscribers. This is useful for debugging, but also for stuff like calling the `preventDefault()` method for events. + * @param {string} propertyExtractor + * @returns {EventStream} + */ + doAction(propertyExtractor:string):EventStream; + + /** + * @callback EventStream#doError~f + * @param {E} error + * @returns {void} + */ + /** + * @method EventStream#doError + * @description Returns an [EventStream]{@link Bacon.EventStream} where the function `f` is executed for each error, before dispatching to subscribers. That is, same as `doAction` but for errors. + * @param {EventStream#doError~f} f + * @returns {EventStream} + */ + doError(f:(error:E) => void):EventStream; + + /** + * @method + * @description Returns an [EventStream]{@link Bacon.EventStream} that inverts boolean values. + * @returns {EventStream} + */ + not():EventStream; + + /** + * @method EventStream#log + * @description Logs each value of the [EventStream]{@link Bacon.EventStream} to the console. It optionally takes a `label` argument to pass to `console.log()` alongside each value. To assist with chaining, it returns the original EventStream. Note that as a side-effect, the EventStream will have a constant listener and will not be garbage-collected. So, use this for debugging only and remove from production code. + * @param {string} [label] + * @returns {EventStream} + */ + log(label?:string):EventStream; + + /** + * @method EventStream#doLog + * @description Logs each value of the [EventStream]{@link Bacon.EventStream} to the console. [doLog]{@link Bacon.EventStream#doLog} behaves like [log]{@link Bacon.EventStream#log} but does not subscribe to the EventStream. You can think of `doLog` as a logger function that – unlike `log` – is safe to use in production. `doLog` is safe, because it does not cause the same surprising side-effects as `log` does. + * @returns {EventStream} + */ + doLog():EventStream; + + /** + * @method + * @description Ends the [EventStream]{@link Bacon.EventStream} on first [Error]{@link Bacon.Error} event. The error is included in the output of the returned EventStream. + * @returns {EventStream} + */ + endOnError():EventStream; + + /** + * @callback EventStream#endOnError~f + * @param {E} error + * @returns {boolean} + */ + /** + * @method EventStream#endOnError + * @description Ends the [EventStream]{@link Bacon.EventStream} on first [Error]{@link Bacon.Error} event for which the given predicate function `f` returns `true`. The error is included in the output of the returned EventStream. + * @param {EventStream#endOnError} f + * @returns {EventStream} + */ + endOnError(f:(error:E) => boolean):EventStream; + + /** + * @callback EventStream#withHandler~f + * @param {Initial|Next|End|Error} event + * @returns {*} + */ + /** + * @method EventStream#withHandler + * @description Lets you do more custom event handling on [EventStream]{@link Bacon.EventStream}: you get all events to your function `f` and you can output any number of events and end the stream if you choose. Note that it's important to return the value from `this.push` so that the connection to the underlying stream will be closed when no more events are needed. + * @param {EventStream#withHandler~f} f + * @returns {EventStream} + * @example + * // Send an error and end the stream in case a value is below zero: + * Bacon.fromArray([1, 2, -3, 3]).withHandler(function (event) { + * if (event.hasValue() && event.value() < 0) { + * this.push(new Bacon.Error("Value below zero")); + * return this.push(new Bacon.End()); + * } else { + * return this.push(event); + * } + * }); + */ + withHandler(f:(event:Initial|Next|End|Error) => any):EventStream; + + /** + * @method + * @description Sets the name of the [EventStream]{@link Bacon.EventStream}. Overrides the default implementation of `toString` and `inspect`. Returns itself. + * @param {string} newName + * @returns {EventStream} + */ + name(newName:string):EventStream; + + /** + * @method + * @description Sets the structured description of the [EventStream]{@link Bacon.EventStream}. The `toString` and `inspect` methods use this data recursively to create a string representation for the `EventStream`. This method is probably useful for Bacon core/library/plugin development only. + * @param {...*} param + * @returns {EventStream} + * @example + * { + * let src = Bacon.once(1), + * obs = src.map(x => -x); + * + * console.log(obs.toString()); + * // Bacon.once(1).map(function) + * + * obs.withDescription(src, "times", -1); + * console.log(obs.toString()); + * // Bacon.once(1).times(-1) + */ + withDescription(...param:any[]):EventStream; + + /** + * @callback EventStream#groupBy1~keyF + * @param {A} value + * @returns {B} + */ + /** + * @method EventStream#groupBy1 + * @description Groups [EventStream]{@link Bacon.EventStream} events to new EventStream's by `keyF`. + * @param {EventStream#groupBy1~keyF} keyF + * @returns {EventStream>} + */ + groupBy(keyF:(value:A) => B):EventStream>; + + /** + * @callback keyF + * @param {A} value + * @returns {B} + */ + /** + * @callback limitF + * @param {EventStream} groupedStream + * @param {Initial|Next|End|Error} groupStartingEvent + * @returns {EventStream} + */ + /** + * @description Groups [EventStream]{@link Bacon.EventStream} events to new EventStream's by `keyF`. `limitF` is provided to limit grouped stream life. EventStream transformed by `limitF` is passed on if provided. `limitF` gets grouped stream and the original [Event]{@link Bacon.Event} causing the EventStream to start as parameters. + * @param {keyF} keyF + * @param {limitF} limitF + * @returns {EventStream>} Grouped streams. + */ + groupBy(keyF:(value:A) => B, limitF:(groupedStream:EventStream, groupStartingEvent:Initial|Next|End|Error) => EventStream):EventStream>; + + /** + * @callback EventStream#subscribe~f + * @param {Event} event + * @returns {void|NoMore} + */ + /** + * @callback EventStream#subscribe~unsubscribe + * @returns {void} + */ + /** + * @method EventStream#subscribe + * @description Subscribes a given handler function `f` to [EventStream]{@link Bacon.EventStream}. Function will receive [Event]{@link Bacon.Event} objects. The [subscribe]{@link EventStream#subscribe} call returns an [unsubscribe function]{@link EventStream#subscribe~unsubscribe} that you can call to unsubscribe. You can also unsubscribe by returning [Bacon.noMore]{@link Bacon.noMore} from the handler function as a reply to an Event. + * @param {EventStream#subscribe~f} f + * @returns {EventStream#subscribe~unsubscribe} + */ + subscribe(f:(event:Event) => void|NoMore):() => void; + + /** + * @callback EventStream#onValue~f + * @param {A} value + * @returns {void} + */ + /** + * @callback EventStream#onValue~unsubscribe + * @returns {void} + */ + /** + * @method EventStream#onValue + * @description Subscribes a given handler function `f` to [EventStream]{@link Bacon.EventStream}. Function will be called for each new value in the EventStream. This is the simplest way to assign a side-effect to a EventStream. The difference to the [subscribe]{@link Bacon.EventStream#subscribe} method is that the actual EventStream values are received, instead of [Event]{@link Bacon.Event} objects. Just like `subscribe`, this method returns a function for `unsubscribe`ing. + * @param {EventStream#onValue~f} f + * @returns {EventStream#onValue~unsubscribe} + */ + onValue(f:(value:A) => void):() => void; + + /** + * @callback EventStream#onValues~f + * @param {*[]} args + * @returns {void} + */ + /** + * @callback EventStream#onValues~unsubscribe + * @returns {void} + */ + /** + * @method EventStream#onValues + * @description Subscribes a given handler function `f` to [EventStream]{@link Bacon.EventStream}. Like [EventStream.onValue]{@link Bacon.EventStream#onValue}, but splits the value (assuming its an array) as function arguments to `f`. + * @param {EventStream#onValues~f} f + * @returns {EventStream#onValues~unsubscribe} + */ + onValues(f:(...args:any[]) => void):() => void; + + /** + * @callback EventStream#skipDuplicates~isEqual + * @param {A} oldValue + * @param {A} newValue + * @returns {boolean} + */ + /** + * @method EventStream#skipDuplicates + * @description Drops consecutive equal elements of the [EventStream]{@link Bacon.EventStream}. Uses the === operator for equality checking by default. If the `isEqual` argument is supplied, checks by calling [isEqual]{@link EventStream#skipDuplicates~isEqual}. For instance, to do a deep comparison, you can use the `isEqual` function from underscore.js like `stream.skipDuplicates(_.isEqual)`. + * @param {EventStream#skipDuplicates~isEqual} [isEqual] + * @returns {EventStream} + * @example + * Bacon.fromArray([1, 2, 2, 1]).skipDuplicates().log(); + * // > returns [1, 2, 1] in an order + */ + skipDuplicates(isEqual?:(oldValue:A, newValue:A) => boolean):EventStream; + + /** + * @method + * @description Concatenates two [EventStream]{@link Bacon.EventStream}s into one so that it will deliver events from EventStream until it ends and then deliver events from `otherStream`. This means too that events from `otherStream`, occurring before the end of EventStream will not be included in the result EventStream. + * @param {EventStream} otherStream + * @returns {EventStream} + */ + concat(otherStream:EventStream):EventStream; + + /** + * @method + * @description Merges two [EventStream]{@link Bacon.EventStream}s into one that delivers events from both. + * @param {EventStream} otherStream + * @returns {EventStream} + */ + merge(otherStream:EventStream):EventStream; + + /** + * @method + * @description Pauses and buffers the [EventStream]{@link Bacon.EventStream} if last event in `valve` is truthy. All buffered events are released when `valve` becomes falsy. + * @param {Observable} valve + * @returns {EventStream} + */ + holdWhen(valve:Observable):EventStream; + + /** + * @method + * @description Adds a starting `value` to the [EventStream]{@link Bacon.EventStream}, i.e. concats a EventStream containing a single `value` with this EventStream. + * @param {A} value + * @returns {EventStream} + */ + startWith(value:A):EventStream; + + /** + * @callback EventStream#skipWhile~f + * @param {A} value + * @returns {boolean} + */ + /** + * @method EventStream#skipWhile + * @description Skips elements in the [EventStream]{@link Bacon.EventStream} until the given predicate function `f` returns falsy once, and then lets all events pass through. + * @param {EventStream#skipWhile~f} f + * @returns {EventStream} + */ + skipWhile(f:(value:A) => boolean):EventStream; + + /** + * @method + * @description Skips elements in the [EventStream]{@link Bacon.EventStream} until the value of the given [Property]{@link Bacon.Property} `property` is falsy once, and then lets all events pass through. + * @param {Property} property + * @returns {EventStream} + */ + skipWhile(property:Property):EventStream; + + /** + * @method + * @description Skips elements from the [EventStream]{@link Bacon.EventStream} until a [Next]{@link Bacon.Next} event appears in `stream2`. In other words, starts delivering values from `stream` after first event appears in `stream2`. + * @param {EventStream} stream2 + * @returns {EventStream} + */ + skipUntil(stream2:EventStream):EventStream; + + /** + * @method + * @description Buffers the [EventStream]{@link Bacon.EventStream} with given `delay` (in milliseconds). The buffer is flushed at most once in the given `delay`. + * @param {number} delay + * @returns {EventStream} + * @example + * // You might get two events containing [1,2,3,4] and [5,6,7] respectively, given that the flush occurs between numbers 4 and 5: + * Bacon.fromArray([1, 2, 3, 4, 5, 6, 7]).bufferWithTime(0); + */ + bufferWithTime(delay:number):EventStream; + + /** + * @callback EventStream#bufferWithTime~f + * @param {EventStream#bufferWithTime~defer} defer + * @returns {void} + */ + /** + * @callback EventStream#bufferWithTime~defer + * @param {...*} args + * @returns {void} + */ + /** + * @method EventStream#bufferWithTime + * @description Buffers the [EventStream]{@link Bacon.EventStream} with given "defer-function" `f`. + * @param {EventStream#bufferWithTime~f} f + * @returns {EventStream} + * @example + * // Here's an equivalent to `stream.bufferWithTime(10)`: + * let stream = Bacon.fromArray([1, 2, 3, 4, 5, 6, 7]); + * stream.bufferWithTime(f => { setTimeout(f, 10); }); } + */ + bufferWithTime(f:(defer:(...args:any[]) => void) => void):EventStream; + + /** + * @method + * @description Buffers the [EventStream]{@link Bacon.EventStream} events with given `count`. The buffer is flushed when it contains the given `count` of elements. + * @param {number} count + * @returns {EventStream} + * @example + * // You will get output events with values `[1, 2]`, `[3, 4]` and `[5]`. + * Bacon.fromArray([1, 2, 3, 4, 5]).bufferWithCount(2); + */ + bufferWithCount(count:number):EventStream; + + /** + * @method + * @description Buffers the [EventStream]{@link Bacon.EventStream} events and flushes when either the buffer contains the given `count` of elements or the given `delay` (in milliseconds) has passed since last buffered event. + * @param {number} delay + * @param {number} count + * @returns {EventStream} + */ + bufferWithTimeOrCount(delay:number, count:number):EventStream; + + /** + * @method EventStream#toProperty + * @description Creates a [Property]{@link Bacon.Property} based on the [EventStream]{@link Bacon.EventStream}. Without arguments, you'll get a Property without an initial value and will get its first actual value from the EventStream, and after that it'll always have a current value. Given `initialValue` will be used as the current value until the first value comes from the EventStream. + * @param {A} [initialValue] + * @returns {Property} + */ + toProperty(initialValue?:A):Property; + } + + var EventStream:{ + /** + * @callback EventStream#new~subscribe + * @param {EventStream#new~sink} sink + * @returns {EventStream#new~unsubscribe} + */ + /** + * @callback EventStream#new~sink + * @param {More|NoMore|(A|Initial|Next|End|Error)|(A|Initial|Next|End|Error)[]} value + * @returns {void} + */ + /** + * @callback EventStream#new~unsubscribe + * @returns {void} + */ + /** + * @constructor EventStream#new + * @constructs Bacon.EventStream + * @description Creates an [EventStream]{@link Bacon.EventStream} with the given `subscribe` function. + * @param {EventStream#new~subscribe} subscribe + * @returns {EventStream} + */ + new(subscribe:(sink:(value:More|NoMore|(A|Initial|Next|End|Error)|(A|Initial|Next|End|Error)[]) => void) => (() => void)):EventStream; + }; + + /** + * @class Property + * @augments Bacon.Observable + * @description A reactive property. Has the concept of "current value". You can create a Property from an [EventStream]{@link Bacon.EventStream} by using either [EventStream.toProperty]{@link Bacon.EventStream#toProperty} or [Observable.scan]{@link Bacon.Observable#scan} method. Note: depending on how a Property is created, it may or may not have an initial value. The current value stays as its last value after the EventStream has ended. + * */ + interface Property extends Observable { + /** + * @callback Property#map~f + * @param {A} value + * @returns {B} + */ + /** + * @method Property#map + * @description Maps the [Property]{@link Bacon.Property} values using given function `f`, returning a new Property. This method, among many others, uses lazy evaluation. + * @param {Property#map~f} f + * @returns {Property} + * */ + map(f:(value:A) => B):Property; + + /** + * @method + * @description Maps the [Property]{@link Bacon.Property} values using given `constant` value, returning a new Property. This method, among many others, uses lazy evaluation. + * @param {B} constant + * @returns {Property} + * */ + map(constant:B):Property; + + /** + * @method + * @description Maps the [Property]{@link Bacon.Property} values using given `propertyExtractor` string like ".keyCode", returning a new Property. So, if f is a string starting with a dot, the elements will be mapped to the corresponding field/function in the event value. For instance map(".keyCode") will pluck the keyCode field from the input values. If "keyCode" was a function, the resulting Property would contain the values returned by the function. This method, among many others, uses lazy evaluation. + * @param {string} propertyExtractor + * @returns {Property} + * */ + map(propertyExtractor:string):Property; + + /** + * @callback Property#mapError~f + * @param {E} error + * @returns {B} + */ + /** + * @method Property#mapError + * @description Maps the [Property]{@link Bacon.Property} errors using given function `f`. More specifically, feeds the "error" field of the [Error]{@link Bacon.Error} event to the function `f` and produces a [Next]{@link Bacon.Next} event based on the return value. + * @param {Property#mapError~f} f + * @returns {Property} + */ + mapError(f:(error:E) => B):Property; + + /** + * @method + * @description Returns a [Property]{@link Bacon.Property} containing [Error]{@link Bacon.Error} events only. Same as filtering with a function that always returns false. + * @returns {Property} + */ + errors():Property; + + /** + * @method + * @description Skips all [Error]{@link Bacon.Error}s. + * @returns {Property} + */ + skipErrors():Property; + + /** + * @callback Property#mapEnd~f + * @returns {A} + */ + /** + * @method Property#mapEnd + * @description Adds an extra [Next]{@link Bacon.Next} event just before [End]{@link Bacon.End} of the [Property]{@link Bacon.Property}. The value is created by calling the given function `f` when the source Property ends. + * @param {Property#mapEnd~f} f + * @returns {Property} + */ + mapEnd(f:() => A):Property; + + /** + * @method + * @description Adds an extra [Next]{@link Bacon.Next} event just before [End]{@link Bacon.End} of the [Property]{@link Bacon.Property}. A static `value` is used. + * @param {A} value + * @returns {Property} + */ + mapEnd(value:A):Property; + + /** + * @callback Property#filter~f + * @param {A} value + * @returns {boolean} + */ + /** + * @method Property#filter + * @description Filters the [Property]{@link Bacon.Property} values using a given predicate function `f`. + * @param {Property#filter~f} f + * @returns {Property} + */ + filter(f:(value:A) => boolean):Property; + + /** + * @method + * @description Filters the [Property]{@link Bacon.Property} values using a given constant `bool` value (`true` to include all, `false` to exclude all). + * @param {boolean} bool + * @returns {Property} + */ + filter(bool:boolean):Property; + + /** + * @method + * @description Filters the [Property]{@link Bacon.Property} values using a given `propertyExtractor` string (like ".isValuable"). + * @param {string} propertyExtractor + * @returns {Property} + */ + filter(propertyExtractor:string):Property; + + /** + * @method + * @description Filters the [Property]{@link Bacon.Property} values based on the value of the Property `property`. Event will be included in output IF AND ONLY IF the `property` holds `true` at the time of the event. + * @param {Property} property + * @returns {Property} + */ + filter(property:Property):Property; + + /** + * @callback Property#takeWhile~f + * @param {A} value + * @returns {boolean} + */ + /** + * @method Property#takeWhile + * @description Takes the [Property]{@link Bacon.Property} values while given predicate function `f` holds `true`, and then ends. + * @param {Property#takeWhile~f} f + * @returns {Property} + */ + takeWhile(f:(value:A) => boolean):Property; + + /** + * @method + * @description Takes the [Property]{@link Bacon.Property} values while the value of a `property` holds `true`, and then ends. + * @param {Property} property + * @returns {Property} + */ + takeWhile(property:Property):Property; + + /** + * @method Property#take + * @description Takes at most `n` elements from the [Property]{@link Bacon.Property}. Equal to `Bacon.never()` if `n <= 0`. + * @param {number} n + * @returns {Property} + */ + take(n:number):Property; + + /** + * @method + * @description Takes elements from the [Property]{@link Bacon.Property} until a [Next]{@link Bacon.Next} event appears in the `stream`. If `stream` ends without value, it is ignored. + * @param {EventStream} stream + * @returns {Property} + */ + takeUntil(stream:EventStream):Property; + + /** + * @method + * @description Takes the first element from the [Property]{@link Bacon.Property}. Essentially [Property.take]{@link Bacon.Property#take}(1). + * @returns {Property} + */ + first():Property; + + /** + * @method + * @description Takes the last element from the [Property]{@link Bacon.Property}. None, if Property is empty. + * @returns {Property} + * @example + * // This creates the property which doesn't produce any events and never ends: + * Bacon.interval(1e1, 0).toProperty().last(); + */ + last():Property; + + /** + * @method + * @description Skips the first `n` elements from the [Property]{@link Bacon.Property}. + * @param {number} n + * @returns {Property} + */ + skip(n:number):Property; + + /** + * @method + * @description Delays the [Property]{@link Bacon.Property} by given `delay` (in milliseconds). Does not delay the initial value of a Property. + * @param {number} delay + * @returns {Property} + */ + delay(delay:number):Property; + + /** + * @method Property#throttle + * @description Throttles the [Property]{@link Bacon.Property} by given `delay` (in milliseconds). Events are emitted with the minimum interval of `delay`. The implementation is based on [EventStream.bufferWithTime]{@link Bacon.EventStream#bufferWithTime}. Does not affect emitting the initial value of a Property. + * @param {number} delay + * @returns {Property} + */ + throttle(delay:number):Property; + + /** + * @method Property#debounce + * @description Throttles the [Property]{@link Bacon.Property} by given `delay` (in milliseconds), but so that event is only emitted after the given "quiet period". Does not affect emitting the initial value of a Property. The difference of [throttle]{@link Bacon.Property#throttle} and [debounce]{@link Bacon.Property#debounce} is the same as it is in the same methods in jQuery. + * @param {number} delay + * @returns {Property} + */ + debounce(delay:number):Property; + + /** + * @method + * @description Passes the first event in the [Property]{@link Bacon.Property} through, but after that, only passes events after a given `delay` (in milliseconds) have passed since previous output. + * @param {number} delay + * @returns {Property} + */ + debounceImmediate(delay:number):Property; + + /** + * @callback Property#doAction~f + * @param {A} value + * @returns {void} + */ + /** + * @method Property#doAction + * @description Returns a [Property]{@link Bacon.Property} where the function `f` is executed for each value, before dispatching to subscribers. This is useful for debugging, but also for stuff like calling the `preventDefault()` method for events. + * @param {Property#doAction~f} f + * @returns {Property} + */ + doAction(f:(value:A) => void):Property; + + /** + * @method + * @description Returns a [Property]{@link Bacon.Property} where the `propertyExtractor` string is applied to each value, before dispatching to subscribers. This is useful for debugging, but also for stuff like calling the `preventDefault()` method for events. + * @param {string} propertyExtractor + * @returns {Property} + */ + doAction(propertyExtractor:string):Property; + + /** + * @callback Property#doError~f + * @param {E} error + * @returns {void} + */ + /** + * @method Property#doError + * @description Returns a [Property]{@link Bacon.Property} where the function `f` is executed for each error, before dispatching to subscribers. That is, same as [doAction]{@link Bacon.Property#doAction} but for [Error]{@link Bacon.Error}s. + * @param {Property#doError~f} f + * @returns {Property} + */ + doError(f:(error:E) => void):Property; + + /** + * @method + * @description Returns a [Property]{@link Bacon.Property} that inverts boolean values. + * @returns {Property} + */ + not():Property; + + /** + * @method Property#log + * @description Logs each value of the [Property]{@link Bacon.Property} to the console. It optionally takes a `label` argument to pass to `console.log()` alongside each value. To assist with chaining, it returns the original Property. Note that as a side-effect, the Property will have a constant listener and will not be garbage-collected. So, use this for debugging only and remove from production code. + * @param {string} [label] + * @returns {Property} + */ + log(label?:string):Property; + + /** + * @method Property#doLog + * @description Logs each value of the [Property]{@link Bacon.Property} to the console. [doLog]{@link Bacon.Property#doLog} behaves like [log]{@link Bacon.Property#log} but does not subscribe to the Property. You can think of `doLog` as a logger function that – unlike `log` – is safe to use in production. `doLog` is safe, because it does not cause the same surprising side-effects as `log` does. + * @returns {Property} + */ + doLog():Property; + + /** + * @method + * @description Ends the [Property]{@link Bacon.Property} on first [Error]{@link Bacon.Error} event. The error is included in the output of the returned Property. + * @returns {Property} + */ + endOnError():Property; + + /** + * @callback Property#endOnError~f + * @param {E} error + * @returns {boolean} + */ + /** + * @method Property#endOnError + * @description Ends the [Property]{@link Bacon.Property} on first [Error]{@link Bacon.Error} event for which the given predicate function `f` returns `true`. The error is included in the output of the returned Property. + * @param {Property#endOnError~f} f + * @returns {Property} + */ + endOnError(f:(error:E) => boolean):Property; + + /** + * @callback Property#withHandler~f + * @param {Initial|Next|End|Error} event + * @returns {*} + */ + /** + * @method Property#withHandler + * @description Lets you do more custom event handling on the [Property]{@link Bacon.Property}: you get all events to your function `f` and you can output any number of [Event]{@link Bacon.Event}s and end the Property if you choose. Note that it's important to return the value from `this.push` so that the connection to the underlying stream will be closed when no more events are needed. + * @param {Property#withHandler~f} f + * @returns {Property} + * @example + * // Send an error and end the stream in case a value is below zero: + * Bacon.fromArray([1, 2, -3, 3]).withHandler(function (event) { + * if (event.hasValue() && event.value() < 0) { + * this.push(new Bacon.Error("Value below zero")); + * return this.push(new Bacon.End()); + * } else { + * return this.push(event); + * } + * }); + */ + withHandler(f:(event:Initial|Next|End|Error) => any):Property; + + /** + * @method + * @description Sets the `newName` of the [Property]{@link Bacon.Property}. Overrides the default implementation of `toString` and `inspect`. Returns itself. + * @param {string} newName + * @returns {Property} + */ + name(newName:string):Property; + + /** + * @method + * @description Sets the structured description of the [Property]{@link Bacon.Property}. The `toString` and `inspect` methods use this data recursively to create a string representation for the Property. This method is probably useful for Bacon core/library/plugin development only. + * @param {...*} param + * @returns {Property} + * @example + * let src = Bacon.once(1), + * obs = src.map(x => -x); + * + * console.log(obs.toString()); + * // Bacon.once(1).map(function) + * + * obs.withDescription(src, "times", -1); + * console.log(obs.toString()); + * // Bacon.once(1).times(-1) + */ + withDescription(...param:any[]):Property; + + /** + * @method + * @description Creates an [EventStream]{@link Bacon.EventStream} based on this [Property]{@link Bacon.Property}. The EventStream contains also an event for the current value of this Property at the time this method was called. + * @returns {EventStream} + */ + toEventStream():EventStream; + + /** + * @callback Property#subscribe~f + * @param {Event} event + * @returns {void} + */ + /** + * @callback Property#subscribe~unsubscribe + * @returns {void} + */ + /** + * @method Property#subscribe + * @description Subscribes a handler function `f` to [Property]{@link Bacon.Property}. If there's a current value, an [Initial]{@link Bacon.Initial} event will be pushed immediately. [Next]{@link Bacon.Next} event will be pushed on updates and an [End]{@link Bacon.End} event in case the source Property ends. Returns a function that you call to `unsubscribe`. + * @param {Property#subscribe~f} f + * @returns {Property#subscribe~unsubscribe} + */ + subscribe(f:(event:Event) => void):() => void; + + /** + * @callback Property#onValue~f + * @param {A} value + * @returns {void} + */ + /** + * @callback Property#onValue~unsubscribe + * @returns {void} + */ + /** + * @method Property#onValue + * @description Subscribes a handler function `f` to [Property]{@link Bacon.Property}. Similar to [EventStream.onValue]{@link Bacon.EventStream#onValue}, except that also pushes the initial value of the Property, in case there is one. Just like [subscribe]{@link Bacon.Property#subscribe}, this method returns a function for `unsubscribe`ing. + * @param {Property#onValue~f} f + * @returns {Property#onValue~unsubscribe} + */ + onValue(f:(value:A) => void):() => void; + + /** + * @callback Property#onValues~f + * @param {*[]} args + * @returns {void} + */ + /** + * @callback Property#onValues~unsubscribe + * @returns {void} + */ + /** + * @method Property#onValues + * @description Subscribes a handler function `f` to [Property]{@link Bacon.Property}. Like [onValue]{@link Bacon.Property#onValue}, but splits the value (assuming its an array) as function arguments to `f`. + * @param {Property#onValues~f} f + * @returns {Property#onValues~unsubscribe} + */ + onValues(f:(...args:any[]) => void):() => void; + + /** + * @method Property#assign + * @description Calls the `method` of the given `object` with each value of this [Property]{@link Bacon.Property}. You can optionally supply `params` which will be used as the first arguments of the `method` call. Note that the [assign]{@link Bacon.Property#assign} method is actually just a synonym for [onValue]{@link Bacon.Property#onValue}. + * @param {Object} obj + * @param {string} method + * @param {...*} params + * @returns {void} + * @example + * let property = Bacon.fromArray([1, 2, 3, 4, 5]).toProperty(); + * // If you want to assign your Property to the "disabled" attribute of a JQuery object, you can do this: + * property.assign($("#my-button"), "attr", "disabled"); + * // A simpler example would be to toggle the visibility of an element based on a Property: + * property.assign($("#my-button"), "toggle"); + */ + assign(obj:Object, method:string, ...params:any[]):void; + + /** + * @method + * @description Creates an [EventStream]{@link Bacon.EventStream} by sampling the [Property]{@link Bacon.Property} value at given `interval` (in milliseconds). + * @param {number} interval + * @returns {EventStream} + */ + sample(interval:number):EventStream; + + /** + * @method Property#sampledBy + * @description Creates an [EventStream]{@link Bacon.EventStream} by sampling the [Property]{@link Bacon.Property} value at each event from the given `stream`. The result EventStream will contain the value at each event in the source Property. + * @param {EventStream} stream + * @returns {EventStream} + */ + sampledBy(stream:EventStream):EventStream; + + /** + * @method + * @description Creates a [Property]{@link Bacon.Property} by sampling the value at each event from the given [Property]{@link Bacon.Property} `property`. The result Property will contain the value at each event in the source Property. + * @param {Property} property + * @returns {Property} + */ + sampledBy(property:Property):Property; + + /** + * @callback Property#sampledBy~f + * @param {A} propertyValue + * @param {B} samplerValue + * @returns {C} + */ + /** + * @method Property#sampledBy + * @description Samples the [Property]{@link Bacon.Property} on `streamOrProperty` events. The result values will be formed using the given function `f`. + * @param {Observable} streamOrProperty + * @param {Property#sampledBy~f} f + * @returns {EventStream} + */ + sampledBy(streamOrProperty:Observable, f:(propertyValue:A, samplerValue:B) => C):EventStream; + + /** + * @callback Property#skipDuplicates~isEqual + * @param {A} oldValue + * @param {A} newValue + * @returns {boolean} + */ + /** + * @method Property#skipDuplicates + * @description Drops consecutive equal elements. Uses the `===` operator for equality checking by default. If the `isEqual` argument is supplied, checks by calling `isEqual(oldValue, newValue)`. The old name for this method was `distinctUntilChanged`. + * @param {Property#skipDuplicates~isEqual} [isEqual] + * @returns {Property} + */ + skipDuplicates(isEqual?:(oldValue:A, newValue:A) => boolean):Property; + + /** + * @method Property#changes + * @description Returns an [EventStream]{@link Bacon.EventStream} of [Property]{@link Bacon.Property} value changes. Returns exactly the same events as the Property itself, except any [Initial]{@link Bacon.Initial} events (the stream DOES NOT include an event for the current value of the Property at the time this method was called). Note that [Property.changes]{@link Bacon.Property#changes} DOES NOT skip duplicate values, use [Property.skipDuplicates]{@link Bacon.Property#skipDuplicates} for that. + * @returns {EventStream} + */ + changes():EventStream; + + /** + * @method + * @description Combines [Property]{@link Bacon.Property}s with the && operator. + * @param {Property} other + * @returns {Property} + */ + and(other:Property):Property; + + /** + * @method + * @description Combines [Property]{@link Bacon.Property}s with the || operator. + * @param {Property} other + * @returns {Property} + */ + or(other:Property):Property; + + /** + * @method + * @description Adds an initial "default" value for the [Property]{@link Bacon.Property}. If the Property doesn't have an initial value of it's own, the given `value` will be used as the initial value. If the property has an initial value of its own, the given `value` will be ignored. + * @param {A} value + * @returns {Property} + */ + startWith(value:A):Property; + } + + /** + * @function Bacon.combineAsArray + * @description Combines [Property]{@link Bacon.Property}s, [EventStream]{@link Bacon.EventStream}s and constant values so that the result Property will have an array of all property values as its value. The input array may contain both Properties and EventStreams. In the latter case, the stream is first converted into a Property and then combined with the other Property's. + * @param {(A|Observable)[]} streams + * @returns {Property} + */ + function combineAsArray(streams:(A|Observable)[]):Property; + + /** + * @function + * @description Combines [Property]{@link Bacon.Property}s, [EventStream]{@link Bacon.EventStream}s and constant values so that the result Property will have an array of all property values as its value. Like [Bacon.combineAsArray]{@link Bacon.combineAsArray}, but `streams` are provided as a list of arguments as opposed to a single array. + * @param {...(A|Observable)} streams + * @returns {Property} + */ + function combineAsArray(...streams:(A|Observable)[]):Property; + + /** + * @callback Property#combineWith~f + * @param {...A} args + * @returns {B} + */ + /** + * @function Property#combineWith + * @description Combines given n [Property]{@link Bacon.Property}s, [EventStream]{@link Bacon.EventStream}s and constant values using the given n-ary function `f`. + * @param {Property#combineWith~f} f + * @param {...(A|Observable)} streams + * @returns {Property} + */ + function combineWith(f:(...args:A[]) => B, ...streams:(A|Observable)[]):Property; + + /** + * @function + * @description Combines [Property]{@link Bacon.Property}s, [EventStream]{@link Bacon.EventStream}s and constant values using a `template` object. + * @param {{string:number|boolean|string|Object|Observable}} template + * @returns {Property} + */ + function combineTemplate(template:{[label:string]:number|boolean|string|Object|Observable}):Property; + + /** + * @function + * @description Merges given array of [EventStream]{@link Bacon.EventStream}s. + * @param {EventStream[]} streams + * @returns {EventStream} + */ + function mergeAll(streams:EventStream[]):EventStream; + + /** + * @function + * @description Merges given array of [EventStream]{@link Bacon.EventStream}s. + * @param {...EventStream} streams + * @returns {EventStream} + */ + function mergeAll(...streams:EventStream[]):EventStream; + + /** + * @function + * @description Zips the array of `streams` in to a new [EventStream]{@link Bacon.EventStream} that will have an array of values from each source EventStream as its value. Zipping means that events from each EventStream are combine pairwise so that the 1st event from each EventStream is published first, then the 2nd event from each. The results will be published as soon as there is a value from each source EventStream. Be careful not to have too much "drift" between EventStream's. If one EventStream produces many more values than some other excessive buffering will occur inside the zipped [Observable]{@link Bacon.Observable}. + * @param {EventStream[]} streams + * @returns {EventStream} + */ + function zipAsArray(streams:EventStream[]):EventStream; + + /** + * @function + * @description Zips the `streams` in to a new [EventStream]{@link Bacon.EventStream} that will have an array of values from each source EventStream as its value. Zipping means that events from each EventStream are combine pairwise so that the 1st event from each EventStream is published first, then the 2nd event from each. The results will be published as soon as there is a value from each source EventStream. EventStream's are provided as a list of arguments as opposed to a single array. Be careful not to have too much "drift" between EventStream's. If one EventStream produces many more values than some other excessive buffering will occur inside the zipped [Observable]{@link Bacon.Observable}. + * @param {...EventStream} streams + * @returns {EventStream} + */ + function zipAsArray(...streams:EventStream[]):EventStream; + + /** + * @callback Bacon.zipWith1~f + * @param {...A} args + * @returns {B} + */ + /** + * @function Bacon.zipWith1 + * @description Zips the array of `streams` in to a new [EventStream]{@link Bacon.EventStream} that will combine the n values from EventStream's with n-ary function `f`. Zipping means that events from each EventStream are combine pairwise so that the 1st event from each EventStream is published first, then the 2nd event from each. The results will be published as soon as there is a value from each source EventStream. Be careful not to have too much "drift" between EventStream's. If one EventStream produces many more values than some other excessive buffering will occur inside the zipped [Observable]{@link Bacon.Observable}. + * @param {EventStream[]} streams + * @param {Bacon.zipWith1~f} f + * @returns {EventStream} + */ + function zipWith(streams:EventStream[], f:(...args:A[]) => B):EventStream; + + /** + * @callback Bacon.zipWith2~f + * @param {...A} args + * @returns {B} + */ + /** + * @function Bacon.zipWith2 + * @description Zips the `streams` in to a new [EventStream]{@link Bacon.EventStream} that will combine the n values from EventStream's with n-ary function `f`. Zipping means that events from each EventStream are combine pairwise so that the 1st event from each EventStream is published first, then the 2nd event from each. The results will be published as soon as there is a value from each source EventStream. Streams are provided as a list of arguments as opposed to a single array. Be careful not to have too much "drift" between EventStream's. If one EventStream produces many more values than some other excessive buffering will occur inside the zipped [Observable]{@link Bacon.Observable}. + * @param {Bacon.zipWith2~f} f + * @param {...EventStream} streams + * @returns {EventStream} + */ + function zipWith(f:(...args:A[]) => B, ...streams:EventStream[]):EventStream; + + /** + * @function + * @description Is a shorthand for combining multiple sources ([EventStream]{@link Bacon.EventStream}s, [Property]{@link Bacon.Property}s, constants) as array and assigning the side-effect function `f` for the values. + * @param {...*} args + * @returns {void} + */ + function onValues(...args:any[]):void; + + /** + * @class Bus + * @augments Bacon.EventStream + * @description An [EventStream]{@link Bacon.EventStream} that allows you to [push]{@link Bacon.Bus#push} values into the EventStream. It also allows [plug]{@link Bacon.Bus#plug}ging other EventStream's into the Bus. The Bus practically merges all plugged-in streams and the values pushed using the [push]{@link Bacon.Bus#push} method. + */ + interface Bus extends EventStream { + /** + * @method Bus#push + * @description Pushes the given `value` to the [Bus]{@link Bacon.Bus}. + * @param {A} value + * @returns {void} + */ + push(value:A):void; + + /** + * @method + * @description Ends the [Bus]{@link Bacon.Bus}. Sends an [End]{@link Bacon.End} event to all subscribers. After this call, there'll be no more events to the subscribers. Also, the [Bus.push]{@link Bacon.Bus#push} and [Bus.plug]{@link Bacon.Bus#plug} methods have no effect. + * @returns {void} + */ + end():void; + + /** + * @method + * @description Sends an [Error]{@link Bacon.Error} with given `error` message to all subscribers. + * @param {E} error + * @returns {void} + */ + error(error:E):void; + + /** + * @callback Bus#plug~unplug + * @returns {void} + */ + /** + * @method Bus#plug + * @description Plugs the given [EventStream]{@link Bacon.EventStream} to the [Bus]{@link Bacon.Bus}. All events from the given `stream` will be delivered to the subscribers of the Bus. Returns a function `unplug` that can be used to unplug the same stream. The [plug]{@link Bacon.Bus#plug} method practically allows you to merge in other EventStream's after the creation of the Bus. + * @param {EventStream} stream + * @returns {Bus#plug~unplug} + */ + plug(stream:EventStream):() => void; + } + + var Bus:{ + /** + * @constructor + * @constructs Bacon.Bus + * @description Returns a new [Bus]{@link Bacon.Bus}. + * @returns {Bus} + */ + new():Bus; + }; + + /** + * @class Event + * @description Has subclasses [Initial]{@link Bacon.Initial}, [Next]{@link Bacon.Next}, [End]{@link Bacon.End} and [Error]{@link Bacon.Error}. + * */ + class Event { + /** + * @method + * @description Returns the value associated with a [Initial]{@link Bacon.Initial} or [Next]{@link Bacon.Next} event. + * @returns {A} + */ + value():A; + + /** + * @method + * @description Returns `true` for events of type [Initial]{@link Bacon.Initial} or [Next]{@link Bacon.Next}. + * @returns {boolean} + */ + hasValue():boolean; + + /** + * @method Error#isInitial + * @description Returns `true` for events of type [Initial]{@link Bacon.Initial}. + * @returns {boolean} + */ + isInitial():boolean; + + /** + * @method Error#isNext + * @description Returns `true` for events of type [Next]{@link Bacon.Next}. + * @returns {boolean} + */ + isNext():boolean; + + /** + * @method Error#isError + * @description Returns `true` for events of type [Error]{@link Bacon.Error}. + * @returns {boolean} + */ + isError():boolean; + + /** + * @method Error#isEnd + * @description Returns `true` for events of type [End]{@link Bacon.End}. + * @returns {boolean} + */ + isEnd():boolean; + } + + /** + * @class Error + * @augments Bacon.Event + * @description An error event. Call [Event.isError]{@link Bacon.Event#isError} to distinguish these events in your subscriber, or use [onError]{@link Bacon.Observable#onError} to react to error events only. [Error.error]{@link Bacon.Error#error} returns the associated error object (usually string). [Error]{@link Bacon.Error} events are always passed through all stream combinators. So, even if you filter all values out, the error events will pass through. If you use [Observable.flatMap]{@link Bacon.Observable#flatMap}, the result stream will contain Error events from the source as well as all the spawned stream. You can take action on errors by using the [Observable.onError]{@link Bacon.Observable#onError}. See documentation on [Observable.onError]{@link Bacon.Observable#onError}, [EventStream.mapError]{@link Bacon.EventStream#mapError}, [Property.mapError]{@link Bacon.Property#mapError}, [EventStream.errors]{@link Bacon.EventStream#errors}, [Property.errors]{@link Bacon.Property#errors}, [EventStream.skipErrors]{@link Bacon.EventStream#skipErrors}, [Property.skipErrors]{@link Bacon.Property#skipErrors}, [Bacon.retry]{@link Bacon.retry} and [Observable.flatMapError]{@link Bacon.Observable#flatMapError}. An Error does not terminate the stream. The methods [EventStream.endOnError]{@link Bacon.EventStream#endOnError} and [EventStream.endOnError]{@link Bacon.EventStream#endOnError} returns a stream/property that ends immediately after first error. Bacon.js doesn't currently generate any Error events itself (except when converting errors using [Bacon.fromPromise]{@link Bacon.fromPromise}). Error events definitely would be generated by streams derived from IO sources such as AJAX calls. + * @example + * // In case you want to convert (some) value events into Error events, you may use `flatMap` like this: + * Bacon.fromArray([1, 2, 3, 4]).flatMap(x => { + * NOTE: had to explicitly specify the `` typing for `flatMap`. + * return x > 2 ? new Bacon.Error("too big") : x; + * }); + * + * // Conversely, if you want to convert some Error events into value events, you may use `flatMapError`: + * Bacon.fromArray([1, 2, 3, 4]).flatMapError(error => { + * let isNonCriticalError = error => Math.random() < .5, + * handleNonCriticalError = error => 42; + * return isNonCriticalError(error) ? handleNonCriticalError(error) : new Bacon.Error(error); + * }); + * + * // Note also that Bacon.js combinators do not catch errors that are thrown. Especially `map` doesn't do so. If you want to map things and wrap caught errors into Error events, you can do the following: + * Bacon.fromArray([1, 2, 3, 4]).flatMap(x => { + * let dangerousFunction = x => { + * throw new Error("dangerous function!"); + * }; + * try { + * return dangerousFunction(x); + * } catch (e) { + * return new Bacon.Error(e); + * } + * }); + */ + class Error extends Event { + /** + * @constructor + * @constructs Error + * @param {E} error + * */ + constructor(error:E); + + /** + * @property Error#error + * @description Returns the `error` associated with an [Error]{@link Bacon.Error} event. + * @returns {E} + */ + error:E; + } + + /** + * @class End + * @augments Bacon.Event + * @description An end-of-stream event of [EventStream]{@link Bacon.EventStream} or [Property]{@link Bacon.Property}. Call [Event.isEnd]{@link Bacon.Event#isEnd} to distinguish an End from other events. + * */ + class End extends Event { + /** + * @constructor + * @constructs Bacon.End + * */ + constructor(); + } + + /** + * @class Initial + * @augments Bacon.Event + * @description The initial (current) value of a [Property]{@link Bacon.Property}. Call [Event.isInitial]{@link Bacon.Event#isInitial} to distinguish from other events. Only sent immediately after subscription to a Property. + * */ + class Initial extends Event { + /** + * @constructor + * @constructs Bacon.Initial + * @param {A} value + * */ + constructor(value:A); + } + + /** + * @class Next + * @augments Bacon.Event + * @description Next value in an [EventStream]{@link Bacon.EventStream} or a [Property]{@link Bacon.Property}. Call [Event.isNext]{@link Bacon.Event#isNext} to distinguish a Next event from other events. + * */ + class Next extends Event { + /** + * @constructor + * @constructs Bacon.Next + * @param {A} value + * @example + * new Bacon.Next("value"); + * */ + constructor(value:A); + + /** + * @callback Next#constructor + * @returns {A} + */ + /** + * @constructor Next#constructor + * @constructs Bacon.Next + * @description This version is safe only when you know that the actual value in the stream is not a function. The idea in using a function `f` instead of a plain value is that the internals on Bacon.js take advantage of lazy evaluation by deferring the evaluations of values created by `map`, `combine`. + * @param {Next#constructor} f + * @example + * new Bacon.Next(() => "value"); + * */ + constructor(f:() => A); + } + + /** + * @callback Bacon.retry1~source + * @description Function that produces an [EventStream]{@link Bacon.EventStream}. + * @returns {EventStream} + */ + /** + * @callback Bacon.retry1~isRetryable + * @description Function returning `true` to continue retrying, `false` to stop. Defaults to `true`. The [Error]{@link Bacon.Error} that occurred is given as a parameter. For example, there is usually no reason to retry a 404 HTTP error, whereas a 500 or a timeout might work on the next attempt. + * @param {E} error + * @returns {boolean} + */ + /** + * @callback Bacon.retry1~delay + * @description Function that returns the time in milliseconds to wait before retrying. Defaults to `0`. The function is given a `context` object with the keys `error` (the [Error]{@link Bacon.Error} that occurred) and `retriesDone` (the number of retries already performed) to help determine the appropriate delay, e.g. for an incremental backoff. + * @param {Object} context + * @param {E} context.error [Error]{@link Bacon.Error} that occurred + * @param {number} context.retriesDone number of retries already performed + * @returns {number} + */ + /** + * @function Bacon.retry1 + * @description Is used to retry the call when there is an [Error]{@link Bacon.Error} event in the [EventStream]{@link Bacon.EventStream} produced by the `source` function. + * @param {Object} options + * @param {Bacon.retry1~source} options.source function that produces an [EventStream]{@link Bacon.EventStream} + * @param {number} options.retries number of times to retry the `source` function in addition to the initial attempt + * @param {Bacon.retry1~isRetryable} [options.isRetryable] function returning `true` to continue retrying, `false` to stop. Defaults to `true`. + * @param {Bacon.retry1~delay} [options.delay] - function that returns the time in milliseconds to wait before retrying. Defaults to `0`. + * @returns {EventStream} + */ + function retry(options:{ + source:() => EventStream; + retries:number; + isRetryable?:(error:E) => boolean; + delay?:(context:{error:E; retriesDone:number}) => number; + }):EventStream; + + /** + * @callback Bacon.retry1~source + * @description Function that produces an [Property]{@link Bacon.Property}. + * @returns {Property} + */ + /** + * @callback Bacon.retry1~isRetryable + * @description Function returning `true` to continue retrying, `false` to stop. Defaults to `true`. The [Error]{@link Bacon.Error} that occurred is given as a parameter. For example, there is usually no reason to retry a 404 HTTP error, whereas a 500 or a timeout might work on the next attempt. + * @param {E} error + * @returns {boolean} + */ + /** + * @callback Bacon.retry1~delay + * @description Function that returns the time in milliseconds to wait before retrying. Defaults to `0`. The function is given a `context` object with the keys `error` (the [Error]{@link Bacon.Error} that occurred) and `retriesDone` (the number of retries already performed) to help determine the appropriate delay, e.g. for an incremental backoff. + * @param {Object} context + * @param {E} context.error [Error]{@link Bacon.Error} that occurred + * @param {number} context.retriesDone number of retries already performed + * @returns {number} + */ + /** + * @function Bacon.retry1 + * @description Is used to retry the call when there is an [Error]{@link Bacon.Error} event in the [Property]{@link Bacon.Property} produced by the `source` function. + * @param {Object} options + * @param {Bacon.retry1~source} options.source function that produces an [Property]{@link Bacon.Property} + * @param {number} options.retries number of times to retry the `source` function in addition to the initial attempt + * @param {Bacon.retry1~isRetryable} [options.isRetryable] function returning `true` to continue retrying, `false` to stop. Defaults to `true`. + * @param {Bacon.retry1~delay} [options.delay] - function that returns the time in milliseconds to wait before retrying. Defaults to `0`. + * @returns {Property} + */ + function retry(options:{ + source:() => Property; + retries:number; + isRetryable?:(error:E) => boolean; + delay?:(context:{error:E; retriesDone:number}) => number; + }):Property; + + /** + * @callback Bacon.when1~f1 + * @param {...A1} args + * @returns {B} + */ + /** + * @method Bacon.when1 + * @description Creates an [EventStream]{@link Bacon.EventStream} from join-pattern system. + * @param {Observable[]} pattern1 + * @param {Bacon.when1~f1} f1 + * @returns {EventStream} + * @example + * { + * // Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick: + * let tick = Bacon.interval(1e2, 0), + * keyEvent = Bacon.fromEvent(document.body, "click", _ => Date.now()), + * handleTick = _ => `timestamp: NONE`, + * handleKeyEvent = timestamp => `timestamp: ${timestamp}`; + * Bacon.when( + * [tick, keyEvent], (_, timestamp) => handleKeyEvent(timestamp), + * [tick], handleTick + * ); + * // Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick. + * } + * + * { + * // Join patterns are indeed a generalization of `zip`, and `zip` is equivalent to a single-rule join pattern. The following `Observable`s have the same output: + * let a = Bacon.once("a"), + * b = Bacon.once("b"), + * c = Bacon.once("c"), + * f = (a, b, c) => `a = ${a}; b = ${b}; c = ${c}.`; + * Bacon.zipWith(f, a, b, c); + * Bacon.when([a, b, c], f); + * } + * + * { + * // Join patterns as a "chemical machine". + * // A quick way to get some intuition for join patterns is to understand them through an analogy in terms of atoms and molecules. A join pattern can here be regarded as a recipe for a chemical reaction. Lets say we have observables `oxygen`, `carbon` and `hydrogen`, where an event in these spawns an 'atom' of that type into a mixture. We can state reactions: + * let oxygen = Bacon.interval(1e3, "O"), + * hydrogen = Bacon.interval(2e3, "H"), + * carbon = Bacon.interval(1.5e3, "C"), + * makeWater = (oxygen:string, hydrogen1:string, hydrogen2:string) => `${hydrogen1}${[hydrogen1, hydrogen2].length}${oxygen}`, + * makeCarbonMonoxide = (oxygen:string, carbon:string) => `${carbon}${oxygen}`; + * Bacon.when( + * [oxygen, hydrogen, hydrogen], makeWater, + * [oxygen, carbon], makeCarbonMonoxide + * ); + * // Now, every time a new 'atom' is spawned from one of the observables, this atom is added to the mixture. If at any time there are two hydrogen atoms, and an oxygen atom, the corresponding atoms are *consumed*, and output is produced via `makeWater`. The same semantics apply for the second rule to create carbon monoxide. The rules are tried at each point from top to bottom. + * } + * + * { + * // Join patterns and properties. + * // Properties are not part of the synchronization pattern, but are instead just sampled. The following example take three input streams `$price`, `$quantity` and `$total`, e.g. coming from input fields, and defines mutally recursive behaviours in properties `price`, `quantity` and `total` such that: + * // -- updating `quantity` sets `total` to `price * quantity`; + * // -- updating `total` sets `price` to `total / quantity`. + * let random = (x:number) => Math.round(x * Math.random()), + * id = (x:A):A => x; + * let $quantity = Bacon.interval(1e3, 10).map(random), + * $price = Bacon.interval(2e3, 100).map(random), + * $total = Bacon.interval(1.5e3, 1000).map(random); + * let quantity = $quantity.toProperty(1), + * price = Bacon.when( + * [$price], id, + * [$total, quantity], (x, y) => x / y + * ).toProperty(0), + * total = Bacon.when( + * [$total], id, + * [$price, quantity], (x, y) => x * y, + * [price, $quantity], (x, y) => x * y + * ).toProperty(0); + * } + * + * { + * // Join patterns and `Bacon.Bus`. + * // The result functions of join patterns are allowed to push values onto a `Bus` that may in turn be in one of its patterns. For instance, an implementation of the dining philosophers problem can be written as follows: + * // Availability of chopsticks are implemented using bus. + * let chopsticks = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // Hungry could be any type of observable, but we'll use bus here. + * hungry = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // A philosopher eats for one second, then makes the chopsticks available again by pushing values onto their bus. + * eat = (i:number) => () => { + * setTimeout(() => { + * console.log("done!"); + * chopsticks[i].push({}); + * chopsticks[(i + 1) % 3].push({}); + * }, 1e3); + * return `philosopher ${i} eating`; + * }, + * // We use Bacon.when to make sure a hungry philosopher can eat only when both his chopsticks are available. + * dining = Bacon.when( + * [hungry[0], chopsticks[0], chopsticks[1]], eat(0), + * [hungry[1], chopsticks[1], chopsticks[2]], eat(1), + * [hungry[2], chopsticks[2], chopsticks[0]], eat(2) + * ).log("dining"); + * // Make all chopsticks initially available. + * chopsticks[0].push({}); + * chopsticks[1].push({}); + * chopsticks[2].push({}); + * // Make philosophers hungry in some way, in this case we just push to their bus. + * for (let i = 0; i < 3; i++) { + * hungry[0].push({}); + * hungry[1].push({}); + * hungry[2].push({}); + * } + * } + */ + function when(pattern1:Observable[], f1:(...args:A1[]) => B):EventStream; + + /** + * @callback Bacon.when2~f1 + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.when2~f2 + * @param {...A2} args + * @returns {B} + */ + /** + * @method Bacon.when2 + * @description Creates an [EventStream]{@link Bacon.EventStream} from join-pattern system. + * @param {Observable[]} pattern1 + * @param {Bacon.when2~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.when2~f2} f2 + * @returns {EventStream} + * @example + * { + * // Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick: + * let tick = Bacon.interval(1e2, 0), + * keyEvent = Bacon.fromEvent(document.body, "click", _ => Date.now()), + * handleTick = _ => `timestamp: NONE`, + * handleKeyEvent = timestamp => `timestamp: ${timestamp}`; + * Bacon.when( + * [tick, keyEvent], (_, timestamp) => handleKeyEvent(timestamp), + * [tick], handleTick + * ); + * // Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick. + * } + * + * { + * // Join patterns are indeed a generalization of `zip`, and `zip` is equivalent to a single-rule join pattern. The following `Observable`s have the same output: + * let a = Bacon.once("a"), + * b = Bacon.once("b"), + * c = Bacon.once("c"), + * f = (a, b, c) => `a = ${a}; b = ${b}; c = ${c}.`; + * Bacon.zipWith(f, a, b, c); + * Bacon.when([a, b, c], f); + * } + * + * { + * // Join patterns as a "chemical machine". + * // A quick way to get some intuition for join patterns is to understand them through an analogy in terms of atoms and molecules. A join pattern can here be regarded as a recipe for a chemical reaction. Lets say we have observables `oxygen`, `carbon` and `hydrogen`, where an event in these spawns an 'atom' of that type into a mixture. We can state reactions: + * let oxygen = Bacon.interval(1e3, "O"), + * hydrogen = Bacon.interval(2e3, "H"), + * carbon = Bacon.interval(1.5e3, "C"), + * makeWater = (oxygen:string, hydrogen1:string, hydrogen2:string) => `${hydrogen1}${[hydrogen1, hydrogen2].length}${oxygen}`, + * makeCarbonMonoxide = (oxygen:string, carbon:string) => `${carbon}${oxygen}`; + * Bacon.when( + * [oxygen, hydrogen, hydrogen], makeWater, + * [oxygen, carbon], makeCarbonMonoxide + * ); + * // Now, every time a new 'atom' is spawned from one of the observables, this atom is added to the mixture. If at any time there are two hydrogen atoms, and an oxygen atom, the corresponding atoms are *consumed*, and output is produced via `makeWater`. The same semantics apply for the second rule to create carbon monoxide. The rules are tried at each point from top to bottom. + * } + * + * { + * // Join patterns and properties. + * // Properties are not part of the synchronization pattern, but are instead just sampled. The following example take three input streams `$price`, `$quantity` and `$total`, e.g. coming from input fields, and defines mutally recursive behaviours in properties `price`, `quantity` and `total` such that: + * // -- updating `quantity` sets `total` to `price * quantity`; + * // -- updating `total` sets `price` to `total / quantity`. + * let random = (x:number) => Math.round(x * Math.random()), + * id = (x:A):A => x; + * let $quantity = Bacon.interval(1e3, 10).map(random), + * $price = Bacon.interval(2e3, 100).map(random), + * $total = Bacon.interval(1.5e3, 1000).map(random); + * let quantity = $quantity.toProperty(1), + * price = Bacon.when( + * [$price], id, + * [$total, quantity], (x, y) => x / y + * ).toProperty(0), + * total = Bacon.when( + * [$total], id, + * [$price, quantity], (x, y) => x * y, + * [price, $quantity], (x, y) => x * y + * ).toProperty(0); + * } + * + * { + * // Join patterns and `Bacon.Bus`. + * // The result functions of join patterns are allowed to push values onto a `Bus` that may in turn be in one of its patterns. For instance, an implementation of the dining philosophers problem can be written as follows: + * // Availability of chopsticks are implemented using bus. + * let chopsticks = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // Hungry could be any type of observable, but we'll use bus here. + * hungry = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // A philosopher eats for one second, then makes the chopsticks available again by pushing values onto their bus. + * eat = (i:number) => () => { + * setTimeout(() => { + * console.log("done!"); + * chopsticks[i].push({}); + * chopsticks[(i + 1) % 3].push({}); + * }, 1e3); + * return `philosopher ${i} eating`; + * }, + * // We use Bacon.when to make sure a hungry philosopher can eat only when both his chopsticks are available. + * dining = Bacon.when( + * [hungry[0], chopsticks[0], chopsticks[1]], eat(0), + * [hungry[1], chopsticks[1], chopsticks[2]], eat(1), + * [hungry[2], chopsticks[2], chopsticks[0]], eat(2) + * ).log("dining"); + * // Make all chopsticks initially available. + * chopsticks[0].push({}); + * chopsticks[1].push({}); + * chopsticks[2].push({}); + * // Make philosophers hungry in some way, in this case we just push to their bus. + * for (let i = 0; i < 3; i++) { + * hungry[0].push({}); + * hungry[1].push({}); + * hungry[2].push({}); + * } + * } + */ + function when(pattern1:Observable[], f1:(...args:A1[]) => B, pattern2:Observable[], f2:(...args:A2[]) => B):EventStream; + + /** + * @callback Bacon.when3~f1 + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.when3~f2 + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.when3~f3 + * @param {...A3} args + * @returns {B} + */ + /** + * @method Bacon.when3 + * @description Creates an [EventStream]{@link Bacon.EventStream} from join-pattern system. + * @param {Observable[]} pattern1 + * @param {Bacon.when3~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.when3~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.when3~f3} f3 + * @returns {EventStream} + * @example + * { + * // Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick: + * let tick = Bacon.interval(1e2, 0), + * keyEvent = Bacon.fromEvent(document.body, "click", _ => Date.now()), + * handleTick = _ => `timestamp: NONE`, + * handleKeyEvent = timestamp => `timestamp: ${timestamp}`; + * Bacon.when( + * [tick, keyEvent], (_, timestamp) => handleKeyEvent(timestamp), + * [tick], handleTick + * ); + * // Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick. + * } + * + * { + * // Join patterns are indeed a generalization of `zip`, and `zip` is equivalent to a single-rule join pattern. The following `Observable`s have the same output: + * let a = Bacon.once("a"), + * b = Bacon.once("b"), + * c = Bacon.once("c"), + * f = (a, b, c) => `a = ${a}; b = ${b}; c = ${c}.`; + * Bacon.zipWith(f, a, b, c); + * Bacon.when([a, b, c], f); + * } + * + * { + * // Join patterns as a "chemical machine". + * // A quick way to get some intuition for join patterns is to understand them through an analogy in terms of atoms and molecules. A join pattern can here be regarded as a recipe for a chemical reaction. Lets say we have observables `oxygen`, `carbon` and `hydrogen`, where an event in these spawns an 'atom' of that type into a mixture. We can state reactions: + * let oxygen = Bacon.interval(1e3, "O"), + * hydrogen = Bacon.interval(2e3, "H"), + * carbon = Bacon.interval(1.5e3, "C"), + * makeWater = (oxygen:string, hydrogen1:string, hydrogen2:string) => `${hydrogen1}${[hydrogen1, hydrogen2].length}${oxygen}`, + * makeCarbonMonoxide = (oxygen:string, carbon:string) => `${carbon}${oxygen}`; + * Bacon.when( + * [oxygen, hydrogen, hydrogen], makeWater, + * [oxygen, carbon], makeCarbonMonoxide + * ); + * // Now, every time a new 'atom' is spawned from one of the observables, this atom is added to the mixture. If at any time there are two hydrogen atoms, and an oxygen atom, the corresponding atoms are *consumed*, and output is produced via `makeWater`. The same semantics apply for the second rule to create carbon monoxide. The rules are tried at each point from top to bottom. + * } + * + * { + * // Join patterns and properties. + * // Properties are not part of the synchronization pattern, but are instead just sampled. The following example take three input streams `$price`, `$quantity` and `$total`, e.g. coming from input fields, and defines mutally recursive behaviours in properties `price`, `quantity` and `total` such that: + * // -- updating `quantity` sets `total` to `price * quantity`; + * // -- updating `total` sets `price` to `total / quantity`. + * let random = (x:number) => Math.round(x * Math.random()), + * id = (x:A):A => x; + * let $quantity = Bacon.interval(1e3, 10).map(random), + * $price = Bacon.interval(2e3, 100).map(random), + * $total = Bacon.interval(1.5e3, 1000).map(random); + * let quantity = $quantity.toProperty(1), + * price = Bacon.when( + * [$price], id, + * [$total, quantity], (x, y) => x / y + * ).toProperty(0), + * total = Bacon.when( + * [$total], id, + * [$price, quantity], (x, y) => x * y, + * [price, $quantity], (x, y) => x * y + * ).toProperty(0); + * } + * + * { + * // Join patterns and `Bacon.Bus`. + * // The result functions of join patterns are allowed to push values onto a `Bus` that may in turn be in one of its patterns. For instance, an implementation of the dining philosophers problem can be written as follows: + * // Availability of chopsticks are implemented using bus. + * let chopsticks = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // Hungry could be any type of observable, but we'll use bus here. + * hungry = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // A philosopher eats for one second, then makes the chopsticks available again by pushing values onto their bus. + * eat = (i:number) => () => { + * setTimeout(() => { + * console.log("done!"); + * chopsticks[i].push({}); + * chopsticks[(i + 1) % 3].push({}); + * }, 1e3); + * return `philosopher ${i} eating`; + * }, + * // We use Bacon.when to make sure a hungry philosopher can eat only when both his chopsticks are available. + * dining = Bacon.when( + * [hungry[0], chopsticks[0], chopsticks[1]], eat(0), + * [hungry[1], chopsticks[1], chopsticks[2]], eat(1), + * [hungry[2], chopsticks[2], chopsticks[0]], eat(2) + * ).log("dining"); + * // Make all chopsticks initially available. + * chopsticks[0].push({}); + * chopsticks[1].push({}); + * chopsticks[2].push({}); + * // Make philosophers hungry in some way, in this case we just push to their bus. + * for (let i = 0; i < 3; i++) { + * hungry[0].push({}); + * hungry[1].push({}); + * hungry[2].push({}); + * } + * } + */ + function when(pattern1:Observable[], f1:(...args:A1[]) => B, pattern2:Observable[], f2:(...args:A2[]) => B, pattern3:Observable[], f3:(...args:A3[]) => B):EventStream; + + /** + * @callback Bacon.when4~f1 + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.when4~f2 + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.when4~f3 + * @param {...A3} args + * @returns {B} + */ + /** + * @callback Bacon.when4~f4 + * @param {...A4} args + * @returns {B} + */ + /** + * @method Bacon.when4 + * @description Creates an [EventStream]{@link Bacon.EventStream} from join-pattern system. + * @param {Observable[]} pattern1 + * @param {Bacon.when4~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.when4~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.when4~f3} f3 + * @param {Observable[]} pattern4 + * @param {Bacon.when4~f4} f4 + * @returns {EventStream} + * @example + * { + * // Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick: + * let tick = Bacon.interval(1e2, 0), + * keyEvent = Bacon.fromEvent(document.body, "click", _ => Date.now()), + * handleTick = _ => `timestamp: NONE`, + * handleKeyEvent = timestamp => `timestamp: ${timestamp}`; + * Bacon.when( + * [tick, keyEvent], (_, timestamp) => handleKeyEvent(timestamp), + * [tick], handleTick + * ); + * // Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick. + * } + * + * { + * // Join patterns are indeed a generalization of `zip`, and `zip` is equivalent to a single-rule join pattern. The following `Observable`s have the same output: + * let a = Bacon.once("a"), + * b = Bacon.once("b"), + * c = Bacon.once("c"), + * f = (a, b, c) => `a = ${a}; b = ${b}; c = ${c}.`; + * Bacon.zipWith(f, a, b, c); + * Bacon.when([a, b, c], f); + * } + * + * { + * // Join patterns as a "chemical machine". + * // A quick way to get some intuition for join patterns is to understand them through an analogy in terms of atoms and molecules. A join pattern can here be regarded as a recipe for a chemical reaction. Lets say we have observables `oxygen`, `carbon` and `hydrogen`, where an event in these spawns an 'atom' of that type into a mixture. We can state reactions: + * let oxygen = Bacon.interval(1e3, "O"), + * hydrogen = Bacon.interval(2e3, "H"), + * carbon = Bacon.interval(1.5e3, "C"), + * makeWater = (oxygen:string, hydrogen1:string, hydrogen2:string) => `${hydrogen1}${[hydrogen1, hydrogen2].length}${oxygen}`, + * makeCarbonMonoxide = (oxygen:string, carbon:string) => `${carbon}${oxygen}`; + * Bacon.when( + * [oxygen, hydrogen, hydrogen], makeWater, + * [oxygen, carbon], makeCarbonMonoxide + * ); + * // Now, every time a new 'atom' is spawned from one of the observables, this atom is added to the mixture. If at any time there are two hydrogen atoms, and an oxygen atom, the corresponding atoms are *consumed*, and output is produced via `makeWater`. The same semantics apply for the second rule to create carbon monoxide. The rules are tried at each point from top to bottom. + * } + * + * { + * // Join patterns and properties. + * // Properties are not part of the synchronization pattern, but are instead just sampled. The following example take three input streams `$price`, `$quantity` and `$total`, e.g. coming from input fields, and defines mutally recursive behaviours in properties `price`, `quantity` and `total` such that: + * // -- updating `quantity` sets `total` to `price * quantity`; + * // -- updating `total` sets `price` to `total / quantity`. + * let random = (x:number) => Math.round(x * Math.random()), + * id = (x:A):A => x; + * let $quantity = Bacon.interval(1e3, 10).map(random), + * $price = Bacon.interval(2e3, 100).map(random), + * $total = Bacon.interval(1.5e3, 1000).map(random); + * let quantity = $quantity.toProperty(1), + * price = Bacon.when( + * [$price], id, + * [$total, quantity], (x, y) => x / y + * ).toProperty(0), + * total = Bacon.when( + * [$total], id, + * [$price, quantity], (x, y) => x * y, + * [price, $quantity], (x, y) => x * y + * ).toProperty(0); + * } + * + * { + * // Join patterns and `Bacon.Bus`. + * // The result functions of join patterns are allowed to push values onto a `Bus` that may in turn be in one of its patterns. For instance, an implementation of the dining philosophers problem can be written as follows: + * // Availability of chopsticks are implemented using bus. + * let chopsticks = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // Hungry could be any type of observable, but we'll use bus here. + * hungry = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // A philosopher eats for one second, then makes the chopsticks available again by pushing values onto their bus. + * eat = (i:number) => () => { + * setTimeout(() => { + * console.log("done!"); + * chopsticks[i].push({}); + * chopsticks[(i + 1) % 3].push({}); + * }, 1e3); + * return `philosopher ${i} eating`; + * }, + * // We use Bacon.when to make sure a hungry philosopher can eat only when both his chopsticks are available. + * dining = Bacon.when( + * [hungry[0], chopsticks[0], chopsticks[1]], eat(0), + * [hungry[1], chopsticks[1], chopsticks[2]], eat(1), + * [hungry[2], chopsticks[2], chopsticks[0]], eat(2) + * ).log("dining"); + * // Make all chopsticks initially available. + * chopsticks[0].push({}); + * chopsticks[1].push({}); + * chopsticks[2].push({}); + * // Make philosophers hungry in some way, in this case we just push to their bus. + * for (let i = 0; i < 3; i++) { + * hungry[0].push({}); + * hungry[1].push({}); + * hungry[2].push({}); + * } + * } + */ + function when(pattern1:Observable[], f1:(...args:A1[]) => B, pattern2:Observable[], f2:(...args:A2[]) => B, pattern3:Observable[], f3:(...args:A3[]) => B, pattern4:Observable[], f4:(...args:A4[]) => B):EventStream; + + /** + * @callback Bacon.when5~f1 + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.when5~f2 + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.when5~f3 + * @param {...A3} args + * @returns {B} + */ + /** + * @callback Bacon.when5~f4 + * @param {...A4} args + * @returns {B} + */ + /** + * @callback Bacon.when5~f5 + * @param {...A5} args + * @returns {B} + */ + /** + * @method Bacon.when5 + * @description Creates an [EventStream]{@link Bacon.EventStream} from join-pattern system. + * @param {Observable[]} pattern1 + * @param {Bacon.when5~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.when5~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.when5~f3} f3 + * @param {Observable[]} pattern4 + * @param {Bacon.when5~f4} f4 + * @param {Observable[]} pattern5 + * @param {Bacon.when5~f5} f5 + * @returns {EventStream} + * @example + * { + * // Consider implementing a game with discrete time ticks. We want to handle key-events synchronized on tick-events, with at most one key event handled per tick. If there are no key events, we want to just process a tick: + * let tick = Bacon.interval(1e2, 0), + * keyEvent = Bacon.fromEvent(document.body, "click", _ => Date.now()), + * handleTick = _ => `timestamp: NONE`, + * handleKeyEvent = timestamp => `timestamp: ${timestamp}`; + * Bacon.when( + * [tick, keyEvent], (_, timestamp) => handleKeyEvent(timestamp), + * [tick], handleTick + * ); + * // Order is important here. If the [tick] patterns had been written first, this would have been tried first, and preferred at each tick. + * } + * + * { + * // Join patterns are indeed a generalization of `zip`, and `zip` is equivalent to a single-rule join pattern. The following `Observable`s have the same output: + * let a = Bacon.once("a"), + * b = Bacon.once("b"), + * c = Bacon.once("c"), + * f = (a, b, c) => `a = ${a}; b = ${b}; c = ${c}.`; + * Bacon.zipWith(f, a, b, c); + * Bacon.when([a, b, c], f); + * } + * + * { + * // Join patterns as a "chemical machine". + * // A quick way to get some intuition for join patterns is to understand them through an analogy in terms of atoms and molecules. A join pattern can here be regarded as a recipe for a chemical reaction. Lets say we have observables `oxygen`, `carbon` and `hydrogen`, where an event in these spawns an 'atom' of that type into a mixture. We can state reactions: + * let oxygen = Bacon.interval(1e3, "O"), + * hydrogen = Bacon.interval(2e3, "H"), + * carbon = Bacon.interval(1.5e3, "C"), + * makeWater = (oxygen:string, hydrogen1:string, hydrogen2:string) => `${hydrogen1}${[hydrogen1, hydrogen2].length}${oxygen}`, + * makeCarbonMonoxide = (oxygen:string, carbon:string) => `${carbon}${oxygen}`; + * Bacon.when( + * [oxygen, hydrogen, hydrogen], makeWater, + * [oxygen, carbon], makeCarbonMonoxide + * ); + * // Now, every time a new 'atom' is spawned from one of the observables, this atom is added to the mixture. If at any time there are two hydrogen atoms, and an oxygen atom, the corresponding atoms are *consumed*, and output is produced via `makeWater`. The same semantics apply for the second rule to create carbon monoxide. The rules are tried at each point from top to bottom. + * } + * + * { + * // Join patterns and properties. + * // Properties are not part of the synchronization pattern, but are instead just sampled. The following example take three input streams `$price`, `$quantity` and `$total`, e.g. coming from input fields, and defines mutally recursive behaviours in properties `price`, `quantity` and `total` such that: + * // -- updating `quantity` sets `total` to `price * quantity`; + * // -- updating `total` sets `price` to `total / quantity`. + * let random = (x:number) => Math.round(x * Math.random()), + * id = (x:A):A => x; + * let $quantity = Bacon.interval(1e3, 10).map(random), + * $price = Bacon.interval(2e3, 100).map(random), + * $total = Bacon.interval(1.5e3, 1000).map(random); + * let quantity = $quantity.toProperty(1), + * price = Bacon.when( + * [$price], id, + * [$total, quantity], (x, y) => x / y + * ).toProperty(0), + * total = Bacon.when( + * [$total], id, + * [$price, quantity], (x, y) => x * y, + * [price, $quantity], (x, y) => x * y + * ).toProperty(0); + * } + * + * { + * // Join patterns and `Bacon.Bus`. + * // The result functions of join patterns are allowed to push values onto a `Bus` that may in turn be in one of its patterns. For instance, an implementation of the dining philosophers problem can be written as follows: + * // Availability of chopsticks are implemented using bus. + * let chopsticks = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // Hungry could be any type of observable, but we'll use bus here. + * hungry = [new Bacon.Bus(), new Bacon.Bus(), new Bacon.Bus()], + * // A philosopher eats for one second, then makes the chopsticks available again by pushing values onto their bus. + * eat = (i:number) => () => { + * setTimeout(() => { + * console.log("done!"); + * chopsticks[i].push({}); + * chopsticks[(i + 1) % 3].push({}); + * }, 1e3); + * return `philosopher ${i} eating`; + * }, + * // We use Bacon.when to make sure a hungry philosopher can eat only when both his chopsticks are available. + * dining = Bacon.when( + * [hungry[0], chopsticks[0], chopsticks[1]], eat(0), + * [hungry[1], chopsticks[1], chopsticks[2]], eat(1), + * [hungry[2], chopsticks[2], chopsticks[0]], eat(2) + * ).log("dining"); + * // Make all chopsticks initially available. + * chopsticks[0].push({}); + * chopsticks[1].push({}); + * chopsticks[2].push({}); + * // Make philosophers hungry in some way, in this case we just push to their bus. + * for (let i = 0; i < 3; i++) { + * hungry[0].push({}); + * hungry[1].push({}); + * hungry[2].push({}); + * } + * } + */ + function when(pattern1:Observable[], f1:(...args:A1[]) => B, pattern2:Observable[], f2:(...args:A2[]) => B, pattern3:Observable[], f3:(...args:A3[]) => B, pattern4:Observable[], f4:(...args:A4[]) => B, pattern5:Observable[], f5:(...args:A5[]) => B):EventStream; + + /** + * @callback Bacon.update1~f1 + * @param {B} initial + * @param {...A1} args + * @returns {B} + */ + /** + * @method Bacon.update1 + * @description Creates an [Property]{@link Bacon.Property} from an `initial` value and a join-pattern system. + * @param {B} initial + * @param {Observable[]} pattern1 + * @param {Bacon.update1~f1} f1 + * @returns {Property} + * @example + * { + * // The inputs to `Bacon.update` are defined like this: + * let initial = 0, + * x = Bacon.interval(1e3, 1), + * y = Bacon.interval(2e3, 1), + * z = Bacon.interval(1.5e3, 1); + * // NOTE: had to explicitly specify the typing for `previous:number` + * Bacon.update(initial, + * [x, y, z], (previous:number, x, y, z) => previous + x + y + z, + * [x, y], (previous:number, x, y) => previous + x + y + z + * ); + * // As input, each function above will get the previous value of the `result` Property, along with values from the listed Observables. The value returned by the function will be used as the next value of `result`. Just like in `Bacon.when`, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream. + * } + * + * { + * // Here's a simple gaming example: + * let scoreMultiplier = Bacon.constant(1), + * hitUfo = new Bacon.Bus(), + * hitMotherShip = new Bacon.Bus(), + * score = Bacon.update(0, + * [hitUfo, scoreMultiplier], (score, _, multiplier:number) => score + 100 * multiplier, + * [hitMotherShip], (score, _) => score + 2000 + * ); + * // In the example, the `score` property is updated when either `hitUfo` or `hitMotherShip` occur. The `scoreMultiplier` Property is sampled to take multiplier into account when `hitUfo` occurs. + * } + */ + function update(initial:B, pattern1:Observable[], f1:(initial:B, ...args:A1[]) => B):Property; + + /** + * @callback Bacon.update2~f1 + * @param {B} initial + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.update2~f2 + * @param {B} initial + * @param {...A2} args + * @returns {B} + */ + /** + * @method Bacon.update2 + * @description Creates an [Property]{@link Bacon.Property} from an `initial` value and a join-pattern system. + * @param {B} initial + * @param {Observable[]} pattern1 + * @param {Bacon.update2~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.update2~f2} f2 + * @returns {Property} + * @example + * { + * // The inputs to `Bacon.update` are defined like this: + * let initial = 0, + * x = Bacon.interval(1e3, 1), + * y = Bacon.interval(2e3, 1), + * z = Bacon.interval(1.5e3, 1); + * // NOTE: had to explicitly specify the typing for `previous:number` + * Bacon.update(initial, + * [x, y, z], (previous:number, x, y, z) => previous + x + y + z, + * [x, y], (previous:number, x, y) => previous + x + y + z + * ); + * // As input, each function above will get the previous value of the `result` Property, along with values from the listed Observables. The value returned by the function will be used as the next value of `result`. Just like in `Bacon.when`, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream. + * } + * + * { + * // Here's a simple gaming example: + * let scoreMultiplier = Bacon.constant(1), + * hitUfo = new Bacon.Bus(), + * hitMotherShip = new Bacon.Bus(), + * score = Bacon.update(0, + * [hitUfo, scoreMultiplier], (score, _, multiplier:number) => score + 100 * multiplier, + * [hitMotherShip], (score, _) => score + 2000 + * ); + * // In the example, the `score` property is updated when either `hitUfo` or `hitMotherShip` occur. The `scoreMultiplier` Property is sampled to take multiplier into account when `hitUfo` occurs. + * } + */ + function update(initial:B, pattern1:Observable[], f1:(initial:B, ...args:A1[]) => B, pattern2:Observable[], f2:(initial:B, ...args:A2[]) => B):Property; + + /** + * @callback Bacon.update3~f1 + * @param {B} initial + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.update3~f2 + * @param {B} initial + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.update3~f3 + * @param {B} initial + * @param {...A3} args + * @returns {B} + */ + /** + * @method Bacon.update3 + * @description Creates an [Property]{@link Bacon.Property} from an `initial` value and a join-pattern system. + * @param {B} initial + * @param {Observable[]} pattern1 + * @param {Bacon.update3~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.update3~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.update3~f3} f3 + * @returns {Property} + * @example + * { + * // The inputs to `Bacon.update` are defined like this: + * let initial = 0, + * x = Bacon.interval(1e3, 1), + * y = Bacon.interval(2e3, 1), + * z = Bacon.interval(1.5e3, 1); + * // NOTE: had to explicitly specify the typing for `previous:number` + * Bacon.update(initial, + * [x, y, z], (previous:number, x, y, z) => previous + x + y + z, + * [x, y], (previous:number, x, y) => previous + x + y + z + * ); + * // As input, each function above will get the previous value of the `result` Property, along with values from the listed Observables. The value returned by the function will be used as the next value of `result`. Just like in `Bacon.when`, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream. + * } + * + * { + * // Here's a simple gaming example: + * let scoreMultiplier = Bacon.constant(1), + * hitUfo = new Bacon.Bus(), + * hitMotherShip = new Bacon.Bus(), + * score = Bacon.update(0, + * [hitUfo, scoreMultiplier], (score, _, multiplier:number) => score + 100 * multiplier, + * [hitMotherShip], (score, _) => score + 2000 + * ); + * // In the example, the `score` property is updated when either `hitUfo` or `hitMotherShip` occur. The `scoreMultiplier` Property is sampled to take multiplier into account when `hitUfo` occurs. + * } + */ + function update(initial:B, pattern1:Observable[], f1:(initial:B, ...args:A1[]) => B, pattern2:Observable[], f2:(initial:B, ...args:A2[]) => B, pattern3:Observable[], f3:(initial:B, ...args:A3[]) => B):Property; + + /** + * @callback Bacon.update4~f1 + * @param {B} initial + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.update4~f2 + * @param {B} initial + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.update4~f3 + * @param {B} initial + * @param {...A3} args + * @returns {B} + */ + /** + * @callback Bacon.update4~f4 + * @param {B} initial + * @param {...A4} args + * @returns {B} + */ + /** + * @method Bacon.update4 + * @description Creates an [Property]{@link Bacon.Property} from an `initial` value and a join-pattern system. + * @param {B} initial + * @param {Observable[]} pattern1 + * @param {Bacon.update4~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.update4~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.update4~f3} f3 + * @param {Observable[]} pattern4 + * @param {Bacon.update4~f4} f4 + * @returns {Property} + * @example + * { + * // The inputs to `Bacon.update` are defined like this: + * let initial = 0, + * x = Bacon.interval(1e3, 1), + * y = Bacon.interval(2e3, 1), + * z = Bacon.interval(1.5e3, 1); + * // NOTE: had to explicitly specify the typing for `previous:number` + * Bacon.update(initial, + * [x, y, z], (previous:number, x, y, z) => previous + x + y + z, + * [x, y], (previous:number, x, y) => previous + x + y + z + * ); + * // As input, each function above will get the previous value of the `result` Property, along with values from the listed Observables. The value returned by the function will be used as the next value of `result`. Just like in `Bacon.when`, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream. + * } + * + * { + * // Here's a simple gaming example: + * let scoreMultiplier = Bacon.constant(1), + * hitUfo = new Bacon.Bus(), + * hitMotherShip = new Bacon.Bus(), + * score = Bacon.update(0, + * [hitUfo, scoreMultiplier], (score, _, multiplier:number) => score + 100 * multiplier, + * [hitMotherShip], (score, _) => score + 2000 + * ); + * // In the example, the `score` property is updated when either `hitUfo` or `hitMotherShip` occur. The `scoreMultiplier` Property is sampled to take multiplier into account when `hitUfo` occurs. + * } + */ + function update(initial:B, pattern1:Observable[], f1:(initial:B, ...args:A1[]) => B, pattern2:Observable[], f2:(initial:B, ...args:A2[]) => B, pattern3:Observable[], f3:(initial:B, ...args:A3[]) => B, pattern4:Observable[], f4:(initial:B, ...args:A4[]) => B):Property; + + /** + * @callback Bacon.update5~f1 + * @param {B} initial + * @param {...A1} args + * @returns {B} + */ + /** + * @callback Bacon.update5~f2 + * @param {B} initial + * @param {...A2} args + * @returns {B} + */ + /** + * @callback Bacon.update5~f3 + * @param {B} initial + * @param {...A3} args + * @returns {B} + */ + /** + * @callback Bacon.update5~f4 + * @param {B} initial + * @param {...A4} args + * @returns {B} + */ + /** + * @callback Bacon.update5~f5 + * @param {B} initial + * @param {...A5} args + * @returns {B} + */ + /** + * @method Bacon.update5 + * @description Creates an [Property]{@link Bacon.Property} from an `initial` value and a join-pattern system. + * @param {B} initial + * @param {Observable[]} pattern1 + * @param {Bacon.update5~f1} f1 + * @param {Observable[]} pattern2 + * @param {Bacon.update5~f2} f2 + * @param {Observable[]} pattern3 + * @param {Bacon.update5~f3} f3 + * @param {Observable[]} pattern4 + * @param {Bacon.update5~f4} f4 + * @param {Observable[]} pattern5 + * @param {Bacon.update5~f5} f5 + * @returns {Property} + * @example + * { + * // The inputs to `Bacon.update` are defined like this: + * let initial = 0, + * x = Bacon.interval(1e3, 1), + * y = Bacon.interval(2e3, 1), + * z = Bacon.interval(1.5e3, 1); + * // NOTE: had to explicitly specify the typing for `previous:number` + * Bacon.update(initial, + * [x, y, z], (previous:number, x, y, z) => previous + x + y + z, + * [x, y], (previous:number, x, y) => previous + x + y + z + * ); + * // As input, each function above will get the previous value of the `result` Property, along with values from the listed Observables. The value returned by the function will be used as the next value of `result`. Just like in `Bacon.when`, only EventStreams will trigger an update, while Properties will be just sampled. So, if you list a single EventStream and several Properties, the value will be updated only when an event occurs in the EventStream. + * } + * + * { + * // Here's a simple gaming example: + * let scoreMultiplier = Bacon.constant(1), + * hitUfo = new Bacon.Bus(), + * hitMotherShip = new Bacon.Bus(), + * score = Bacon.update(0, + * [hitUfo, scoreMultiplier], (score, _, multiplier:number) => score + 100 * multiplier, + * [hitMotherShip], (score, _) => score + 2000 + * ); + * // In the example, the `score` property is updated when either `hitUfo` or `hitMotherShip` occur. The `scoreMultiplier` Property is sampled to take multiplier into account when `hitUfo` occurs. + * } + */ + function update(initial:B, pattern1:Observable[], f1:(initial:B, ...args:A1[]) => B, pattern2:Observable[], f2:(initial:B, ...args:A2[]) => B, pattern3:Observable[], f3:(initial:B, ...args:A3[]) => B, pattern4:Observable[], f4:(initial:B, ...args:A4[]) => B, pattern5:Observable[], f5:(initial:B, ...args:A5[]) => B):Property; +} + +declare module "baconjs" { + export = Bacon; +} \ No newline at end of file diff --git a/typings/main/ambient/chai/index.d.ts b/typings/main/ambient/chai/index.d.ts new file mode 100644 index 00000000..56660a5b --- /dev/null +++ b/typings/main/ambient/chai/index.d.ts @@ -0,0 +1,403 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/1914a00b3c740348dae407ee0d2be89b0b58ad7f/chai/chai.d.ts +// Type definitions for chai 3.4.0 +// Project: http://chaijs.com/ +// Definitions by: Jed Mao , +// Bart van der Schoor , +// Andrew Brown , +// Olivier Chevet , +// Matt Wistrand +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// + +declare module Chai { + + interface ChaiStatic { + expect: ExpectStatic; + should(): Should; + /** + * Provides a way to extend the internals of Chai + */ + use(fn: (chai: any, utils: any) => void): ChaiStatic; + assert: AssertStatic; + config: Config; + AssertionError: typeof AssertionError; + } + + export interface ExpectStatic extends AssertionStatic { + fail(actual?: any, expected?: any, message?: string, operator?: string): void; + } + + export interface AssertStatic extends Assert { + } + + export interface AssertionStatic { + (target: any, message?: string): Assertion; + } + + interface ShouldAssertion { + equal(value1: any, value2: any, message?: string): void; + Throw: ShouldThrow; + throw: ShouldThrow; + exist(value: any, message?: string): void; + } + + interface Should extends ShouldAssertion { + not: ShouldAssertion; + fail(actual: any, expected: any, message?: string, operator?: string): void; + } + + interface ShouldThrow { + (actual: Function): void; + (actual: Function, expected: string|RegExp, message?: string): void; + (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; + } + + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + not: Assertion; + deep: Deep; + any: KeyFilter; + all: KeyFilter; + a: TypeComparison; + an: TypeComparison; + include: Include; + includes: Include; + contain: Include; + contains: Include; + ok: Assertion; + true: Assertion; + false: Assertion; + null: Assertion; + undefined: Assertion; + NaN: Assertion; + exist: Assertion; + empty: Assertion; + arguments: Assertion; + Arguments: Assertion; + equal: Equal; + equals: Equal; + eq: Equal; + eql: Equal; + eqls: Equal; + property: Property; + ownProperty: OwnProperty; + haveOwnProperty: OwnProperty; + ownPropertyDescriptor: OwnPropertyDescriptor; + haveOwnPropertyDescriptor: OwnPropertyDescriptor; + length: Length; + lengthOf: Length; + match: Match; + matches: Match; + string(string: string, message?: string): Assertion; + keys: Keys; + key(string: string): Assertion; + throw: Throw; + throws: Throw; + Throw: Throw; + respondTo: RespondTo; + respondsTo: RespondTo; + itself: Assertion; + satisfy: Satisfy; + satisfies: Satisfy; + closeTo: CloseTo; + approximately: CloseTo; + members: Members; + increase: PropertyChange; + increases: PropertyChange; + decrease: PropertyChange; + decreases: PropertyChange; + change: PropertyChange; + changes: PropertyChange; + extensible: Assertion; + sealed: Assertion; + frozen: Assertion; + oneOf(list: any[], message?: string): Assertion; + } + + interface LanguageChains { + to: Assertion; + be: Assertion; + been: Assertion; + is: Assertion; + that: Assertion; + which: Assertion; + and: Assertion; + has: Assertion; + have: Assertion; + with: Assertion; + at: Assertion; + of: Assertion; + same: Assertion; + } + + interface NumericComparison { + above: NumberComparer; + gt: NumberComparer; + greaterThan: NumberComparer; + least: NumberComparer; + gte: NumberComparer; + below: NumberComparer; + lt: NumberComparer; + lessThan: NumberComparer; + most: NumberComparer; + lte: NumberComparer; + within(start: number, finish: number, message?: string): Assertion; + } + + interface NumberComparer { + (value: number, message?: string): Assertion; + } + + interface TypeComparison { + (type: string, message?: string): Assertion; + instanceof: InstanceOf; + instanceOf: InstanceOf; + } + + interface InstanceOf { + (constructor: Object, message?: string): Assertion; + } + + interface CloseTo { + (expected: number, delta: number, message?: string): Assertion; + } + + interface Deep { + equal: Equal; + include: Include; + property: Property; + members: Members; + } + + interface KeyFilter { + keys: Keys; + } + + interface Equal { + (value: any, message?: string): Assertion; + } + + interface Property { + (name: string, value?: any, message?: string): Assertion; + } + + interface OwnProperty { + (name: string, message?: string): Assertion; + } + + interface OwnPropertyDescriptor { + (name: string, descriptor: PropertyDescriptor, message?: string): Assertion; + (name: string, message?: string): Assertion; + } + + interface Length extends LanguageChains, NumericComparison { + (length: number, message?: string): Assertion; + } + + interface Include { + (value: Object, message?: string): Assertion; + (value: string, message?: string): Assertion; + (value: number, message?: string): Assertion; + keys: Keys; + members: Members; + any: KeyFilter; + all: KeyFilter; + } + + interface Match { + (regexp: RegExp|string, message?: string): Assertion; + } + + interface Keys { + (...keys: string[]): Assertion; + (keys: any[]): Assertion; + (keys: Object): Assertion; + } + + interface Throw { + (): Assertion; + (expected: string, message?: string): Assertion; + (expected: RegExp, message?: string): Assertion; + (constructor: Error, expected?: string, message?: string): Assertion; + (constructor: Error, expected?: RegExp, message?: string): Assertion; + (constructor: Function, expected?: string, message?: string): Assertion; + (constructor: Function, expected?: RegExp, message?: string): Assertion; + } + + interface RespondTo { + (method: string, message?: string): Assertion; + } + + interface Satisfy { + (matcher: Function, message?: string): Assertion; + } + + interface Members { + (set: any[], message?: string): Assertion; + } + + interface PropertyChange { + (object: Object, prop: string, msg?: string): Assertion; + } + + export interface Assert { + /** + * @param expression Expression to test for truthiness. + * @param message Message to display on error. + */ + (expression: any, message?: string): void; + + fail(actual?: any, expected?: any, msg?: string, operator?: string): void; + + ok(val: any, msg?: string): void; + isOk(val: any, msg?: string): void; + notOk(val: any, msg?: string): void; + isNotOk(val: any, msg?: string): void; + + equal(act: any, exp: any, msg?: string): void; + notEqual(act: any, exp: any, msg?: string): void; + + strictEqual(act: any, exp: any, msg?: string): void; + notStrictEqual(act: any, exp: any, msg?: string): void; + + deepEqual(act: any, exp: any, msg?: string): void; + notDeepEqual(act: any, exp: any, msg?: string): void; + + isTrue(val: any, msg?: string): void; + isFalse(val: any, msg?: string): void; + + isNotTrue(val: any, msg?: string): void; + isNotFalse(val: any, msg?: string): void; + + isNull(val: any, msg?: string): void; + isNotNull(val: any, msg?: string): void; + + isUndefined(val: any, msg?: string): void; + isDefined(val: any, msg?: string): void; + + isNaN(val: any, msg?: string): void; + isNotNaN(val: any, msg?: string): void; + + isAbove(val: number, abv: number, msg?: string): void; + isBelow(val: number, blw: number, msg?: string): void; + + isAtLeast(val: number, atlst: number, msg?: string): void; + isAtMost(val: number, atmst: number, msg?: string): void; + + isFunction(val: any, msg?: string): void; + isNotFunction(val: any, msg?: string): void; + + isObject(val: any, msg?: string): void; + isNotObject(val: any, msg?: string): void; + + isArray(val: any, msg?: string): void; + isNotArray(val: any, msg?: string): void; + + isString(val: any, msg?: string): void; + isNotString(val: any, msg?: string): void; + + isNumber(val: any, msg?: string): void; + isNotNumber(val: any, msg?: string): void; + + isBoolean(val: any, msg?: string): void; + isNotBoolean(val: any, msg?: string): void; + + typeOf(val: any, type: string, msg?: string): void; + notTypeOf(val: any, type: string, msg?: string): void; + + instanceOf(val: any, type: Function, msg?: string): void; + notInstanceOf(val: any, type: Function, msg?: string): void; + + include(exp: string, inc: any, msg?: string): void; + include(exp: any[], inc: any, msg?: string): void; + + notInclude(exp: string, inc: any, msg?: string): void; + notInclude(exp: any[], inc: any, msg?: string): void; + + match(exp: any, re: RegExp, msg?: string): void; + notMatch(exp: any, re: RegExp, msg?: string): void; + + property(obj: Object, prop: string, msg?: string): void; + notProperty(obj: Object, prop: string, msg?: string): void; + deepProperty(obj: Object, prop: string, msg?: string): void; + notDeepProperty(obj: Object, prop: string, msg?: string): void; + + propertyVal(obj: Object, prop: string, val: any, msg?: string): void; + propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; + deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + lengthOf(exp: any, len: number, msg?: string): void; + //alias frenzy + throw(fn: Function, msg?: string): void; + throw(fn: Function, regExp: RegExp): void; + throw(fn: Function, errType: Function, msg?: string): void; + throw(fn: Function, errType: Function, regExp: RegExp): void; + + throws(fn: Function, msg?: string): void; + throws(fn: Function, regExp: RegExp): void; + throws(fn: Function, errType: Function, msg?: string): void; + throws(fn: Function, errType: Function, regExp: RegExp): void; + + Throw(fn: Function, msg?: string): void; + Throw(fn: Function, regExp: RegExp): void; + Throw(fn: Function, errType: Function, msg?: string): void; + Throw(fn: Function, errType: Function, regExp: RegExp): void; + + doesNotThrow(fn: Function, msg?: string): void; + doesNotThrow(fn: Function, regExp: RegExp): void; + doesNotThrow(fn: Function, errType: Function, msg?: string): void; + doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; + + operator(val: any, operator: string, val2: any, msg?: string): void; + closeTo(act: number, exp: number, delta: number, msg?: string): void; + approximately(act: number, exp: number, delta: number, msg?: string): void; + + sameMembers(set1: any[], set2: any[], msg?: string): void; + sameDeepMembers(set1: any[], set2: any[], msg?: string): void; + includeMembers(superset: any[], subset: any[], msg?: string): void; + + ifError(val: any, msg?: string): void; + + isExtensible(obj: {}, msg?: string): void; + extensible(obj: {}, msg?: string): void; + isNotExtensible(obj: {}, msg?: string): void; + notExtensible(obj: {}, msg?: string): void; + + isSealed(obj: {}, msg?: string): void; + sealed(obj: {}, msg?: string): void; + isNotSealed(obj: {}, msg?: string): void; + notSealed(obj: {}, msg?: string): void; + + isFrozen(obj: Object, msg?: string): void; + frozen(obj: Object, msg?: string): void; + isNotFrozen(obj: Object, msg?: string): void; + notFrozen(obj: Object, msg?: string): void; + + oneOf(inList: any, list: any[], msg?: string): void; + } + + export interface Config { + includeStack: boolean; + } + + export class AssertionError { + constructor(message: string, _props?: any, ssf?: Function); + name: string; + message: string; + showDiff: boolean; + stack: string; + } +} + +declare var chai: Chai.ChaiStatic; + +declare module "chai" { + export = chai; +} + +interface Object { + should: Chai.Assertion; +} \ No newline at end of file diff --git a/typings/main/ambient/lodash/index.d.ts b/typings/main/ambient/lodash/index.d.ts new file mode 100644 index 00000000..5b90e6e5 --- /dev/null +++ b/typings/main/ambient/lodash/index.d.ts @@ -0,0 +1,15453 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/3d572e1ee3e6492983ef01f8b7adf6150d345b11/lodash/lodash-3.10.d.ts +// Type definitions for Lo-Dash +// Project: http://lodash.com/ +// Definitions by: Brian Zengel , Ilya Mochalov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var _: _.LoDashStatic; + +declare module _ { + interface LoDashStatic { + /** + * Creates a lodash object which wraps the given value to enable intuitive method chaining. + * + * In addition to Lo-Dash methods, wrappers also have the following Array methods: + * concat, join, pop, push, reverse, shift, slice, sort, splice, and unshift + * + * Chaining is supported in custom builds as long as the value method is implicitly or + * explicitly included in the build. + * + * The chainable wrapper functions are: + * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, + * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, + * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, + * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, + * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, + * remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times, + * toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip + * + * The non-chainable wrapper functions are: + * clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast, + * findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean, + * isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, + * isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin, + * noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some, + * sortedIndex, runInContext, template, unescape, uniqueId, and value + * + * The wrapper functions first and last return wrapped values when n is provided, otherwise + * they return unwrapped values. + * + * Explicit chaining can be enabled by using the _.chain method. + **/ + (value: number): LoDashImplicitWrapper; + (value: string): LoDashImplicitStringWrapper; + (value: boolean): LoDashImplicitWrapper; + (value: Array): LoDashImplicitNumberArrayWrapper; + (value: Array): LoDashImplicitArrayWrapper; + (value: T): LoDashImplicitObjectWrapper; + (value: any): LoDashImplicitWrapper; + + /** + * The semantic version number. + **/ + VERSION: string; + + /** + * An object used to flag environments features. + **/ + support: Support; + + /** + * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby + * (ERB). Change the following template settings to use alternative delimiters. + **/ + templateSettings: TemplateSettings; + } + + /** + * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby + * (ERB). Change the following template settings to use alternative delimiters. + **/ + interface TemplateSettings { + /** + * The "escape" delimiter. + **/ + escape?: RegExp; + + /** + * The "evaluate" delimiter. + **/ + evaluate?: RegExp; + + /** + * An object to import into the template as local variables. + **/ + imports?: Dictionary; + + /** + * The "interpolate" delimiter. + **/ + interpolate?: RegExp; + + /** + * Used to reference the data object in the template text. + **/ + variable?: string; + } + + /** + * Creates a cache object to store key/value pairs. + */ + interface MapCache { + /** + * Removes `key` and its value from the cache. + * @param key The key of the value to remove. + * @return Returns `true` if the entry was removed successfully, else `false`. + */ + delete(key: string): boolean; + + /** + * Gets the cached value for `key`. + * @param key The key of the value to get. + * @return Returns the cached value. + */ + get(key: string): any; + + /** + * Checks if a cached value for `key` exists. + * @param key The key of the entry to check. + * @return Returns `true` if an entry for `key` exists, else `false`. + */ + has(key: string): boolean; + + /** + * Sets `value` to `key` of the cache. + * @param key The key of the value to cache. + * @param value The value to cache. + * @return Returns the cache object. + */ + set(key: string, value: any): _.Dictionary; + } + + /** + * An object used to flag environments features. + **/ + interface Support { + /** + * Detect if an arguments object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). + **/ + argsClass: boolean; + + /** + * Detect if arguments objects are Object objects (all but Narwhal and Opera < 10.5). + **/ + argsObject: boolean; + + /** + * Detect if name or message properties of Error.prototype are enumerable by default. + * (IE < 9, Safari < 5.1) + **/ + enumErrorProps: boolean; + + /** + * Detect if prototype properties are enumerable by default. + * + * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 (if the prototype or a property on the + * prototype has been set) incorrectly set the [[Enumerable]] value of a function’s prototype property to true. + **/ + enumPrototypes: boolean; + + /** + * Detect if Function#bind exists and is inferred to be fast (all but V8). + **/ + fastBind: boolean; + + /** + * Detect if functions can be decompiled by Function#toString (all but PS3 and older Opera + * mobile browsers & avoided in Windows 8 apps). + **/ + funcDecomp: boolean; + + /** + * Detect if Function#name is supported (all but IE). + **/ + funcNames: boolean; + + /** + * Detect if arguments object indexes are non-enumerable (Firefox < 4, IE < 9, PhantomJS, + * Safari < 5.1). + **/ + nonEnumArgs: boolean; + + /** + * Detect if properties shadowing those on Object.prototype are non-enumerable. + * + * In IE < 9 an objects own properties, shadowing non-enumerable ones, are made + * non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). + **/ + nonEnumShadows: boolean; + + /** + * Detect if own properties are iterated after inherited properties (all but IE < 9). + **/ + ownLast: boolean; + + /** + * Detect if Array#shift and Array#splice augment array-like objects correctly. + * + * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array shift() and splice() + * functions that fail to remove the last element, value[0], of array-like objects even + * though the length property is set to 0. The shift() method is buggy in IE 8 compatibility + * mode, while splice() is buggy regardless of mode in IE < 9 and buggy in compatibility mode + * in IE 9. + **/ + spliceObjects: boolean; + + /** + * Detect lack of support for accessing string characters by index. + * + * IE < 8 can't access characters by index and IE 8 can only access characters by index on + * string literals. + **/ + unindexedChars: boolean; + } + + interface LoDashWrapperBase { } + + interface LoDashImplicitWrapperBase extends LoDashWrapperBase { } + + interface LoDashExplicitWrapperBase extends LoDashWrapperBase { } + + interface LoDashImplicitWrapper extends LoDashImplicitWrapperBase> { } + + interface LoDashExplicitWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitStringWrapper extends LoDashImplicitWrapper { } + + interface LoDashExplicitStringWrapper extends LoDashExplicitWrapper { } + + interface LoDashImplicitObjectWrapper extends LoDashImplicitWrapperBase> { } + + interface LoDashExplicitObjectWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitArrayWrapper extends LoDashImplicitWrapperBase> { + pop(): T; + push(...items: T[]): LoDashImplicitArrayWrapper; + shift(): T; + sort(compareFn?: (a: T, b: T) => number): LoDashImplicitArrayWrapper; + splice(start: number): LoDashImplicitArrayWrapper; + splice(start: number, deleteCount: number, ...items: any[]): LoDashImplicitArrayWrapper; + unshift(...items: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper extends LoDashExplicitWrapperBase> { } + + interface LoDashImplicitNumberArrayWrapper extends LoDashImplicitArrayWrapper { } + + interface LoDashExplicitNumberArrayWrapper extends LoDashExplicitArrayWrapper { } + + // join (exists only in wrappers) + interface LoDashImplicitWrapper { + /** + * @see _.join + */ + join(separator?: string): string; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.join + */ + join(separator?: string): string; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.join + */ + join(separator?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.join + */ + join(separator?: string): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.join + */ + join(separator?: string): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.join + */ + join(separator?: string): LoDashExplicitWrapper; + } + + /********* + * Array * + *********/ + + //_.chunk + interface LoDashStatic { + /** + * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the + * final chunk will be the remaining elements. + * + * @param array The array to process. + * @param size The length of each chunk. + * @return Returns the new array containing chunks. + */ + chunk( + array: List, + size?: number + ): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.chunk + */ + chunk(size?: number): LoDashExplicitArrayWrapper; + } + + //_.compact + interface LoDashStatic { + /** + * Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are + * falsey. + * + * @param array The array to compact. + * @return (Array) Returns the new array of filtered values. + */ + compact(array?: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.compact + */ + compact(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.compact + */ + compact(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.compact + */ + compact(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.compact + */ + compact(): LoDashExplicitArrayWrapper; + } + + //_.difference + interface LoDashStatic { + /** + * Creates an array of unique array values not included in the other provided arrays using SameValueZero for + * equality comparisons. + * + * @param array The array to inspect. + * @param values The arrays of values to exclude. + * @return Returns the new array of filtered values. + */ + difference( + array: T[]|List, + ...values: (T[]|List)[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.difference + */ + difference(...values: (T[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.difference + */ + difference(...values: (TValue[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.difference + */ + difference(...values: (T[]|List)[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.difference + */ + difference(...values: (TValue[]|List)[]): LoDashExplicitArrayWrapper; + } + + //_.drop + interface LoDashStatic { + /** + * Creates a slice of array with n elements dropped from the beginning. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + drop(array: T[]|List, n?: number): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.drop + */ + drop(n?: number): LoDashExplicitArrayWrapper; + } + + //_.dropRight + interface LoDashStatic { + /** + * Creates a slice of array with n elements dropped from the end. + * + * @param array The array to query. + * @param n The number of elements to drop. + * @return Returns the slice of array. + */ + dropRight( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropRight + */ + dropRight(n?: number): LoDashExplicitArrayWrapper; + } + + //_.dropRightWhile + interface LoDashStatic { + /** + * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * match the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + dropRightWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropRightWhile + */ + dropRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.dropWhile + interface LoDashStatic { + /** + * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate + * returns falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + dropWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropWhile + */ + dropWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.dropWhile + */ + dropWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.dropWhile + */ + dropWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.fill + interface LoDashStatic { + /** + * Fills elements of array with value from start up to, but not including, end. + * + * Note: This method mutates array. + * + * @param array The array to fill. + * @param value The value to fill array with. + * @param start The start position. + * @param end The end position. + * @return Returns array. + */ + fill( + array: any[], + value: T, + start?: number, + end?: number + ): T[]; + + /** + * @see _.fill + */ + fill( + array: List, + value: T, + start?: number, + end?: number + ): List; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.fill + */ + fill( + value: T, + start?: number, + end?: number + ): LoDashExplicitObjectWrapper>; + } + + //_.findIndex + interface LoDashStatic { + /** + * This method is like _.find except that it returns the index of the first element predicate returns truthy + * for instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the index of the found element, else -1. + */ + findIndex( + array: List, + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + array: List, + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + array: List, + predicate?: W + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findIndex + */ + findIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findIndex + */ + findIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + //_.findLastIndex + interface LoDashStatic { + /** + * This method is like _.findIndex except that it iterates over elements of collection from right to left. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to search. + * @param predicate The function invoked per iteration. + * @param thisArg The function invoked per iteration. + * @return Returns the index of the found element, else -1. + */ + findLastIndex( + array: List, + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + array: List, + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + array: List, + predicate?: W + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): number; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastIndex + */ + findLastIndex( + predicate?: W + ): LoDashExplicitWrapper; + } + + //_.first + interface LoDashStatic { + /** + * Gets the first element of array. + * + * @alias _.head + * + * @param array The array to query. + * @return Returns the first element of array. + */ + first(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.first + */ + first(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.first + */ + first(): TResult; + } + + interface RecursiveArray extends Array> {} + interface ListOfRecursiveArraysOrValues extends List> {} + + //_.flatten + interface LoDashStatic { + /** + * Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it’s only + * flattened a single level. + * + * @param array The array to flatten. + * @param isDeep Specify a deep flatten. + * @return Returns the new flattened array. + */ + flatten(array: ListOfRecursiveArraysOrValues, isDeep: boolean): T[]; + + /** + * @see _.flatten + */ + flatten(array: List): T[]; + + /** + * @see _.flatten + */ + flatten(array: ListOfRecursiveArraysOrValues): RecursiveArray; + } + + interface LoDashImplicitWrapper { + /** + * @see _.flatten + */ + flatten(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flatten + */ + flatten(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flatten + */ + flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; + } + + //_.flattenDeep + interface LoDashStatic { + /** + * Recursively flattens a nested array. + * + * @param array The array to recursively flatten. + * @return Returns the new flattened array. + */ + flattenDeep(array: ListOfRecursiveArraysOrValues): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flattenDeep + */ + flattenDeep(): LoDashExplicitArrayWrapper; + } + + //_.head + interface LoDashStatic { + /** + * @see _.first + */ + head(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.first + */ + head(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.first + */ + head(): TResult; + } + + //_.indexOf + interface LoDashStatic { + /** + * Gets the index at which the first occurrence of value is found in array using SameValueZero for equality + * comparisons. If fromIndex is negative, it’s used as the offset from the end of array. If array is sorted + * providing true for fromIndex performs a faster binary search. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return The index to search from or true to perform a binary search on a sorted array. + */ + indexOf( + array: List, + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: TValue, + fromIndex?: boolean|number + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: T, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.indexOf + */ + indexOf( + value: TValue, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + //_.initial + interface LoDashStatic { + /** + * Gets all but the last element of array. + * + * @param array The array to query. + * @return Returns the slice of array. + */ + initial(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.initial + */ + initial(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.initial + */ + initial(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.initial + */ + initial(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.initial + */ + initial(): LoDashExplicitArrayWrapper; + } + + //_.intersection + interface LoDashStatic { + /** + * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of shared values. + */ + intersection(...arrays: (T[]|List)[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashExplicitArrayWrapper; + } + + //_.last + interface LoDashStatic { + /** + * Gets the last element of array. + * + * @param array The array to query. + * @return Returns the last element of array. + */ + last(array: List): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.last + */ + last(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.last + */ + last(): T; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.last + */ + last(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.last + */ + last(): LoDashExplicitObjectWrapper; + } + + //_.lastIndexOf + interface LoDashStatic { + /** + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ + lastIndexOf( + array: List, + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: TResult, + fromIndex?: boolean|number + ): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: T, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: TResult, + fromIndex?: boolean|number + ): LoDashExplicitWrapper; + } + + //_.object + interface LoDashStatic { + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + object( + props: List|List>, + values?: List + ): _.Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + object( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + //_.pull + interface LoDashStatic { + /** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * Note: Unlike _.without, this method mutates array. + * + * @param array The array to modify. + * @param values The values to remove. + * @return Returns array. + */ + pull( + array: T[], + ...values: T[] + ): T[]; + + /** + * @see _.pull + */ + pull( + array: List, + ...values: T[] + ): List; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pull + */ + pull(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pull + */ + pull(...values: TValue[]): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pull + */ + pull(...values: T[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pull + */ + pull(...values: TValue[]): LoDashExplicitObjectWrapper>; + } + + //_.pullAt + interface LoDashStatic { + /** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * Note: Unlike _.at, this method mutates array. + * + * @param array The array to modify. + * @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @return Returns the new array of removed elements. + */ + pullAt( + array: List, + ...indexes: (number|number[])[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pullAt + */ + pullAt(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper; + } + + //_.remove + interface LoDashStatic { + /** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed + * elements. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Note: Unlike _.filter, this method mutates array. + * + * @param array The array to modify. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new array of removed elements. + */ + remove( + array: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.remove + */ + remove( + array: List, + predicate?: string, + thisArg?: any + ): T[]; + + /** + * @see _.remove + */ + remove( + array: List, + predicate?: W + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.remove + */ + remove( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.remove + */ + remove( + predicate?: W + ): LoDashExplicitArrayWrapper; + } + + //_.rest + interface LoDashStatic { + /** + * Gets all but the first element of array. + * + * @alias _.tail + * + * @param array The array to query. + * @return Returns the slice of array. + */ + rest(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.rest + */ + rest(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rest + */ + rest(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.rest + */ + rest(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.rest + */ + rest(): LoDashExplicitArrayWrapper; + } + + //_.slice + interface LoDashStatic { + /** + * Creates a slice of array from start up to, but not including, end. + * + * @param array The array to slice. + * @param start The start position. + * @param end The end position. + * @return Returns the slice of array. + */ + slice( + array: T[], + start?: number, + end?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashExplicitArrayWrapper; + } + + //_.sortedIndex + interface LoDashStatic { + /** + * Uses a binary search to determine the lowest index at which value should be inserted into array in order to maintain its sort order. If an iteratee function is provided it’s invoked for value and each element of array to compute their sort ranking. The iteratee is bound to thisArg and invoked with one argument; (value). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that have the properties of the given object, else false. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @return The this binding of iteratee. + */ + sortedIndex( + array: List, + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedIndex + */ + sortedIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; + } + + //_.sortedLastIndex + interface LoDashStatic { + /** + * This method is like _.sortedIndex except that it returns the highest index at which value should be + * inserted into array in order to maintain its sort order. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the index at which value should be inserted into array. + */ + sortedLastIndex( + array: List, + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; + } + + //_.tail + interface LoDashStatic { + /** + * @see _.rest + */ + tail(array: List): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.rest + */ + tail(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rest + */ + tail(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.rest + */ + tail(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.rest + */ + tail(): LoDashExplicitArrayWrapper; + } + + //_.take + interface LoDashStatic { + /** + * Creates a slice of array with n elements taken from the beginning. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + take( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.take + */ + take(n?: number): LoDashExplicitArrayWrapper; + } + + //_.takeRight + interface LoDashStatic { + /** + * Creates a slice of array with n elements taken from the end. + * + * @param array The array to query. + * @param n The number of elements to take. + * @return Returns the slice of array. + */ + takeRight( + array: List, + n?: number + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashExplicitArrayWrapper; + } + + //_.takeRightWhile + interface LoDashStatic { + /** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + takeRightWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeRightWhile + */ + takeRightWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.takeWhile + interface LoDashStatic { + /** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns + * falsey. The predicate is bound to thisArg and invoked with three arguments: (value, index, array). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param array The array to query. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the slice of array. + */ + takeWhile( + array: List, + predicate?: ListIterator, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeWhile + */ + takeWhile( + array: List, + predicate?: string, + thisArg?: any + ): TValue[]; + + /** + * @see _.takeWhile + */ + takeWhile( + array: List, + predicate?: TWhere + ): TValue[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.takeWhile + */ + takeWhile( + predicate?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.union + interface LoDashStatic { + /** + * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of combined values. + */ + union(...arrays: List[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + //_.uniq + interface LoDashStatic { + /** + * Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only + * the first occurrence of each element is kept. Providing true for isSorted performs a faster search + * algorithm for sorted arrays. If an iteratee function is provided it’s invoked for each element in the + * array to generate the criterion by which uniqueness is computed. The iteratee is bound to thisArg and + * invoked with three arguments: (value, index, array). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.unique + * + * @param array The array to inspect. + * @param isSorted Specify the array is sorted. + * @param iteratee The function invoked per iteration. + * @param thisArg iteratee + * @return Returns the new duplicate-value-free array. + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: TWhere + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + uniq( + array: List, + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.unique + interface LoDashStatic { + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: TWhere + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.unzip + interface LoDashStatic { + /** + * This method is like _.zip except that it accepts an array of grouped elements and creates an array + * regrouping the elements to their pre-zip configuration. + * + * @param array The array of grouped elements to process. + * @return Returns the new array of regrouped elements. + */ + unzip(array: List>): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.unzip + */ + unzip(): LoDashExplicitArrayWrapper; + } + + //_.unzipWith + interface LoDashStatic { + /** + * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * + * @param array The array of grouped elements to process. + * @param iteratee The function to combine regrouped values. + * @param thisArg The this binding of iteratee. + * @return Returns the new array of regrouped elements. + */ + unzipWith( + array: List>, + iteratee?: MemoIterator, + thisArg?: any + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.unzipWith + */ + unzipWith( + iteratee?: MemoIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + //_.without + interface LoDashStatic { + /** + * Creates an array excluding all provided values using SameValueZero for equality comparisons. + * + * @param array The array to filter. + * @param values The values to exclude. + * @return Returns the new array of filtered values. + */ + without( + array: List, + ...values: T[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.without + */ + without(...values: T[]): LoDashExplicitArrayWrapper; + } + + //_.xor + interface LoDashStatic { + /** + * Creates an array of unique values that is the symmetric difference of the provided arrays. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of values. + */ + xor(...arrays: List[]): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.xor + */ + xor(...arrays: List[]): LoDashExplicitArrayWrapper; + } + + //_.zip + interface LoDashStatic { + /** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @param arrays The arrays to process. + * @return Returns the new array of grouped elements. + */ + zip(...arrays: List[]): T[][]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashExplicitArrayWrapper; + } + + //_.zipObject + interface LoDashStatic { + /** + * The inverse of _.pairs; this method returns an object composed from arrays of property names and values. + * Provide either a single two dimensional array, e.g. [[key1, value1], [key2, value2]] or two arrays, one of + * property names and one of corresponding values. + * + * @alias _.object + * + * @param props The property names. + * @param values The property values. + * @return Returns the new object. + */ + zipObject( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + zipObject( + props: List|List>, + values?: List + ): TResult; + + /** + * @see _.zipObject + */ + zipObject( + props: List|List>, + values?: List + ): _.Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashImplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper; + + /** + * @see _.zipObject + */ + zipObject( + values?: List + ): _.LoDashExplicitObjectWrapper<_.Dictionary>; + } + + //_.zipWith + interface LoDashStatic { + /** + * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be + * combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index, + * group). + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee] The function to combine grouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @return Returns the new array of grouped elements. + */ + zipWith(...args: any[]): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.zipWith + */ + zipWith(...args: any[]): LoDashImplicitArrayWrapper; + } + + /********* + * Chain * + *********/ + + //_.chain + interface LoDashStatic { + /** + * Creates a lodash object that wraps value with explicit method chaining enabled. + * + * @param value The value to wrap. + * @return Returns the new lodash wrapper instance. + */ + chain(value: number): LoDashExplicitWrapper; + chain(value: string): LoDashExplicitWrapper; + chain(value: boolean): LoDashExplicitWrapper; + chain(value: T[]): LoDashExplicitArrayWrapper; + chain(value: T): LoDashExplicitObjectWrapper; + chain(value: any): LoDashExplicitWrapper; + } + + interface LoDashImplicitWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.chain + */ + chain(): TWrapper; + } + + //_.tap + interface LoDashStatic { + /** + * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one + * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @parem thisArg The this binding of interceptor. + * @return Returns value. + **/ + tap( + value: T, + interceptor: (value: T) => void, + thisArg?: any + ): T; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.tap + */ + tap( + interceptor: (value: T) => void, + thisArg?: any + ): TWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.tap + */ + tap( + interceptor: (value: T) => void, + thisArg?: any + ): TWrapper; + } + + //_.thru + interface LoDashStatic { + /** + * This method is like _.tap except that it returns the result of interceptor. + * + * @param value The value to provide to interceptor. + * @param interceptor The function to invoke. + * @param thisArg The this binding of interceptor. + * @return Returns the result of interceptor. + */ + thru( + value: T, + interceptor: (value: T) => TResult, + thisArg?: any + ): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any): LoDashImplicitObjectWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult[], + thisArg?: any): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.thru + */ + thru( + interceptor: (value: T) => TResult[], + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + //_.prototype.commit + interface LoDashImplicitWrapperBase { + /** + * Executes the chained sequence and returns the wrapped result. + * + * @return Returns the new lodash wrapper instance. + */ + commit(): TWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.commit + */ + commit(): TWrapper; + } + + //_.prototype.concat + interface LoDashImplicitWrapperBase { + /** + * Creates a new array joining a wrapped array with any additional arrays and/or values. + * + * @param items + * @return Returns the new concatenated array. + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + + /** + * @see _.concat + */ + concat(...items: Array>): LoDashExplicitArrayWrapper; + } + + //_.prototype.plant + interface LoDashImplicitWrapperBase { + /** + * Creates a clone of the chained sequence planting value as the wrapped value. + * @param value The value to plant as the wrapped value. + * @return Returns the new lodash wrapper instance. + */ + plant(value: number): LoDashImplicitWrapper; + + /** + * @see _.plant + */ + plant(value: string): LoDashImplicitStringWrapper; + + /** + * @see _.plant + */ + plant(value: boolean): LoDashImplicitWrapper; + + /** + * @see _.plant + */ + plant(value: number[]): LoDashImplicitNumberArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T[]): LoDashImplicitArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T): LoDashImplicitObjectWrapper; + + /** + * @see _.plant + */ + plant(value: any): LoDashImplicitWrapper; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.plant + */ + plant(value: number): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: string): LoDashExplicitStringWrapper; + + /** + * @see _.plant + */ + plant(value: boolean): LoDashExplicitWrapper; + + /** + * @see _.plant + */ + plant(value: number[]): LoDashExplicitNumberArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T[]): LoDashExplicitArrayWrapper; + + /** + * @see _.plant + */ + plant(value: T): LoDashExplicitObjectWrapper; + + /** + * @see _.plant + */ + plant(value: any): LoDashExplicitWrapper; + } + + //_.prototype.reverse + interface LoDashImplicitArrayWrapper { + /** + * Reverses the wrapped array so the first element becomes the last, the second element becomes the second to + * last, and so on. + * + * Note: This method mutates the wrapped array. + * + * @return Returns the new reversed lodash wrapper instance. + */ + reverse(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.reverse + */ + reverse(): LoDashExplicitArrayWrapper; + } + + //_.prototype.run + interface LoDashWrapperBase { + /** + * @see _.value + */ + run(): T; + } + + //_.prototype.toJSON + interface LoDashWrapperBase { + /** + * @see _.value + */ + toJSON(): T; + } + + //_.prototype.toString + interface LoDashWrapperBase { + /** + * Produces the result of coercing the unwrapped value to a string. + * + * @return Returns the coerced string value. + */ + toString(): string; + } + + //_.prototype.value + interface LoDashWrapperBase { + /** + * Executes the chained sequence to extract the unwrapped value. + * + * @alias _.run, _.toJSON, _.valueOf + * + * @return Returns the resolved unwrapped value. + */ + value(): T; + } + + //_.valueOf + interface LoDashWrapperBase { + /** + * @see _.value + */ + valueOf(): T; + } + + /************** + * Collection * + **************/ + + //_.all + interface LoDashStatic { + /** + * @see _.every + */ + all( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + collection: List|Dictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.every + */ + all( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + all( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.any + interface LoDashStatic { + /** + * @see _.some + */ + any( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: List|Dictionary|NumericDictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: List|Dictionary|NumericDictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.some + */ + any( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + any( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.at + interface LoDashStatic { + /** + * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be + * specified as individual arguments or as arrays of keys. + * + * @param collection The collection to iterate over. + * @param props The property names or indexes of elements to pick, specified individually or in arrays. + * @return Returns the new array of picked elements. + */ + at( + collection: List|Dictionary, + ...props: (number|string|(number|string)[])[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.at + */ + at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper; + } + + //_.collect + interface LoDashStatic { + /** + * @see _.map + */ + collect( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: List|Dictionary, + iteratee?: string + ): TResult[]; + + /** + * @see _.map + */ + collect( + collection: List|Dictionary, + iteratee?: TObject + ): boolean[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.map + */ + collect( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + collect( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + //_.contains + interface LoDashStatic { + /** + * @see _.includes + */ + contains( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + contains( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + contains( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + contains( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + contains( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + contains( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + contains( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + contains( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.countBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the number of times the key was returned by iteratee. The + * iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + countBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: NumericDictionary, + iteratee?: NumericDictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: W + ): Dictionary; + + /** + * @see _.countBy + */ + countBy( + collection: List|Dictionary|NumericDictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.countBy + */ + countBy( + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.countBy + */ + countBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + //_.detect + interface LoDashStatic { + /** + * @see _.find + */ + detect( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + collection: List|Dictionary, + predicate?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.find + */ + detect( + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + detect( + predicate?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.find + */ + detect( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + detect( + predicate?: string, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + detect( + predicate?: TObject + ): TResult; + } + + //_.each + interface LoDashStatic { + /** + * @see _.forEach + */ + each( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEach + */ + each( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEach + */ + each( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + each( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEach + */ + each( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEach + */ + each( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEach + */ + each( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.eachRight + interface LoDashStatic { + /** + * @see _.forEachRight + */ + eachRight( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEachRight + */ + eachRight( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEachRight + */ + eachRight( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEachRight + */ + eachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.every + interface LoDashStatic { + /** + * Checks if predicate returns truthy for all elements of collection. The predicate is bound to thisArg and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.all + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns true if all elements pass the predicate check, else false. + */ + every( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + collection: List|Dictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.every + */ + every( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.every + */ + every( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.filter + interface LoDashStatic { + /** + * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The + * predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.select + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + filter( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.filter + */ + filter( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + filter( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.filter + */ + filter( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.filter + */ + filter( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + filter(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.find + interface LoDashStatic { + /** + * Iterates over elements of collection, returning the first element predicate returns truthy for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.detect + * + * @param collection The collection to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the matched element, else undefined. + */ + find( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: List|Dictionary, + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + collection: List|Dictionary, + predicate?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.find + */ + find( + predicate?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): T; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.find + */ + find( + predicate?: ListIterator|DictionaryIterator, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + find( + predicate?: string, + thisArg?: any + ): TResult; + + /** + * @see _.find + */ + find( + predicate?: TObject + ): TResult; + } + + //_.findWhere + interface LoDashStatic { + /** + * @see _.find + **/ + findWhere( + collection: Array, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findWhere( + collection: List, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findWhere( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: Array, + whereValue: W): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: List, + whereValue: W): T; + + /** + * @see _.find + * @param _.matches style callback + **/ + findWhere( + collection: Dictionary, + whereValue: W): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: Array, + pluckValue: string): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: List, + pluckValue: string): T; + + /** + * @see _.find + * @param _.property style callback + **/ + findWhere( + collection: Dictionary, + pluckValue: string): T; + } + + //_.findLast + interface LoDashStatic { + /** + * This method is like _.find except that it iterates over elements of a collection from + * right to left. + * @param collection Searches for a value in this list. + * @param callback The function called per iteration. + * @param thisArg The this binding of callback. + * @return The found element, else undefined. + **/ + findLast( + collection: Array, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findLast( + collection: List, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + **/ + findLast( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: Array, + whereValue: W): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: List, + whereValue: W): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + findLast( + collection: Dictionary, + whereValue: W): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: Array, + pluckValue: string): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: List, + pluckValue: string): T; + + /** + * @see _.find + * @param _.where style callback + **/ + findLast( + collection: Dictionary, + pluckValue: string): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.findLast + */ + findLast( + callback: ListIterator, + thisArg?: any): T; + /** + * @see _.findLast + * @param _.where style callback + */ + findLast( + whereValue: W): T; + + /** + * @see _.findLast + * @param _.where style callback + */ + findLast( + pluckValue: string): T; + } + + //_.forEach + interface LoDashStatic { + /** + * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg + * and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false. + * + * Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To + * avoid this behavior _.forIn or _.forOwn may be used for object iteration. + * + * @alias _.each + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + */ + forEach( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEach + */ + forEach( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEach + */ + forEach( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEach + */ + forEach( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEach + */ + forEach( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.forEachRight + interface LoDashStatic { + /** + * This method is like _.forEach except that it iterates over elements of collection from right to left. + * + * @alias _.eachRight + * + * @param collection The collection to iterate over. + * @param iteratee The function called per iteration. + * @param thisArg The this binding of callback. + */ + forEachRight( + collection: T[], + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): List; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T, + iteratee?: ObjectIterator, + thisArgs?: any + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forEachRight + */ + forEachRight( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + } + + //_.groupBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is an array of the elements responsible for generating the + * key. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + groupBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: TValue + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: TWhere + ): Dictionary; + + /** + * @see _.groupBy + */ + groupBy( + collection: List|Dictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: TValue + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: TWhere + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.groupBy + */ + groupBy( + iteratee?: Object + ): LoDashExplicitObjectWrapper>; + } + + //_.include + interface LoDashStatic { + /** + * @see _.includes + */ + include( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + include( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + include( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + include( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + include( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + include( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + include( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + include( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.includes + interface LoDashStatic { + /** + * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, + * it’s used as the offset from the end of collection. + * + * @alias _.contains, _.include + * + * @param collection The collection to search. + * @param target The value to search for. + * @param fromIndex The index to search from. + * @return True if the target element is found, else false. + */ + includes( + collection: List|Dictionary, + target: T, + fromIndex?: number + ): boolean; + + /** + * @see _.includes + */ + includes( + collection: string, + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.includes + */ + includes( + target: T, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.includes + */ + includes( + target: TValue, + fromIndex?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.includes + */ + includes( + target: string, + fromIndex?: number + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.includes + */ + includes( + target: T, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.includes + */ + includes( + target: TValue, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.includes + */ + includes( + target: string, + fromIndex?: number + ): LoDashExplicitWrapper; + } + + //_.indexBy + interface LoDashStatic { + /** + * Creates an object composed of keys generated from the results of running each element of collection through + * iteratee. The corresponding value of each key is the last element responsible for generating the key. The + * iteratee function is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the composed aggregate object. + */ + indexBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: NumericDictionary, + iteratee?: NumericDictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: W + ): Dictionary; + + /** + * @see _.indexBy + */ + indexBy( + collection: List|NumericDictionary|Dictionary, + iteratee?: Object + ): Dictionary; + } + + interface LoDashImplicitWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: Object + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.indexBy + */ + indexBy( + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: W + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.indexBy + */ + indexBy( + iteratee?: Object + ): LoDashExplicitObjectWrapper>; + } + + //_.invoke + interface LoDashStatic { + /** + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this + * bound to, each element in the collection. + * @param collection The collection to iterate over. + * @param methodName The name of the method to invoke. + * @param args Arguments to invoke the method with. + **/ + invoke( + collection: Array, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: List, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Dictionary, + methodName: string, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Array, + method: Function, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: List, + method: Function, + ...args: any[]): any; + + /** + * @see _.invoke + **/ + invoke( + collection: Dictionary, + method: Function, + ...args: any[]): any; + } + + //_.map + interface LoDashStatic { + /** + * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to + * thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * Many lodash methods are guarded to work as iteratees for methods like _.every, _.filter, _.map, _.mapValues, + * _.reject, and _.some. + * + * The guarded methods are: + * ary, callback, chunk, clone, create, curry, curryRight, drop, dropRight, every, fill, flatten, invert, max, + * min, parseInt, slice, sortBy, take, takeRight, template, trim, trimLeft, trimRight, trunc, random, range, + * sample, some, sum, uniq, and words + * + * @alias _.collect + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped array. + */ + map( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: List|Dictionary, + iteratee?: string + ): TResult[]; + + /** + * @see _.map + */ + map( + collection: List|Dictionary, + iteratee?: TObject + ): boolean[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.map + */ + map( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.map + */ + map( + iteratee?: TObject + ): LoDashExplicitArrayWrapper; + } + + //_.partition + interface LoDashStatic { + /** + * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, + * while the second of which contains elements predicate returns falsey for. + * The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the array of grouped elements. + **/ + partition( + collection: List, + callback: ListIterator, + thisArg?: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + callback: DictionaryIterator, + thisArg?: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + whereValue: W): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + whereValue: W): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + path: string, + srcValue: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + path: string, + srcValue: any): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: List, + pluckValue: string): T[][]; + + /** + * @see _.partition + **/ + partition( + collection: Dictionary, + pluckValue: string): T[][]; + } + + interface LoDashImplicitStringWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + whereValue: W): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + path: string, + srcValue: any): LoDashImplicitArrayWrapper; + /** + * @see _.partition + */ + partition( + pluckValue: string): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.partition + */ + partition( + callback: ListIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + callback: DictionaryIterator, + thisArg?: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + path: string, + srcValue: any): LoDashImplicitArrayWrapper; + + /** + * @see _.partition + */ + partition( + pluckValue: string): LoDashImplicitArrayWrapper; + } + + //_.pluck + interface LoDashStatic { + /** + * Gets the property value of path from all elements in collection. + * + * @param collection The collection to iterate over. + * @param path The path of the property to pluck. + * @return A new array of property values. + */ + pluck( + collection: List|Dictionary, + path: StringRepresentable|StringRepresentable[] + ): any[]; + + /** + * @see _.pluck + */ + pluck( + collection: List|Dictionary, + path: StringRepresentable|StringRepresentable[] + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pluck + */ + pluck(path: StringRepresentable|StringRepresentable[]): LoDashExplicitArrayWrapper; + } + + //_.reduce + interface LoDashStatic { + /** + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback + * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @param thisArg The this binding of callback. + * @return Returns the accumulated value. + **/ + reduce( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + thisArg?: any): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + reduce( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + inject( + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduce + **/ + foldl( + callback: MemoIterator, + thisArg?: any): TResult; + } + + //_.reduceRight + interface LoDashStatic { + /** + * This method is like _.reduce except that it iterates over elements of a collection from + * right to left. + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param accumulator Initial value of the accumulator. + * @param thisArg The this binding of callback. + * @return The accumulated value. + **/ + reduceRight( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + reduceRight( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Array, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: List, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Dictionary, + callback: MemoIterator, + accumulator: TResult, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Array, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: List, + callback: MemoIterator, + thisArg?: any): TResult; + + /** + * @see _.reduceRight + **/ + foldr( + collection: Dictionary, + callback: MemoIterator, + thisArg?: any): TResult; + } + + //_.reject + interface LoDashStatic { + /** + * The opposite of _.filter; this method returns the elements of collection that predicate does not return + * truthy for. + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the new filtered array. + */ + reject( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.reject + */ + reject( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.reject + */ + reject( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.reject + */ + reject( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.reject + */ + reject( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.reject + */ + reject( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.reject + */ + reject(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.sample + interface LoDashStatic { + /** + * Retrieves a random element or n random elements from a collection. + * @param collection The collection to sample. + * @return Returns the random sample(s) of collection. + **/ + sample(collection: Array): T; + + /** + * @see _.sample + **/ + sample(collection: List): T; + + /** + * @see _.sample + **/ + sample(collection: Dictionary): T; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: Array, n: number): T[]; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: List, n: number): T[]; + + /** + * @see _.sample + * @param n The number of elements to sample. + **/ + sample(collection: Dictionary, n: number): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sample + **/ + sample(n: number): LoDashImplicitArrayWrapper; + + /** + * @see _.sample + **/ + sample(): LoDashImplicitWrapper; + } + + //_.select + interface LoDashStatic { + /** + * @see _.filter + */ + select( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: string, + predicate?: StringIterator, + thisArg?: any + ): string[]; + + /** + * @see _.filter + */ + select( + collection: List|Dictionary, + predicate: string, + thisArg?: any + ): T[]; + + /** + * @see _.filter + */ + select( + collection: List|Dictionary, + predicate: W + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.filter + */ + select( + predicate?: StringIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.filter + */ + select( + predicate?: StringIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.filter + */ + select( + predicate: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select( + predicate: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.filter + */ + select(predicate: W): LoDashExplicitArrayWrapper; + } + + //_.shuffle + interface LoDashStatic { + /** + * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. + * + * @param collection The collection to shuffle. + * @return Returns the new shuffled array. + */ + shuffle(collection: List|Dictionary): T[]; + + /** + * @see _.shuffle + */ + shuffle(collection: string): string[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.shuffle + */ + shuffle(): LoDashExplicitArrayWrapper; + } + + //_.size + interface LoDashStatic { + /** + * Gets the size of collection by returning its length for array-like values or the number of own enumerable + * properties for objects. + * + * @param collection The collection to inspect. + * @return Returns the size of collection. + */ + size(collection: List|Dictionary): number; + + /** + * @see _.size + */ + size(collection: string): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.size + */ + size(): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.size + */ + size(): LoDashExplicitWrapper; + } + + //_.some + interface LoDashStatic { + /** + * Checks if predicate returns truthy for any element of collection. The function returns as soon as it finds + * a passing value and does not iterate over the entire collection. The predicate is bound to thisArg and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.any + * + * @param collection The collection to iterate over. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns true if any element passes the predicate check, else false. + */ + some( + collection: List, + predicate?: ListIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: Dictionary, + predicate?: DictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: List|Dictionary|NumericDictionary, + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: List|Dictionary|NumericDictionary, + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): boolean; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.some + */ + some( + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.some + */ + some( + predicate?: TObject + ): LoDashExplicitWrapper; + } + + //_.sortBy + interface LoDashStatic { + /** + * Creates an array of elements, sorted in ascending order by the results of running each element in a + * collection through iteratee. This method performs a stable sort, that is, it preserves the original sort + * order of equal elements. The iteratee is bound to thisArg and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * valueof the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new sorted array. + */ + sortBy( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary, + iteratee: string + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary, + whereValue: W + ): T[]; + + /** + * @see _.sortBy + */ + sortBy( + collection: List|Dictionary + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashImplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortBy + */ + sortBy( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(iteratee: string): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(whereValue: W): LoDashExplicitArrayWrapper; + + /** + * @see _.sortBy + */ + sortBy(): LoDashExplicitArrayWrapper; + } + + //_.sortByAll + interface LoDashStatic { + /** + * This method is like "_.sortBy" except that it can sort by multiple iteratees or + * property names. + * + * If a property name is provided for an iteratee the created "_.property" style callback + * returns the property value of the given element. + * + * If a value is also provided for thisArg the created "_.matchesProperty" style callback + * returns true for elements that have a matching property value, else false. + * + * If an object is provided for an iteratee the created "_.matches" style callback returns + * true for elements that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param callback The function called per iteration. + * @param thisArg The this binding of callback. + * @return A new array of sorted elements. + **/ + sortByAll( + collection: Array, + iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: List, + iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: Array, + ...iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * @see _.sortByAll + **/ + sortByAll( + collection: List, + ...iteratees: (ListIterator|string|Object)[]): T[]; + + /** + * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts + * @param args The rules by which to sort + */ + sortByAll( + collection: (Array|List), + ...args: (ListIterator|Object|string)[] + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * Sorts by all the given arguments, using either ListIterator, pluckValue, or whereValue foramts + * @param args The rules by which to sort + */ + sortByAll(...args: (ListIterator|Object|string)[]): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByAll + **/ + sortByAll( + iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByAll + **/ + sortByAll( + ...iteratees: (ListIterator|string|Object)[]): LoDashImplicitArrayWrapper; + } + + //_.sortByOrder + interface LoDashStatic { + /** + * This method is like _.sortByAll except that it allows specifying the sort orders of the iteratees to sort + * by. If orders is unspecified, all values are sorted in ascending order. Otherwise, a value is sorted in + * ascending order if its corresponding order is "asc", and descending if "desc". + * + * If a property name is provided for an iteratee the created _.property style callback returns the property + * value of the given element. + * + * If an object is provided for an iteratee the created _.matches style callback returns true for elements + * that have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratees The iteratees to sort by. + * @param orders The sort orders of iteratees. + * @return Returns the new sorted array. + */ + sortByOrder( + collection: List, + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: List, + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: NumericDictionary, + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: Dictionary, + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + + /** + * @see _.sortByOrder + */ + sortByOrder( + collection: Dictionary, + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|(ListIterator|string)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|(ListIterator|string)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|W|(ListIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: ListIterator|string|Object|(ListIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|W|(NumericDictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: NumericDictionaryIterator|string|Object|(NumericDictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|W|(DictionaryIterator|string|W)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + + /** + * @see _.sortByOrder + */ + sortByOrder( + iteratees: DictionaryIterator|string|Object|(DictionaryIterator|string|Object)[], + orders?: boolean|string|(boolean|string)[] + ): LoDashExplicitArrayWrapper; + } + + //_.where + interface LoDashStatic { + /** + * Performs a deep comparison of each element in a collection to the given properties + * object, returning an array of all elements that have equivalent property values. + * @param collection The collection to iterate over. + * @param properties The object of property values to filter by. + * @return A new array of elements that have the given properties. + **/ + where( + list: Array, + properties: U): T[]; + + /** + * @see _.where + **/ + where( + list: List, + properties: U): T[]; + + /** + * @see _.where + **/ + where( + list: Dictionary, + properties: U): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.where + **/ + where(properties: U): LoDashImplicitArrayWrapper; + } + + /******** + * Date * + ********/ + + //_.now + interface LoDashStatic { + /** + * Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @return The number of milliseconds. + */ + now(): number; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.now + */ + now(): number; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.now + */ + now(): LoDashExplicitWrapper; + } + + /************* + * Functions * + *************/ + + //_.after + interface LoDashStatic { + /** + * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. + * + * @param n The number of calls before func is invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + after( + n: number, + func: TFunc + ): TFunc; + } + + interface LoDashImplicitWrapper { + /** + * @see _.after + **/ + after(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.after + **/ + after(func: TFunc): LoDashExplicitObjectWrapper; + } + + //_.ary + interface LoDashStatic { + /** + * Creates a function that accepts up to n arguments ignoring any additional arguments. + * + * @param func The function to cap arguments for. + * @param n The arity cap. + * @returns Returns the new function. + */ + ary( + func: Function, + n?: number + ): TResult; + + ary( + func: T, + n?: number + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.ary + */ + ary(n?: number): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.ary + */ + ary(n?: number): LoDashExplicitObjectWrapper; + } + + //_.backflow + interface LoDashStatic { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + backflow(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.before + interface LoDashStatic { + /** + * Creates a function that invokes func, with the this binding and arguments of the created function, while + * it’s called less than n times. Subsequent calls to the created function return the result of the last func + * invocation. + * + * @param n The number of calls at which func is no longer invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + before( + n: number, + func: TFunc + ): TFunc; + } + + interface LoDashImplicitWrapper { + /** + * @see _.before + **/ + before(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.before + **/ + before(func: TFunc): LoDashExplicitObjectWrapper; + } + + //_.bind + interface FunctionBind { + placeholder: any; + + ( + func: T, + thisArg: any, + ...partials: any[] + ): TResult; + + ( + func: Function, + thisArg: any, + ...partials: any[] + ): TResult; + } + + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of thisArg and prepends any additional _.bind + * arguments to those provided to the bound function. + * + * The _.bind.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for + * partially applied arguments. + * + * Note: Unlike native Function#bind this method does not set the "length" property of bound functions. + * + * @param func The function to bind. + * @param thisArg The this binding of func. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + bind: FunctionBind; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bind + */ + bind( + thisArg: any, + ...partials: any[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bind + */ + bind( + thisArg: any, + ...partials: any[] + ): LoDashExplicitObjectWrapper; + } + + //_.bindAll + interface LoDashStatic { + /** + * Binds methods of an object to the object itself, overwriting the existing method. Method names may be + * specified as individual arguments or as arrays of method names. If no method names are provided all + * enumerable function properties, own and inherited, of object are bound. + * + * Note: This method does not set the "length" property of bound functions. + * + * @param object The object to bind and assign the bound methods to. + * @param methodNames The object method names to bind, specified as individual method names or arrays of + * method names. + * @return Returns object. + */ + bindAll( + object: T, + ...methodNames: (string|string[])[] + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bindAll + */ + bindAll(...methodNames: (string|string[])[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bindAll + */ + bindAll(...methodNames: (string|string[])[]): LoDashExplicitObjectWrapper; + } + + //_.bindKey + interface FunctionBindKey { + placeholder: any; + + ( + object: T, + key: any, + ...partials: any[] + ): TResult; + + ( + object: Object, + key: any, + ...partials: any[] + ): TResult; + } + + interface LoDashStatic { + /** + * Creates a function that invokes the method at object[key] and prepends any additional _.bindKey arguments + * to those provided to the bound function. + * + * This method differs from _.bind by allowing bound functions to reference methods that may be redefined + * or don’t yet exist. See Peter Michaux’s article for more details. + * + * The _.bindKey.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder + * for partially applied arguments. + * + * @param object The object the method belongs to. + * @param key The key of the method. + * @param partials The arguments to be partially applied. + * @return Returns the new bound function. + */ + bindKey: FunctionBindKey; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.bindKey + */ + bindKey( + key: any, + ...partials: any[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bindKey + */ + bindKey( + key: any, + ...partials: any[] + ): LoDashExplicitObjectWrapper; + } + + //_.compose + interface LoDashStatic { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + compose(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.createCallback + interface LoDashStatic { + /** + * Produces a callback bound to an optional thisArg. If func is a property name the created + * callback will return the property value for a given element. If func is an object the created + * callback will return true for elements that contain the equivalent object properties, + * otherwise it will return false. + * @param func The value to convert to a callback. + * @param thisArg The this binding of the created callback. + * @param argCount The number of arguments the callback accepts. + * @return A callback function. + **/ + createCallback( + func: string, + thisArg?: any, + argCount?: number): () => any; + + /** + * @see _.createCallback + **/ + createCallback( + func: Dictionary, + thisArg?: any, + argCount?: number): () => boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.createCallback + **/ + createCallback( + thisArg?: any, + argCount?: number): LoDashImplicitObjectWrapper<() => any>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.createCallback + **/ + createCallback( + thisArg?: any, + argCount?: number): LoDashImplicitObjectWrapper<() => any>; + } + + //_.curry + interface LoDashStatic { + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1) => R): + CurriedFunction1; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2) => R): + CurriedFunction2; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3) => R): + CurriedFunction3; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): + CurriedFunction4; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curry(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): + CurriedFunction5; + /** + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + curry( + func: Function, + arity?: number): TResult; + } + + interface CurriedFunction1 { + (): CurriedFunction1; + (t1: T1): R; + } + + interface CurriedFunction2 { + (): CurriedFunction2; + (t1: T1): CurriedFunction1; + (t1: T1, t2: T2): R; + } + + interface CurriedFunction3 { + (): CurriedFunction3; + (t1: T1): CurriedFunction2; + (t1: T1, t2: T2): CurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; + } + + interface CurriedFunction4 { + (): CurriedFunction4; + (t1: T1): CurriedFunction3; + (t1: T1, t2: T2): CurriedFunction2; + (t1: T1, t2: T2, t3: T3): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; + } + + interface CurriedFunction5 { + (): CurriedFunction5; + (t1: T1): CurriedFunction4; + (t1: T1, t2: T2): CurriedFunction3; + (t1: T1, t2: T2, t3: T3): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.curry + **/ + curry(arity?: number): LoDashImplicitObjectWrapper; + } + + //_.curryRight + interface LoDashStatic { + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1) => R): + CurriedFunction1; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2) => R): + CurriedFunction2; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3) => R): + CurriedFunction3; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): + CurriedFunction4; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @return Returns the new curried function. + */ + curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): + CurriedFunction5; + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + curryRight( + func: Function, + arity?: number): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.curryRight + **/ + curryRight(arity?: number): LoDashImplicitObjectWrapper; + } + + //_.debounce + interface DebounceSettings { + /** + * Specify invoking on the leading edge of the timeout. + */ + leading?: boolean; + + /** + * The maximum time func is allowed to be delayed before it’s invoked. + */ + maxWait?: number; + + /** + * Specify invoking on the trailing edge of the timeout. + */ + trailing?: boolean; + } + + interface LoDashStatic { + /** + * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since + * the last time the debounced function was invoked. The debounced function comes with a cancel method to + * cancel delayed invocations. Provide an options object to indicate that func should be invoked on the + * leading and/or trailing edge of the wait timeout. Subsequent calls to the debounced function return the + * result of the last func invocation. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only + * if the the debounced function is invoked more than once during the wait timeout. + * + * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. + * + * @param func The function to debounce. + * @param wait The number of milliseconds to delay. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new debounced function. + */ + debounce( + func: T, + wait?: number, + options?: DebounceSettings + ): T & Cancelable; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.debounce + */ + debounce( + wait?: number, + options?: DebounceSettings + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.debounce + */ + debounce( + wait?: number, + options?: DebounceSettings + ): LoDashExplicitObjectWrapper; + } + + //_.defer + interface LoDashStatic { + /** + * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to + * func when it’s invoked. + * + * @param func The function to defer. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + defer( + func: T, + ...args: any[] + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defer + */ + defer(...args: any[]): LoDashImplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.defer + */ + defer(...args: any[]): LoDashExplicitWrapper; + } + + //_.delay + interface LoDashStatic { + /** + * Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked. + * + * @param func The function to delay. + * @param wait The number of milliseconds to delay invocation. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + delay( + func: T, + wait: number, + ...args: any[] + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.delay + */ + delay( + wait: number, + ...args: any[] + ): LoDashImplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.delay + */ + delay( + wait: number, + ...args: any[] + ): LoDashExplicitWrapper; + } + + //_.flow + interface LoDashStatic { + /** + * Creates a function that returns the result of invoking the provided functions with the this binding of the + * created function, where each successive invocation is supplied the return value of the previous. + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + flow(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flow + */ + flow(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flow + */ + flow(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + //_.flowRight + interface LoDashStatic { + /** + * This method is like _.flow except that it creates a function that invokes the provided functions from right + * to left. + * + * @alias _.backflow, _.compose + * + * @param funcs Functions to invoke. + * @return Returns the new function. + */ + flowRight(...funcs: Function[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.flowRight + */ + flowRight(...funcs: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.flowRight + */ + flowRight(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + + + //_.memoize + interface MemoizedFunction extends Function { + cache: MapCache; + } + + interface LoDashStatic { + /** + * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for + * storing the result based on the arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with + * the this binding of the memoized function. + * @param func The function to have its output memoized. + * @param resolver The function to resolve the cache key. + * @return Returns the new memoizing function. + */ + memoize: { + (func: T, resolver?: Function): T & MemoizedFunction; + Cache: MapCache; + } + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.memoize + */ + memoize(resolver?: Function): LoDashImplicitObjectWrapper; + } + + //_.modArgs + interface LoDashStatic { + /** + * Creates a function that runs each argument through a corresponding transform function. + * + * @param func The function to wrap. + * @param transforms The functions to transform arguments, specified as individual functions or arrays + * of functions. + * @return Returns the new function. + */ + modArgs( + func: T, + ...transforms: Function[] + ): TResult; + + /** + * @see _.modArgs + */ + modArgs( + func: T, + transforms: Function[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.modArgs + */ + modArgs(...transforms: Function[]): LoDashImplicitObjectWrapper; + + /** + * @see _.modArgs + */ + modArgs(transforms: Function[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.modArgs + */ + modArgs(...transforms: Function[]): LoDashExplicitObjectWrapper; + + /** + * @see _.modArgs + */ + modArgs(transforms: Function[]): LoDashExplicitObjectWrapper; + } + + //_.negate + interface LoDashStatic { + /** + * Creates a function that negates the result of the predicate func. The func predicate is invoked with + * the this binding and arguments of the created function. + * + * @param predicate The predicate to negate. + * @return Returns the new function. + */ + negate(predicate: T): (...args: any[]) => boolean; + + /** + * @see _.negate + */ + negate(predicate: T): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.negate + */ + negate(): LoDashImplicitObjectWrapper<(...args: any[]) => boolean>; + + /** + * @see _.negate + */ + negate(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper; + } + + //_.once + interface LoDashStatic { + /** + * Creates a function that is restricted to invoking func once. Repeat calls to the function return the value + * of the first call. The func is invoked with the this binding and arguments of the created function. + * + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + once(func: T): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.once + */ + once(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.once + */ + once(): LoDashExplicitObjectWrapper; + } + + //_.partial + interface LoDashStatic { + /** + * Creates a function that, when called, invokes func with any additional partial arguments + * prepended to those provided to the new function. This method is similar to _.bind except + * it does not alter the this binding. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + partial: Partial; + } + + type PH = LoDashStatic; + + interface Function0 { + (): R; + } + interface Function1 { + (t1: T1): R; + } + interface Function2 { + (t1: T1, t2: T2): R; + } + interface Function3 { + (t1: T1, t2: T2, t3: T3): R; + } + interface Function4 { + (t1: T1, t2: T2, t3: T3, t4: T4): R; + } + + interface Partial { + // arity 0 + (func: Function0): Function0; + // arity 1 + (func: Function1): Function1; + (func: Function1, arg1: T1): Function0; + // arity 2 + (func: Function2): Function2; + (func: Function2, arg1: T1): Function1< T2, R>; + (func: Function2, plc1: PH, arg2: T2): Function1; + (func: Function2, arg1: T1, arg2: T2): Function0< R>; + // arity 3 + (func: Function3): Function3; + (func: Function3, arg1: T1): Function2< T2, T3, R>; + (func: Function3, plc1: PH, arg2: T2): Function2; + (func: Function3, arg1: T1, arg2: T2): Function1< T3, R>; + (func: Function3, plc1: PH, plc2: PH, arg3: T3): Function2; + (func: Function3, arg1: T1, plc2: PH, arg3: T3): Function1< T2, R>; + (func: Function3, plc1: PH, arg2: T2, arg3: T3): Function1; + (func: Function3, arg1: T1, arg2: T2, arg3: T3): Function0< R>; + // arity 4 + (func: Function4): Function4; + (func: Function4, arg1: T1): Function3< T2, T3, T4, R>; + (func: Function4, plc1: PH, arg2: T2): Function3; + (func: Function4, arg1: T1, arg2: T2): Function2< T3, T4, R>; + (func: Function4, plc1: PH, plc2: PH, arg3: T3): Function3; + (func: Function4, arg1: T1, plc2: PH, arg3: T3): Function2< T2, T4, R>; + (func: Function4, plc1: PH, arg2: T2, arg3: T3): Function2; + (func: Function4, arg1: T1, arg2: T2, arg3: T3): Function1< T4, R>; + (func: Function4, plc1: PH, plc2: PH, plc3: PH, arg4: T4): Function3; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, arg4: T4): Function2< T2, T3, R>; + (func: Function4, plc1: PH, arg2: T2, plc3: PH, arg4: T4): Function2; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, arg4: T4): Function1< T3, R>; + (func: Function4, plc1: PH, plc2: PH, arg3: T3, arg4: T4): Function2; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, arg4: T4): Function1< T2, R>; + (func: Function4, plc1: PH, arg2: T2, arg3: T3, arg4: T4): Function1; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; + // catch-all + (func: Function, ...args: any[]): Function; + } + + //_.partialRight + interface LoDashStatic { + /** + * This method is like _.partial except that partial arguments are appended to those provided + * to the new function. + * @param func The function to partially apply arguments to. + * @param args Arguments to be partially applied. + * @return The new partially applied function. + **/ + partialRight: PartialRight + } + + interface PartialRight { + // arity 0 + (func: Function0): Function0; + // arity 1 + (func: Function1): Function1; + (func: Function1, arg1: T1): Function0; + // arity 2 + (func: Function2): Function2; + (func: Function2, arg1: T1, plc2: PH): Function1< T2, R>; + (func: Function2, arg2: T2): Function1; + (func: Function2, arg1: T1, arg2: T2): Function0< R>; + // arity 3 + (func: Function3): Function3; + (func: Function3, arg1: T1, plc2: PH, plc3: PH): Function2< T2, T3, R>; + (func: Function3, arg2: T2, plc3: PH): Function2; + (func: Function3, arg1: T1, arg2: T2, plc3: PH): Function1< T3, R>; + (func: Function3, arg3: T3): Function2; + (func: Function3, arg1: T1, plc2: PH, arg3: T3): Function1< T2, R>; + (func: Function3, arg2: T2, arg3: T3): Function1; + (func: Function3, arg1: T1, arg2: T2, arg3: T3): Function0< R>; + // arity 4 + (func: Function4): Function4; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, plc4: PH): Function3< T2, T3, T4, R>; + (func: Function4, arg2: T2, plc3: PH, plc4: PH): Function3; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, plc4: PH): Function2< T3, T4, R>; + (func: Function4, arg3: T3, plc4: PH): Function3; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, plc4: PH): Function2< T2, T4, R>; + (func: Function4, arg2: T2, arg3: T3, plc4: PH): Function2; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, plc4: PH): Function1< T4, R>; + (func: Function4, arg4: T4): Function3; + (func: Function4, arg1: T1, plc2: PH, plc3: PH, arg4: T4): Function2< T2, T3, R>; + (func: Function4, arg2: T2, plc3: PH, arg4: T4): Function2; + (func: Function4, arg1: T1, arg2: T2, plc3: PH, arg4: T4): Function1< T3, R>; + (func: Function4, arg3: T3, arg4: T4): Function2; + (func: Function4, arg1: T1, plc2: PH, arg3: T3, arg4: T4): Function1< T2, R>; + (func: Function4, arg2: T2, arg3: T3, arg4: T4): Function1; + (func: Function4, arg1: T1, arg2: T2, arg3: T3, arg4: T4): Function0< R>; + // catch-all + (func: Function, ...args: any[]): Function; + } + + //_.rearg + interface LoDashStatic { + /** + * Creates a function that invokes func with arguments arranged according to the specified indexes where the + * argument value at the first index is provided as the first argument, the argument value at the second index + * is provided as the second argument, and so on. + * @param func The function to rearrange arguments for. + * @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes. + * @return Returns the new function. + */ + rearg(func: Function, indexes: number[]): TResult; + + /** + * @see _.rearg + */ + rearg(func: Function, ...indexes: number[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.rearg + */ + rearg(indexes: number[]): LoDashImplicitObjectWrapper; + + /** + * @see _.rearg + */ + rearg(...indexes: number[]): LoDashImplicitObjectWrapper; + } + + //_.restParam + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * + * Note: This method is based on the rest parameter. + * + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + restParam( + func: Function, + start?: number + ): TResult; + + /** + * @see _.restParam + */ + restParam( + func: TFunc, + start?: number + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.restParam + */ + restParam(start?: number): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.restParam + */ + restParam(start?: number): LoDashExplicitObjectWrapper; + } + + //_.spread + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * + * Note: This method is based on the spread operator. + * + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + spread(func: F): T; + + /** + * @see _.spread + */ + spread(func: Function): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.spread + */ + spread(): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.spread + */ + spread(): LoDashExplicitObjectWrapper; + } + + //_.throttle + interface ThrottleSettings { + /** + * If you'd like to disable the leading-edge call, pass this as false. + */ + leading?: boolean; + + /** + * If you'd like to disable the execution on the trailing-edge, pass false. + */ + trailing?: boolean; + } + + interface LoDashStatic { + /** + * Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled + * function comes with a cancel method to cancel delayed invocations. Provide an options object to indicate + * that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls to + * the throttled function return the result of the last func call. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if + * the the throttled function is invoked more than once during the wait timeout. + * + * @param func The function to throttle. + * @param wait The number of milliseconds to throttle invocations to. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new throttled function. + */ + throttle( + func: T, + wait?: number, + options?: ThrottleSettings + ): T & Cancelable; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.throttle + */ + throttle( + wait?: number, + options?: ThrottleSettings + ): LoDashExplicitObjectWrapper; + } + + //_.wrap + interface LoDashStatic { + /** + * Creates a function that provides value to the wrapper function as its first argument. Any additional + * arguments provided to the function are appended to those provided to the wrapper function. The wrapper is + * invoked with the this binding of the created function. + * + * @param value The value to wrap. + * @param wrapper The wrapper function. + * @return Returns the new function. + */ + wrap( + value: V, + wrapper: W + ): R; + + /** + * @see _.wrap + */ + wrap( + value: V, + wrapper: Function + ): R; + + /** + * @see _.wrap + */ + wrap( + value: any, + wrapper: Function + ): R; + } + + interface LoDashImplicitWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashImplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.wrap + */ + wrap(wrapper: W): LoDashExplicitObjectWrapper; + + /** + * @see _.wrap + */ + wrap(wrapper: Function): LoDashExplicitObjectWrapper; + } + + /******** + * Lang * + ********/ + + //_.clone + interface CloneCustomizer { + (value: TValue): TResult; + } + + interface LoDashStatic { + /** + * Creates a clone of value. If isDeep is true nested objects are cloned, otherwise they are assigned by + * reference. If customizer is provided it's invoked to produce the cloned values. If customizer returns + * undefined cloning is handled by the method instead. The customizer is bound to thisArg and invoked with + * up to three argument; (value [, index|key, object]). + * + * Note: This method is loosely based on the structured clone algorithm. The enumerable properties of + * arguments objects and objects created by constructors other than Object are cloned to plain Object + * objects. An empty object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, + * and WeakMaps. + * + * @param value The value to clone. + * @param isDeep Specify a deep clone. + * @param customizer The function to customize cloning values. + * @param thisArg The this binding of customizer. + * @return Returns the cloned value. + */ + clone( + value: any, + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + value: T, + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + + /** + * @see _.clone + */ + clone( + value: any, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + value: T, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + value: T, + isDeep?: boolean + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): T; + } + + interface LoDashExplicitWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + isDeep: boolean, + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.clone + */ + clone( + customizer: CloneCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.clone + */ + clone( + isDeep?: boolean + ): LoDashExplicitObjectWrapper; + } + + //_.cloneDeep + interface CloneDeepCustomizer { + (value: TValue): TResult; + } + + interface LoDashStatic { + /** + * Creates a deep clone of value. If customizer is provided it's invoked to produce the cloned values. + * If customizer returns undefined cloning is handled by the method instead. The customizer is bound to + * thisArg and invoked with up to three argument; (value [, index|key, object]). + * + * Note: This method is loosely based on the structured clone algorithm. The enumerable properties of + * arguments objects and objects created by constructors other than Object are cloned to plain Object objects. + * An empty object is returned for uncloneable values such as functions, DOM nodes, Maps, Sets, and WeakMaps. + * + * @param value The value to deep clone. + * @param customizer The function to customize cloning values. + * @param thisArg The this binding of customizer. + * @return Returns the deep cloned value. + */ + cloneDeep( + value: any, + customizer: CloneDeepCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.cloneDeep + */ + cloneDeep( + value: T, + customizer: CloneDeepCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.cloneDeep + */ + cloneDeep( + value: T + ): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.cloneDeep + */ + cloneDeep(): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.cloneDeep + */ + cloneDeep(): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.cloneDeep + */ + cloneDeep(): T; + } + + interface LoDashExplicitWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + isDeep?: boolean + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + isDeep?: boolean + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + customizer: CloneDeepCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.cloneDeep + */ + cloneDeep( + isDeep?: boolean + ): LoDashExplicitObjectWrapper; + } + + //_.eq + interface LoDashStatic { + /** + * @see _.isEqual + */ + eq( + value: any, + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEqual + */ + eq( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEqual + */ + eq( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + } + + //_.gt + interface LoDashStatic { + /** + * Checks if value is greater than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than other, else false. + */ + gt( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.gt + */ + gt(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.gt + */ + gt(other: any): LoDashExplicitWrapper; + } + + //_.gte + interface LoDashStatic { + /** + * Checks if value is greater than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is greater than or equal to other, else false. + */ + gte( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.gte + */ + gte(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.gte + */ + gte(other: any): LoDashExplicitWrapper; + } + + //_.isArguments + interface LoDashStatic { + /** + * Checks if value is classified as an arguments object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isArguments(value?: any): value is IArguments; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArguments + */ + isArguments(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArguments + */ + isArguments(): LoDashExplicitWrapper; + } + + //_.isArray + interface LoDashStatic { + /** + * Checks if value is classified as an Array object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isArray(value?: any): value is T[]; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isArray + */ + isArray(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isArray + */ + isArray(): LoDashExplicitWrapper; + } + + //_.isBoolean + interface LoDashStatic { + /** + * Checks if value is classified as a boolean primitive or object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isBoolean(value?: any): value is boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): LoDashExplicitWrapper; + } + + //_.isDate + interface LoDashStatic { + /** + * Checks if value is classified as a Date object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isDate(value?: any): value is Date; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isDate + */ + isDate(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isDate + */ + isDate(): LoDashExplicitWrapper; + } + + //_.isElement + interface LoDashStatic { + /** + * Checks if value is a DOM element. + * + * @param value The value to check. + * @return Returns true if value is a DOM element, else false. + */ + isElement(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isElement + */ + isElement(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isElement + */ + isElement(): LoDashExplicitWrapper; + } + + //_.isEmpty + interface LoDashStatic { + /** + * Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string, or + * jQuery-like collection with a length greater than 0 or an object with own enumerable properties. + * + * @param value The value to inspect. + * @return Returns true if value is empty, else false. + */ + isEmpty(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEmpty + */ + isEmpty(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEmpty + */ + isEmpty(): LoDashExplicitWrapper; + } + + //_.isEqual + interface IsEqualCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * Performs a deep comparison between two values to determine if they are equivalent. If customizer is + * provided it’s invoked to compare values. If customizer returns undefined comparisons are handled by the + * method instead. The customizer is bound to thisArg and invoked with up to three arguments: (value, other + * [, index|key]). + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, + * and strings. Objects are compared by their own, not inherited, enumerable properties. Functions and DOM + * nodes are not supported. Provide a customizer function to extend support for comparing other values. + * + * @alias _.eq + * + * @param value The value to compare. + * @param other The other value to compare. + * @param customizer The function to customize value comparisons. + * @param thisArg The this binding of customizer. + * @return Returns true if the values are equivalent, else false. + */ + isEqual( + value: any, + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isEqual + */ + isEqual( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isEqual + */ + isEqual( + other: any, + customizer?: IsEqualCustomizer, + thisArg?: any + ): LoDashExplicitWrapper; + } + + //_.isError + interface LoDashStatic { + /** + * Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError + * object. + * + * @param value The value to check. + * @return Returns true if value is an error object, else false. + */ + isError(value: any): value is Error; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isError + */ + isError(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isError + */ + isError(): LoDashExplicitWrapper; + } + + //_.isFinite + interface LoDashStatic { + /** + * Checks if value is a finite primitive number. + * + * Note: This method is based on Number.isFinite. + * + * @param value The value to check. + * @return Returns true if value is a finite number, else false. + */ + isFinite(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isFinite + */ + isFinite(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isFinite + */ + isFinite(): LoDashExplicitWrapper; + } + + //_.isFunction + interface LoDashStatic { + /** + * Checks if value is classified as a Function object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isFunction(value?: any): value is Function; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isFunction + */ + isFunction(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isFunction + */ + isFunction(): LoDashExplicitWrapper; + } + + //_.isMatch + interface isMatchCustomizer { + (value: any, other: any, indexOrKey?: number|string): boolean; + } + + interface LoDashStatic { + /** + * Performs a deep comparison between object and source to determine if object contains equivalent property + * values. If customizer is provided it’s invoked to compare values. If customizer returns undefined + * comparisons are handled by the method instead. The customizer is bound to thisArg and invoked with three + * arguments: (value, other, index|key). + * @param object The object to inspect. + * @param source The object of property values to match. + * @param customizer The function to customize value comparisons. + * @param thisArg The this binding of customizer. + * @return Returns true if object is a match, else false. + */ + isMatch(object: Object, source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.isMatch + */ + isMatch(source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean; + } + + //_.isNaN + interface LoDashStatic { + /** + * Checks if value is NaN. + * + * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values. + * + * @param value The value to check. + * @return Returns true if value is NaN, else false. + */ + isNaN(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isNaN + */ + isNaN(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isNaN + */ + isNaN(): LoDashExplicitWrapper; + } + + //_.isNative + interface LoDashStatic { + /** + * Checks if value is a native function. + * @param value The value to check. + * + * @retrun Returns true if value is a native function, else false. + */ + isNative(value: any): value is Function; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNative + */ + isNative(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNative + */ + isNative(): LoDashExplicitWrapper; + } + + //_.isNull + interface LoDashStatic { + /** + * Checks if value is null. + * + * @param value The value to check. + * @return Returns true if value is null, else false. + */ + isNull(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNull + */ + isNull(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNull + */ + isNull(): LoDashExplicitWrapper; + } + + //_.isNumber + interface LoDashStatic { + /** + * Checks if value is classified as a Number primitive or object. + * + * Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the _.isFinite method. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isNumber(value?: any): value is number; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNumber + */ + isNumber(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNumber + */ + isNumber(): LoDashExplicitWrapper; + } + + //_.isObject + interface LoDashStatic { + /** + * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), + * and new String('')) + * + * @param value The value to check. + * @return Returns true if value is an object, else false. + */ + isObject(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isObject + */ + isObject(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isObject + */ + isObject(): LoDashExplicitWrapper; + } + + //_.isPlainObject + interface LoDashStatic { + /** + * Checks if value is a plain object, that is, an object created by the Object constructor or one with a + * [[Prototype]] of null. + * + * Note: This method assumes objects created by the Object constructor have no inherited enumerable properties. + * + * @param value The value to check. + * @return Returns true if value is a plain object, else false. + */ + isPlainObject(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isPlainObject + */ + isPlainObject(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isPlainObject + */ + isPlainObject(): LoDashExplicitWrapper; + } + + //_.isRegExp + interface LoDashStatic { + /** + * Checks if value is classified as a RegExp object. + * @param value The value to check. + * + * @return Returns true if value is correctly classified, else false. + */ + isRegExp(value?: any): value is RegExp; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isRegExp + */ + isRegExp(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isRegExp + */ + isRegExp(): LoDashExplicitWrapper; + } + + //_.isString + interface LoDashStatic { + /** + * Checks if value is classified as a String primitive or object. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isString(value?: any): value is string; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isString + */ + isString(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isString + */ + isString(): LoDashExplicitWrapper; + } + + //_.isTypedArray + interface LoDashStatic { + /** + * Checks if value is classified as a typed array. + * + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + */ + isTypedArray(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isTypedArray + */ + isTypedArray(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isTypedArray + */ + isTypedArray(): LoDashExplicitWrapper; + } + + //_.isUndefined + interface LoDashStatic { + /** + * Checks if value is undefined. + * + * @param value The value to check. + * @return Returns true if value is undefined, else false. + */ + isUndefined(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isUndefined + */ + isUndefined(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isUndefined + */ + isUndefined(): LoDashExplicitWrapper; + } + + //_.lt + interface LoDashStatic { + /** + * Checks if value is less than other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than other, else false. + */ + lt( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.lt + */ + lt(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.lt + */ + lt(other: any): LoDashExplicitWrapper; + } + + //_.lte + interface LoDashStatic { + /** + * Checks if value is less than or equal to other. + * + * @param value The value to compare. + * @param other The other value to compare. + * @return Returns true if value is less than or equal to other, else false. + */ + lte( + value: any, + other: any + ): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.lte + */ + lte(other: any): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.lte + */ + lte(other: any): LoDashExplicitWrapper; + } + + //_.toArray + interface LoDashStatic { + /** + * Converts value to an array. + * + * @param value The value to convert. + * @return Returns the converted array. + */ + toArray(value: List|Dictionary|NumericDictionary): T[]; + + /** + * @see _.toArray + */ + toArray(value: TValue): TResult[]; + + /** + * @see _.toArray + */ + toArray(value?: any): TResult[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.toArray + */ + toArray(): LoDashExplicitArrayWrapper; + } + + //_.toPlainObject + interface LoDashStatic { + /** + * Converts value to a plain object flattening inherited enumerable properties of value to own properties + * of the plain object. + * + * @param value The value to convert. + * @return Returns the converted plain object. + */ + toPlainObject(value?: any): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.toPlainObject + */ + toPlainObject(): LoDashImplicitObjectWrapper; + } + + /******** + * Math * + ********/ + + //_.add + interface LoDashStatic { + /** + * Adds two numbers. + * + * @param augend The first number to add. + * @param addend The second number to add. + * @return Returns the sum. + */ + add( + augend: number, + addend: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.add + */ + add(addend: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.add + */ + add(addend: number): LoDashExplicitWrapper; + } + + //_.ceil + interface LoDashStatic { + /** + * Calculates n rounded up to precision. + * + * @param n The number to round up. + * @param precision The precision to round up to. + * @return Returns the rounded up number. + */ + ceil( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.ceil + */ + ceil(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.ceil + */ + ceil(precision?: number): LoDashExplicitWrapper; + } + + //_.floor + interface LoDashStatic { + /** + * Calculates n rounded down to precision. + * + * @param n The number to round down. + * @param precision The precision to round down to. + * @return Returns the rounded down number. + */ + floor( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.floor + */ + floor(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.floor + */ + floor(precision?: number): LoDashExplicitWrapper; + } + + //_.max + interface LoDashStatic { + /** + * Gets the maximum value of collection. If collection is empty or falsey -Infinity is returned. If an iteratee + * function is provided it’s invoked for each value in collection to generate the criterion by which the value + * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the maximum value. + */ + max( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.max + */ + max( + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.max + */ + max( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.max + */ + max( + whereValue?: TObject + ): T; + } + + //_.min + interface LoDashStatic { + /** + * Gets the minimum value of collection. If collection is empty or falsey Infinity is returned. If an iteratee + * function is provided it’s invoked for each value in collection to generate the criterion by which the value + * is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection). + * + * If a property name is provided for iteratee the created _.property style callback returns the property value + * of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the minimum value. + */ + min( + collection: List, + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: List|Dictionary, + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + collection: List|Dictionary, + whereValue?: TObject + ): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.min + */ + min( + iteratee?: ListIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + whereValue?: TObject + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.min + */ + min( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + iteratee?: string, + thisArg?: any + ): T; + + /** + * @see _.min + */ + min( + whereValue?: TObject + ): T; + } + + //_.round + interface LoDashStatic { + /** + * Calculates n rounded to precision. + * + * @param n The number to round. + * @param precision The precision to round to. + * @return Returns the rounded number. + */ + round( + n: number, + precision?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.round + */ + round(precision?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.round + */ + round(precision?: number): LoDashExplicitWrapper; + } + + //_.sum + interface LoDashStatic { + /** + * Gets the sum of the values in collection. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the sum. + */ + sum( + collection: List, + iteratee: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + **/ + sum( + collection: Dictionary, + iteratee: DictionaryIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum( + collection: List|Dictionary, + iteratee: string + ): number; + + /** + * @see _.sum + */ + sum(collection: List|Dictionary): number; + + /** + * @see _.sum + */ + sum(collection: List|Dictionary): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum(iteratee: string): number; + + /** + * @see _.sum + */ + sum(): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sum + **/ + sum( + iteratee: ListIterator|DictionaryIterator, + thisArg?: any + ): number; + + /** + * @see _.sum + */ + sum(iteratee: string): number; + + /** + * @see _.sum + */ + sum(): number; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sum + */ + sum( + iteratee: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(iteratee: string): LoDashExplicitWrapper; + + /** + * @see _.sum + */ + sum(): LoDashExplicitWrapper; + } + + /********** + * Number * + **********/ + + //_.inRange + interface LoDashStatic { + /** + * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start + * with start then set to 0. + * + * @param n The number to check. + * @param start The start of the range. + * @param end The end of the range. + * @return Returns true if n is in the range, else false. + */ + inRange( + n: number, + start: number, + end: number + ): boolean; + + + /** + * @see _.inRange + */ + inRange( + n: number, + end: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.inRange + */ + inRange( + start: number, + end: number + ): boolean; + + /** + * @see _.inRange + */ + inRange(end: number): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.inRange + */ + inRange( + start: number, + end: number + ): LoDashExplicitWrapper; + + /** + * @see _.inRange + */ + inRange(end: number): LoDashExplicitWrapper; + } + + //_.random + interface LoDashStatic { + /** + * Produces a random number between min and max (inclusive). If only one argument is provided a number between + * 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point + * number is returned instead of an integer. + * + * @param min The minimum possible value. + * @param max The maximum possible value. + * @param floating Specify returning a floating-point number. + * @return Returns the random number. + */ + random( + min?: number, + max?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random( + min?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random(floating?: boolean): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.random + */ + random( + max?: number, + floating?: boolean + ): number; + + /** + * @see _.random + */ + random(floating?: boolean): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.random + */ + random( + max?: number, + floating?: boolean + ): LoDashExplicitWrapper; + + /** + * @see _.random + */ + random(floating?: boolean): LoDashExplicitWrapper; + } + + /********** + * Object * + **********/ + + //_.assign + interface AssignCustomizer { + (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}): any; + } + + interface LoDashStatic { + /** + * Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources + * overwrite property assignments of previous sources. If customizer is provided it’s invoked to produce the + * assigned values. The customizer is bound to thisArg and invoked with five arguments: + * (objectValue, sourceValue, key, object, source). + * + * Note: This method mutates object and is based on Object.assign. + * + * @alias _.extend + * + * @param object The destination object. + * @param source The source objects. + * @param customizer The function to customize assigned values. + * @param thisArg The this binding of callback. + * @return The destination object. + */ + assign( + object: TObject, + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + assign + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.assign + */ + assign(object: TObject): TObject; + + /** + * @see _.assign + */ + assign( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assign + */ + assign( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assign + */ + assign( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + assign( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + assign(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + //_.create + interface LoDashStatic { + /** + * Creates an object that inherits from the given prototype object. If a properties object is provided its own + * enumerable properties are assigned to the created object. + * + * @param prototype The object to inherit from. + * @param properties The properties to assign to the object. + * @return Returns the new object. + */ + create( + prototype: T, + properties?: U + ): T & U; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.create + */ + create(properties?: U): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.create + */ + create(properties?: U): LoDashExplicitObjectWrapper; + } + + //_.defaults + interface LoDashStatic { + /** + * Assigns own enumerable properties of source object(s) to the destination object for all destination + * properties that resolve to undefined. Once a property is set, additional values of the same property are + * ignored. + * + * Note: This method mutates object. + * + * @param object The destination object. + * @param sources The source objects. + * @return The destination object. + */ + defaults( + object: Obj, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: Obj, + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): TResult; + + /** + * @see _.defaults + */ + defaults( + object: {}, + ...sources: {}[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashImplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.defaults + */ + defaults( + source1: S1, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults( + source1: S1, + source2: S2, + source3: S3, + source4: S4, + ...sources: {}[] + ): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(): LoDashExplicitObjectWrapper; + + /** + * @see _.defaults + */ + defaults(...sources: {}[]): LoDashExplicitObjectWrapper; + } + + //_.defaultsDeep + interface LoDashStatic { + /** + * This method is like _.defaults except that it recursively assigns default properties. + * @param object The destination object. + * @param sources The source objects. + * @return Returns object. + **/ + defaultsDeep( + object: T, + ...sources: any[]): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.defaultsDeep + **/ + defaultsDeep(...sources: any[]): LoDashImplicitObjectWrapper + } + + //_.extend + interface LoDashStatic { + /** + * @see assign + */ + extend( + object: TObject, + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see assign + */ + extend + ( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): TResult; + + /** + * @see _.assign + */ + extend(object: TObject): TObject; + + /** + * @see _.assign + */ + extend( + object: TObject, ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.assign + */ + extend( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(): LoDashImplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(...otherArgs: any[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.assign + */ + extend( + source: TSource, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see assign + */ + extend( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: AssignCustomizer, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(): LoDashExplicitObjectWrapper; + + /** + * @see _.assign + */ + extend(...otherArgs: any[]): LoDashExplicitObjectWrapper; + } + + //_.findKey + interface LoDashStatic { + /** + * This method is like _.find except that it returns the key of the first element predicate returns truthy for + * instead of the element itself. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + findKey( + object: TObject, + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + object: TObject, + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + object: TObject, + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey, TObject>( + object: TObject, + predicate?: TWhere + ): string; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findKey + */ + findKey( + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey( + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findKey + */ + findKey>( + predicate?: TWhere + ): string; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findKey + */ + findKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findKey + */ + findKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + + //_.findLastKey + interface LoDashStatic { + /** + * This method is like _.findKey except that it iterates over elements of a collection in the opposite order. + * + * If a property name is provided for predicate the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for predicate the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @param object The object to search. + * @param predicate The function invoked per iteration. + * @param thisArg The this binding of predicate. + * @return Returns the key of the matched element, else undefined. + */ + findLastKey( + object: TObject, + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + object: TObject, + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + object: TObject, + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey, TObject>( + object: TObject, + predicate?: TWhere + ): string; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: DictionaryIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: ObjectIterator, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: string, + thisArg?: any + ): string; + + /** + * @see _.findLastKey + */ + findLastKey>( + predicate?: TWhere + ): string; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: DictionaryIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: ObjectIterator, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey( + predicate?: string, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.findLastKey + */ + findLastKey>( + predicate?: TWhere + ): LoDashExplicitWrapper; + } + + //_.forIn + interface LoDashStatic { + /** + * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The + * iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may + * exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forIn( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forIn + */ + forIn( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forIn + */ + forIn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forIn + */ + forIn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forInRight + interface LoDashStatic { + /** + * This method is like _.forIn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forInRight( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forInRight + */ + forInRight( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forOwn + interface LoDashStatic { + /** + * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is + * bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may exit + * iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forOwn( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forOwn + */ + forOwn( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forOwn + */ + forOwn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forOwn + */ + forOwn( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.forOwnRight + interface LoDashStatic { + /** + * This method is like _.forOwn except that it iterates over properties of object in the opposite order. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns object. + */ + forOwnRight( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.forOwnRight + */ + forOwnRight( + object: T, + iteratee?: ObjectIterator, + thisArg?: any + ): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.forOwnRight + */ + forOwnRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forOwnRight + */ + forOwnRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; + } + + //_.functions + interface LoDashStatic { + /** + * Creates an array of function property names from all enumerable properties, own and inherited, of object. + * + * @alias _.methods + * + * @param object The object to inspect. + * @return Returns the new array of property names. + */ + functions(object: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.functions + */ + functions(): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.functions + */ + functions(): _.LoDashExplicitArrayWrapper; + } + + //_.get + interface LoDashStatic { + /** + * Gets the property value at path of object. If the resolved + * value is undefined the defaultValue is used in its place. + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + **/ + get(object: Object, + path: string|number|boolean|Array, + defaultValue?:TResult + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.get + **/ + get(path: string|number|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + //_.has + interface LoDashStatic { + /** + * Checks if path is a direct property. + * + * @param object The object to query. + * @param path The path to check. + * @return Returns true if path is a direct property, else false. + */ + has( + object: T, + path: StringRepresentable|StringRepresentable[] + ): boolean; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.has + */ + has(path: StringRepresentable|StringRepresentable[]): boolean; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.has + */ + has(path: StringRepresentable|StringRepresentable[]): LoDashExplicitWrapper; + } + + //_.invert + interface LoDashStatic { + /** + * Creates an object composed of the inverted keys and values of object. If object contains duplicate values, + * subsequent values overwrite property assignments of previous values unless multiValue is true. + * + * @param object The object to invert. + * @param multiValue Allow multiple values per key. + * @return Returns the new inverted object. + */ + invert( + object: T, + multiValue?: boolean + ): TResult; + + /** + * @see _.invert + */ + invert( + object: Object, + multiValue?: boolean + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.invert + */ + invert(multiValue?: boolean): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.invert + */ + invert(multiValue?: boolean): LoDashExplicitObjectWrapper; + } + + //_.keys + interface LoDashStatic { + /** + * Creates an array of the own enumerable property names of object. + * + * Note: Non-object values are coerced to objects. See the ES spec for more details. + * + * @param object The object to query. + * @return Returns the array of property names. + */ + keys(object?: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.keys + */ + keys(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.keys + */ + keys(): LoDashExplicitArrayWrapper; + } + + //_.keysIn + interface LoDashStatic { + /** + * Creates an array of the own and inherited enumerable property names of object. + * + * Note: Non-object values are coerced to objects. + * + * @param object The object to query. + * @return An array of property names. + */ + keysIn(object?: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.keysIn + */ + keysIn(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.keysIn + */ + keysIn(): LoDashExplicitArrayWrapper; + } + + //_.mapKeys + interface LoDashStatic { + /** + * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated + * by running each own enumerable property of object through iteratee. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the new mapped object. + */ + mapKeys( + object: List, + iteratee?: ListIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: Dictionary, + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: List|Dictionary, + iteratee?: TObject + ): Dictionary; + + /** + * @see _.mapKeys + */ + mapKeys( + object: List|Dictionary, + iteratee?: string, + thisArg?: any + ): Dictionary; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: ListIterator|DictionaryIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: TObject + ): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapKeys + */ + mapKeys( + iteratee?: string, + thisArg?: any + ): LoDashExplicitObjectWrapper>; + } + + //_.mapValues + interface LoDashStatic { + /** + * Creates an object with the same keys as object and values generated by running each own + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). + * + * If a property name is provided iteratee the created "_.property" style callback returns + * the property value of the given element. + * + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true + * for elements that have the properties of the given object, else false. + * + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Object} [thisArg] The `this` binding of `iteratee`. + * @return {Object} Returns the new mapped object. + */ + mapValues(obj: Dictionary, callback: ObjectIterator, thisArg?: any): Dictionary; + mapValues(obj: Dictionary, where: Dictionary): Dictionary; + mapValues(obj: T, pluck: string): TMapped; + mapValues(obj: T, callback: ObjectIterator, thisArg?: any): T; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mapValues + * TValue is the type of the property values of T. + * TResult is the type output by the ObjectIterator function + */ + mapValues(callback: ObjectIterator, thisArg?: any): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the property specified by pluck. + * T should be a Dictionary> + */ + mapValues(pluck: string): LoDashImplicitObjectWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the properties on the object specified by pluck. + * T should be a Dictionary>> + */ + mapValues(pluck: string, where: Dictionary): LoDashImplicitArrayWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the properties of each object in the values of T + * T should be a Dictionary> + */ + mapValues(where: Dictionary): LoDashImplicitArrayWrapper; + } + + //_.merge + interface MergeCustomizer { + (value: any, srcValue: any, key?: string, object?: Object, source?: Object): any; + } + + interface LoDashStatic { + /** + * Recursively merges own enumerable properties of the source object(s), that don’t resolve to undefined into + * the destination object. Subsequent sources overwrite property assignments of previous sources. If customizer + * is provided it’s invoked to produce the merged values of the destination and source properties. If + * customizer returns undefined merging is handled by the method instead. The customizer is bound to thisArg + * and invoked with five arguments: (objectValue, sourceValue, key, object, source). + * + * @param object The destination object. + * @param source The source objects. + * @param customizer The function to customize assigned values. + * @param thisArg The this binding of customizer. + * @return Returns object. + */ + merge( + object: TObject, + source: TSource, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2 & TSource3; + + /** + * @see _.merge + */ + merge( + object: TObject, + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: MergeCustomizer, + thisArg?: any + ): TObject & TSource1 & TSource2 & TSource3 & TSource4; + + /** + * @see _.merge + */ + merge( + object: any, + ...otherArgs: any[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.merge + */ + merge( + source: TSource, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + source1: TSource1, + source2: TSource2, + source3: TSource3, + source4: TSource4, + customizer?: MergeCustomizer, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.merge + */ + merge( + ...otherArgs: any[] + ): LoDashImplicitObjectWrapper; + } + + //_.methods + interface LoDashStatic { + /** + * @see _.functions + */ + methods(object: any): string[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.functions + */ + methods(): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.functions + */ + methods(): _.LoDashExplicitArrayWrapper; + } + + //_.omit + interface LoDashStatic { + /** + * The opposite of _.pick; this method creates an object composed of the own and inherited enumerable + * properties of object that are not omitted. + * + * @param object The source object. + * @param predicate The function invoked per iteration or property names to omit, specified as individual + * property names or arrays of property names. + * @param thisArg The this binding of predicate. + * @return Returns the new object. + */ + omit( + object: T, + predicate: ObjectIterator, + thisArg?: any + ): TResult; + + /** + * @see _.omit + */ + omit( + object: T, + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; + } + + //_.pairs + interface LoDashStatic { + /** + * Creates a two dimensional array of the key-value pairs for object, e.g. [[key1, value1], [key2, value2]]. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + pairs(object?: T): any[][]; + + pairs(object?: T): TResult[][]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pairs + */ + pairs(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pairs + */ + pairs(): LoDashExplicitArrayWrapper; + } + + //_.pick + interface LoDashStatic { + /** + * Creates an object composed of the picked object properties. Property names may be specified as individual + * arguments or as arrays of property names. If predicate is provided it’s invoked for each property of object + * picking the properties predicate returns truthy for. The predicate is bound to thisArg and invoked with + * three arguments: (value, key, object). + * + * @param object The source object. + * @param predicate The function invoked per iteration or property names to pick, specified as individual + * property names or arrays of property names. + * @param thisArg The this binding of predicate. + * @return Returns the new object. + */ + pick( + object: T, + predicate: ObjectIterator, + thisArg?: any + ): TResult; + + /** + * @see _.pick + */ + pick( + object: T, + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.pick + */ + pick( + predicate: ObjectIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.pick + */ + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pick + */ + pick( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.pick + */ + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; + } + + //_.result + interface LoDashStatic { + /** + * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding + * of its parent object and its result is returned. + * + * @param object The object to query. + * @param path The path of the property to resolve. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + */ + result( + object: TObject, + path: number|string|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.result + */ + result( + path: number|string|boolean|Array, + defaultValue?: TResult + ): TResult; + } + + //_.set + interface LoDashStatic { + /** + * Sets the property value of path on object. If a portion of path does not exist it’s created. + * + * @param object The object to augment. + * @param path The path of the property to set. + * @param value The value to set. + * @return Returns object. + */ + set( + object: Object, + path: StringRepresentable|StringRepresentable[], + value: any + ): TResult; + + /** + * @see _.set + */ + set( + object: Object, + path: StringRepresentable|StringRepresentable[], + value: V + ): TResult; + + /** + * @see _.set + */ + set( + object: O, + path: StringRepresentable|StringRepresentable[], + value: V + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: any + ): LoDashImplicitObjectWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: V + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.set + */ + set( + path: StringRepresentable|StringRepresentable[], + value: V + ): LoDashExplicitObjectWrapper; + } + + //_.transform + interface LoDashStatic { + /** + * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of + * running each of its own enumerable properties through iteratee, with each invocation potentially mutating + * the accumulator object. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, + * value, key, object). Iteratee functions may exit iteration early by explicitly returning false. + * + * @param object The object to iterate over. + * @param iteratee The function invoked per iteration. + * @param accumulator The custom accumulator value. + * @param thisArg The this binding of iteratee. + * @return Returns the accumulated value. + */ + transform( + object: T[], + iteratee?: MemoVoidArrayIterator, + accumulator?: TResult[], + thisArg?: any + ): TResult[]; + + /** + * @see _.transform + */ + transform( + object: T[], + iteratee?: MemoVoidArrayIterator>, + accumulator?: Dictionary, + thisArg?: any + ): Dictionary; + + /** + * @see _.transform + */ + transform( + object: Dictionary, + iteratee?: MemoVoidDictionaryIterator>, + accumulator?: Dictionary, + thisArg?: any + ): Dictionary; + + /** + * @see _.transform + */ + transform( + object: Dictionary, + iteratee?: MemoVoidDictionaryIterator, + accumulator?: TResult[], + thisArg?: any + ): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidArrayIterator, + accumulator?: TResult[], + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidArrayIterator>, + accumulator?: Dictionary, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidDictionaryIterator>, + accumulator?: Dictionary, + thisArg?: any + ): LoDashImplicitObjectWrapper>; + + /** + * @see _.transform + */ + transform( + iteratee?: MemoVoidDictionaryIterator, + accumulator?: TResult[], + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + //_.values + interface LoDashStatic { + /** + * Creates an array of the own enumerable property values of object. + * + * @param object The object to query. + * @return Returns an array of property values. + */ + values(object?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.values + */ + values(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.values + */ + values(): LoDashExplicitArrayWrapper; + } + + //_.valuesIn + interface LoDashStatic { + /** + * Creates an array of the own and inherited enumerable property values of object. + * + * @param object The object to query. + * @return Returns the array of property values. + */ + valuesIn(object?: any): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.valuesIn + */ + valuesIn(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.valuesIn + */ + valuesIn(): LoDashExplicitArrayWrapper; + } + + /********** + * String * + **********/ + + //_.camelCase + interface LoDashStatic { + /** + * Converts string to camel case. + * + * @param string The string to convert. + * @return Returns the camel cased string. + */ + camelCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.camelCase + */ + camelCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.camelCase + */ + camelCase(): LoDashExplicitWrapper; + } + + //_.capitalize + interface LoDashStatic { + capitalize(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.capitalize + */ + capitalize(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.capitalize + */ + capitalize(): LoDashExplicitWrapper; + } + + //_.deburr + interface LoDashStatic { + /** + * Deburrs string by converting latin-1 supplementary letters to basic latin letters and removing combining + * diacritical marks. + * + * @param string The string to deburr. + * @return Returns the deburred string. + */ + deburr(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.deburr + */ + deburr(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.deburr + */ + deburr(): LoDashExplicitWrapper; + } + + //_.endsWith + interface LoDashStatic { + /** + * Checks if string ends with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string ends with target, else false. + */ + endsWith( + string?: string, + target?: string, + position?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.endsWith + */ + endsWith( + target?: string, + position?: number + ): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.endsWith + */ + endsWith( + target?: string, + position?: number + ): LoDashExplicitWrapper; + } + + // _.escape + interface LoDashStatic { + /** + * Converts the characters "&", "<", ">", '"', "'", and "`", in string to their corresponding HTML entities. + * + * Note: No other characters are escaped. To escape additional characters use a third-party library like he. + * + * Though the ">" character is escaped for symmetry, characters like ">" and "/" don’t need escaping in HTML + * and have no special meaning unless they're part of a tag or unquoted attribute value. See Mathias Bynens’s + * article (under "semi-related fun fact") for more details. + * + * Backticks are escaped because in Internet Explorer < 9, they can break out of attribute values or HTML + * comments. See #59, #102, #108, and #133 of the HTML5 Security Cheatsheet for more details. + * + * When working with HTML you should always quote attribute values to reduce XSS vectors. + * + * @param string The string to escape. + * @return Returns the escaped string. + */ + escape(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.escape + */ + escape(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.escape + */ + escape(): LoDashExplicitWrapper; + } + + // _.escapeRegExp + interface LoDashStatic { + /** + * Escapes the RegExp special characters "\", "/", "^", "$", ".", "|", "?", "*", "+", "(", ")", "[", "]", + * "{" and "}" in string. + * + * @param string The string to escape. + * @return Returns the escaped string. + */ + escapeRegExp(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.escapeRegExp + */ + escapeRegExp(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.escapeRegExp + */ + escapeRegExp(): LoDashExplicitWrapper; + } + + //_.kebabCase + interface LoDashStatic { + /** + * Converts string to kebab case. + * + * @param string The string to convert. + * @return Returns the kebab cased string. + */ + kebabCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.kebabCase + */ + kebabCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.kebabCase + */ + kebabCase(): LoDashExplicitWrapper; + } + + //_.pad + interface LoDashStatic { + /** + * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if + * they can’t be evenly divided by length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + pad( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.pad + */ + pad( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.pad + */ + pad( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.padLeft + interface LoDashStatic { + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + padLeft( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.padLeft + */ + padLeft( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.padLeft + */ + padLeft( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.padRight + interface LoDashStatic { + /** + * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + padRight( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.padRight + */ + padRight( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.padRight + */ + padRight( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + + //_.parseInt + interface LoDashStatic { + /** + * Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used + * unless value is a hexadecimal, in which case a radix of 16 is used. + * + * Note: This method aligns with the ES5 implementation of parseInt. + * + * @param string The string to convert. + * @param radix The radix to interpret value by. + * @return Returns the converted integer. + */ + parseInt( + string: string, + radix?: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.parseInt + */ + parseInt(radix?: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.parseInt + */ + parseInt(radix?: number): LoDashExplicitWrapper; + } + + //_.repeat + interface LoDashStatic { + /** + * Repeats the given string n times. + * + * @param string The string to repeat. + * @param n The number of times to repeat the string. + * @return Returns the repeated string. + */ + repeat( + string?: string, + n?: number + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.repeat + */ + repeat(n?: number): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.repeat + */ + repeat(n?: number): LoDashExplicitWrapper; + } + + //_.snakeCase + interface LoDashStatic { + /** + * Converts string to snake case. + * + * @param string The string to convert. + * @return Returns the snake cased string. + */ + snakeCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.snakeCase + */ + snakeCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.snakeCase + */ + snakeCase(): LoDashExplicitWrapper; + } + + //_.startCase + interface LoDashStatic { + /** + * Converts string to start case. + * + * @param string The string to convert. + * @return Returns the start cased string. + */ + startCase(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.startCase + */ + startCase(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.startCase + */ + startCase(): LoDashExplicitWrapper; + } + + //_.startsWith + interface LoDashStatic { + /** + * Checks if string starts with the given target string. + * + * @param string The string to search. + * @param target The string to search for. + * @param position The position to search from. + * @return Returns true if string starts with target, else false. + */ + startsWith( + string?: string, + target?: string, + position?: number + ): boolean; + } + + interface LoDashImplicitWrapper { + /** + * @see _.startsWith + */ + startsWith( + target?: string, + position?: number + ): boolean; + } + + interface LoDashExplicitWrapper { + /** + * @see _.startsWith + */ + startsWith( + target?: string, + position?: number + ): LoDashExplicitWrapper; + } + + //_.template + interface TemplateOptions extends TemplateSettings { + /** + * The sourceURL of the template's compiled source. + */ + sourceURL?: string; + } + + interface TemplateExecutor { + (data?: Object): string; + source: string; + } + + interface LoDashStatic { + /** + * Creates a compiled template function that can interpolate data properties in "interpolate" delimiters, + * HTML-escape interpolated data properties in "escape" delimiters, and execute JavaScript in "evaluate" + * delimiters. Data properties may be accessed as free variables in the template. If a setting object is + * provided it takes precedence over _.templateSettings values. + * + * Note: In the development build _.template utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) for easier + * debugging. + * + * For more information on precompiling templates see + * [lodash's custom builds documentation](https://lodash.com/custom-builds). + * + * For more information on Chrome extension sandboxes see + * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). + * + * @param string The template string. + * @param options The options object. + * @param options.escape The HTML "escape" delimiter. + * @param options.evaluate The "evaluate" delimiter. + * @param options.imports An object to import into the template as free variables. + * @param options.interpolate The "interpolate" delimiter. + * @param options.sourceURL The sourceURL of the template's compiled source. + * @param options.variable The data object variable name. + * @return Returns the compiled template function. + */ + template( + string: string, + options?: TemplateOptions + ): TemplateExecutor; + } + + interface LoDashImplicitWrapper { + /** + * @see _.template + */ + template(options?: TemplateOptions): TemplateExecutor; + } + + interface LoDashExplicitWrapper { + /** + * @see _.template + */ + template(options?: TemplateOptions): LoDashExplicitObjectWrapper; + } + + //_.trim + interface LoDashStatic { + /** + * Removes leading and trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trim( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trim + */ + trim(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trim + */ + trim(chars?: string): LoDashExplicitWrapper; + } + + //_.trimLeft + interface LoDashStatic { + /** + * Removes leading whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trimLeft( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trimLeft + */ + trimLeft(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trimLeft + */ + trimLeft(chars?: string): LoDashExplicitWrapper; + } + + //_.trimRight + interface LoDashStatic { + /** + * Removes trailing whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trimRight( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trimRight + */ + trimRight(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trimRight + */ + trimRight(chars?: string): LoDashExplicitWrapper; + } + + //_.trunc + interface TruncOptions { + /** The maximum string length. */ + length?: number; + /** The string to indicate text is omitted. */ + omission?: string; + /** The separator pattern to truncate to. */ + separator?: string|RegExp; + } + + interface LoDashStatic { + /** + * Truncates string if it’s longer than the given maximum string length. The last characters of the truncated + * string are replaced with the omission string which defaults to "…". + * + * @param string The string to truncate. + * @param options The options object or maximum string length. + * @return Returns the truncated string. + */ + trunc( + string?: string, + options?: TruncOptions|number + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trunc + */ + trunc(options?: TruncOptions|number): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trunc + */ + trunc(options?: TruncOptions|number): LoDashExplicitWrapper; + } + + //_.unescape + interface LoDashStatic { + /** + * The inverse of _.escape; this method converts the HTML entities &, <, >, ", ', and ` + * in string to their corresponding characters. + * + * @param string The string to unescape. + * @return Returns the unescaped string. + */ + unescape(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.unescape + */ + unescape(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.unescape + */ + unescape(): LoDashExplicitWrapper; + } + + //_.words + interface LoDashStatic { + /** + * Splits string into an array of its words. + * + * @param string The string to inspect. + * @param pattern The pattern to match words. + * @return Returns the words of string. + */ + words( + string?: string, + pattern?: string|RegExp + ): string[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.words + */ + words(pattern?: string|RegExp): string[]; + } + + interface LoDashExplicitWrapper { + /** + * @see _.words + */ + words(pattern?: string|RegExp): LoDashExplicitArrayWrapper; + } + + /*********** + * Utility * + ***********/ + + //_.attempt + interface LoDashStatic { + /** + * Attempts to invoke func, returning either the result or the caught error object. Any additional arguments + * are provided to func when it’s invoked. + * + * @param func The function to attempt. + * @return Returns the func result or error object. + */ + attempt(func: (...args: any[]) => TResult, ...args: any[]): TResult|Error; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.attempt + */ + attempt(...args: any[]): TResult|Error; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.attempt + */ + attempt(...args: any[]): LoDashExplicitObjectWrapper; + } + + //_.callback + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of thisArg and arguments of the created function. + * If func is a property name the created callback returns the property value for a given element. If func is + * an object the created callback returns true for elements that contain the equivalent object properties, + * otherwise it returns false. + * + * @param func The value to convert to a callback. + * @param thisArg The this binding of func. + * @result Returns the callback. + */ + callback( + func: Function, + thisArg?: any + ): (...args: any[]) => TResult; + + /** + * @see _.callback + */ + callback( + func: string, + thisArg?: any + ): (object: any) => TResult; + + /** + * @see _.callback + */ + callback( + func: Object, + thisArg?: any + ): (object: any) => boolean; + + /** + * @see _.callback + */ + callback(): (value: TResult) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + callback(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + } + + //_.constant + interface LoDashStatic { + /** + * Creates a function that returns value. + * + * @param value The value to return from the new function. + * @return Returns the new function. + */ + constant(value: T): () => T; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.constant + */ + constant(): LoDashImplicitObjectWrapper<() => TResult>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.constant + */ + constant(): LoDashExplicitObjectWrapper<() => TResult>; + } + + //_.identity + interface LoDashStatic { + /** + * This method returns the first argument provided to it. + * @param value Any value. + * @return Returns value. + */ + identity(value?: T): T; + } + + interface LoDashImplicitWrapper { + /** + * @see _.identity + */ + identity(): T; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.identity + */ + identity(): T[]; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.identity + */ + identity(): T; + } + + //_.iteratee + interface LoDashStatic { + /** + * @see _.callback + */ + iteratee( + func: Function, + thisArg?: any + ): (...args: any[]) => TResult; + + /** + * @see _.callback + */ + iteratee( + func: string, + thisArg?: any + ): (object: any) => TResult; + + /** + * @see _.callback + */ + iteratee( + func: Object, + thisArg?: any + ): (object: any) => boolean; + + /** + * @see _.callback + */ + iteratee(): (value: TResult) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; + + /** + * @see _.callback + */ + iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + } + + //_.matches + interface LoDashStatic { + /** + * Creates a function that performs a deep comparison between a given object and source, returning true if the + * given object has equivalent property values, else false. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. For comparing a single own + * or inherited property value see _.matchesProperty. + * + * @param source The object of property values to match. + * @return Returns the new function. + */ + matches(source: T): (value: any) => boolean; + + /** + * @see _.matches + */ + matches(source: T): (value: V) => boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.matches + */ + matches(): LoDashImplicitObjectWrapper<(value: V) => boolean>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.matches + */ + matches(): LoDashExplicitObjectWrapper<(value: V) => boolean>; + } + + //_.matchesProperty + interface LoDashStatic { + /** + * Creates a function that compares the property value of path on a given object to value. + * + * Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and + * strings. Objects are compared by their own, not inherited, enumerable properties. + * + * @param path The path of the property to get. + * @param srcValue The value to match. + * @return Returns the new function. + */ + matchesProperty( + path: StringRepresentable|StringRepresentable[], + srcValue: T + ): (value: any) => boolean; + + /** + * @see _.matchesProperty + */ + matchesProperty( + path: StringRepresentable|StringRepresentable[], + srcValue: T + ): (value: V) => boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashImplicitObjectWrapper<(value: any) => boolean>; + + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashImplicitObjectWrapper<(value: Value) => boolean>; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashExplicitObjectWrapper<(value: any) => boolean>; + + /** + * @see _.matchesProperty + */ + matchesProperty( + srcValue: SrcValue + ): LoDashExplicitObjectWrapper<(value: Value) => boolean>; + } + + //_.method + interface LoDashStatic { + /** + * Creates a function that invokes the method at path on a given object. Any additional arguments are provided + * to the invoked method. + * + * @param path The path of the method to invoke. + * @param args The arguments to invoke the method with. + * @return Returns the new function. + */ + method( + path: string|StringRepresentable[], + ...args: any[] + ): (object: TObject) => TResult; + + /** + * @see _.method + */ + method( + path: string|StringRepresentable[], + ...args: any[] + ): (object: any) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashImplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: TObject) => TResult>; + + /** + * @see _.method + */ + method(...args: any[]): LoDashExplicitObjectWrapper<(object: any) => TResult>; + } + + //_.methodOf + interface LoDashStatic { + /** + * The opposite of _.method; this method creates a function that invokes the method at a given path on object. + * Any additional arguments are provided to the invoked method. + * + * @param object The object to query. + * @param args The arguments to invoke the method with. + * @return Returns the new function. + */ + methodOf( + object: TObject, + ...args: any[] + ): (path: StringRepresentable|StringRepresentable[]) => TResult; + + /** + * @see _.methodOf + */ + methodOf( + object: {}, + ...args: any[] + ): (path: StringRepresentable|StringRepresentable[]) => TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.methodOf + */ + methodOf( + ...args: any[] + ): LoDashImplicitObjectWrapper<(path: StringRepresentable|StringRepresentable[]) => TResult>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.methodOf + */ + methodOf( + ...args: any[] + ): LoDashExplicitObjectWrapper<(path: StringRepresentable|StringRepresentable[]) => TResult>; + } + + //_.mixin + interface MixinOptions { + chain?: boolean; + } + + interface LoDashStatic { + /** + * Adds all own enumerable function properties of a source object to the destination object. If object is a + * function then methods are added to its prototype as well. + * + * Note: Use _.runInContext to create a pristine lodash function to avoid conflicts caused by modifying + * the original. + * + * @param object The destination object. + * @param source The object of functions to add. + * @param options The options object. + * @param options.chain Specify whether the functions added are chainable. + * @return Returns object. + */ + mixin( + object: TObject, + source: Dictionary, + options?: MixinOptions + ): TResult; + + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): TResult; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashImplicitObjectWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.mixin + */ + mixin( + source: Dictionary, + options?: MixinOptions + ): LoDashExplicitObjectWrapper; + + /** + * @see _.mixin + */ + mixin( + options?: MixinOptions + ): LoDashExplicitObjectWrapper; + } + + //_.noConflict + interface LoDashStatic { + /** + * Reverts the _ variable to its previous value and returns a reference to the lodash function. + * + * @return Returns the lodash function. + */ + noConflict(): typeof _; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.noConflict + */ + noConflict(): typeof _; + } + + //_.noop + interface LoDashStatic { + /** + * A no-operation function that returns undefined regardless of the arguments it receives. + * + * @return undefined + */ + noop(...args: any[]): void; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.noop + */ + noop(...args: any[]): void; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.noop + */ + noop(...args: any[]): _.LoDashExplicitWrapper; + } + + //_.property + interface LoDashStatic { + /** + * Creates a function that returns the property value at path on a given object. + * + * @param path The path of the property to get. + * @return Returns the new function. + */ + property(path: StringRepresentable|StringRepresentable[]): (obj: TObj) => TResult; + } + + interface LoDashImplicitWrapper { + /** + * @see _.property + */ + property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.property + */ + property(): LoDashImplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashExplicitWrapper { + /** + * @see _.property + */ + property(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.property + */ + property(): LoDashExplicitObjectWrapper<(obj: TObj) => TResult>; + } + + //_.propertyOf + interface LoDashStatic { + /** + * The opposite of _.property; this method creates a function that returns the property value at a given path + * on object. + * + * @param object The object to query. + * @return Returns the new function. + */ + propertyOf(object: T): (path: string|string[]) => any; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.propertyOf + */ + propertyOf(): LoDashImplicitObjectWrapper<(path: string|string[]) => any>; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.propertyOf + */ + propertyOf(): LoDashExplicitObjectWrapper<(path: string|string[]) => any>; + } + + //_.range + interface LoDashStatic { + /** + * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. + * If end is not specified it’s set to start with start then set to 0. If end is less than start a zero-length + * range is created unless a negative step is specified. + * + * @param start The start of the range. + * @param end The end of the range. + * @param step The value to increment or decrement by. + * @return Returns a new range array. + */ + range( + start: number, + end: number, + step?: number + ): number[]; + + /** + * @see _.range + */ + range( + end: number, + step?: number + ): number[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.range + */ + range( + end?: number, + step?: number + ): LoDashExplicitArrayWrapper; + } + + //_.runInContext + interface LoDashStatic { + /** + * Create a new pristine lodash function using the given context object. + * + * @param context The context object. + * @return Returns a new lodash function. + */ + runInContext(context?: Object): typeof _; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.runInContext + */ + runInContext(): typeof _; + } + + //_.times + interface LoDashStatic { + /** + * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee is + * bound to thisArg and invoked with one argument; (index). + * + * @param n The number of times to invoke iteratee. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the array of results. + */ + times( + n: number, + iteratee: (num: number) => TResult, + thisArg?: any + ): TResult[]; + + /** + * @see _.times + */ + times(n: number): number[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult, + thisArgs?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.times + */ + times(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.times + */ + times( + iteratee: (num: number) => TResult, + thisArgs?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.times + */ + times(): LoDashExplicitArrayWrapper; + } + + //_.uniqueId + interface LoDashStatic { + /** + * Generates a unique ID. If prefix is provided the ID is appended to it. + * + * @param prefix The value to prefix the ID with. + * @return Returns the unique ID. + */ + uniqueId(prefix?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniqueId + */ + uniqueId(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniqueId + */ + uniqueId(): LoDashExplicitWrapper; + } + + interface ListIterator { + (value: T, index: number, collection: List): TResult; + } + + interface DictionaryIterator { + (value: T, key?: string, collection?: Dictionary): TResult; + } + + interface NumericDictionaryIterator { + (value: T, key?: number, collection?: Dictionary): TResult; + } + + interface ObjectIterator { + (element: T, key?: string, collection?: any): TResult; + } + + interface StringIterator { + (char: string, index?: number, string?: string): TResult; + } + + interface MemoVoidIterator { + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): void; + } + interface MemoIterator { + (prev: TResult, curr: T, indexOrKey?: any, list?: T[]): TResult; + } + + interface MemoVoidArrayIterator { + (acc: TResult, curr: T, index?: number, arr?: T[]): void; + } + interface MemoVoidDictionaryIterator { + (acc: TResult, curr: T, key?: string, dict?: Dictionary): void; + } + + //interface Collection {} + + // Common interface between Arrays and jQuery objects + interface List { + [index: number]: T; + length: number; + } + + interface Dictionary { + [index: string]: T; + } + + interface NumericDictionary { + [index: number]: T; + } + + interface StringRepresentable { + toString(): string; + } + + interface Cancelable { + cancel(): void; + } +} + +declare module "lodash" { + export = _; +} \ No newline at end of file diff --git a/typings/main/ambient/mocha-node/index.d.ts b/typings/main/ambient/mocha-node/index.d.ts new file mode 100644 index 00000000..25b55951 --- /dev/null +++ b/typings/main/ambient/mocha-node/index.d.ts @@ -0,0 +1,16 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/098def61bc44ee29dae7e7a5c719873195086ac2/mocha/mocha-node.d.ts +// Type definitions for mocha 2.2.5 +// Project: http://mochajs.org/ +// Definitions by: Vadim Macagon , vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module Mocha { + interface IRunnable extends NodeJS.EventEmitter { + } + interface ISuite extends NodeJS.EventEmitter { + } + interface IRunner extends NodeJS.EventEmitter { + } +} \ No newline at end of file diff --git a/typings/main/ambient/mocha/index.d.ts b/typings/main/ambient/mocha/index.d.ts new file mode 100644 index 00000000..851d48a8 --- /dev/null +++ b/typings/main/ambient/mocha/index.d.ts @@ -0,0 +1,238 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/d6dd320291705694ba8e1a79497a908e9f5e6617/mocha/mocha.d.ts +// Type definitions for mocha 2.2.5 +// Project: http://mochajs.org/ +// Definitions by: Kazi Manzur Rashid , otiai10 , jt000 , Vadim Macagon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface MochaSetupOptions { + //milliseconds to wait before considering a test slow + slow?: number; + + // timeout in milliseconds + timeout?: number; + + // ui name "bdd", "tdd", "exports" etc + ui?: string; + + //array of accepted globals + globals?: any[]; + + // reporter instance (function or string), defaults to `mocha.reporters.Spec` + reporter?: any; + + // bail on the first test failure + bail?: boolean; + + // ignore global leaks + ignoreLeaks?: boolean; + + // grep string or regexp to filter tests with + grep?: any; +} + +interface MochaDone { + (error?: Error): void; +} + +declare var mocha: Mocha; +declare var describe: Mocha.IContextDefinition; +declare var xdescribe: Mocha.IContextDefinition; +// alias for `describe` +declare var context: Mocha.IContextDefinition; +// alias for `describe` +declare var suite: Mocha.IContextDefinition; +declare var it: Mocha.ITestDefinition; +declare var xit: Mocha.ITestDefinition; +// alias for `it` +declare var test: Mocha.ITestDefinition; + +declare function before(action: () => void): void; + +declare function before(action: (done: MochaDone) => void): void; + +declare function before(description: string, action: () => void): void; + +declare function before(description: string, action: (done: MochaDone) => void): void; + +declare function setup(action: () => void): void; + +declare function setup(action: (done: MochaDone) => void): void; + +declare function after(action: () => void): void; + +declare function after(action: (done: MochaDone) => void): void; + +declare function after(description: string, action: () => void): void; + +declare function after(description: string, action: (done: MochaDone) => void): void; + +declare function teardown(action: () => void): void; + +declare function teardown(action: (done: MochaDone) => void): void; + +declare function beforeEach(action: () => void): void; + +declare function beforeEach(action: (done: MochaDone) => void): void; + +declare function beforeEach(description: string, action: () => void): void; + +declare function beforeEach(description: string, action: (done: MochaDone) => void): void; + +declare function suiteSetup(action: () => void): void; + +declare function suiteSetup(action: (done: MochaDone) => void): void; + +declare function afterEach(action: () => void): void; + +declare function afterEach(action: (done: MochaDone) => void): void; + +declare function afterEach(description: string, action: () => void): void; + +declare function afterEach(description: string, action: (done: MochaDone) => void): void; + +declare function suiteTeardown(action: () => void): void; + +declare function suiteTeardown(action: (done: MochaDone) => void): void; + +declare class Mocha { + constructor(options?: { + grep?: RegExp; + ui?: string; + reporter?: string; + timeout?: number; + bail?: boolean; + }); + + /** Setup mocha with the given options. */ + setup(options: MochaSetupOptions): Mocha; + bail(value?: boolean): Mocha; + addFile(file: string): Mocha; + /** Sets reporter by name, defaults to "spec". */ + reporter(name: string): Mocha; + /** Sets reporter constructor, defaults to mocha.reporters.Spec. */ + reporter(reporter: (runner: Mocha.IRunner, options: any) => any): Mocha; + ui(value: string): Mocha; + grep(value: string): Mocha; + grep(value: RegExp): Mocha; + invert(): Mocha; + ignoreLeaks(value: boolean): Mocha; + checkLeaks(): Mocha; + /** + * Function to allow assertion libraries to throw errors directly into mocha. + * This is useful when running tests in a browser because window.onerror will + * only receive the 'message' attribute of the Error. + */ + throwError(error: Error): void; + /** Enables growl support. */ + growl(): Mocha; + globals(value: string): Mocha; + globals(values: string[]): Mocha; + useColors(value: boolean): Mocha; + useInlineDiffs(value: boolean): Mocha; + timeout(value: number): Mocha; + slow(value: number): Mocha; + enableTimeouts(value: boolean): Mocha; + asyncOnly(value: boolean): Mocha; + noHighlighting(value: boolean): Mocha; + /** Runs tests and invokes `onComplete()` when finished. */ + run(onComplete?: (failures: number) => void): Mocha.IRunner; +} + +// merge the Mocha class declaration with a module +declare module Mocha { + /** Partial interface for Mocha's `Runnable` class. */ + interface IRunnable { + title: string; + fn: Function; + async: boolean; + sync: boolean; + timedOut: boolean; + } + + /** Partial interface for Mocha's `Suite` class. */ + interface ISuite { + parent: ISuite; + title: string; + + fullTitle(): string; + } + + /** Partial interface for Mocha's `Test` class. */ + interface ITest extends IRunnable { + parent: ISuite; + pending: boolean; + + fullTitle(): string; + } + + /** Partial interface for Mocha's `Runner` class. */ + interface IRunner {} + + interface IContextDefinition { + (description: string, spec: () => void): ISuite; + only(description: string, spec: () => void): ISuite; + skip(description: string, spec: () => void): void; + timeout(ms: number): void; + } + + interface ITestDefinition { + (expectation: string, assertion?: () => void): ITest; + (expectation: string, assertion?: (done: MochaDone) => void): ITest; + only(expectation: string, assertion?: () => void): ITest; + only(expectation: string, assertion?: (done: MochaDone) => void): ITest; + skip(expectation: string, assertion?: () => void): void; + skip(expectation: string, assertion?: (done: MochaDone) => void): void; + timeout(ms: number): void; + } + + export module reporters { + export class Base { + stats: { + suites: number; + tests: number; + passes: number; + pending: number; + failures: number; + }; + + constructor(runner: IRunner); + } + + export class Doc extends Base {} + export class Dot extends Base {} + export class HTML extends Base {} + export class HTMLCov extends Base {} + export class JSON extends Base {} + export class JSONCov extends Base {} + export class JSONStream extends Base {} + export class Landing extends Base {} + export class List extends Base {} + export class Markdown extends Base {} + export class Min extends Base {} + export class Nyan extends Base {} + export class Progress extends Base { + /** + * @param options.open String used to indicate the start of the progress bar. + * @param options.complete String used to indicate a complete test on the progress bar. + * @param options.incomplete String used to indicate an incomplete test on the progress bar. + * @param options.close String used to indicate the end of the progress bar. + */ + constructor(runner: IRunner, options?: { + open?: string; + complete?: string; + incomplete?: string; + close?: string; + }); + } + export class Spec extends Base {} + export class TAP extends Base {} + export class XUnit extends Base { + constructor(runner: IRunner, options?: any); + } + } +} + +declare module "mocha" { + export = Mocha; +} \ No newline at end of file diff --git a/typings/main/ambient/mongoose/index.d.ts b/typings/main/ambient/mongoose/index.d.ts new file mode 100644 index 00000000..28c89c99 --- /dev/null +++ b/typings/main/ambient/mongoose/index.d.ts @@ -0,0 +1,504 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/cebde64b3a1d63d07ee7c7dbc49b631ce220d027/mongoose/mongoose.d.ts +// Type definitions for Mongoose 3.8.5 +// Project: http://mongoosejs.com/ +// Definitions by: horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module "mongoose" { + function connect(uri: string, options?: ConnectionOptions , callback?: (err: any) => void): Mongoose; + function createConnection(): Connection; + function createConnection(uri: string, options?: ConnectionOptions): Connection; + function createConnection(host: string, database_name: string, port?: number, options?: ConnectionOptions): Connection; + function disconnect(callback?: (err?: any) => void): Mongoose; + + function model(name: string, schema?: Schema, collection?: string, skipInit?: boolean): Model; + function modelNames(): string[]; + function plugin(plugin: (schema: Schema, options?: Object) => void, options?: Object): Mongoose; + + function get(key: string): any; + function set(key: string, value: any): void; + + var mongo: any; + var mquery: any; + var version: string; + var connection: Connection; + + export class Mongoose { + connect(uri: string, options?: ConnectOpenOptionsBase, callback?: (err: any) => void): Mongoose; + createConnection(): Connection; + createConnection(uri: string, options?: Object): Connection; + createConnection(host: string, database_name: string, port?: number, options?: ConnectOpenOptionsBase): Connection; + disconnect(callback?: (err?: any) => void): Mongoose; + get(key: string): any; + model(name: string, schema?: Schema, collection?: string, skipInit?: boolean): Model; + modelNames(): string[]; + plugin(plugin: (schema: Schema, options?: Object) => void, options?: Object): Mongoose; + set(key: string, value: any): void; + + mongo: any; + mquery: any; + version: string; + connection: Connection; + } + + export interface Connection extends NodeJS.EventEmitter { + constructor(base: Mongoose): Connection; + + close(callback?: (err: any) => void): Connection; + collection(name: string, options?: Object): Collection; + model(name: string, schema?: Schema, collection?: string): Model; + modelNames(): string[]; + open(host: string, database?: string, port?: number, options?: OpenSetConnectionOptions, callback?: (err: any) => void): Connection; + openSet(uris: string, database?: string, options?: OpenSetConnectionOptions, callback?: (err: any) => void): Connection; + + db: any; + collections: {[index: string]: Collection}; + readyState: number; + } + + export interface ConnectOpenOptionsBase { + db?: any; + server?: any; + replset?: any; + /** Username for authentication if not supplied in the URI. */ + user?: string; + /** Password for authentication if not supplied in the URI. */ + pass?: string; + /** Options for authentication */ + auth?: any; + } + + export interface ConnectionOptions extends ConnectOpenOptionsBase { + /** Passed to the underlying driver's Mongos instance. */ + mongos?: MongosOptions; + } + + interface OpenSetConnectionOptions extends ConnectOpenOptionsBase { + /** If true, enables High Availability support for mongos */ + mongos?: boolean; + } + + interface MongosOptions { + /** Turn on high availability monitoring. (default: true) */ + ha?: boolean; + /** Time between each replicaset status check. (default: 5000) */ + haInterval?: number; + /** + * Number of connections in the connection pool for each + * server instance. (default: 5 (for legacy reasons)) */ + poolSize?: number; + /** + * Use ssl connection (needs to have a mongod server with + * ssl support). (default: false). + */ + ssl?: boolean; + /** + * Validate mongod server certificate against ca + * (needs to have a mongod server with ssl support, 2.4 or higher) + * (default: true) + */ + sslValidate?: boolean; + /** Turn on high availability monitoring. */ + sslCA?: (Buffer|string)[]; + sslKey?: Buffer|string; + sslPass?: Buffer|string; + socketOptions?: { + noDelay?: boolean; + keepAlive?: number; + connectionTimeoutMS?: number; + socketTimeoutMS?: number; + }; + } + + export interface Collection { + } + + + export class SchemaType { } + export class VirtualType { + get(fn: Function): VirtualType; + set(fn: Function): VirtualType; + } + export module Types { + export class ObjectId { + constructor(id?: string|number); + toHexString(): string; + equals(other: ObjectId): boolean; + getTimestamp(): Date; + isValid(): boolean; + static createFromTime(time: number): ObjectId; + static createFromHexString(hexString: string): ObjectId; + } + } + + export class Schema { + static Types: { + String: String; + ObjectId: Types.ObjectId; + OId: Types.ObjectId; + Mixed: any; + }; + constructor(schema?: Object, options?: Object); + + add(obj: Object, prefix?: string): void; + eachPath(fn: (path: string, type: any) => void): Schema; + get(key: string): any; + index(fields: Object, options?: Object): Schema; + indexes(): void; + method(name: string, fn: Function): Schema; + method(method: Object): Schema; + path(path: string): any; + path(path: string, constructor: any): Schema; + pathType(path: string): string; + plugin(plugin: (schema: Schema, options?: Object) => void, options?: Object): Schema; + post(method: string, fn: Function): Schema; + pre(method: string, callback: Function): Schema; + requiredPaths(): string[]; + set(key: string, value: any): void; + static(name: string, fn: Function): Schema; + virtual(name: string, options?: Object): VirtualType; + virtualpath(name: string): VirtualType; + } + export interface SchemaOption { + autoIndex?: boolean; + bufferCommands?: boolean; + capped?: boolean; + collection?: string; + id?: boolean; + _id?: boolean; + minimize?: boolean; + read?: string; + safe?: boolean; + shardKey?: boolean; + strict?: boolean; + toJSON?: Object; + toObject?: Object; + versionKey?: boolean; + } + + export interface Model extends NodeJS.EventEmitter { + new(doc?: Object, fields?: Object, skipInit?: boolean): T; + + aggregate(...aggregations: Object[]): Aggregate; + aggregate(aggregation: Object, callback: (err: any, res: T[]) => void): Promise; + aggregate(aggregation1: Object, aggregation2: Object, callback: (err: any, res: T[]) => void): Promise; + aggregate(aggregation1: Object, aggregation2: Object, aggregation3: Object, callback: (err: any, res: T[]) => void): Promise; + count(conditions: Object, callback?: (err: any, count: number) => void): Query; + + create(doc: Object, fn?: (err: any, res: T) => void): Promise; + create(doc1: Object, doc2: Object, fn?: (err: any, res1: T, res2: T) => void): Promise; + create(doc1: Object, doc2: Object, doc3: Object, fn?: (err: any, res1: T, res2: T, res3: T) => void): Promise; + discriminator(name: string, schema: Schema): Model; + distinct(field: string, callback?: (err: any, res: T[]) => void): Query; + distinct(field: string, conditions: Object, callback?: (err: any, res: T[]) => void): Query; + ensureIndexes(callback: (err: any) => void): Promise; + + find(cond: Object, callback?: (err: any, res: T[]) => void): Query; + find(cond: Object, fields: Object, callback?: (err: any, res: T[]) => void): Query; + find(cond: Object, fields: Object, options: Object, callback?: (err: any, res: T[]) => void): Query; + findById(id: string, callback?: (err: any, res: T) => void): Query; + findById(id: string, fields: Object, callback?: (err: any, res: T) => void): Query; + findById(id: string, fields: Object, options: Object, callback?: (err: any, res: T) => void): Query; + findByIdAndRemove(id: string, callback?: (err: any, res: T) => void): Query; + findByIdAndRemove(id: string, options: Object, callback?: (err: any, res: T) => void): Query; + findByIdAndUpdate(id: string, update: Object, callback?: (err: any, res: T) => void): Query; + findByIdAndUpdate(id: string, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query; + findOne(cond?: Object, callback?: (err: any, res: T) => void): Query; + findOne(cond: Object, fields: Object, callback?: (err: any, res: T) => void): Query; + findOne(cond: Object, fields: Object, options: Object, callback?: (err: any, res: T) => void): Query; + findOneAndRemove(cond: Object, callback?: (err: any, res: T) => void): Query; + findOneAndRemove(cond: Object, options: Object, callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(cond: Object, update: Object, callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(cond: Object, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query; + + geoNear(point: { type: string; coordinates: number[] }, options: Object, callback?: (err: any, res: T[], stats: any) => void): Query; + geoNear(point: number[], options: Object, callback?: (err: any, res: T[], stats: any) => void): Query; + geoSearch(cond: Object, options: GeoSearchOption, callback?: (err: any, res: T[]) => void): Query; + increment(): T; + mapReduce(options: MapReduceOption, callback?: (err: any, res: MapReduceResult[]) => void): Promise[]>; + mapReduce(options: MapReduceOption2, callback?: (err: any, res: MapReduceResult[]) => void): Promise[]>; + model(name: string): Model; + + populate(doc: U, options: Object, callback?: (err: any, res: U) => void): Promise; + populate(doc: U[], options: Object, callback?: (err: any, res: U[]) => void): Promise; + update(cond: Object, update: Object, callback?: (err: any, affectedRows: number, raw: any) => void): Query; + update(cond: Object, update: Object, options: Object, callback?: (err: any, affectedRows: number, raw: any) => void): Query; + remove(cond: Object, callback?: (err: any) => void): Query<{}>; + save(callback?: (err: any, result: T, numberAffected: number) => void): Query; + where(path: string, val?: Object): Query; + + $where(argument: string): Query; + $where(argument: Function): Query; + + base: Mongoose; + collection: Collection; + db: any; + discriminators: any; + modelName: string; + schema: Schema; + } + export interface FindAndUpdateOption { + new?: boolean; + upsert?: boolean; + sort?: Object; + select?: Object; + } + export interface GeoSearchOption { + near: number[]; + maxDistance: number; + limit?: number; + lean?: boolean; + } + export interface MapReduceOption { + map: () => void; + reduce: (key: Key, vals: T[]) => Val; + query?: Object; + limit?: number; + keeptemp?: boolean; + finalize?: (key: Key, val: Val) => Val; + scope?: Object; + jsMode?: boolean; + verbose?: boolean; + out?: { + inline?: number; + replace?: string; + reduce?: string; + merge?: string; + }; + } + export interface MapReduceOption2 { + map: string; + reduce: (key: Key, vals: T[]) => Val; + query?: Object; + limit?: number; + keeptemp?: boolean; + finalize?: (key: Key, val: Val) => Val; + scope?: Object; + jsMode?: boolean; + verbose?: boolean; + out?: { + inline?: number; + replace?: string; + reduce?: string; + merge?: string; + }; + } + export interface MapReduceResult { + _id: Key; + value: Val; + } + + export class Query { + exec(callback?: (err: any, res: T) => void): Promise; + exec(operation: string, callback?: (err: any, res: T) => void): Promise; + exec(operation: Function, callback?: (err: any, res: T) => void): Promise; + + all(val: number): Query; + all(path: string, val: number): Query; + and(array: Object[]): Query; + box(val: Object): Query; + box(a: number[], b: number[]): Query; + batchSize(val: number): Query; + cast(model: Model, obj: Object): U; + //center(): Query; + //centerSphere(path: string, val: Object): Query; + circle(area: Object): Query; + circle(path: string, area: Object): Query; + comment(val: any): Query; + count(callback?: (err: any, count: number) => void): Query; + count(criteria: Object, callback?: (err: any, count: number) => void): Query; + distinct(callback?: (err: any, res: T) => void): Query; + distinct(field: string, callback?: (err: any, res: T) => void): Query; + distinct(criteria: Object, field: string, callback?: (err: any, res: T) => void): Query; + distinct(criteria: Query, field: string, callback?: (err: any, res: T) => void): Query; + elemMatch(criteria: Object): Query; + elemMatch(criteria: (elem: Query) => void): Query; + elemMatch(path: string, criteria: Object): Query; + elemMatch(path: string, criteria: (elem: Query) => void): Query; + equals(val: Object): Query; + exists(val?: boolean): Query; + exists(path: string, val?: boolean): Query; + find(callback?: (err: any, res: T) => void): Query; + find(criteria: Object, callback?: (err: any, res: T) => void): Query; + findOne(callback?: (err: any, res: T) => void): Query; + findOne(criteria: Object, callback?: (err: any, res: T) => void): Query; + findOneAndRemove(callback?: (err: any, res: T) => void): Query; + findOneAndRemove(cond: Object, callback?: (err: any, res: T) => void): Query; + findOneAndRemove(cond: Object, options: Object, callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(update: Object, callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(cond: Object, update: Object, callback?: (err: any, res: T) => void): Query; + findOneAndUpdate(cond: Object, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query; + geometry(object: Object): Query; + gt(val: number): Query; + gt(path: string, val: number): Query; + gte(val: number): Query; + gte(path: string, val: number): Query; + hint(val: Object): Query; + in(val: any[]): Query; + in(path: string, val: any[]): Query; + intersects(arg?: Object): Query; + lean(bool?: boolean): Query; + limit(val: number): Query; + lt(val: number): Query; + lt(path: string, val: number): Query; + lte(val: number): Query; + lte(path: string, val: number): Query; + maxDistance(val: number): Query; + maxDistance(path: string, val: number): Query; + maxScan(val: number): Query; + merge(source: Query): Query; + merge(source: Object): Query; + mod(val: number[]): Query; + mod(path: string, val: number[]): Query; + ne(val: any): Query; + ne(path: string, val: any): Query; + near(val: Object): Query; + near(path: string, val: Object): Query; + nearSphere(val: Object): Query; + nearSphere(path: string, val: Object): Query; + nin(val: any[]): Query; + nin(path: string, val: any[]): Query; + nor(array: Object[]): Query; + or(array: Object[]): Query; + polygon(...coordinatePairs: number[][]): Query; + polygon(path: string, ...coordinatePairs: number[][]): Query; + populate(path: string, select?: string, match?: Object, options?: Object): Query; + populate(path: string, select: string, model: string, match?: Object, options?: Object): Query; + populate(opt: PopulateOption): Query; + read(pref: string, tags?: Object[]): Query; + regex(val: RegExp): Query; + regex(path: string, val: RegExp): Query; + remove(callback?: (err: any, res: T) => void): Query; + remove(criteria: Object, callback?: (err: any, res: T) => void): Query; + select(arg: string): Query; + select(arg: Object): Query; + setOptions(options: Object): Query; + size(val: number): Query; + size(path: string, val: number): Query; + skip(val: number): Query; + slaveOk(v?: boolean): Query; + slice(val: number): Query; + slice(val: number[]): Query; + slice(path: string, val: number): Query; + slice(path: string, val: number[]): Query; + snapshot(v?: boolean): Query; + sort(arg: Object): Query; + sort(arg: string): Query; + stream(options?: { transform?: Function; }): QueryStream; + tailable(v?: boolean): Query; + toConstructor(): Query; + update(callback?: (err: any, affectedRows: number, doc: T) => void): Query; + update(doc: Object, callback?: (err: any, affectedRows: number, doc: T) => void): Query; + update(criteria: Object, doc: Object, callback?: (err: any, affectedRows: number, doc: T) => void): Query; + update(criteria: Object, doc: Object, options: Object, callback?: (err: any, affectedRows: number, doc: T) => void): Query; + where(path?: string, val?: any): Query; + where(path?: Object, val?: any): Query; + within(val?: Object): Query; + within(coordinate: number[], ...coordinatePairs: number[][]): Query; + + $where(argument: string): Query; + $where(argument: Function): Query; + + static use$geoWithin: boolean; + } + + export interface PopulateOption { + path: string; + select?: string; + model?: string; + match?: Object; + options?: Object; + } + + export interface QueryStream extends NodeJS.EventEmitter { + destory(err?: any): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + paused: number; + readable: boolean; + } + + export interface Document { + id?: string; + _id: any; + + equals(doc: Document): boolean; + get(path: string, type?: new(...args: any[]) => any): any; + inspect(options?: Object): string; + invalidate(path: string, errorMsg: string, value: any): void; + invalidate(path: string, error: Error, value: any): void; + isDirectModified(path: string): boolean; + isInit(path: string): boolean; + isModified(path?: string): boolean; + isSelected(path: string): boolean; + markModified(path: string): void; + modifiedPaths(): string[]; + populate(callback?: (err: any, res: T) => void): Document; + populate(path?: string, callback?: (err: any, res: T) => void): Document; + populate(opt: PopulateOption, callback?: (err: any, res: T) => void): Document; + populated(path: string): any; + remove(callback?: (err: any) => void): Query; + save(callback?: (err: any, res: T) => void): void; + set(path: string, val: any, type?: new(...args: any[]) => any, options?: Object): void; + set(path: string, val: any, options?: Object): void; + set(value: Object): void; + toJSON(options?: Object): Object; + toObject(options?: Object): Object; + toString(): string; + update(doc: Object, options: Object, callback: (err: any, affectedRows: number, raw: any) => void): Query; + validate(cb: (err: any) => void): void; + + isNew: boolean; + errors: Object; + schema: Object; + } + + + export class Aggregate { + constructor(...options: Object[]); + + append(...options: Object[]): Aggregate; + group(arg: Object): Aggregate; + limit(num: number): Aggregate; + match(arg: Object): Aggregate; + near(parameters: Object): Aggregate; + project(arg: string): Aggregate; + project(arg: Object): Aggregate; + select(filter: string): Aggregate; + skip(num: number): Aggregate; + sort(arg: string): Aggregate; + sort(arg: Object): Aggregate; + unwind(fiels: string, ...rest: string[]): Aggregate; + + exec(callback?: (err: any, result: T) => void): Promise; + read(pref: string, ...tags: Object[]): Aggregate; + } + + export class Promise { + constructor(fn?: (err: any, result: T) => void); + + then(onFulFill: (result: T) => void, onReject?: (err: any) => void): Promise; + end(): void; + + fulfill(result: T): Promise; + reject(err: any): Promise; + resolve(err: any, result: T): Promise; + + onFulfill(listener: (result: T) => void): Promise; + onReject(listener: (err: any) => void): Promise; + onResolve(listener: (err: any, result: T) => void): Promise; + on(event: string, listener: Function): Promise; + + // Deprecated methods. + addBack(listener: (err: any, result: T) => void): Promise; + addCallback(listener: (result: T) => void): Promise; + addErrback(listener: (err: any) => void): Promise; + complete(result: T): Promise; + error(err: any): Promise; + } + +} \ No newline at end of file diff --git a/typings/main/ambient/node/index.d.ts b/typings/main/ambient/node/index.d.ts new file mode 100644 index 00000000..4bea6186 --- /dev/null +++ b/typings/main/ambient/node/index.d.ts @@ -0,0 +1,2219 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/48c1e3c1d6baefa4f1a126f188c27c4fefd36bff/node/node.d.ts +// Type definitions for Node.js v4.x +// Project: http://nodejs.org/ +// Definitions by: Microsoft TypeScript , DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/************************************************ +* * +* Node.js v4.x API * +* * +************************************************/ + +interface Error { + stack?: string; +} + + +// compat for TypeScript 1.5.3 +// if you use with --target es3 or --target es5 and use below definitions, +// use the lib.es6.d.ts that is bundled with TypeScript 1.5.3. +interface MapConstructor {} +interface WeakMapConstructor {} +interface SetConstructor {} +interface WeakSetConstructor {} + +/************************************************ +* * +* GLOBAL * +* * +************************************************/ +declare var process: NodeJS.Process; +declare var global: NodeJS.Global; + +declare var __filename: string; +declare var __dirname: string; + +declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; +declare function clearTimeout(timeoutId: NodeJS.Timer): void; +declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; +declare function clearInterval(intervalId: NodeJS.Timer): void; +declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; +declare function clearImmediate(immediateId: any): void; + +interface NodeRequireFunction { + (id: string): any; +} + +interface NodeRequire extends NodeRequireFunction { + resolve(id:string): string; + cache: any; + extensions: any; + main: any; +} + +declare var require: NodeRequire; + +interface NodeModule { + exports: any; + require: NodeRequireFunction; + id: string; + filename: string; + loaded: boolean; + parent: any; + children: any[]; +} + +declare var module: NodeModule; + +// Same as module.exports +declare var exports: any; +declare var SlowBuffer: { + new (str: string, encoding?: string): Buffer; + new (size: number): Buffer; + new (size: Uint8Array): Buffer; + new (array: any[]): Buffer; + prototype: Buffer; + isBuffer(obj: any): boolean; + byteLength(string: string, encoding?: string): number; + concat(list: Buffer[], totalLength?: number): Buffer; +}; + + +// Buffer class +interface Buffer extends NodeBuffer {} + +/** + * Raw data is stored in instances of the Buffer class. + * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. + * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' + */ +declare var Buffer: { + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + */ + new (str: string, encoding?: string): Buffer; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + */ + new (size: number): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + new (array: Uint8Array): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + new (array: any[]): Buffer; + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + */ + new (buffer: Buffer): Buffer; + prototype: Buffer; + /** + * Returns true if {obj} is a Buffer + * + * @param obj object to test. + */ + isBuffer(obj: any): obj is Buffer; + /** + * Returns true if {encoding} is a valid encoding argument. + * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' + * + * @param encoding string to test. + */ + isEncoding(encoding: string): boolean; + /** + * Gives the actual byte length of a string. encoding defaults to 'utf8'. + * This is not the same as String.prototype.length since that returns the number of characters in a string. + * + * @param string string to test. + * @param encoding encoding used to evaluate (defaults to 'utf8') + */ + byteLength(string: string, encoding?: string): number; + /** + * Returns a buffer which is the result of concatenating all the buffers in the list together. + * + * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. + * If the list has exactly one item, then the first item of the list is returned. + * If the list has more than one item, then a new Buffer is created. + * + * @param list An array of Buffer objects to concatenate + * @param totalLength Total length of the buffers when concatenated. + * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. + */ + concat(list: Buffer[], totalLength?: number): Buffer; + /** + * The same as buf1.compare(buf2). + */ + compare(buf1: Buffer, buf2: Buffer): number; +}; + +/************************************************ +* * +* GLOBAL INTERFACES * +* * +************************************************/ +declare module NodeJS { + export interface ErrnoException extends Error { + errno?: number; + code?: string; + path?: string; + syscall?: string; + stack?: string; + } + + export interface EventEmitter { + addListener(event: string, listener: Function): this; + on(event: string, listener: Function): this; + once(event: string, listener: Function): this; + removeListener(event: string, listener: Function): this; + removeAllListeners(event?: string): this; + setMaxListeners(n: number): this; + getMaxListeners(): number; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; + } + + export interface ReadableStream extends EventEmitter { + readable: boolean; + read(size?: number): string|Buffer; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: ReadableStream): ReadableStream; + } + + export interface WritableStream extends EventEmitter { + writable: boolean; + write(buffer: Buffer|string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface ReadWriteStream extends ReadableStream, WritableStream {} + + export interface Events extends EventEmitter { } + + export interface Domain extends Events { + run(fn: Function): void; + add(emitter: Events): void; + remove(emitter: Events): void; + bind(cb: (err: Error, data: any) => any): any; + intercept(cb: (data: any) => any): any; + dispose(): void; + + addListener(event: string, listener: Function): this; + on(event: string, listener: Function): this; + once(event: string, listener: Function): this; + removeListener(event: string, listener: Function): this; + removeAllListeners(event?: string): this; + } + + export interface Process extends EventEmitter { + stdout: WritableStream; + stderr: WritableStream; + stdin: ReadableStream; + argv: string[]; + execArgv: string[]; + execPath: string; + abort(): void; + chdir(directory: string): void; + cwd(): string; + env: any; + exit(code?: number): void; + getgid(): number; + setgid(id: number): void; + setgid(id: string): void; + getuid(): number; + setuid(id: number): void; + setuid(id: string): void; + version: string; + versions: { + http_parser: string; + node: string; + v8: string; + ares: string; + uv: string; + zlib: string; + openssl: string; + }; + config: { + target_defaults: { + cflags: any[]; + default_configuration: string; + defines: string[]; + include_dirs: string[]; + libraries: string[]; + }; + variables: { + clang: number; + host_arch: string; + node_install_npm: boolean; + node_install_waf: boolean; + node_prefix: string; + node_shared_openssl: boolean; + node_shared_v8: boolean; + node_shared_zlib: boolean; + node_use_dtrace: boolean; + node_use_etw: boolean; + node_use_openssl: boolean; + target_arch: string; + v8_no_strict_aliasing: number; + v8_use_snapshot: boolean; + visibility: string; + }; + }; + kill(pid:number, signal?: string|number): void; + pid: number; + title: string; + arch: string; + platform: string; + memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; }; + nextTick(callback: Function): void; + umask(mask?: number): number; + uptime(): number; + hrtime(time?:number[]): number[]; + domain: Domain; + + // Worker + send?(message: any, sendHandle?: any): void; + disconnect(): void; + connected: boolean; + } + + export interface Global { + Array: typeof Array; + ArrayBuffer: typeof ArrayBuffer; + Boolean: typeof Boolean; + Buffer: typeof Buffer; + DataView: typeof DataView; + Date: typeof Date; + Error: typeof Error; + EvalError: typeof EvalError; + Float32Array: typeof Float32Array; + Float64Array: typeof Float64Array; + Function: typeof Function; + GLOBAL: Global; + Infinity: typeof Infinity; + Int16Array: typeof Int16Array; + Int32Array: typeof Int32Array; + Int8Array: typeof Int8Array; + Intl: typeof Intl; + JSON: typeof JSON; + Map: MapConstructor; + Math: typeof Math; + NaN: typeof NaN; + Number: typeof Number; + Object: typeof Object; + Promise: Function; + RangeError: typeof RangeError; + ReferenceError: typeof ReferenceError; + RegExp: typeof RegExp; + Set: SetConstructor; + String: typeof String; + Symbol: Function; + SyntaxError: typeof SyntaxError; + TypeError: typeof TypeError; + URIError: typeof URIError; + Uint16Array: typeof Uint16Array; + Uint32Array: typeof Uint32Array; + Uint8Array: typeof Uint8Array; + Uint8ClampedArray: Function; + WeakMap: WeakMapConstructor; + WeakSet: WeakSetConstructor; + clearImmediate: (immediateId: any) => void; + clearInterval: (intervalId: NodeJS.Timer) => void; + clearTimeout: (timeoutId: NodeJS.Timer) => void; + console: typeof console; + decodeURI: typeof decodeURI; + decodeURIComponent: typeof decodeURIComponent; + encodeURI: typeof encodeURI; + encodeURIComponent: typeof encodeURIComponent; + escape: (str: string) => string; + eval: typeof eval; + global: Global; + isFinite: typeof isFinite; + isNaN: typeof isNaN; + parseFloat: typeof parseFloat; + parseInt: typeof parseInt; + process: Process; + root: Global; + setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => any; + setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; + setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; + undefined: typeof undefined; + unescape: (str: string) => string; + gc: () => void; + v8debug?: any; + } + + export interface Timer { + ref() : void; + unref() : void; + } +} + +/** + * @deprecated + */ +interface NodeBuffer { + [index: number]: number; + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + toJSON(): any; + length: number; + equals(otherBuffer: Buffer): boolean; + compare(otherBuffer: Buffer): number; + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + slice(start?: number, end?: number): Buffer; + writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readUInt8(offset: number, noAssert?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + writeUInt8(value: number, offset: number, noAssert?: boolean): number; + writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeInt8(value: number, offset: number, noAssert?: boolean): number; + writeInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeFloatLE(value: number, offset: number, noAssert?: boolean): number; + writeFloatBE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; + fill(value: any, offset?: number, end?: number): Buffer; + indexOf(value: string | number | Buffer, byteOffset?: number): number; +} + +/************************************************ +* * +* MODULES * +* * +************************************************/ +declare module "buffer" { + export var INSPECT_MAX_BYTES: number; + var BuffType: typeof Buffer; + var SlowBuffType: typeof SlowBuffer; + export { BuffType as Buffer, SlowBuffType as SlowBuffer }; +} + +declare module "querystring" { + export interface StringifyOptions { + encodeURIComponent?: Function; + } + + export interface ParseOptions { + maxKeys?: number; + decodeURIComponent?: Function; + } + + export function stringify(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string; + export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): any; + export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): T; + export function escape(str: string): string; + export function unescape(str: string): string; +} + +declare module "events" { + export class EventEmitter implements NodeJS.EventEmitter { + static EventEmitter: EventEmitter; + static listenerCount(emitter: EventEmitter, event: string): number; // deprecated + static defaultMaxListeners: number; + + addListener(event: string, listener: Function): this; + on(event: string, listener: Function): this; + once(event: string, listener: Function): this; + removeListener(event: string, listener: Function): this; + removeAllListeners(event?: string): this; + setMaxListeners(n: number): this; + getMaxListeners(): number; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; + } +} + +declare module "http" { + import * as events from "events"; + import * as net from "net"; + import * as stream from "stream"; + + export interface RequestOptions { + protocol?: string; + host?: string; + hostname?: string; + family?: number; + port?: number; + localAddress?: string; + socketPath?: string; + method?: string; + path?: string; + headers?: { [key: string]: any }; + auth?: string; + agent?: Agent|boolean; + } + + export interface Server extends events.EventEmitter { + listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server; + listen(port: number, hostname?: string, callback?: Function): Server; + listen(path: string, callback?: Function): Server; + listen(handle: any, listeningListener?: Function): Server; + close(cb?: any): Server; + address(): { port: number; family: string; address: string; }; + maxHeadersCount: number; + } + /** + * @deprecated Use IncomingMessage + */ + export interface ServerRequest extends IncomingMessage { + connection: net.Socket; + } + export interface ServerResponse extends events.EventEmitter, stream.Writable { + // Extended base methods + write(buffer: Buffer): boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + write(str: string, encoding?: string, fd?: string): boolean; + + writeContinue(): void; + writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void; + writeHead(statusCode: number, headers?: any): void; + statusCode: number; + statusMessage: string; + headersSent: boolean; + setHeader(name: string, value: string | string[]): void; + sendDate: boolean; + getHeader(name: string): string; + removeHeader(name: string): void; + write(chunk: any, encoding?: string): any; + addTrailers(headers: any): void; + + // Extended base methods + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + end(data?: any, encoding?: string): void; + } + export interface ClientRequest extends events.EventEmitter, stream.Writable { + // Extended base methods + write(buffer: Buffer): boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + write(str: string, encoding?: string, fd?: string): boolean; + + write(chunk: any, encoding?: string): void; + abort(): void; + setTimeout(timeout: number, callback?: Function): void; + setNoDelay(noDelay?: boolean): void; + setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; + + // Extended base methods + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + end(data?: any, encoding?: string): void; + } + export interface IncomingMessage extends events.EventEmitter, stream.Readable { + httpVersion: string; + headers: any; + rawHeaders: string[]; + trailers: any; + rawTrailers: any; + setTimeout(msecs: number, callback: Function): NodeJS.Timer; + /** + * Only valid for request obtained from http.Server. + */ + method?: string; + /** + * Only valid for request obtained from http.Server. + */ + url?: string; + /** + * Only valid for response obtained from http.ClientRequest. + */ + statusCode?: number; + /** + * Only valid for response obtained from http.ClientRequest. + */ + statusMessage?: string; + socket: net.Socket; + } + /** + * @deprecated Use IncomingMessage + */ + export interface ClientResponse extends IncomingMessage { } + + export interface AgentOptions { + /** + * Keep sockets around in a pool to be used by other requests in the future. Default = false + */ + keepAlive?: boolean; + /** + * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. + * Only relevant if keepAlive is set to true. + */ + keepAliveMsecs?: number; + /** + * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity + */ + maxSockets?: number; + /** + * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. + */ + maxFreeSockets?: number; + } + + export class Agent { + maxSockets: number; + sockets: any; + requests: any; + + constructor(opts?: AgentOptions); + + /** + * Destroy any sockets that are currently in use by the agent. + * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, + * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, + * sockets may hang open for quite a long time before the server terminates them. + */ + destroy(): void; + } + + export var METHODS: string[]; + + export var STATUS_CODES: { + [errorCode: number]: string; + [errorCode: string]: string; + }; + export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server; + export function createClient(port?: number, host?: string): any; + export function request(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; + export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest; + export var globalAgent: Agent; +} + +declare module "cluster" { + import * as child from "child_process"; + import * as events from "events"; + + export interface ClusterSettings { + exec?: string; + args?: string[]; + silent?: boolean; + } + + export interface Address { + address: string; + port: number; + addressType: string; + } + + export class Worker extends events.EventEmitter { + id: string; + process: child.ChildProcess; + suicide: boolean; + send(message: any, sendHandle?: any): void; + kill(signal?: string): void; + destroy(signal?: string): void; + disconnect(): void; + } + + export var settings: ClusterSettings; + export var isMaster: boolean; + export var isWorker: boolean; + export function setupMaster(settings?: ClusterSettings): void; + export function fork(env?: any): Worker; + export function disconnect(callback?: Function): void; + export var worker: Worker; + export var workers: Worker[]; + + // Event emitter + export function addListener(event: string, listener: Function): void; + export function on(event: "disconnect", listener: (worker: Worker) => void): void; + export function on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): void; + export function on(event: "fork", listener: (worker: Worker) => void): void; + export function on(event: "listening", listener: (worker: Worker, address: any) => void): void; + export function on(event: "message", listener: (worker: Worker, message: any) => void): void; + export function on(event: "online", listener: (worker: Worker) => void): void; + export function on(event: "setup", listener: (settings: any) => void): void; + export function on(event: string, listener: Function): any; + export function once(event: string, listener: Function): void; + export function removeListener(event: string, listener: Function): void; + export function removeAllListeners(event?: string): void; + export function setMaxListeners(n: number): void; + export function listeners(event: string): Function[]; + export function emit(event: string, ...args: any[]): boolean; +} + +declare module "zlib" { + import * as stream from "stream"; + export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; } + + export interface Gzip extends stream.Transform { } + export interface Gunzip extends stream.Transform { } + export interface Deflate extends stream.Transform { } + export interface Inflate extends stream.Transform { } + export interface DeflateRaw extends stream.Transform { } + export interface InflateRaw extends stream.Transform { } + export interface Unzip extends stream.Transform { } + + export function createGzip(options?: ZlibOptions): Gzip; + export function createGunzip(options?: ZlibOptions): Gunzip; + export function createDeflate(options?: ZlibOptions): Deflate; + export function createInflate(options?: ZlibOptions): Inflate; + export function createDeflateRaw(options?: ZlibOptions): DeflateRaw; + export function createInflateRaw(options?: ZlibOptions): InflateRaw; + export function createUnzip(options?: ZlibOptions): Unzip; + + export function deflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function deflateSync(buf: Buffer, options?: ZlibOptions): any; + export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function deflateRawSync(buf: Buffer, options?: ZlibOptions): any; + export function gzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function gzipSync(buf: Buffer, options?: ZlibOptions): any; + export function gunzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function gunzipSync(buf: Buffer, options?: ZlibOptions): any; + export function inflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function inflateSync(buf: Buffer, options?: ZlibOptions): any; + export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function inflateRawSync(buf: Buffer, options?: ZlibOptions): any; + export function unzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function unzipSync(buf: Buffer, options?: ZlibOptions): any; + + // Constants + export var Z_NO_FLUSH: number; + export var Z_PARTIAL_FLUSH: number; + export var Z_SYNC_FLUSH: number; + export var Z_FULL_FLUSH: number; + export var Z_FINISH: number; + export var Z_BLOCK: number; + export var Z_TREES: number; + export var Z_OK: number; + export var Z_STREAM_END: number; + export var Z_NEED_DICT: number; + export var Z_ERRNO: number; + export var Z_STREAM_ERROR: number; + export var Z_DATA_ERROR: number; + export var Z_MEM_ERROR: number; + export var Z_BUF_ERROR: number; + export var Z_VERSION_ERROR: number; + export var Z_NO_COMPRESSION: number; + export var Z_BEST_SPEED: number; + export var Z_BEST_COMPRESSION: number; + export var Z_DEFAULT_COMPRESSION: number; + export var Z_FILTERED: number; + export var Z_HUFFMAN_ONLY: number; + export var Z_RLE: number; + export var Z_FIXED: number; + export var Z_DEFAULT_STRATEGY: number; + export var Z_BINARY: number; + export var Z_TEXT: number; + export var Z_ASCII: number; + export var Z_UNKNOWN: number; + export var Z_DEFLATED: number; + export var Z_NULL: number; +} + +declare module "os" { + export interface CpuInfo { + model: string; + speed: number; + times: { + user: number; + nice: number; + sys: number; + idle: number; + irq: number; + }; + } + + export interface NetworkInterfaceInfo { + address: string; + netmask: string; + family: string; + mac: string; + internal: boolean; + } + + export function tmpdir(): string; + export function homedir(): string; + export function endianness(): string; + export function hostname(): string; + export function type(): string; + export function platform(): string; + export function arch(): string; + export function release(): string; + export function uptime(): number; + export function loadavg(): number[]; + export function totalmem(): number; + export function freemem(): number; + export function cpus(): CpuInfo[]; + export function networkInterfaces(): {[index: string]: NetworkInterfaceInfo[]}; + export var EOL: string; +} + +declare module "https" { + import * as tls from "tls"; + import * as events from "events"; + import * as http from "http"; + + export interface ServerOptions { + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any; + crl?: any; + ciphers?: string; + honorCipherOrder?: boolean; + requestCert?: boolean; + rejectUnauthorized?: boolean; + NPNProtocols?: any; + SNICallback?: (servername: string) => any; + } + + export interface RequestOptions extends http.RequestOptions{ + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any; + ciphers?: string; + rejectUnauthorized?: boolean; + secureProtocol?: string; + } + + export interface Agent { + maxSockets: number; + sockets: any; + requests: any; + } + export var Agent: { + new (options?: RequestOptions): Agent; + }; + export interface Server extends tls.Server { } + export function createServer(options: ServerOptions, requestListener?: Function): Server; + export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest; + export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest; + export var globalAgent: Agent; +} + +declare module "punycode" { + export function decode(string: string): string; + export function encode(string: string): string; + export function toUnicode(domain: string): string; + export function toASCII(domain: string): string; + export var ucs2: ucs2; + interface ucs2 { + decode(string: string): number[]; + encode(codePoints: number[]): string; + } + export var version: any; +} + +declare module "repl" { + import * as stream from "stream"; + import * as events from "events"; + + export interface ReplOptions { + prompt?: string; + input?: NodeJS.ReadableStream; + output?: NodeJS.WritableStream; + terminal?: boolean; + eval?: Function; + useColors?: boolean; + useGlobal?: boolean; + ignoreUndefined?: boolean; + writer?: Function; + } + export function start(options: ReplOptions): events.EventEmitter; +} + +declare module "readline" { + import * as events from "events"; + import * as stream from "stream"; + + export interface Key { + sequence?: string; + name?: string; + ctrl?: boolean; + meta?: boolean; + shift?: boolean; + } + + export interface ReadLine extends events.EventEmitter { + setPrompt(prompt: string): void; + prompt(preserveCursor?: boolean): void; + question(query: string, callback: (answer: string) => void): void; + pause(): ReadLine; + resume(): ReadLine; + close(): void; + write(data: string|Buffer, key?: Key): void; + } + + export interface Completer { + (line: string): CompleterResult; + (line: string, callback: (err: any, result: CompleterResult) => void): any; + } + + export interface CompleterResult { + completions: string[]; + line: string; + } + + export interface ReadLineOptions { + input: NodeJS.ReadableStream; + output?: NodeJS.WritableStream; + completer?: Completer; + terminal?: boolean; + historySize?: number; + } + + export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer, terminal?: boolean): ReadLine; + export function createInterface(options: ReadLineOptions): ReadLine; + + export function cursorTo(stream: NodeJS.WritableStream, x: number, y: number): void; + export function moveCursor(stream: NodeJS.WritableStream, dx: number|string, dy: number|string): void; + export function clearLine(stream: NodeJS.WritableStream, dir: number): void; + export function clearScreenDown(stream: NodeJS.WritableStream): void; +} + +declare module "vm" { + export interface Context { } + export interface Script { + runInThisContext(): void; + runInNewContext(sandbox?: Context): void; + } + export function runInThisContext(code: string, filename?: string): void; + export function runInNewContext(code: string, sandbox?: Context, filename?: string): void; + export function runInContext(code: string, context: Context, filename?: string): void; + export function createContext(initSandbox?: Context): Context; + export function createScript(code: string, filename?: string): Script; +} + +declare module "child_process" { + import * as events from "events"; + import * as stream from "stream"; + + export interface ChildProcess extends events.EventEmitter { + stdin: stream.Writable; + stdout: stream.Readable; + stderr: stream.Readable; + stdio: (stream.Readable|stream.Writable)[]; + pid: number; + kill(signal?: string): void; + send(message: any, sendHandle?: any): void; + disconnect(): void; + unref(): void; + } + + export function spawn(command: string, args?: string[], options?: { + cwd?: string; + stdio?: any; + custom?: any; + env?: any; + detached?: boolean; + }): ChildProcess; + export function exec(command: string, options: { + cwd?: string; + stdio?: any; + customFds?: any; + env?: any; + encoding?: string; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function exec(command: string, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function execFile(file: string, + callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function execFile(file: string, args?: string[], + callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function execFile(file: string, args?: string[], options?: { + cwd?: string; + stdio?: any; + customFds?: any; + env?: any; + encoding?: string; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function fork(modulePath: string, args?: string[], options?: { + cwd?: string; + env?: any; + execPath?: string; + execArgv?: string[]; + silent?: boolean; + uid?: number; + gid?: number; + }): ChildProcess; + export function spawnSync(command: string, args?: string[], options?: { + cwd?: string; + input?: string | Buffer; + stdio?: any; + env?: any; + uid?: number; + gid?: number; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + encoding?: string; + }): { + pid: number; + output: string[]; + stdout: string | Buffer; + stderr: string | Buffer; + status: number; + signal: string; + error: Error; + }; + export function execSync(command: string, options?: { + cwd?: string; + input?: string|Buffer; + stdio?: any; + env?: any; + uid?: number; + gid?: number; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + encoding?: string; + }): string | Buffer; + export function execFileSync(command: string, args?: string[], options?: { + cwd?: string; + input?: string|Buffer; + stdio?: any; + env?: any; + uid?: number; + gid?: number; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + encoding?: string; + }): string | Buffer; +} + +declare module "url" { + export interface Url { + href?: string; + protocol?: string; + auth?: string; + hostname?: string; + port?: string; + host?: string; + pathname?: string; + search?: string; + query?: any; // string | Object + slashes?: boolean; + hash?: string; + path?: string; + } + + export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url; + export function format(url: Url): string; + export function resolve(from: string, to: string): string; +} + +declare module "dns" { + export function lookup(domain: string, family: number, callback: (err: Error, address: string, family: number) =>void ): string; + export function lookup(domain: string, callback: (err: Error, address: string, family: number) =>void ): string; + export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; + export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[]; +} + +declare module "net" { + import * as stream from "stream"; + + export interface Socket extends stream.Duplex { + // Extended base methods + write(buffer: Buffer): boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + write(str: string, encoding?: string, fd?: string): boolean; + + connect(port: number, host?: string, connectionListener?: Function): void; + connect(path: string, connectionListener?: Function): void; + bufferSize: number; + setEncoding(encoding?: string): void; + write(data: any, encoding?: string, callback?: Function): void; + destroy(): void; + pause(): void; + resume(): void; + setTimeout(timeout: number, callback?: Function): void; + setNoDelay(noDelay?: boolean): void; + setKeepAlive(enable?: boolean, initialDelay?: number): void; + address(): { port: number; family: string; address: string; }; + unref(): void; + ref(): void; + + remoteAddress: string; + remoteFamily: string; + remotePort: number; + localAddress: string; + localPort: number; + bytesRead: number; + bytesWritten: number; + + // Extended base methods + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + end(data?: any, encoding?: string): void; + } + + export var Socket: { + new (options?: { fd?: string; type?: string; allowHalfOpen?: boolean; }): Socket; + }; + + export interface Server extends Socket { + listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server; + listen(path: string, listeningListener?: Function): Server; + listen(handle: any, listeningListener?: Function): Server; + close(callback?: Function): Server; + address(): { port: number; family: string; address: string; }; + maxConnections: number; + connections: number; + } + export function createServer(connectionListener?: (socket: Socket) =>void ): Server; + export function createServer(options?: { allowHalfOpen?: boolean; }, connectionListener?: (socket: Socket) =>void ): Server; + export function connect(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket; + export function connect(port: number, host?: string, connectionListener?: Function): Socket; + export function connect(path: string, connectionListener?: Function): Socket; + export function createConnection(options: { port: number, host?: string, localAddress? : string, localPort? : string, family? : number, allowHalfOpen?: boolean; }, connectionListener?: Function): Socket; + export function createConnection(port: number, host?: string, connectionListener?: Function): Socket; + export function createConnection(path: string, connectionListener?: Function): Socket; + export function isIP(input: string): number; + export function isIPv4(input: string): boolean; + export function isIPv6(input: string): boolean; +} + +declare module "dgram" { + import * as events from "events"; + + interface RemoteInfo { + address: string; + port: number; + size: number; + } + + interface AddressInfo { + address: string; + family: string; + port: number; + } + + export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; + + interface Socket extends events.EventEmitter { + send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; + bind(port: number, address?: string, callback?: () => void): void; + close(): void; + address(): AddressInfo; + setBroadcast(flag: boolean): void; + setMulticastTTL(ttl: number): void; + setMulticastLoopback(flag: boolean): void; + addMembership(multicastAddress: string, multicastInterface?: string): void; + dropMembership(multicastAddress: string, multicastInterface?: string): void; + } +} + +declare module "fs" { + import * as stream from "stream"; + import * as events from "events"; + + interface Stats { + isFile(): boolean; + isDirectory(): boolean; + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isSymbolicLink(): boolean; + isFIFO(): boolean; + isSocket(): boolean; + dev: number; + ino: number; + mode: number; + nlink: number; + uid: number; + gid: number; + rdev: number; + size: number; + blksize: number; + blocks: number; + atime: Date; + mtime: Date; + ctime: Date; + birthtime: Date; + } + + interface FSWatcher extends events.EventEmitter { + close(): void; + } + + export interface ReadStream extends stream.Readable { + close(): void; + } + export interface WriteStream extends stream.Writable { + close(): void; + bytesWritten: number; + } + + /** + * Asynchronous rename. + * @param oldPath + * @param newPath + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /** + * Synchronous rename + * @param oldPath + * @param newPath + */ + export function renameSync(oldPath: string, newPath: string): void; + export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function truncateSync(path: string, len?: number): void; + export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function ftruncateSync(fd: number, len?: number): void; + export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chownSync(path: string, uid: number, gid: number): void; + export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchownSync(fd: number, uid: number, gid: number): void; + export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchownSync(path: string, uid: number, gid: number): void; + export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chmodSync(path: string, mode: number): void; + export function chmodSync(path: string, mode: string): void; + export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchmodSync(fd: number, mode: number): void; + export function fchmodSync(fd: number, mode: string): void; + export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchmodSync(path: string, mode: number): void; + export function lchmodSync(path: string, mode: string): void; + export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function statSync(path: string): Stats; + export function lstatSync(path: string): Stats; + export function fstatSync(fd: number): Stats; + export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function linkSync(srcpath: string, dstpath: string): void; + export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; + export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void; + export function readlinkSync(path: string): string; + export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; + export function realpath(path: string, cache: {[path: string]: string}, callback: (err: NodeJS.ErrnoException, resolvedPath: string) =>any): void; + export function realpathSync(path: string, cache?: { [path: string]: string }): string; + /* + * Asynchronous unlink - deletes the file specified in {path} + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Synchronous unlink - deletes the file specified in {path} + * + * @param path + */ + export function unlinkSync(path: string): void; + /* + * Asynchronous rmdir - removes the directory specified in {path} + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Synchronous rmdir - removes the directory specified in {path} + * + * @param path + */ + export function rmdirSync(path: string): void; + /* + * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function mkdirSync(path: string, mode?: number): void; + /* + * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ + export function mkdirSync(path: string, mode?: string): void; + export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; + export function readdirSync(path: string): string[]; + export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function closeSync(fd: number): void; + export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function openSync(path: string, flags: string, mode?: number): number; + export function openSync(path: string, flags: string, mode?: string): number; + export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimesSync(path: string, atime: number, mtime: number): void; + export function utimesSync(path: string, atime: Date, mtime: Date): void; + export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimesSync(fd: number, atime: number, mtime: number): void; + export function futimesSync(fd: number, atime: Date, mtime: Date): void; + export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fsyncSync(fd: number): void; + export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; + export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; + export function write(fd: number, data: any, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, data: any, offset: number, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; + export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param encoding + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ + export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ + export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ + export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ + export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + /* + * Synchronous readFile - Synchronously reads the entire contents of a file. + * + * @param fileName + * @param encoding + */ + export function readFileSync(filename: string, encoding: string): string; + /* + * Synchronous readFile - Synchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer. + */ + export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; + /* + * Synchronous readFile - Synchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer. + */ + export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; + export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; + export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void; + export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void; + export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher; + export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; + export function exists(path: string, callback?: (exists: boolean) => void): void; + export function existsSync(path: string): boolean; + /** Constant for fs.access(). File is visible to the calling process. */ + export var F_OK: number; + /** Constant for fs.access(). File can be read by the calling process. */ + export var R_OK: number; + /** Constant for fs.access(). File can be written by the calling process. */ + export var W_OK: number; + /** Constant for fs.access(). File can be executed by the calling process. */ + export var X_OK: number; + /** Tests a user's permissions for the file specified by path. */ + export function access(path: string, callback: (err: NodeJS.ErrnoException) => void): void; + export function access(path: string, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; + /** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */ + export function accessSync(path: string, mode ?: number): void; + export function createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: number; + mode?: number; + autoClose?: boolean; + }): ReadStream; + export function createWriteStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: number; + mode?: number; + }): WriteStream; +} + +declare module "path" { + + /** + * A parsed path object generated by path.parse() or consumed by path.format(). + */ + export interface ParsedPath { + /** + * The root of the path such as '/' or 'c:\' + */ + root: string; + /** + * The full directory path such as '/home/user/dir' or 'c:\path\dir' + */ + dir: string; + /** + * The file name including extension (if any) such as 'index.html' + */ + base: string; + /** + * The file extension (if any) such as '.html' + */ + ext: string; + /** + * The file name without extension (if any) such as 'index' + */ + name: string; + } + + /** + * Normalize a string path, reducing '..' and '.' parts. + * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. + * + * @param p string path to normalize. + */ + export function normalize(p: string): string; + /** + * Join all arguments together and normalize the resulting path. + * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. + * + * @param paths string paths to join. + */ + export function join(...paths: any[]): string; + /** + * Join all arguments together and normalize the resulting path. + * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. + * + * @param paths string paths to join. + */ + export function join(...paths: string[]): string; + /** + * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. + * + * Starting from leftmost {from} paramter, resolves {to} to an absolute path. + * + * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. + * + * @param pathSegments string paths to join. Non-string arguments are ignored. + */ + export function resolve(...pathSegments: any[]): string; + /** + * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. + * + * @param path path to test. + */ + export function isAbsolute(path: string): boolean; + /** + * Solve the relative path from {from} to {to}. + * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. + * + * @param from + * @param to + */ + export function relative(from: string, to: string): string; + /** + * Return the directory name of a path. Similar to the Unix dirname command. + * + * @param p the path to evaluate. + */ + export function dirname(p: string): string; + /** + * Return the last portion of a path. Similar to the Unix basename command. + * Often used to extract the file name from a fully qualified path. + * + * @param p the path to evaluate. + * @param ext optionally, an extension to remove from the result. + */ + export function basename(p: string, ext?: string): string; + /** + * Return the extension of the path, from the last '.' to end of string in the last portion of the path. + * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string + * + * @param p the path to evaluate. + */ + export function extname(p: string): string; + /** + * The platform-specific file separator. '\\' or '/'. + */ + export var sep: string; + /** + * The platform-specific file delimiter. ';' or ':'. + */ + export var delimiter: string; + /** + * Returns an object from a path string - the opposite of format(). + * + * @param pathString path to evaluate. + */ + export function parse(pathString: string): ParsedPath; + /** + * Returns a path string from an object - the opposite of parse(). + * + * @param pathString path to evaluate. + */ + export function format(pathObject: ParsedPath): string; + + export module posix { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function isAbsolute(p: string): boolean; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; + export var delimiter: string; + export function parse(p: string): ParsedPath; + export function format(pP: ParsedPath): string; + } + + export module win32 { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function isAbsolute(p: string): boolean; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; + export var delimiter: string; + export function parse(p: string): ParsedPath; + export function format(pP: ParsedPath): string; + } +} + +declare module "string_decoder" { + export interface NodeStringDecoder { + write(buffer: Buffer): string; + detectIncompleteChar(buffer: Buffer): number; + } + export var StringDecoder: { + new (encoding: string): NodeStringDecoder; + }; +} + +declare module "tls" { + import * as crypto from "crypto"; + import * as net from "net"; + import * as stream from "stream"; + + var CLIENT_RENEG_LIMIT: number; + var CLIENT_RENEG_WINDOW: number; + + export interface TlsOptions { + host?: string; + port?: number; + pfx?: any; //string or buffer + key?: any; //string or buffer + passphrase?: string; + cert?: any; + ca?: any; //string or buffer + crl?: any; //string or string array + ciphers?: string; + honorCipherOrder?: any; + requestCert?: boolean; + rejectUnauthorized?: boolean; + NPNProtocols?: any; //array or Buffer; + SNICallback?: (servername: string) => any; + } + + export interface ConnectionOptions { + host?: string; + port?: number; + socket?: net.Socket; + pfx?: any; //string | Buffer + key?: any; //string | Buffer + passphrase?: string; + cert?: any; //string | Buffer + ca?: any; //Array of string | Buffer + rejectUnauthorized?: boolean; + NPNProtocols?: any; //Array of string | Buffer + servername?: string; + } + + export interface Server extends net.Server { + // Extended base methods + listen(port: number, host?: string, backlog?: number, listeningListener?: Function): Server; + listen(path: string, listeningListener?: Function): Server; + listen(handle: any, listeningListener?: Function): Server; + + listen(port: number, host?: string, callback?: Function): Server; + close(): Server; + address(): { port: number; family: string; address: string; }; + addContext(hostName: string, credentials: { + key: string; + cert: string; + ca: string; + }): void; + maxConnections: number; + connections: number; + } + + export interface ClearTextStream extends stream.Duplex { + authorized: boolean; + authorizationError: Error; + getPeerCertificate(): any; + getCipher: { + name: string; + version: string; + }; + address: { + port: number; + family: string; + address: string; + }; + remoteAddress: string; + remotePort: number; + } + + export interface SecurePair { + encrypted: any; + cleartext: any; + } + + export interface SecureContextOptions { + pfx?: any; //string | buffer + key?: any; //string | buffer + passphrase?: string; + cert?: any; // string | buffer + ca?: any; // string | buffer + crl?: any; // string | string[] + ciphers?: string; + honorCipherOrder?: boolean; + } + + export interface SecureContext { + context: any; + } + + export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server; + export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream; + export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; + export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; + export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; + export function createSecureContext(details: SecureContextOptions): SecureContext; +} + +declare module "crypto" { + export interface CredentialDetails { + pfx: string; + key: string; + passphrase: string; + cert: string; + ca: any; //string | string array + crl: any; //string | string array + ciphers: string; + } + export interface Credentials { context?: any; } + export function createCredentials(details: CredentialDetails): Credentials; + export function createHash(algorithm: string): Hash; + export function createHmac(algorithm: string, key: string): Hmac; + export function createHmac(algorithm: string, key: Buffer): Hmac; + export interface Hash { + update(data: any, input_encoding?: string): Hash; + digest(encoding: 'buffer'): Buffer; + digest(encoding: string): any; + digest(): Buffer; + } + export interface Hmac extends NodeJS.ReadWriteStream { + update(data: any, input_encoding?: string): Hmac; + digest(encoding: 'buffer'): Buffer; + digest(encoding: string): any; + digest(): Buffer; + } + export function createCipher(algorithm: string, password: any): Cipher; + export function createCipheriv(algorithm: string, key: any, iv: any): Cipher; + export interface Cipher { + update(data: Buffer): Buffer; + update(data: string, input_encoding?: string, output_encoding?: string): string; + final(): Buffer; + final(output_encoding: string): string; + setAutoPadding(auto_padding: boolean): void; + getAuthTag(): Buffer; + } + export function createDecipher(algorithm: string, password: any): Decipher; + export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher; + export interface Decipher { + update(data: Buffer): Buffer; + update(data: string|Buffer, input_encoding?: string, output_encoding?: string): string; + update(data: string|Buffer, input_encoding?: string, output_encoding?: string): Buffer; + final(): Buffer; + final(output_encoding: string): string; + setAutoPadding(auto_padding: boolean): void; + setAuthTag(tag: Buffer): void; + } + export function createSign(algorithm: string): Signer; + export interface Signer extends NodeJS.WritableStream { + update(data: any): void; + sign(private_key: string, output_format: string): string; + } + export function createVerify(algorith: string): Verify; + export interface Verify extends NodeJS.WritableStream { + update(data: any): void; + verify(object: string, signature: string, signature_format?: string): boolean; + } + export function createDiffieHellman(prime_length: number): DiffieHellman; + export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman; + export interface DiffieHellman { + generateKeys(encoding?: string): string; + computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string; + getPrime(encoding?: string): string; + getGenerator(encoding: string): string; + getPublicKey(encoding?: string): string; + getPrivateKey(encoding?: string): string; + setPublicKey(public_key: string, encoding?: string): void; + setPrivateKey(public_key: string, encoding?: string): void; + } + export function getDiffieHellman(group_name: string): DiffieHellman; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string) : Buffer; + export function randomBytes(size: number): Buffer; + export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; + export function pseudoRandomBytes(size: number): Buffer; + export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; + export interface RsaPublicKey { + key: string; + padding?: any; + } + export interface RsaPrivateKey { + key: string; + passphrase?: string, + padding?: any; + } + export function publicEncrypt(public_key: string|RsaPublicKey, buffer: Buffer): Buffer + export function privateDecrypt(private_key: string|RsaPrivateKey, buffer: Buffer): Buffer +} + +declare module "stream" { + import * as events from "events"; + + export class Stream extends events.EventEmitter { + pipe(destination: T, options?: { end?: boolean; }): T; + } + + export interface ReadableOptions { + highWaterMark?: number; + encoding?: string; + objectMode?: boolean; + } + + export class Readable extends events.EventEmitter implements NodeJS.ReadableStream { + readable: boolean; + constructor(opts?: ReadableOptions); + _read(size: number): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: any): void; + wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; + push(chunk: any, encoding?: string): boolean; + } + + export interface WritableOptions { + highWaterMark?: number; + decodeStrings?: boolean; + objectMode?: boolean; + } + + export class Writable extends events.EventEmitter implements NodeJS.WritableStream { + writable: boolean; + constructor(opts?: WritableOptions); + _write(chunk: any, encoding: string, callback: Function): void; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; + end(): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; + } + + export interface DuplexOptions extends ReadableOptions, WritableOptions { + allowHalfOpen?: boolean; + } + + // Note: Duplex extends both Readable and Writable. + export class Duplex extends Readable implements NodeJS.ReadWriteStream { + writable: boolean; + constructor(opts?: DuplexOptions); + _write(chunk: any, encoding: string, callback: Function): void; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; + end(): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; + } + + export interface TransformOptions extends ReadableOptions, WritableOptions {} + + // Note: Transform lacks the _read and _write methods of Readable/Writable. + export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream { + readable: boolean; + writable: boolean; + constructor(opts?: TransformOptions); + _transform(chunk: any, encoding: string, callback: Function): void; + _flush(callback: Function): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: any): void; + wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; + push(chunk: any, encoding?: string): boolean; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; + end(): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; + } + + export class PassThrough extends Transform {} +} + +declare module "util" { + export interface InspectOptions { + showHidden?: boolean; + depth?: number; + colors?: boolean; + customInspect?: boolean; + } + + export function format(format: any, ...param: any[]): string; + export function debug(string: string): void; + export function error(...param: any[]): void; + export function puts(...param: any[]): void; + export function print(...param: any[]): void; + export function log(string: string): void; + export function inspect(object: any, showHidden?: boolean, depth?: number, color?: boolean): string; + export function inspect(object: any, options: InspectOptions): string; + export function isArray(object: any): boolean; + export function isRegExp(object: any): boolean; + export function isDate(object: any): boolean; + export function isError(object: any): boolean; + export function inherits(constructor: any, superConstructor: any): void; + export function debuglog(key:string): (msg:string,...param: any[])=>void; +} + +declare module "assert" { + function internal (value: any, message?: string): void; + module internal { + export class AssertionError implements Error { + name: string; + message: string; + actual: any; + expected: any; + operator: string; + generatedMessage: boolean; + + constructor(options?: {message?: string; actual?: any; expected?: any; + operator?: string; stackStartFunction?: Function}); + } + + export function fail(actual?: any, expected?: any, message?: string, operator?: string): void; + export function ok(value: any, message?: string): void; + export function equal(actual: any, expected: any, message?: string): void; + export function notEqual(actual: any, expected: any, message?: string): void; + export function deepEqual(actual: any, expected: any, message?: string): void; + export function notDeepEqual(acutal: any, expected: any, message?: string): void; + export function strictEqual(actual: any, expected: any, message?: string): void; + export function notStrictEqual(actual: any, expected: any, message?: string): void; + export function deepStrictEqual(actual: any, expected: any, message?: string): void; + export function notDeepStrictEqual(actual: any, expected: any, message?: string): void; + export var throws: { + (block: Function, message?: string): void; + (block: Function, error: Function, message?: string): void; + (block: Function, error: RegExp, message?: string): void; + (block: Function, error: (err: any) => boolean, message?: string): void; + }; + + export var doesNotThrow: { + (block: Function, message?: string): void; + (block: Function, error: Function, message?: string): void; + (block: Function, error: RegExp, message?: string): void; + (block: Function, error: (err: any) => boolean, message?: string): void; + }; + + export function ifError(value: any): void; + } + + export = internal; +} + +declare module "tty" { + import * as net from "net"; + + export function isatty(fd: number): boolean; + export interface ReadStream extends net.Socket { + isRaw: boolean; + setRawMode(mode: boolean): void; + isTTY: boolean; + } + export interface WriteStream extends net.Socket { + columns: number; + rows: number; + isTTY: boolean; + } +} + +declare module "domain" { + import * as events from "events"; + + export class Domain extends events.EventEmitter implements NodeJS.Domain { + run(fn: Function): void; + add(emitter: events.EventEmitter): void; + remove(emitter: events.EventEmitter): void; + bind(cb: (err: Error, data: any) => any): any; + intercept(cb: (data: any) => any): any; + dispose(): void; + } + + export function create(): Domain; +} + +declare module "constants" { + export var E2BIG: number; + export var EACCES: number; + export var EADDRINUSE: number; + export var EADDRNOTAVAIL: number; + export var EAFNOSUPPORT: number; + export var EAGAIN: number; + export var EALREADY: number; + export var EBADF: number; + export var EBADMSG: number; + export var EBUSY: number; + export var ECANCELED: number; + export var ECHILD: number; + export var ECONNABORTED: number; + export var ECONNREFUSED: number; + export var ECONNRESET: number; + export var EDEADLK: number; + export var EDESTADDRREQ: number; + export var EDOM: number; + export var EEXIST: number; + export var EFAULT: number; + export var EFBIG: number; + export var EHOSTUNREACH: number; + export var EIDRM: number; + export var EILSEQ: number; + export var EINPROGRESS: number; + export var EINTR: number; + export var EINVAL: number; + export var EIO: number; + export var EISCONN: number; + export var EISDIR: number; + export var ELOOP: number; + export var EMFILE: number; + export var EMLINK: number; + export var EMSGSIZE: number; + export var ENAMETOOLONG: number; + export var ENETDOWN: number; + export var ENETRESET: number; + export var ENETUNREACH: number; + export var ENFILE: number; + export var ENOBUFS: number; + export var ENODATA: number; + export var ENODEV: number; + export var ENOENT: number; + export var ENOEXEC: number; + export var ENOLCK: number; + export var ENOLINK: number; + export var ENOMEM: number; + export var ENOMSG: number; + export var ENOPROTOOPT: number; + export var ENOSPC: number; + export var ENOSR: number; + export var ENOSTR: number; + export var ENOSYS: number; + export var ENOTCONN: number; + export var ENOTDIR: number; + export var ENOTEMPTY: number; + export var ENOTSOCK: number; + export var ENOTSUP: number; + export var ENOTTY: number; + export var ENXIO: number; + export var EOPNOTSUPP: number; + export var EOVERFLOW: number; + export var EPERM: number; + export var EPIPE: number; + export var EPROTO: number; + export var EPROTONOSUPPORT: number; + export var EPROTOTYPE: number; + export var ERANGE: number; + export var EROFS: number; + export var ESPIPE: number; + export var ESRCH: number; + export var ETIME: number; + export var ETIMEDOUT: number; + export var ETXTBSY: number; + export var EWOULDBLOCK: number; + export var EXDEV: number; + export var WSAEINTR: number; + export var WSAEBADF: number; + export var WSAEACCES: number; + export var WSAEFAULT: number; + export var WSAEINVAL: number; + export var WSAEMFILE: number; + export var WSAEWOULDBLOCK: number; + export var WSAEINPROGRESS: number; + export var WSAEALREADY: number; + export var WSAENOTSOCK: number; + export var WSAEDESTADDRREQ: number; + export var WSAEMSGSIZE: number; + export var WSAEPROTOTYPE: number; + export var WSAENOPROTOOPT: number; + export var WSAEPROTONOSUPPORT: number; + export var WSAESOCKTNOSUPPORT: number; + export var WSAEOPNOTSUPP: number; + export var WSAEPFNOSUPPORT: number; + export var WSAEAFNOSUPPORT: number; + export var WSAEADDRINUSE: number; + export var WSAEADDRNOTAVAIL: number; + export var WSAENETDOWN: number; + export var WSAENETUNREACH: number; + export var WSAENETRESET: number; + export var WSAECONNABORTED: number; + export var WSAECONNRESET: number; + export var WSAENOBUFS: number; + export var WSAEISCONN: number; + export var WSAENOTCONN: number; + export var WSAESHUTDOWN: number; + export var WSAETOOMANYREFS: number; + export var WSAETIMEDOUT: number; + export var WSAECONNREFUSED: number; + export var WSAELOOP: number; + export var WSAENAMETOOLONG: number; + export var WSAEHOSTDOWN: number; + export var WSAEHOSTUNREACH: number; + export var WSAENOTEMPTY: number; + export var WSAEPROCLIM: number; + export var WSAEUSERS: number; + export var WSAEDQUOT: number; + export var WSAESTALE: number; + export var WSAEREMOTE: number; + export var WSASYSNOTREADY: number; + export var WSAVERNOTSUPPORTED: number; + export var WSANOTINITIALISED: number; + export var WSAEDISCON: number; + export var WSAENOMORE: number; + export var WSAECANCELLED: number; + export var WSAEINVALIDPROCTABLE: number; + export var WSAEINVALIDPROVIDER: number; + export var WSAEPROVIDERFAILEDINIT: number; + export var WSASYSCALLFAILURE: number; + export var WSASERVICE_NOT_FOUND: number; + export var WSATYPE_NOT_FOUND: number; + export var WSA_E_NO_MORE: number; + export var WSA_E_CANCELLED: number; + export var WSAEREFUSED: number; + export var SIGHUP: number; + export var SIGINT: number; + export var SIGILL: number; + export var SIGABRT: number; + export var SIGFPE: number; + export var SIGKILL: number; + export var SIGSEGV: number; + export var SIGTERM: number; + export var SIGBREAK: number; + export var SIGWINCH: number; + export var SSL_OP_ALL: number; + export var SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; + export var SSL_OP_CIPHER_SERVER_PREFERENCE: number; + export var SSL_OP_CISCO_ANYCONNECT: number; + export var SSL_OP_COOKIE_EXCHANGE: number; + export var SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; + export var SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; + export var SSL_OP_EPHEMERAL_RSA: number; + export var SSL_OP_LEGACY_SERVER_CONNECT: number; + export var SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number; + export var SSL_OP_MICROSOFT_SESS_ID_BUG: number; + export var SSL_OP_MSIE_SSLV2_RSA_PADDING: number; + export var SSL_OP_NETSCAPE_CA_DN_BUG: number; + export var SSL_OP_NETSCAPE_CHALLENGE_BUG: number; + export var SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number; + export var SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number; + export var SSL_OP_NO_COMPRESSION: number; + export var SSL_OP_NO_QUERY_MTU: number; + export var SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; + export var SSL_OP_NO_SSLv2: number; + export var SSL_OP_NO_SSLv3: number; + export var SSL_OP_NO_TICKET: number; + export var SSL_OP_NO_TLSv1: number; + export var SSL_OP_NO_TLSv1_1: number; + export var SSL_OP_NO_TLSv1_2: number; + export var SSL_OP_PKCS1_CHECK_1: number; + export var SSL_OP_PKCS1_CHECK_2: number; + export var SSL_OP_SINGLE_DH_USE: number; + export var SSL_OP_SINGLE_ECDH_USE: number; + export var SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number; + export var SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number; + export var SSL_OP_TLS_BLOCK_PADDING_BUG: number; + export var SSL_OP_TLS_D5_BUG: number; + export var SSL_OP_TLS_ROLLBACK_BUG: number; + export var ENGINE_METHOD_DSA: number; + export var ENGINE_METHOD_DH: number; + export var ENGINE_METHOD_RAND: number; + export var ENGINE_METHOD_ECDH: number; + export var ENGINE_METHOD_ECDSA: number; + export var ENGINE_METHOD_CIPHERS: number; + export var ENGINE_METHOD_DIGESTS: number; + export var ENGINE_METHOD_STORE: number; + export var ENGINE_METHOD_PKEY_METHS: number; + export var ENGINE_METHOD_PKEY_ASN1_METHS: number; + export var ENGINE_METHOD_ALL: number; + export var ENGINE_METHOD_NONE: number; + export var DH_CHECK_P_NOT_SAFE_PRIME: number; + export var DH_CHECK_P_NOT_PRIME: number; + export var DH_UNABLE_TO_CHECK_GENERATOR: number; + export var DH_NOT_SUITABLE_GENERATOR: number; + export var NPN_ENABLED: number; + export var RSA_PKCS1_PADDING: number; + export var RSA_SSLV23_PADDING: number; + export var RSA_NO_PADDING: number; + export var RSA_PKCS1_OAEP_PADDING: number; + export var RSA_X931_PADDING: number; + export var RSA_PKCS1_PSS_PADDING: number; + export var POINT_CONVERSION_COMPRESSED: number; + export var POINT_CONVERSION_UNCOMPRESSED: number; + export var POINT_CONVERSION_HYBRID: number; + export var O_RDONLY: number; + export var O_WRONLY: number; + export var O_RDWR: number; + export var S_IFMT: number; + export var S_IFREG: number; + export var S_IFDIR: number; + export var S_IFCHR: number; + export var S_IFLNK: number; + export var O_CREAT: number; + export var O_EXCL: number; + export var O_TRUNC: number; + export var O_APPEND: number; + export var F_OK: number; + export var R_OK: number; + export var W_OK: number; + export var X_OK: number; + export var UV_UDP_REUSEADDR: number; +} \ No newline at end of file diff --git a/typings/main/ambient/react/index.d.ts b/typings/main/ambient/react/index.d.ts new file mode 100644 index 00000000..052450e0 --- /dev/null +++ b/typings/main/ambient/react/index.d.ts @@ -0,0 +1,2407 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/945ebfe049964e429c2530971b9081f3c0f611df/react/react.d.ts +// Type definitions for React v0.14 +// Project: http://facebook.github.io/react/ +// Definitions by: Asana , AssureSign , Microsoft +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace __React { + + // + // React Elements + // ---------------------------------------------------------------------- + + type ReactType = string | ComponentClass | StatelessComponent; + type Key = string | number; + type Ref = string | ((instance: T) => any); + + interface ReactElement