{"_id":"argtype","_rev":"15-a7a065a5776aa3e86900ebe9e5aa8465","name":"argtype","description":"JavaScript function arguments type checker","dist-tags":{"latest":"0.2.1"},"versions":{"0.2.0":{"name":"argtype","description":"JavaScript function arguments type checker","version":"0.2.0","homepage":"http://magnimedia.no/","author":{"name":"Tor Valamo","email":"tor.valamo@magimedia.no","url":"http://magnimedia.no/"},"repository":{"type":"git","url":"http://github.com/torvalamo/argtype.js.git"},"bugs":{"web":"http://github.com/torvalamo/argtype.js/issues"},"engines":{"node":">=0.2.0"},"licenses":[{"type":"MIT","url":"http://github.com/torvalamo/argtype.js/blob/master/COPYING"}],"_id":"argtype@0.2.0","_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"https://registry.npmjs.org/argtype/-/argtype-0.2.0.tgz","shasum":"18ff1ca2e15adba67595ee752fed24639c574d56","integrity":"sha512-QVXmk+7trLgWmVuhAlqvK1e9GAZsBvAuPXqfyaIFMRR/PveCvWAqLOtPRqO43cTk1eZ3AG8sGVhE9mDYREUP6g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGH4wednmsjwRunhOS6vNLinsw+ak6rkZDZr2Y3p1VcnAiBZnoMNBxbJyRMG+lYdKr/NunC6pQVEw1urN9V4ZTkygA=="}]},"directories":{},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.2.1":{"name":"argtype","version":"0.2.1","description":"JavaScript function arguments type checker","main":"argtype.js","repository":{"type":"git","url":"git+https://github.com/torvalamo/argtype.js.git"},"license":"MIT","gitHead":"39e25d18102927382b05327358630d426202da48","bugs":{"url":"https://github.com/torvalamo/argtype.js/issues"},"homepage":"https://github.com/torvalamo/argtype.js#readme","_id":"argtype@0.2.1","scripts":{},"_shasum":"450106fd9fbc68a1b4338b72846749ab2c7a20e3","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"torvalamo","email":"tor.valamo@gmail.com"},"dist":{"shasum":"450106fd9fbc68a1b4338b72846749ab2c7a20e3","tarball":"https://registry.npmjs.org/argtype/-/argtype-0.2.1.tgz","integrity":"sha512-i5Fy6QYyAZYDzVHvonPz/6DTM72imfNPzTgm3yeDm0W9Cd8Oyn1WVOLZDM64f+xLzKOvMhgaIn/kDYvbHtv7iA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGT34XqYS6JGZp3lhJzL6yPjBeuwbzaXHB42ff/VqXK1AiEA4hTcTCgaVlFbZUyNKGLQr2FscSr5Pb+D1gCiahuSCRU="}]},"maintainers":[{"name":"torvalamo","email":"tor.valamo@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/argtype-0.2.1.tgz_1457956762247_0.40560633782297373"},"directories":{},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"maintainers":[{"name":"torvalamo","email":"tor.valamo@gmail.com"}],"repository":{"type":"git","url":"git+https://github.com/torvalamo/argtype.js.git"},"time":{"modified":"2022-06-13T03:26:30.162Z","created":"2011-01-29T14:49:12.460Z","0.2.0":"2011-01-29T14:49:12.460Z","0.2.1":"2016-03-14T11:59:24.449Z"},"readme":"# argtype.js\r\n\r\n    npm install argtype\r\n\r\n## 2016\r\n\r\nIf anyone wants to contribute to cleaning up this stuff, feel free to create pull requests. I have a snaky suspicion there might be a smarter way to implement this concept.\r\n\r\nAdded package.json, since it broke npm.\r\n\r\nAlso I have no idea why people use this, but apparently some do, which is the only reason I felt like updating the npm entry.\r\n\r\n## Usage\r\n\r\nExample of use:\r\n\r\n    var func = argtype(this, ['?b', true, 'n=[-9,9]', 'f'],\r\n               function(aBool, aNum, aFunc) {\r\n                 /* stuff here */\r\n               })\r\n\r\n* The first (optional) argument is a boolean with default value true.\r\n* The second (required) argument must be a number (int or float) between -9 and +9 (inclusive).\r\n* The third (required) argument is a function.\r\n\r\nPutting it short:\r\n\r\n* `?` means optional, and must be the first character of the argtype string. `'?s'` - optional string.\r\n* `0` means its value can be null. This must be the next character (first if no optional). `'0s'` - required string, but can be null\r\n* `+` means that the value must be either an unsigned (positive) number, or case-sensitivity in a regex part (see below).\r\n* Then follows the type character. There are many different types:\r\n  * `.` - Untyped (the type of the input is not checked, just optionality and default values)\r\n  * `n` - Number. Use `i` for integer and `f` for float to be specific.\r\n  * `s` - String.\r\n  * `b` - Boolean.\r\n  * `c` - Function. The input must match typeof 'function'\r\n  * `o` - Object. An object that matches typeof 'object'. Function-objects will not match (see `t`)\r\n  * `a` - Array. Input matches instanceof Array.\r\n  * `t` - Function-object. Input matches instanceof the function-object given in the next argument.\r\n* After the type character comes range limits and/or pattern matching. Only some types support either.\r\n  * `/` indicates a regular expression follows until the end of the string. This will be matched against untyped or string inputs. It will be ignored for any other types.\r\n  * `=` indicates that the value is within a range, given as a closed interval `[from,to]` or an open interval `(from,to)`. Bracket types can be mixed, like so `[closed,open)`.\r\n  * `>`, `>=`, `<`, `<=` indicates that the value should be 'greater than', 'greater than or equal to', 'lesser than' or 'lesser than or equal to' the number which follows. `s>3` - A string longer than 3 characters. Length also works for arrays. Numbers use their actual value.\r\n\r\nThe next argument can be (in the case of 't') further specification of the string definition, and must be the function-object which input will be matched (instanceof) against.\r\n\r\nIt can also be the default value for an optional argument, or in the case of 'o' (object) it can contain default attribute values.\r\nA 't' type can also have an optional argument, but then as the second argument after the definition (following the function-object).\r\n\r\n## Simplified BSD License\r\n\r\nCopyright (c) 2012, Tor Valamo\r\nAll rights reserved.\r\n\r\nRedistribution and use in source and binary forms, with or without\r\nmodification, are permitted provided that the following conditions are met: \r\n\r\n1. Redistributions of source code must retain the above copyright notice, this\r\n   list of conditions and the following disclaimer. \r\n2. Redistributions in binary form must reproduce the above copyright notice,\r\n   this list of conditions and the following disclaimer in the documentation\r\n   and/or other materials provided with the distribution. \r\n\r\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\r\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\r\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n","homepage":"https://github.com/torvalamo/argtype.js#readme","bugs":{"url":"https://github.com/torvalamo/argtype.js/issues"},"license":"MIT","readmeFilename":"README.md"}