{"_id":"pinkyswear","_rev":"32-0b5a9b10daccc0943e329c4b98890d58","name":"pinkyswear","description":"Minimalistic Promises/A+ implementation, <500 bytes","dist-tags":{"latest":"2.2.3"},"versions":{"0.0.2":{"name":"pinkyswear","version":"0.0.2","description":"Minimalistic Promises/A+ implementation, <350 bytes","main":"pinkyswear.js","dependencies":{"promises-aplus-tests":"~1.1.0"},"devDependencies":{},"scripts":{"test":"node promise-test.js pinkyswear.js; node promise-test.js pinkyswear.min.js"},"repository":{"type":"git","url":"https://github.com/timjansen/PinkySwear.js.git"},"keywords":["promises"],"author":{"name":"Tim Jansen"},"license":"Public Domain","gitHead":"44f973cb770ff232b35227de9873440810d6e0aa","_id":"pinkyswear@0.0.2","dist":{"shasum":"2be10954eeef37c80682e81f41a350d2dd0ec3ce","tarball":"https://registry.npmjs.org/pinkyswear/-/pinkyswear-0.0.2.tgz","integrity":"sha512-kYksT2/i+WXfsX8Ga5sKgYeY0XgXaBu+ErvE8IcId6dL8TLs589CyC59qLIwboF6O60XoiMzJLzboPTg67TvwA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0/2E4QEMVgJ6CM4lIn9JS/VpUC6MhsGrLRVDhyalH1wIgPEF+yM5zTqeUNZ6gFvvhMVtSOq9JwKTcDfeAp03D8Ks="}]},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"tjansen","email":"tim@tjansen.de"},"maintainers":[{"name":"tjansen","email":"tim@tjansen.de"}]},"2.0.0":{"name":"pinkyswear","version":"2.0.0","description":"Minimalistic Promises/A+ implementation, <500 bytes","main":"pinkyswear.js","dependencies":{"promises-aplus-tests":"~2.0.3"},"devDependencies":{},"scripts":{"test":"node promise-test.js pinkyswear.js; node promise-test.js pinkyswear.min.js"},"repository":{"type":"git","url":"https://github.com/timjansen/PinkySwear.js.git"},"keywords":["promises"],"author":{"name":"Tim Jansen"},"license":"Public Domain","gitHead":"44f973cb770ff232b35227de9873440810d6e0aa","bugs":{"url":"https://github.com/timjansen/PinkySwear.js/issues"},"_id":"pinkyswear@2.0.0","dist":{"shasum":"97b55049244e03860013dd4cfb5e4ea04b7d6727","tarball":"https://registry.npmjs.org/pinkyswear/-/pinkyswear-2.0.0.tgz","integrity":"sha512-4IwOiiPf0sqXg+5eoW/uXKFQBeWiXjOnYxdkRrUl/0Ef1I2ai2q8Wxas3PM8yovqW7AyZkh4P1uuGX0wCvv4Ig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGD2Bh1+OZpBqId8tsfmANwVc3Wu3xnJW4gyMJzjEPpYAiAd/1XdEbOVg0/jFmYXGjaIPQE27h8wDO0KtVscaGooFg=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"tjansen","email":"tim@tjansen.de"},"maintainers":[{"name":"tjansen","email":"tim@tjansen.de"}]},"2.0.1":{"name":"pinkyswear","version":"2.0.1","description":"Minimalistic Promises/A+ implementation, <500 bytes","main":"pinkyswear.js","dependencies":{"promises-aplus-tests":"~2.0.3"},"devDependencies":{"mocha":"^1.18.2"},"scripts":{"test":"node promise-test.js pinkyswear.js; node promise-test.js pinkyswear.min.js; mocha pinkyswear-additional-functionality-test.js"},"repository":{"type":"git","url":"https://github.com/timjansen/PinkySwear.js.git"},"keywords":["promises"],"author":{"name":"Tim Jansen"},"license":"Public Domain","gitHead":"44f973cb770ff232b35227de9873440810d6e0aa","bugs":{"url":"https://github.com/timjansen/PinkySwear.js/issues"},"_id":"pinkyswear@2.0.1","dist":{"shasum":"f041e8a21b107ac1c11e62fa5627665ae32f19bd","tarball":"https://registry.npmjs.org/pinkyswear/-/pinkyswear-2.0.1.tgz","integrity":"sha512-KMQPkSXatmb6gSmNVsOXtGe5gK03HBNx4mIWI1EIcBPwY/l8tpxFJAAiK8dKpg5xIeR1UrbBvRUZTlr452Rp9g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCYfc4Rx47BiM0RkjXYkrt1KUiUxy3VDQ5kvcKweYnzowIhALfsTWmGDhEE36NtxEwGEZTgrvb43g/THJn7A8W66XQV"}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"tjansen","email":"tim@tjansen.de"},"maintainers":[{"name":"tjansen","email":"tim@tjansen.de"}]},"2.0.2":{"name":"pinkyswear","version":"2.0.2","description":"Minimalistic Promises/A+ implementation, <500 bytes","main":"pinkyswear.js","dependencies":{"promises-aplus-tests":"~2.0.3"},"devDependencies":{"mocha":"^1.18.2"},"scripts":{"test":"node promise-test.js pinkyswear.js; node promise-test.js pinkyswear.min.js; mocha pinkyswear-additional-functionality-test.js"},"repository":{"type":"git","url":"https://github.com/timjansen/PinkySwear.js.git"},"keywords":["promises"],"author":{"name":"Tim Jansen"},"license":"Public Domain","gitHead":"44f973cb770ff232b35227de9873440810d6e0aa","bugs":{"url":"https://github.com/timjansen/PinkySwear.js/issues"},"_id":"pinkyswear@2.0.2","dist":{"shasum":"1d68fb8f2e26dc877c3f9b94e0d54642618e0ee6","tarball":"https://registry.npmjs.org/pinkyswear/-/pinkyswear-2.0.2.tgz","integrity":"sha512-nIQB7cwMhtPbjmQTYApZ0yMPwqA8a8CccCtWFN8oUBTLJkV6d5kVUzK8qJSs52SM6iht8W8zH2Lqw3+6mf7xrg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC3IPfZgtlHPlHDnkMHrrFbJteON9kxtKDLlc6nR/KwSwIgSDHsUlwXCU+8RQl83H/0ufwCFFgMecFvnlfaeR749+c="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"tjansen","email":"tim@tjansen.de"},"maintainers":[{"name":"tjansen","email":"tim@tjansen.de"}]},"2.2.1":{"name":"pinkyswear","version":"2.2.1","description":"Minimalistic Promises/A+ implementation, <500 bytes","main":"pinkyswear.js","dependencies":{"promises-aplus-tests":"~2.0.4"},"devDependencies":{"mocha":"^1.18.2"},"scripts":{"test":"node promise-test.js pinkyswear.js; node promise-test.js pinkyswear.min.js; mocha pinkyswear-additional-functionality-test.js"},"repository":{"type":"git","url":"https://github.com/timjansen/PinkySwear.js.git"},"keywords":["promises","promises-aplus"],"author":{"name":"Tim Jansen"},"license":"Public Domain","gitHead":"44f973cb770ff232b35227de9873440810d6e0aa","bugs":{"url":"https://github.com/timjansen/PinkySwear.js/issues"},"_id":"pinkyswear@2.2.1","dist":{"shasum":"aa339a1ad019f9580bbfa98da1295bc5c7130c79","tarball":"https://registry.npmjs.org/pinkyswear/-/pinkyswear-2.2.1.tgz","integrity":"sha512-AGmsm+4txQyYSCyscY3EXec3r+TyEHSJKTIMonQhYZv8OHdB4JEUgMQHuFBpYMRt8f5vpyyHQRUJ8ClJHnyeqA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDAdW8kDvVfXSWuTvEgdtdCgxwdyN6i8REmxP3ay5A8VQIgX0ADM6X3VlSlMDAa+vpN7WTLN5fEzlSl+NWskBlvcps="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"tjansen","email":"tim@tjansen.de"},"maintainers":[{"name":"tjansen","email":"tim@tjansen.de"}]},"2.2.2":{"name":"pinkyswear","version":"2.2.2","description":"Minimalistic Promises/A+ implementation, <500 bytes","main":"pinkyswear.js","dependencies":{"promises-aplus-tests":"~2.0.4"},"devDependencies":{"mocha":"^1.18.2"},"scripts":{"test":"node promise-test.js pinkyswear.js; node promise-test.js pinkyswear.min.js; mocha pinkyswear-additional-functionality-test.js"},"repository":{"type":"git","url":"https://github.com/timjansen/PinkySwear.js.git"},"keywords":["promises","promises-aplus"],"author":{"name":"Tim Jansen"},"license":"Public Domain","gitHead":"44f973cb770ff232b35227de9873440810d6e0aa","bugs":{"url":"https://github.com/timjansen/PinkySwear.js/issues"},"_id":"pinkyswear@2.2.2","dist":{"shasum":"9595f6a18fc1aa07b68466c3eece1a610c093bef","tarball":"https://registry.npmjs.org/pinkyswear/-/pinkyswear-2.2.2.tgz","integrity":"sha512-SzITbvEtqKFdVDOGK9vN6WC48EE6tiHaxAR4Gv78hf74TLkAQo4fgicVc/OgGU4Kst20iV3xbndr+E/P6VWwFw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5EuxcjmlqLmwNa5Eb82B23JtQC+G1FbD5nvQoUhsCdQIhAMXBupZaiK/oBojN+bZq8WaQw8D4z+7r/PrIH29od8+b"}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"tjansen","email":"tim@tjansen.de"},"maintainers":[{"name":"tjansen","email":"tim@tjansen.de"}]},"2.2.3":{"name":"pinkyswear","version":"2.2.3","description":"Minimalistic Promises/A+ implementation, <500 bytes","main":"pinkyswear.js","devDependencies":{"mocha":"^3.3.0","promises-aplus-tests":"^2.1.2"},"scripts":{"test":"node promise-test.js pinkyswear.js; node promise-test.js pinkyswear.min.js; mocha pinkyswear-additional-functionality-test.js"},"repository":{"type":"git","url":"git+https://github.com/timjansen/PinkySwear.js.git"},"keywords":["promises","promises-aplus"],"author":{"name":"Tim Jansen"},"license":"Public Domain","gitHead":"44f973cb770ff232b35227de9873440810d6e0aa","bugs":{"url":"https://github.com/timjansen/PinkySwear.js/issues"},"homepage":"https://github.com/timjansen/PinkySwear.js#readme","_id":"pinkyswear@2.2.3","_shasum":"e589b72c268a09d0e46458861d6b8ccc5c921a3b","_from":".","_npmVersion":"3.9.5","_nodeVersion":"0.10.17","_npmUser":{"name":"tjansen","email":"tim@tjansen.de"},"dist":{"shasum":"e589b72c268a09d0e46458861d6b8ccc5c921a3b","tarball":"https://registry.npmjs.org/pinkyswear/-/pinkyswear-2.2.3.tgz","integrity":"sha512-DLwyrY2cqAqKT+xfgZkC8HSmf9/1rK34ruDEa97opLE5N0AjvBk+hvmaLM58dW4XpT+hdHFuEnONOyC6g2BPug==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCTyY+kbzZ5L79AlSrrgW8866MhbIx4Jcy6rSNtxy1s2gIhAOESqpUJB/8r5MXSchFG+9YpCSQGppAk9P2KGhpZKM6L"}]},"maintainers":[{"name":"tjansen","email":"tim@tjansen.de"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pinkyswear-2.2.3.tgz_1494669437141_0.6634507745038718"}}},"readme":"<a href=\"http://promisesaplus.com/\">\n    <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\"\n         title=\"Promises/A+ 1.1 compliant\" align=\"right\" />\n</a>\nPinkySwear.js 2.2.2\n====================\n\nPinkySwear is a very small implementation of the Promises/A+ specification. After compilation with the\nGoogle Closure Compiler and gzipping it weighs less than 500 bytes. It is originally based on the implementation for \n<a href=\"http://minifiedjs.com\">Minified.js</a> and is for embedding. In other words, you can use it as a\nlightweight dependency for your library if you need to return a promise. It is not intended as a stand-alone\nlibrary for more complex applications, and therefore does not support assimilation of other promises.\nMinified's implementation does support assimilation though.\n \n## Release History ##\n\n#####Version 2.2.2 released July 30, 2014\n- Support extensions for promises created using then() (thanks, Zbyszek Tenerowicz)\n\n#####Version 2.2.1 released July 17, 2014\n- Added extend function to constructor (thanks, Zbyszek Tenerowicz)\n\n#####Version 2.1 released June 6, 2014\n- Removed always() and error(), since they were not in the spirit of a minimal implementation.\n- Updated Promises/A+ Compliance Test to 2.0.4\n\n#####Version 2.0.2, released May 10, 2014\n- Use setImmediate() on platforms that support it (thanks, Carl-Erik Kopseng)\n\n#####Version 2.0.1, released Apr 3, 2014\n- Fixed PinkySwear on IE8 which can't handle apply() without arguments (thanks, Luis Nabais)\n- Fix and test case for PinkySwear's multi-arguments extension (thanks, Carl-Erik Kopseng)\n\n#####Version 2.0, released Feb 10, 2014\nPasses Promises/A+ Compliance Test 2.0.3. Allows obtaining state by calling promise function without arguments.\n\n#####Version 1.0, released Feb 09, 2013\nFirst release. Passes Promises/A+ Compliance Test 1.10.0 with one exception (PinkySwear is function-based, which is\nallowed in the spec, but not in the old test suite).\n \n \n## Stats ##\n\n<table>\n<tr><th>Name</th><th>Type</th><th>Size</th></tr>\n<tr><td>pinkyswear.js</td><td>Source code</td><td>about 4kB</td></tr>\n<tr><td>pinkyswear.min.js</td><td>Closure /w Advanced Optimization</td><td>828 bytes</td></tr>\n<tr><td>pinkyswear.min.js.gz</td><td>Closure + GZip'd</td><td>470 bytes</td></tr>\n</table>\n\n## How to Include / Node.js ##\n\nYou can install PinkySwear.js using npm:\n> npm install pinkyswear\n\nUse require() to get the initial function:\n> var pinkySwear = require('pinkyswear');\n\n\n## How to Include / Browser ##\n\nTo use PinkySwear in a browser, just include it with a script tag. You probably want to use the minified version in a browser:\n> &lt;script type=\"text/javascript\" src=\"path/to/pinkyswear.min.js\">&lt;/script>\n\n \n## API ##\n \nPinkySwear has just three functions.\n\nTo create a new promise in pending state, call pinkySwear():\n>         var promise = pinkySwear();\n \nThe returned object has a Promises/A+ compatible then() implementation:\n>         promise.then(function(value) { alert(\"Success!\"); }, function(value) { alert(\"Failure!\"); });\n \nThe promise returned by pinkySwear() is a function itself. To fulfill the promise, call the function with true as first argument and\nan optional array of values to pass to the then() handler. By putting more than one value in the array, you can pass more than one\nvalue to the then() handlers. Here an example to fulfill a promise, this time with only one argument: \n>         promise(true, [42]);\n \nWhen the promise has been rejected, call it with false as first argument:\n>         promise(false, [6, 6, 6]);\n\nYou can obtain the promise's current state by calling the function without arguments. It will be true if fulfilled,\nfalse if rejected, and otherwise undefined.\n>\t\t  var state = promise();\n\nIt is possible to extend PinkySwear's promise object with custom methods by specifying an extend function:\n>         function addHello(prom) { \n>             prom.sayHello = function() { console.log('hello'); }; \n>             return prom; \n>         }\n>         var promise = pinkySwear(addHello);\n\n## Examples ##\n### setTimeout ###\nA PinkySwear-powered timeout function that returns a promise:\n>         function promiseTimeout(timeoutMs) {\n>             var prom = pinkySwear();\n>             setTimeout(function() {\n>                 prom(true, []);\n>             }, timeoutMs);\n>             return prom; \n>         }\n\nUsing the timeout:\n>         console.log('Starting timeout now.');\n>         promiseTimeout(5000).then(function() {\n>             console.log('5s have passed.');\n>         });\n\n### XmlHttpRequest ###\nThis is a simple implementation of HTTP GET requests in browsers using XmlHttpRequest. It returns a promise with the result or failure:\n>        function get(url) {\n>            var prom = pinkySwear();\n>            var xhr = new XMLHttpRequest();\n>            xhr.onreadystatechange = function() {\n>                if (xhr.readyState==4 && xhr.status==200)\n>                    prom(true, [xhr.status, xhr.responseText]);\n>                else \n>                    prom(false, [xhr.status, xhr.statusText, xhr.responseText]);\n>            };\n>            oReq.open('get', url, true);\n>            oReq.send();\n>            return prom;\n>        }\n\nThis is how to retrieve a simple file:\n>        get('http://example.com/someFile.txt').then(function(status, txt) {\n>            console.log('Got my file: ', txt);\n>            return get('http://example.com/fileTwo.txt');\n>        }, function(status, statusText, txt) {\n>            console.log('Something bad happened. Got status code: ', status, statusText);\n>        });\n\n\nThis example retrieves a file, waits 3s and gets a second one:\n>        get('http://example.com/fileOne.txt').then(function(status, txt) {\n>            console.log('Got first file: ', txt);\n>            return promiseTimeout(3000);\n>        }).then(function() {\n>            console.log('Waited 3s');\n>            return get('http://example.com/fileTwo.txt');\n>        }).then(function(status, txt) {\n>            console.log('Got second file: ', txt);\n>        }).then(null, function() {\n>            console.log('Something bad happened along the way.');\n>        });\n\n\n## Licensing ##\n\nPublic Domain. Use, modify and distribute it any way you like. No attribution required.\nTo the extent possible under law, Tim Jansen has waived all copyright and related or neighboring rights to PinkySwear.\nPlease see http://creativecommons.org/publicdomain/zero/1.0/\n","maintainers":[{"name":"tjansen","email":"tim@tjansen.de"}],"time":{"modified":"2022-06-24T00:07:47.152Z","created":"2013-02-09T00:03:37.412Z","0.0.2":"2013-02-09T00:03:39.316Z","2.0.0":"2014-02-10T00:34:14.514Z","2.0.1":"2014-04-03T21:33:21.595Z","2.0.2":"2014-05-10T09:52:07.451Z","2.2.1":"2014-07-17T18:03:25.330Z","2.2.2":"2014-07-30T18:34:53.816Z","2.2.3":"2017-05-13T09:57:19.111Z"},"author":{"name":"Tim Jansen"},"repository":{"type":"git","url":"git+https://github.com/timjansen/PinkySwear.js.git"},"readmeFilename":"README.md","keywords":["promises","promises-aplus"],"bugs":{"url":"https://github.com/timjansen/PinkySwear.js/issues"},"license":"Public Domain","homepage":"https://github.com/timjansen/PinkySwear.js#readme","users":{"liunian":true}}