├── CHANGELOG.md ├── LICENSE ├── README.md ├── index.js ├── package.json ├── test └── index.js └── useless.txt /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [v2.0.4](https://github.com/ljharb/promise-deferred/compare/v2.0.3...v2.0.4) - 2023-09-06 9 | 10 | ### Commits 11 | 12 | - [meta] update `.gitignore` [`5fe39be`](https://github.com/ljharb/promise-deferred/commit/5fe39be3bf5cc1ebf3817bb5728bfe9fad2b578c) 13 | - [actions] add reusable workflows [`b489c11`](https://github.com/ljharb/promise-deferred/commit/b489c110f1868aec6c7decce76f75d7c4a7475ef) 14 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `safe-publish-latest`, `tape` [`c9ad5ca`](https://github.com/ljharb/promise-deferred/commit/c9ad5cad7e418c0c77497aab672e6ecf624eabee) 15 | - [Dev Deps] switch from `covert` to `nyc` [`7a4d62c`](https://github.com/ljharb/promise-deferred/commit/7a4d62c54564d8d678d0743d0b68fdfe5bec3396) 16 | - [actions] update rebase action [`b5bb367`](https://github.com/ljharb/promise-deferred/commit/b5bb3678dd08d64d0ef1889c1ac7d16de94ad3ea) 17 | - [meta] create FUNDING.yml [`7e4873f`](https://github.com/ljharb/promise-deferred/commit/7e4873f90248f25935f1577c8accbb80a276f4eb) 18 | - [meta] use `npmignore` to autogenerate an npmignore file [`ac3a16d`](https://github.com/ljharb/promise-deferred/commit/ac3a16da2ef733f965036a4bf7a7f8302a4c7e6d) 19 | - [Dev Deps] update `@ljharb/eslint-config`, `tape`; add `safe-publish-latest` [`b7f7d23`](https://github.com/ljharb/promise-deferred/commit/b7f7d23730ac89779df606bf357a54a8ff357253) 20 | - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`a30fb1a`](https://github.com/ljharb/promise-deferred/commit/a30fb1aab274252b968f828817f3b832b1214f48) 21 | - [Dev Deps] update `auto-changelog`, `tape` [`026083b`](https://github.com/ljharb/promise-deferred/commit/026083b950b8c8640e52284d9249c5ccb6676f6c) 22 | - [Tests] only audit prod deps [`0b101b6`](https://github.com/ljharb/promise-deferred/commit/0b101b68e0bc75dc2f138456ee4e0b084234997d) 23 | - [Deps] update `promise` [`05422e6`](https://github.com/ljharb/promise-deferred/commit/05422e6269a2d628cdf63b667c62d199975c2b3c) 24 | - [Dev Deps] update `auto-changelog` [`4bc237c`](https://github.com/ljharb/promise-deferred/commit/4bc237c97846e44b3eda2b4e1113bac0ffe0ef68) 25 | - [Deps] update `promise` [`3ec9fd6`](https://github.com/ljharb/promise-deferred/commit/3ec9fd619958f4ecf5cd6304d48d9446f1d63e04) 26 | - [Deps] update `promise` - turns out it was 729483b causing the break [`c8226e5`](https://github.com/ljharb/promise-deferred/commit/c8226e5dcb67eef9bf925c6af312213844dc79e0) 27 | 28 | ## [v2.0.3](https://github.com/ljharb/promise-deferred/compare/v2.0.2...v2.0.3) - 2020-01-14 29 | 30 | ### Commits 31 | 32 | - [Deps] downgrade `promise`, as upgrading it was a breaking change [`b50f4a8`](https://github.com/ljharb/promise-deferred/commit/b50f4a82533c3d13bd25c24be03abf990df80665) 33 | 34 | ## [v2.0.2](https://github.com/ljharb/promise-deferred/compare/v2.0.1...v2.0.2) - 2020-01-14 35 | 36 | ### Commits 37 | 38 | - Update `tape`, `eslint`, `jscs`; add my personal shared `eslint` config [`7ca9c8d`](https://github.com/ljharb/promise-deferred/commit/7ca9c8dbf83414da876069315e1f5317763867da) 39 | - Add `npm run eslint` [`97e6e47`](https://github.com/ljharb/promise-deferred/commit/97e6e47d61368b9dacac360a947e0d55f3998577) 40 | - [Dev Deps] remove `jscs` [`d263787`](https://github.com/ljharb/promise-deferred/commit/d263787e6154de03979d5a921dd1692bca2f1f31) 41 | - [Tests] use shared travis-ci configs [`5b01bbd`](https://github.com/ljharb/promise-deferred/commit/5b01bbda040388ee5df3adbfa6d66e679096eaaf) 42 | - [Tests] up to `node` `v8.1`; `v7.10`; `v6.11`; `v5.12`, `v4.8`; `io.js` `v3.3`; improve test matrix; npm 4.6+ breaks on node < 1; npm 5+ breaks on node < 4. [`be6ffa0`](https://github.com/ljharb/promise-deferred/commit/be6ffa0d469e536b8b80bb445162f199b5df1b94) 43 | - [meta] add `auto-changelog` [`8df5df8`](https://github.com/ljharb/promise-deferred/commit/8df5df80484f6b503c27eef61dcf02cf10562ac4) 44 | - [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config`, `nsp`, `tape` [`333ba8c`](https://github.com/ljharb/promise-deferred/commit/333ba8c9b261a38e45d98dc0b99dea5b59da9adc) 45 | - Update `tape`, `covert`, `jscs` [`1f2a186`](https://github.com/ljharb/promise-deferred/commit/1f2a1869594cc91f98b0216b5cb62f6b8deb147f) 46 | - Update `eslint` [`b1e9015`](https://github.com/ljharb/promise-deferred/commit/b1e90153e2d270b39b49d5414e070e28383520b2) 47 | - Test up to `io.js` `v2.3` [`4af8785`](https://github.com/ljharb/promise-deferred/commit/4af87852835df30adba850521abe8ca0c4bc5816) 48 | - [actions] add automatic rebasing / merge commit blocking [`000672a`](https://github.com/ljharb/promise-deferred/commit/000672a70e06651d0d7ae5cc52e571534fe70e19) 49 | - [Dev Deps] update `tape`, `jscs`, `eslint` [`c91fd12`](https://github.com/ljharb/promise-deferred/commit/c91fd12b29a09132bba392cde17926a8d6ff0870) 50 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `covert` [`f82414c`](https://github.com/ljharb/promise-deferred/commit/f82414c07b74a380a3b9f166a2dbc9928c05bdfe) 51 | - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp`, `tape` [`4e1dc22`](https://github.com/ljharb/promise-deferred/commit/4e1dc22027a787c727926aad5b9ed351fe235a48) 52 | - Only apps should have lockfiles. [`6a2d7a1`](https://github.com/ljharb/promise-deferred/commit/6a2d7a1fc7b85ef31e794dd6a0c202109ccbd92d) 53 | - Add `npm run security` [`427afe6`](https://github.com/ljharb/promise-deferred/commit/427afe6c4029fad1fdc439d0668147413af617a6) 54 | - All grade A-supported `node`/`iojs` versions now ship with an `npm` that understands `^`. [`5b51d5a`](https://github.com/ljharb/promise-deferred/commit/5b51d5aa201bf4c705a594ebc4c4d7cf712d453d) 55 | - Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`a73ba53`](https://github.com/ljharb/promise-deferred/commit/a73ba53406462479dd20f6bf4d29bfb2cd9505a2) 56 | - [readme] remove testling [`a3e7517`](https://github.com/ljharb/promise-deferred/commit/a3e75177fb5b0db8bf8324ba15ddb0b10800cae7) 57 | - [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`5ad1266`](https://github.com/ljharb/promise-deferred/commit/5ad12662402e9a2e214680df1ceeb817ed533620) 58 | - Update `promise`, `tape` [`abb7d6c`](https://github.com/ljharb/promise-deferred/commit/abb7d6c0519d1bd4bb4982ed178dc7f4a8961e0d) 59 | - Test up to `io.js` `v2.5` [`57f75ad`](https://github.com/ljharb/promise-deferred/commit/57f75adf12ab5313f11618f67f1fc760d0b10163) 60 | - Update `tape`, `jscs` [`cf8057c`](https://github.com/ljharb/promise-deferred/commit/cf8057cf3657691358e50d67c2634c8ef80f8eae) 61 | - [Deps] update `promise` [`80c0d66`](https://github.com/ljharb/promise-deferred/commit/80c0d66e96258a09b8fcc15d8b29d567e2624f69) 62 | - [meta] add `funding` field [`f075ee6`](https://github.com/ljharb/promise-deferred/commit/f075ee67c6dc187746d47ea3467bc7bae928ccfb) 63 | - docs(readme): correct markdown [`fe0903a`](https://github.com/ljharb/promise-deferred/commit/fe0903a4ffb507fafa068c6060fdbbcd128c18e7) 64 | - [Dev Deps] update `tape` [`1035c0d`](https://github.com/ljharb/promise-deferred/commit/1035c0d09409e2d2dc4528bdb56507906ba63406) 65 | - Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. [`76e4ad5`](https://github.com/ljharb/promise-deferred/commit/76e4ad56325d59ec7a8f8ba67a60908b4e28deb2) 66 | - Use just the bare es6 promise implementation in `promise`. [`729483b`](https://github.com/ljharb/promise-deferred/commit/729483be4ae451c668c9a35831973b4d4c98c9d2) 67 | - Update `promise` [`66ab6b5`](https://github.com/ljharb/promise-deferred/commit/66ab6b52c3f30e7c9b492846fa3c8c30a32fc515) 68 | - [Deps] remove mistakenly added dep [`148ec27`](https://github.com/ljharb/promise-deferred/commit/148ec27e56e7c149da409e13b8ec042fec56bfd6) 69 | - Test on `io.js` `v3.0` [`e0fd61d`](https://github.com/ljharb/promise-deferred/commit/e0fd61ddb90bd9fcca00c02d095bafe45ca3b760) 70 | 71 | ## [v2.0.1](https://github.com/ljharb/promise-deferred/compare/v2.0.0...v2.0.1) - 2015-01-19 72 | 73 | ### Commits 74 | 75 | - Using my standard jscs.json file [`e37f90c`](https://github.com/ljharb/promise-deferred/commit/e37f90cc9bdf4c76cd4b93e0b0b3150f9253f30e) 76 | - Naming deps/devDeps URLs in README [`02b6590`](https://github.com/ljharb/promise-deferred/commit/02b65909038a2b716ea3e43475676cf132a44830) 77 | - Update `promise`, `tape`, `jscs` [`402f918`](https://github.com/ljharb/promise-deferred/commit/402f9188ab4e61f03df704c583a4770dd7706f9f) 78 | - Update `promise`, `tape`, `jscs` [`2c07ef6`](https://github.com/ljharb/promise-deferred/commit/2c07ef687809af99d08b7a5f4d31ec832e755be8) 79 | - Naming testling-ci URLs in README [`522df12`](https://github.com/ljharb/promise-deferred/commit/522df12e1ca1058e8520cd3c522a9fc7c33836c6) 80 | - Naming travis-ci URLs in README [`ed13fad`](https://github.com/ljharb/promise-deferred/commit/ed13fadc1631d1a8984a5b0e32584360eb9551d5) 81 | - Naming npm URL in README [`c41f70c`](https://github.com/ljharb/promise-deferred/commit/c41f70c28fa56b26fb583de558626edc00060ca7) 82 | - Update `jscs` [`0adee60`](https://github.com/ljharb/promise-deferred/commit/0adee60ef02bc08bd2979ee3f229b0be12d1262d) 83 | - Update `tape`, `jscs` [`6476094`](https://github.com/ljharb/promise-deferred/commit/64760948066008218b6bf408379bddc7dee803d6) 84 | - Naming npm badge PNG in README [`8033a8a`](https://github.com/ljharb/promise-deferred/commit/8033a8af2a1beca6f889ba8175ff1e78e71654f6) 85 | - Naming npm version SVG in README [`644f945`](https://github.com/ljharb/promise-deferred/commit/644f9451a2673efa1feb25fb573fb1ba8eaa96eb) 86 | - Update `tape` [`04c2606`](https://github.com/ljharb/promise-deferred/commit/04c26063f861581549bebaac14cbab332a5ff951) 87 | - Lock covert to v1.0.0 [`ba4ff7c`](https://github.com/ljharb/promise-deferred/commit/ba4ff7c97232214c59c44cfe19daab52725d8a9b) 88 | - Run tests in strict mode. [`3c5a49e`](https://github.com/ljharb/promise-deferred/commit/3c5a49e50e2f4ba022533a3e048cf1722ab72ade) 89 | - Using consistent quotes. [`832d7c2`](https://github.com/ljharb/promise-deferred/commit/832d7c24e107d722282a2f7451c1577b5a06b7ae) 90 | - Updating jscs [`ddd64c5`](https://github.com/ljharb/promise-deferred/commit/ddd64c5d3bbcf5772aedbd4fe7483d33e9524d58) 91 | - Fixing this equality test [`c1a5ccc`](https://github.com/ljharb/promise-deferred/commit/c1a5ccc9c516d8f925abe2b1fe067fc4cb3a4165) 92 | - Updating tape [`f66ea13`](https://github.com/ljharb/promise-deferred/commit/f66ea13807a1568c562fd7471c09457a3c2ab892) 93 | 94 | ## [v2.0.0](https://github.com/ljharb/promise-deferred/compare/v1.0.1...v2.0.0) - 2014-09-13 95 | 96 | ### Commits 97 | 98 | - Adding license and downloads badges [`7c245b8`](https://github.com/ljharb/promise-deferred/commit/7c245b8d4e8bff9a1f2263005035102bd7680b0d) 99 | - Updating to v2.0.0 due to a major version bump in "promise" [`788785e`](https://github.com/ljharb/promise-deferred/commit/788785e7c9220eb64fde8047b5e1bb23e170383f) 100 | - Updating promise [`6d3e940`](https://github.com/ljharb/promise-deferred/commit/6d3e9408e882af5a7a204619acf7c3d0c094d24d) 101 | - Updating jscs [`643a8ea`](https://github.com/ljharb/promise-deferred/commit/643a8eab37c389861bd4564c1919804f87583b42) 102 | - Updating jscs [`696d58f`](https://github.com/ljharb/promise-deferred/commit/696d58ffc323bf6a1a63fcc07f536aa342446a89) 103 | 104 | ## [v1.0.1](https://github.com/ljharb/promise-deferred/compare/v1.0.0...v1.0.1) - 2014-08-27 105 | 106 | ### Commits 107 | 108 | - Adding `npm run lint` [`c3f9047`](https://github.com/ljharb/promise-deferred/commit/c3f90471f33b7231bf4cca64fe0abb851b5c7531) 109 | - USe SVG badges instead of PNG [`44291fb`](https://github.com/ljharb/promise-deferred/commit/44291fbe3a37afdb09e25a178e08fe010f2b71ad) 110 | - Adding a test for Deferred.Promise [`19bfe33`](https://github.com/ljharb/promise-deferred/commit/19bfe33f13146dc9d65091b0d6335d823a84dd09) 111 | - Make the entire module be in strict mode [`8e460da`](https://github.com/ljharb/promise-deferred/commit/8e460da1ec638b07b5f8209f5551ad217fefdbd6) 112 | - Run linter as part of tests. [`6304611`](https://github.com/ljharb/promise-deferred/commit/6304611075da93e04e2562f44484cdd4aa04f1f3) 113 | - Run code coverage checks during tests [`318dd2e`](https://github.com/ljharb/promise-deferred/commit/318dd2e0bb1ad32b71b0774aab052c7d73903a81) 114 | - Updating covert [`035328c`](https://github.com/ljharb/promise-deferred/commit/035328c46379367e6f4bd5b500576ab5a538f12c) 115 | 116 | ## [v1.0.0](https://github.com/ljharb/promise-deferred/compare/v0.2.0...v1.0.0) - 2014-08-10 117 | 118 | ### Commits 119 | 120 | - Updating tape [`7c75fe2`](https://github.com/ljharb/promise-deferred/commit/7c75fe2e4c9d1ae849ccf7b971d565feaa2ff357) 121 | - Updating tape [`8d61078`](https://github.com/ljharb/promise-deferred/commit/8d61078cc3ea80783000d779af244e1110a5abac) 122 | 123 | ## [v0.2.0](https://github.com/ljharb/promise-deferred/compare/v0.1.1...v0.2.0) - 2014-04-29 124 | 125 | ### Commits 126 | 127 | - Make sure old and unstable nodes don't break Travis [`04d07f3`](https://github.com/ljharb/promise-deferred/commit/04d07f30a3e317fa1b5cd866c20af428f53ca667) 128 | - Updating "promise" [`043524d`](https://github.com/ljharb/promise-deferred/commit/043524d084b6267df66a4d847db12aba36683920) 129 | - Updating covert [`3ff4f6d`](https://github.com/ljharb/promise-deferred/commit/3ff4f6dc8049260401c2ce2d9beffaf7d6007cc6) 130 | - Updating tape [`014782a`](https://github.com/ljharb/promise-deferred/commit/014782a4b8529299f65a05cb592a2c7798e88a01) 131 | 132 | ## [v0.1.1](https://github.com/ljharb/promise-deferred/compare/v0.1.0...v0.1.1) - 2014-03-16 133 | 134 | ### Commits 135 | 136 | - Updating dependencies [`67f85fc`](https://github.com/ljharb/promise-deferred/commit/67f85fcf1938a2dc1d94fee0956ce2906a3a871e) 137 | - Adding more Travis coverage [`d16e1d8`](https://github.com/ljharb/promise-deferred/commit/d16e1d8636380f3ef5c64901536464cbb8091030) 138 | - Declare explicit support for node 0.8 and up [`d747193`](https://github.com/ljharb/promise-deferred/commit/d7471932d8358fb087d53b148adea30f15102f50) 139 | - Testing on node 0.6 again [`ba98eda`](https://github.com/ljharb/promise-deferred/commit/ba98edad37f72474fcff10a6a1ba704e403a4f7d) 140 | - Updating covert [`98e3be8`](https://github.com/ljharb/promise-deferred/commit/98e3be81d1295c31368f3903835887ab5e4b74f6) 141 | - Don't test in unstable node just yett [`89f55ed`](https://github.com/ljharb/promise-deferred/commit/89f55ed65f2c8deb77bc625ac6dba9121ac22633) 142 | 143 | ## v0.1.0 - 2013-12-30 144 | 145 | ### Commits 146 | 147 | - package.json [`d3e375b`](https://github.com/ljharb/promise-deferred/commit/d3e375b2363a7b9e5072f5ff50166d3f38ef58da) 148 | - README [`4f278bb`](https://github.com/ljharb/promise-deferred/commit/4f278bbc40ed8f9a88fc8ac0fcc82fe0d065be16) 149 | - Initial commit [`9f3705e`](https://github.com/ljharb/promise-deferred/commit/9f3705e48e0e5439ae92710251410669b3f1b4c4) 150 | - Tests. [`92772ec`](https://github.com/ljharb/promise-deferred/commit/92772ecbc4db996f9e04bf2dcf8f67fc1bc90c66) 151 | - Implementation. [`b121bd1`](https://github.com/ljharb/promise-deferred/commit/b121bd151086a91ce91118a68e9dfc9a220fc6c7) 152 | - Travis CI [`69b94ea`](https://github.com/ljharb/promise-deferred/commit/69b94ea1d146d26daab7a60353e493a7b1fa498b) 153 | - bump to v0.1.0 [`c666219`](https://github.com/ljharb/promise-deferred/commit/c6662192c0acc84754e882b958e0717c4d6ec331) 154 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Jordan Harband 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # promise-deferred [![Version Badge][npm-version-svg]][npm-url] 2 | 3 | [![Build Status][travis-svg]][travis-url] 4 | [![dependency status][deps-svg]][deps-url] 5 | 6 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Promise = require('promise/lib/es6-extensions'); 4 | 5 | var Deferred = function Deferred() { 6 | if (!(this instanceof Deferred)) { 7 | return new Deferred(); 8 | } 9 | 10 | var self = this; 11 | self.promise = new Promise(function (resolve, reject) { 12 | self.resolve = resolve; 13 | self.reject = reject; 14 | }); 15 | return self; 16 | }; 17 | Deferred.Promise = Promise; 18 | 19 | module.exports = Deferred; 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "promise-deferred", 3 | "version": "2.0.4", 4 | "description": "A lightweight Deferred implementation, on top of Promises/A+", 5 | "main": "index.js", 6 | "scripts": { 7 | "prepack": "npmignore --auto --commentLines=autogenerated", 8 | "prepublishOnly": "safe-publish-latest", 9 | "prepublish": "not-in-publish || npm run prepublishOnly", 10 | "pretest": "npm run lint", 11 | "tests-only": "nyc tape 'test/**/*.js'", 12 | "test": "npm run tests-only", 13 | "posttest": "aud --production", 14 | "lint": "eslint .", 15 | "version": "auto-changelog && git add CHANGELOG.md", 16 | "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "git://github.com/ljharb/promise-deferred.git" 21 | }, 22 | "keywords": [ 23 | "promise", 24 | "promises", 25 | "deferred", 26 | "deferreds", 27 | "reject", 28 | "resolve", 29 | "async" 30 | ], 31 | "author": "Jordan Harband", 32 | "funding": { 33 | "url": "https://github.com/sponsors/ljharb" 34 | }, 35 | "license": "MIT", 36 | "bugs": { 37 | "url": "https://github.com/ljharb/promise-deferred/issues" 38 | }, 39 | "homepage": "https://github.com/ljharb/promise-deferred", 40 | "testling": { 41 | "files": "test/index.js", 42 | "browsers": [ 43 | "iexplore/6.0..latest", 44 | "firefox/3.0..6.0", 45 | "firefox/15.0..latest", 46 | "firefox/nightly", 47 | "chrome/4.0..10.0", 48 | "chrome/20.0..latest", 49 | "chrome/canary", 50 | "opera/10.0..latest", 51 | "opera/next", 52 | "safari/4.0..latest", 53 | "ipad/6.0..latest", 54 | "iphone/6.0..latest", 55 | "android-browser/4.2" 56 | ] 57 | }, 58 | "dependencies": { 59 | "promise": "^8.3.0" 60 | }, 61 | "devDependencies": { 62 | "@ljharb/eslint-config": "^21.1.0", 63 | "aud": "^2.0.3", 64 | "auto-changelog": "^2.4.0", 65 | "eslint": "=8.8.0", 66 | "in-publish": "^2.0.1", 67 | "npmignore": "^0.3.0", 68 | "nyc": "^10.3.2", 69 | "safe-publish-latest": "^2.0.0", 70 | "tape": "^5.6.6" 71 | }, 72 | "engines": { 73 | "node": ">= 0.4" 74 | }, 75 | "auto-changelog": { 76 | "output": "CHANGELOG.md", 77 | "template": "keepachangelog", 78 | "unreleased": false, 79 | "commitLimit": false, 80 | "backfillLimit": false, 81 | "hideCredit": true 82 | }, 83 | "publishConfig": { 84 | "ignore": [ 85 | ".github/workflows" 86 | ] 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var test = require('tape'); 4 | var Deferred = require('..'); 5 | var Promise = require('promise'); 6 | 7 | test('constructs', function (t) { 8 | t.ok(new Deferred() instanceof Deferred, 'constructs a new Deferred'); 9 | t.ok(Deferred() instanceof Deferred, 'returns a new Deferred'); 10 | t.notEqual(Deferred(), Deferred(), 'returns new instance each time'); 11 | t.end(); 12 | }); 13 | 14 | test('Deferred has a reference to Promise', function (t) { 15 | t.equal(Deferred.Promise, Promise, 'Deferred.Promise === Promise'); 16 | t.end(); 17 | }); 18 | 19 | test('has a promise', function (t) { 20 | var deferred = Deferred(); 21 | t.ok(deferred.promise instanceof Promise, 'promise property is a Promise'); 22 | t.end(); 23 | }); 24 | 25 | test('resolve', function (t) { 26 | var deferred = Deferred(); 27 | t.plan(1); 28 | deferred.promise.then(function (value) { 29 | t.equal(value, 42, 'value is resolved properly'); 30 | }); 31 | deferred.resolve(42); 32 | }); 33 | 34 | test('reject', function (t) { 35 | var deferred = Deferred(); 36 | t.plan(1); 37 | deferred.promise.then(null, function (error) { 38 | t.equal(error, 'error', 'error is rejected properly'); 39 | }); 40 | deferred.reject('error'); 41 | }); 42 | -------------------------------------------------------------------------------- /useless.txt: -------------------------------------------------------------------------------- 1 | 2024-12-21 # 10# 2 | --------------------------------------------------------------------------------